mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
More in line with Squire v2.2.5
This commit is contained in:
parent
0423c50c51
commit
bcb6d30023
1 changed files with 16 additions and 28 deletions
32
vendors/squire/build/squire-raw.js
vendored
32
vendors/squire/build/squire-raw.js
vendored
|
|
@ -790,17 +790,15 @@ const
|
||||||
if (!child || isLeaf(child)) {
|
if (!child || isLeaf(child)) {
|
||||||
if (startOffset) {
|
if (startOffset) {
|
||||||
child = startContainer.childNodes[startOffset - 1];
|
child = startContainer.childNodes[startOffset - 1];
|
||||||
let prev = child.previousSibling;
|
|
||||||
// If we have an empty text node next to another text node,
|
|
||||||
// just skip and remove it.
|
|
||||||
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
|
|
||||||
child.remove();
|
|
||||||
child = prev;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (child instanceof Text) {
|
if (child instanceof Text) {
|
||||||
startContainer = child;
|
let textChild = child;
|
||||||
startOffset = child.data.length;
|
let prev;
|
||||||
|
while (!textChild.length && (prev = textChild.previousSibling) && prev instanceof Text) {
|
||||||
|
textChild.remove();
|
||||||
|
textChild = prev;
|
||||||
|
}
|
||||||
|
startContainer = textChild;
|
||||||
|
startOffset = textChild.data.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2478,12 +2476,6 @@ class Squire
|
||||||
// Grammarly breaks the editor, *sigh*
|
// Grammarly breaks the editor, *sigh*
|
||||||
root.setAttribute('data-gramm', 'false');
|
root.setAttribute('data-gramm', 'false');
|
||||||
|
|
||||||
// Remove Firefox's built-in controls
|
|
||||||
try {
|
|
||||||
doc.execCommand('enableObjectResizing', false, 'false');
|
|
||||||
doc.execCommand('enableInlineTableEditing', false, 'false');
|
|
||||||
} catch (error) {}
|
|
||||||
|
|
||||||
root.__squire__ = this;
|
root.__squire__ = this;
|
||||||
|
|
||||||
// Need to register instance before calling setHTML, so that the fixCursor
|
// Need to register instance before calling setHTML, so that the fixCursor
|
||||||
|
|
@ -2618,18 +2610,12 @@ class Squire
|
||||||
win.focus();
|
win.focus();
|
||||||
}
|
}
|
||||||
let sel = win.getSelection();
|
let sel = win.getSelection();
|
||||||
if (sel?.setBaseAndExtent) {
|
|
||||||
sel.setBaseAndExtent(
|
sel.setBaseAndExtent(
|
||||||
range.startContainer,
|
range.startContainer,
|
||||||
range.startOffset,
|
range.startOffset,
|
||||||
range.endContainer,
|
range.endContainer,
|
||||||
range.endOffset,
|
range.endOffset,
|
||||||
);
|
);
|
||||||
} else if (sel) {
|
|
||||||
// This is just for IE11
|
|
||||||
sel.removeAllRanges();
|
|
||||||
sel.addRange(range);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this._restoreSelection = true;
|
this._restoreSelection = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2823,10 +2809,12 @@ class Squire
|
||||||
|
|
||||||
undo() {
|
undo() {
|
||||||
this.editStack.undo();
|
this.editStack.undo();
|
||||||
|
// this.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
redo() {
|
redo() {
|
||||||
this.editStack.redo();
|
this.editStack.redo();
|
||||||
|
// this.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Inline formatting ---
|
// --- Inline formatting ---
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue