From 4301d92d0b9aeb3fa1a3e7e284229f1c449e3775 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 26 Sep 2022 14:32:47 +0200 Subject: [PATCH] Change Squire HTML<>TEXT button for clarity as discussed https://github.com/the-djmaze/snappymail/issues/498#issuecomment-1257076375 --- dev/External/SquireUI.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dev/External/SquireUI.js b/dev/External/SquireUI.js index 4007dd143..fdf8bff25 100644 --- a/dev/External/SquireUI.js +++ b/dev/External/SquireUI.js @@ -78,8 +78,13 @@ class SquireUI actions = { mode: { plain: { - html: '〈〉', - cmd: () => this.setMode('plain' == this.mode ? 'wysiwyg' : 'plain'), +// html: '〈〉', +// cmd: () => this.setMode('plain' == this.mode ? 'wysiwyg' : 'plain'), + select: [ + [i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML'),'wysiwyg'], + [i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN'),'plain'] + ], + cmd: s => this.setMode('plain' == s.value ? 'plain' : 'wysiwyg'), hint: i18n('EDITOR/TEXT_SWITCHER_PLAIN_TEXT', 'Plain') } }, @@ -299,8 +304,9 @@ class SquireUI input.className = 'btn'; if (Array.isArray(cfg.select)) { cfg.select.forEach(value => { - var option = new Option(value, value); - option.style[action] = value; + value = Array.isArray(value) ? value : [value, value]; + var option = new Option(value[0], value[1]); + option.style[action] = value[1]; input.append(option); }); } else { @@ -347,6 +353,8 @@ class SquireUI toolgroup.children.length && toolbar.append(toolgroup); } + this.modeSelect = actions.mode.plain.input; + let changes = actions.changes; changes.undo.input.disabled = changes.redo.input.disabled = true; squire.addEventListener('undoStateChange', state => { @@ -413,6 +421,7 @@ class SquireUI this.onModeChange?.(); setTimeout(()=>this.focus(),1); } + this.modeSelect.selectedIndex = 'plain' == this.mode ? 1 : 0; } // CKeditor gimmicks used by HtmlEditor