mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-09 14:44:34 +08:00
Bugfix and improve Squire HTML/Plain modes
This commit is contained in:
parent
5efbcf5ad3
commit
1c95eab6d6
4 changed files with 17 additions and 13 deletions
|
@ -30,7 +30,7 @@ export function pString(value) {
|
|||
export function inFocus() {
|
||||
try {
|
||||
return doc.activeElement && doc.activeElement.matches(
|
||||
'input,textarea,.cke_editable'
|
||||
'input,textarea,[contenteditable]'
|
||||
);
|
||||
} catch (e) {
|
||||
return false;
|
||||
|
|
13
dev/External/SquireUI.js
vendored
13
dev/External/SquireUI.js
vendored
|
@ -336,7 +336,7 @@ class SquireUI
|
|||
}
|
||||
|
||||
plain.className = 'squire-plain';
|
||||
wysiwyg.className = 'squire-wysiwyg cke_editable';
|
||||
wysiwyg.className = 'squire-wysiwyg';
|
||||
this.mode = ''; // 'plain' | 'wysiwyg'
|
||||
this.__plain = {
|
||||
getRawData: () => this.plain.value,
|
||||
|
@ -349,18 +349,17 @@ class SquireUI
|
|||
this.wysiwyg = wysiwyg;
|
||||
|
||||
toolbar.className = 'squire-toolbar btn-toolbar';
|
||||
let touchTap;
|
||||
for (let group in actions) {
|
||||
let group, action, touchTap;
|
||||
for (group in actions) {
|
||||
/*
|
||||
if ('bidi' == group && !rl.settings.app('allowHtmlEditorBitiButtons')) {
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
let toolgroup = doc.createElement('div');
|
||||
toolgroup.className = 'btn-group';
|
||||
toolgroup.id = 'squire-toolgroup-'+group;
|
||||
for (let action in actions[group]) {
|
||||
if ('source' == action && !rl.settings.app('allowHtmlEditorSourceButton')) {
|
||||
continue;
|
||||
}
|
||||
for (action in actions[group]) {
|
||||
let cfg = actions[group][action], input, ev = 'click';
|
||||
if (cfg.input) {
|
||||
input = doc.createElement('input');
|
||||
|
|
|
@ -175,3 +175,7 @@ Secondly, we can't rely on MUA's what to do with :empty
|
|||
.rl-mobile .b-compose.modal {
|
||||
min-height: calc(100% - 62px);
|
||||
}
|
||||
|
||||
.RL-PopupsCompose[data-wysiwyg*=Forced] #squire-toolgroup-mode {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -130,7 +130,6 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
this.allowContacts = AppUserStore.allowContacts();
|
||||
|
||||
this.bSkipNextHide = false;
|
||||
this.editorDefaultType = SettingsUserStore.editorDefaultType;
|
||||
|
||||
this.capaOpenPGP = PgpUserStore.capaOpenPGP;
|
||||
|
||||
|
@ -716,6 +715,8 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
|
||||
this.autosaveStart();
|
||||
|
||||
this.viewModelDom.dataset.wysiwyg = SettingsUserStore.editorDefaultType();
|
||||
|
||||
if (AppUserStore.composeInEdit()) {
|
||||
type = type || ComposeType.Empty;
|
||||
if (ComposeType.Empty !== type) {
|
||||
|
@ -772,7 +773,7 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
isPlainEditor() {
|
||||
let type = this.editorDefaultType();
|
||||
let type = SettingsUserStore.editorDefaultType();
|
||||
return EditorDefaultType.Html !== type && EditorDefaultType.HtmlForced !== type;
|
||||
}
|
||||
|
||||
|
@ -971,8 +972,8 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
editor.setHtml(sText);
|
||||
|
||||
if (
|
||||
EditorDefaultType.PlainForced === this.editorDefaultType() ||
|
||||
(!message.isHtml() && EditorDefaultType.HtmlForced !== this.editorDefaultType())
|
||||
EditorDefaultType.PlainForced === SettingsUserStore.editorDefaultType() ||
|
||||
(!message.isHtml() && EditorDefaultType.HtmlForced !== SettingsUserStore.editorDefaultType())
|
||||
) {
|
||||
editor.modePlain();
|
||||
}
|
||||
|
@ -1256,7 +1257,7 @@ class ComposePopupView extends AbstractViewPopup {
|
|||
ro.toolbar = dom.querySelector('.b-header-toolbar');
|
||||
ro.els = [dom.querySelector('.textAreaParent'), dom.querySelector('.attachmentAreaParent')];
|
||||
|
||||
this.editor(editor => editor.modeWysiwyg());
|
||||
this.editor(editor => editor[this.isPlainEditor()?'modePlain':'modeWysiwyg']());
|
||||
|
||||
// Fullscreen must be on app, else other popups fail
|
||||
const el = doc.getElementById('rl-app');
|
||||
|
|
Loading…
Add table
Reference in a new issue