[evolution] Composer: Special-case requote of BLOCKQUOTE nodes in Plain Text mode
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Composer: Special-case requote of BLOCKQUOTE nodes in Plain Text mode
- Date: Thu, 13 Jan 2022 14:43:44 +0000 (UTC)
commit 0fc6bf5804240397945cb7395350ec34069dc98e
Author: Milan Crha <mcrha redhat com>
Date: Thu Jan 13 15:40:56 2022 +0100
Composer: Special-case requote of BLOCKQUOTE nodes in Plain Text mode
While the BLOCKQUOTE node is considered a clock node, it's not a real
block node for paragraph quoting, thus special-case it and requote
its content instead.
This could exhibit in certain occasions when deleting content inside
quoted part using Backspace or Delete keys.
data/webkit/e-editor.js | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 2746590d2e..4f0452cdaa 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -3093,6 +3093,23 @@ EvoEditor.hasElementWithTagNameAsParent = function(node, tagName)
return false;
}
+EvoEditor.requoteBlockquotes = function(node, blockquoteLevel)
+{
+ var child;
+
+ for (child = node.firstChild; child; child = child.nextElementSibling) {
+ if (child.tagName == "DIV" ||
+ child.tagName == "P" ||
+ child.tagName == "PRE" ||
+ child.tagName == "UL" ||
+ child.tagName == "OL") {
+ EvoEditor.quoteParagraph(child, blockquoteLevel, EvoEditor.NORMAL_PARAGRAPH_WIDTH -
(2 * blockquoteLevel));
+ } else if (child.tagName == "BLOCKQUOTE") {
+ EvoEditor.requoteBlockquotes(child, blockquoteLevel + 1);
+ }
+ }
+}
+
EvoEditor.requoteNodeParagraph = function(node)
{
while (node && node.tagName != "BODY" && !EvoEditor.IsBlockNode(node)) {
@@ -3108,7 +3125,11 @@ EvoEditor.requoteNodeParagraph = function(node)
try {
var blockquoteLevel = EvoEditor.getBlockquoteLevel(node);
- EvoEditor.quoteParagraph(node, blockquoteLevel, EvoEditor.NORMAL_PARAGRAPH_WIDTH - (2 *
blockquoteLevel));
+ if (node.tagName == "BLOCKQUOTE") {
+ EvoEditor.requoteBlockquotes(node, blockquoteLevel);
+ } else {
+ EvoEditor.quoteParagraph(node, blockquoteLevel, EvoEditor.NORMAL_PARAGRAPH_WIDTH - (2
* blockquoteLevel));
+ }
} finally {
EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "requote");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]