diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 5cd9f64fa..8eee90a41 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -17,13 +17,11 @@ @warn-color: @colortheme_default-warn // color of the warning text in the toolbar ) { @toolbar-color: @color; - //@toolbar-color: @bg-color; @toolbar-color-l20: lighten(@color, 20%); @toolbar-color-d20: darken(@color, 20%); @toolbar-color-d15: darken(@color, 15%); @toolbar-bg-color: @bg-color; - //@toolbar-bg-color: #FFFFFF; @toolbar-bg-color-l8: lighten(@bg-color, 8%); @toolbar-bg-color-l20: lighten(@bg-color, 20%); @toolbar-bg-color-d5: darken(@bg-color, 5%); @@ -731,6 +729,8 @@ color: var(--toolbar-bg-color); font-size: 25px; font-style: italic; white-space: nowrap; + display: inline-flex; + align-items: center; } .cp-toolbar-title-hoverable { display: inline-flex; @@ -1056,9 +1056,20 @@ color: var(--toolbar-bg-color); } } } + .cp-toolbar-file { + order: 1; + } + .cp-toolbar-appmenu { + order: 3; + } + .cp-toolbar-mediatag { + order: 5; + } + .cp-toolbar-tools { + order: 7; + } .cp-toolbar-file { button { - order: 50; &.fa-plus { order: 0; } &.fa-history { order: 5; } &.fa-hashtag { order: 10; } @@ -1070,9 +1081,6 @@ color: var(--toolbar-bg-color); &.fa-trash { order: 40; } &.fa-info-circle { order: 100; } - &.fa-arrows-h { order: 5; } - &.fa-cog { order: 5; } - &.fa-paint-brush { order: 5; } &.cp-toolbar-icon-help { order: 150; } } } @@ -1125,36 +1133,10 @@ color: var(--toolbar-bg-color); display: inline; vertical-align: baseline; } - &.fa-info-circle, &.fa-history, &.fa-cog { - .cp-toolbar-drawer-element { - margin-left: 11px; - } - } - &.fa-unlock-alt { - .cp-toolbar-drawer-element { - margin-left: 15px; - } - } - &.fa-question { - .cp-toolbar-drawer-element { - margin-left: 16px; - } - } &:hover { background-color: @colortheme_dropdown-bg-hover !important; color: @colortheme_dropdown-color; } - order: 8; - &.fa-history { order: 1; } - &.fa-clone { order: 1; } - &.fa-download { order: 2; } - &.fa-upload { order: 3; } - &.fa-print { order: 4; } - &.fa-arrows-h { order: 5; } - &.fa-cog { order: 5; } - &.fa-paint-brush { order: 5; } - &.fa-info-circle { order: 6; } - &.fa-help { order: 7; } } } } diff --git a/www/code/inner.js b/www/code/inner.js index 3ffb2baef..53ebf08ef 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -77,6 +77,51 @@ define([ 'xml', ]); + var mkThemeButton = function (framework) { + Messages.toolbar_theme = "Theme"; // XXX (duplicate from slide/inner.js) + var $theme = $(h('button.cp-toolbar-appmenu', [ + h('i.cptools.cptools-palette'), + h('span.cp-button-name', Messages.toolbar_theme) + ])); + var $content = $(h('div.cp-toolbar-drawer-content', { + tabindex: 1 + })).hide(); + $theme.click(function () { + $content.toggle(); + $theme.removeClass('cp-toolbar-button-active'); + if ($content.is(':visible')) { + $theme.addClass('cp-toolbar-button-active'); + $content.focus(); + var wh = $(window).height(); + var topPos = $theme[0].getBoundingClientRect().bottom; + $content.css('max-height', Math.floor(wh - topPos - 1)+'px'); + } + }); + var onBlur = function (e) { + if (e.relatedTarget) { + if ($(e.relatedTarget).is('.cp-toolbar-drawer-button')) { return; } + if ($(e.relatedTarget).parents('.cp-toolbar-drawer-content').length) { + $(e.relatedTarget).blur(onBlur); + return; + } + } + $theme.removeClass('cp-toolbar-button-active'); + $content.hide(); + }; + $content.blur(onBlur).appendTo($theme); + framework._.toolbar.$theme = $content; + framework._.toolbar.$bottomL.append($theme); + }; + + var mkCbaButton = function (framework, markers) { + var $showAuthorColorsButton = framework._.sfCommon.createButton('', true, { + text: Messages.cba_hide, + name: 'authormarks', + icon: 'fa-paint-brush', + }).hide(); + framework._.toolbar.$theme.append($showAuthorColorsButton); // XXX + markers.setButton($showAuthorColorsButton); + }; var mkPrintButton = function (framework, $content, $print) { var $printButton = framework._.sfCommon.createButton('print', true); $printButton.click(function () { @@ -92,7 +137,7 @@ define([ var markdownTb = framework._.sfCommon.createMarkdownToolbar(editor); $codeMirrorContainer.prepend(markdownTb.toolbar); - framework._.toolbar.$rightside.append(markdownTb.button); + framework._.toolbar.$bottomL.append(markdownTb.button); var modeChange = function (mode) { if (['markdown', 'gfm'].indexOf(mode) !== -1) { return void markdownTb.setState(true); } @@ -168,7 +213,7 @@ define([ } }); - framework._.toolbar.$rightside.append($previewButton); + framework._.toolbar.$bottomM.append($previewButton); $preview.click(function (e) { if (!e.target) { return; } @@ -325,7 +370,7 @@ define([ setButton(!markers.getState()); UI.alert(content); }); - framework._.toolbar.$drawer.append($cbaButton); + framework._.toolbar.$theme.append($cbaButton); }; var mkFilePicker = function (framework, editor, evModeChange) { @@ -356,6 +401,8 @@ define([ var previewPane = mkPreviewPane(editor, CodeMirror, framework, isPresentMode); var markdownTb = mkMarkdownTb(editor, framework); + mkThemeButton(framework); + var markers = Markers.create({ common: common, framework: framework, @@ -363,17 +410,13 @@ define([ devMode: privateData.devMode, editor: editor }); - - var $showAuthorColorsButton = framework._.sfCommon.createButton('', true, { - icon: 'fa-paint-brush', - }).hide(); - framework._.toolbar.$rightside.append($showAuthorColorsButton); - markers.setButton($showAuthorColorsButton); + mkCbaButton(framework, markers); var $print = $('#cp-app-code-print'); var $content = $('#cp-app-code-preview-content'); mkPrintButton(framework, $content, $print); + mkHelpMenu(framework); var evModeChange = Util.mkEvent(); diff --git a/www/code/markers.js b/www/code/markers.js index bf3f00f82..fb67736a6 100644 --- a/www/code/markers.js +++ b/www/code/markers.js @@ -604,16 +604,13 @@ define([ var setButton = function (Env, $button) { var toggle = function () { - var tippy = $button[0] && $button[0]._tippy; if (Env.opacity) { Env.opacity = 0; - if (tippy) { tippy.title = Messages.cba_show; } - else { $button.attr('title', Messages.cba_show); } + $button.find('.cp-toolbar-drawer-element').text(Messages.cba_show); $button.removeClass("cp-toolbar-button-active"); } else { Env.opacity = MARK_OPACITY; - if (tippy) { tippy.title = Messages.cba_hide; } - else { $button.attr('title', Messages.cba_hide); } + $button.find('.cp-toolbar-drawer-element').text(Messages.cba_hide); $button.addClass("cp-toolbar-button-active"); } }; diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 17e90857c..ef6bfc67e 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1556,7 +1556,7 @@ define([ break; case 'mediatag': Messages.toolbar_insert = "Insert"; // XXX - button = $(h('button', { + button = $(h('button.cp-toolbar-mediatag', { title: Messages.filePickerButton, // XXX remove tippy? }, [ h('i.fa.fa-picture-o'), @@ -1564,11 +1564,13 @@ define([ ])).click(common.prepareFeedback(type)); break; case 'savetodrive': - button = $('