From c010cfdf2a662cb40b1e3d4b7284df974e520dcf Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Thu, 27 Mar 2025 17:12:39 +0200 Subject: [PATCH 01/39] Make toolbar wrap #1831 --- customize.dist/src/less2/include/toolbar.less | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index b904d26d8..7020b63ae 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -64,7 +64,10 @@ } .cp-markdown-toolbar { - height: @toolbar_line-height; + min-height: @toolbar_line-height; + height: auto; + display: flex; + flex-wrap: wrap; background-color: @cp_toolbar-bg; color: @cp_toolbar-fg; display: none; @@ -85,6 +88,12 @@ button:nth-of-type(1) { margin-left: 0.3rem; } + + @media screen and (max-width: @browser_media-medium-screen) { + button:nth-of-type(1) { + margin-left: 0; + } + } } .cp-toolbar-container { From 332d658abcfe1af8536cdb044e74d0ab76d939da Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Mon, 31 Mar 2025 12:04:56 +0300 Subject: [PATCH 02/39] Keep margin on small screens #1831 --- customize.dist/src/less2/include/toolbar.less | 1 + 1 file changed, 1 insertion(+) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 7020b63ae..2a45d72e0 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -93,6 +93,7 @@ button:nth-of-type(1) { margin-left: 0; } + margin-left: 0.3rem; } } From 16e162a15a5e0db7c0639444b1952d23c1e7b2b7 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Mon, 31 Mar 2025 12:16:10 +0300 Subject: [PATCH 03/39] Remove media-query #1831 --- customize.dist/src/less2/include/toolbar.less | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 2a45d72e0..8d7894b2c 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -66,11 +66,11 @@ .cp-markdown-toolbar { min-height: @toolbar_line-height; height: auto; - display: flex; flex-wrap: wrap; background-color: @cp_toolbar-bg; color: @cp_toolbar-fg; display: none; + margin-left: 0.3rem; button { height: @toolbar_line-height !important; outline: 0; @@ -85,16 +85,6 @@ outline: @variables_focus_style; } } - button:nth-of-type(1) { - margin-left: 0.3rem; - } - - @media screen and (max-width: @browser_media-medium-screen) { - button:nth-of-type(1) { - margin-left: 0; - } - margin-left: 0.3rem; - } } .cp-toolbar-container { From 20f3ff43feac6b135a89aceb18c94500dbdacf6d Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Mon, 31 Mar 2025 12:18:01 +0300 Subject: [PATCH 04/39] Remove redundat profile handling of markdown toolbar #1831 --- www/profile/app-profile.less | 5 ----- 1 file changed, 5 deletions(-) diff --git a/www/profile/app-profile.less b/www/profile/app-profile.less index 70747493f..7662b80f6 100644 --- a/www/profile/app-profile.less +++ b/www/profile/app-profile.less @@ -203,11 +203,6 @@ //margin-bottom: 20px; .cp-app-profile-description-code { display: none; - .cp-markdown-toolbar { - display: flex; - height: auto; - flex-wrap: wrap; - } } #cp-app-profile-description-info { overflow-wrap: anywhere; From b0d543b5fb3589c16f43e61ccbdfbb79e7a7ec80 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Mon, 14 Apr 2025 13:19:26 +0300 Subject: [PATCH 05/39] Add escape key to markdown toolbar #1831 --- www/common/common-ui-elements.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index c3de21053..2a00c5321 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1171,6 +1171,14 @@ define([ var href = Messages.mdToolbar_tutorial; common.openUnsafeURL(href); }).appendTo($toolbar); + + $toolbar.on('keydown', function (e) { + if (e.key === 'Escape' || e.keyCode === 27) { + editor.focus(); + e.preventDefault(); + } + }); + return $toolbar; }; UIElements.createMarkdownToolbar = function (common, editor, opts) { From 8640bf51ddf4620fd59f74f32e622c7f96204464 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Sat, 19 Apr 2025 13:58:04 +0300 Subject: [PATCH 06/39] Remove lingering tooltips + fix profile desc editor esc #1831 --- www/common/common-ui-elements.js | 8 ++++++++ www/profile/inner.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 2a00c5321..000bf4ae4 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1161,6 +1161,14 @@ define([ 'class': 'pure-button fa ' + actions[k].icon, title: Messages['mdToolbar_' + k] || k }).click(onClick); + $b.on('mouseenter focus', function () { + $('[aria-describedby]').each(function () { + const tip = document.getElementById(this.getAttribute('aria-describedby')); + if (tip && tip._tippy) { + tip._tippy.hide(); // hide tooltips on unfocused elements + } + }); + }); if (k === "embed") { $toolbar.prepend($b); } else { $toolbar.append($b); } } diff --git a/www/profile/inner.js b/www/profile/inner.js index 455595286..bccf79888 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -533,7 +533,7 @@ define([ cm.configureTheme(common, function () {}); editor.setOption("extraKeys", { "Esc": function () { - cm.getInputField().blur(); + editor.getInputField().blur(); $(save).focus(); } }); From 8334d787128b40ffaeda28e184a7391ff71b5cc5 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Sat, 19 Apr 2025 14:07:49 +0300 Subject: [PATCH 07/39] Make toolbar button outline fully visible #1831 --- customize.dist/src/less2/include/toolbar.less | 1 + 1 file changed, 1 insertion(+) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 8d7894b2c..bd34a597c 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -65,6 +65,7 @@ .cp-markdown-toolbar { min-height: @toolbar_line-height; + padding: 0.1rem 0; height: auto; flex-wrap: wrap; background-color: @cp_toolbar-bg; From 518b36ea325589520403539db928ce8c7670576e Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Sat, 19 Apr 2025 14:18:04 +0300 Subject: [PATCH 08/39] More robust way to handle tooltips + fast movement #1831 --- www/common/common-ui-elements.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 000bf4ae4..13c8cacdc 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1011,6 +1011,29 @@ define([ return button; }; + let hideTooltipsTimer; + const hideOtherTooltips = (except) => { + clearTimeout(hideTooltipsTimer); + hideTooltipsTimer = setTimeout(() => { + if (typeof tippy !== 'undefined' && typeof tippy.hideAll === 'function') { + tippy.hideAll({ exclude: except }); + } else { + $('[aria-describedby]').each(function () { + const tooltipId = this.getAttribute('aria-describedby'); + const tooltip = document.getElementById(tooltipId); + if ( + tooltip && + tooltip._tippy && + tooltip._tippy.reference !== except + ) { + tooltip._tippy.hide(); + } + }); + } + }, 60); // ~1 frame delay to buffer fast movement + }; + + var createMdToolbar = function (common, editor, cfg) { cfg = cfg || {}; var $toolbar = $('
', { @@ -1162,12 +1185,7 @@ define([ title: Messages['mdToolbar_' + k] || k }).click(onClick); $b.on('mouseenter focus', function () { - $('[aria-describedby]').each(function () { - const tip = document.getElementById(this.getAttribute('aria-describedby')); - if (tip && tip._tippy) { - tip._tippy.hide(); // hide tooltips on unfocused elements - } - }); + hideOtherTooltips(this); }); if (k === "embed") { $toolbar.prepend($b); } else { $toolbar.append($b); } From 56a408ea997081c64d128f09ff533543eba5d289 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Sat, 19 Apr 2025 14:40:19 +0300 Subject: [PATCH 09/39] Add escape key to code editor #1831 --- www/code/inner.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/www/code/inner.js b/www/code/inner.js index b445aaa20..fcad5e5c0 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -578,6 +578,24 @@ define([ framework.setCursorGetter(CodeMirror.getCursor); editor.on('cursorActivity', updateCursor); + editor.setOption("extraKeys", { + "Esc": function() { + const $toolbar = $('.cp-markdown-toolbar:visible'); + if ($toolbar.length) { + const $btn = $toolbar.find('button:visible').first(); + if ($btn.length) { + setTimeout(() => { + $btn[0].focus(); + $btn[0].scrollIntoView({ block: 'center', behavior: 'smooth' }); // if toolbar is visible then escape key focuses on first button of toolbar + }, 0); + } + } + else { + $(body).focus(); //fallback + } + } + }); + framework.onEditableChange(function () { editor.setOption('readOnly', framework.isLocked() || framework.isReadOnly()); }); From 21b722e3ddf3c61ab59b8f514fce2351998b8d9a Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Tue, 22 Apr 2025 10:54:53 +0300 Subject: [PATCH 10/39] Fix UI for kanban as well #1831 --- customize.dist/src/less2/include/toolbar.less | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index bd34a597c..a56cba125 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -71,7 +71,6 @@ background-color: @cp_toolbar-bg; color: @cp_toolbar-fg; display: none; - margin-left: 0.3rem; button { height: @toolbar_line-height !important; outline: 0; @@ -86,6 +85,14 @@ outline: @variables_focus_style; } } + button:nth-of-type(1) { + margin-left: 0.3rem; + } + @media screen and (max-width: @browser_media-medium-screen) { + button:nth-of-type(1) { + margin-left: 0; + } + } } .cp-toolbar-container { From 5b748c26ecca9bd6b23302033d46a28ef9bd5871 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Tue, 22 Apr 2025 19:30:26 +0300 Subject: [PATCH 11/39] Refactor of markdown toolbar buttons #1831 --- customize.dist/src/less2/include/toolbar.less | 5 +- www/common/common-ui-elements.js | 55 +++++++------------ www/form/app-form.less | 1 + 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index a56cba125..923604a0a 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -77,7 +77,10 @@ border-radius: @variables_radius; color: @toolbar-color; .toolbar_button; - font: normal normal normal 14px/1 FontAwesome; + .fa { + font: normal normal normal 14px/1 FontAwesome; + font-family: FontAwesome; + } &:hover { background-color: contrast(@cp_toolbar-bg, darken(@cp_toolbar-bg, 5%), lighten(@cp_toolbar-bg, 5%)); } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 13c8cacdc..c22f7dccf 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -905,7 +905,8 @@ define([ case 'toggle': button = $(h('button.cp-toolbar-tools', { //title: data.title || '', // TODO display if the label text is collapsed - 'aria-label': data.text || Messages.toolbar_tools // Fallback + 'aria-label': data.text || Messages.toolbar_tools, // Fallback + 'aria-pressed': false }, [ h('i.fa.' + (data.icon || 'fa-wrench')), h('span.cp-toolbar-name', data.text || Messages.toolbar_tools) @@ -923,6 +924,7 @@ define([ button.click(function (e) { data.element.toggle(); var isVisible = data.element.is(':visible'); + button.attr('aria-pressed', isVisible ? 'true' : 'false'); if (callback) { callback(isVisible); } if (isVisible) { button.addClass('cp-toolbar-button-active'); @@ -1011,29 +1013,6 @@ define([ return button; }; - let hideTooltipsTimer; - const hideOtherTooltips = (except) => { - clearTimeout(hideTooltipsTimer); - hideTooltipsTimer = setTimeout(() => { - if (typeof tippy !== 'undefined' && typeof tippy.hideAll === 'function') { - tippy.hideAll({ exclude: except }); - } else { - $('[aria-describedby]').each(function () { - const tooltipId = this.getAttribute('aria-describedby'); - const tooltip = document.getElementById(tooltipId); - if ( - tooltip && - tooltip._tippy && - tooltip._tippy.reference !== except - ) { - tooltip._tippy.hide(); - } - }); - } - }, 60); // ~1 frame delay to buffer fast movement - }; - - var createMdToolbar = function (common, editor, cfg) { cfg = cfg || {}; var $toolbar = $('
', { @@ -1180,20 +1159,28 @@ define([ }; for (var k in actions) { let $b = $('