[evolution] I#1159 - Composer: Removing highlighted quoted section creates empty quoted lines
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1159 - Composer: Removing highlighted quoted section creates empty quoted lines
- Date: Wed, 10 Mar 2021 16:34:00 +0000 (UTC)
commit f3bcbb37f56979fbf3811fc9c22d6e349c6c32da
Author: Milan Crha <mcrha redhat com>
Date: Wed Mar 10 17:33:16 2021 +0100
I#1159 - Composer: Removing highlighted quoted section creates empty quoted lines
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1159
data/webkit/e-editor.js | 32 ++++++++++++++++++++++++++++
src/e-util/test-html-editor-units-bugs.c | 36 ++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index e2ca304e8e..1ddca5ce80 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -3572,6 +3572,38 @@ EvoEditor.AfterInputEvent = function(inputEvent, isWordDelim)
EvoEditor.EmitContentChanged();
}
}
+ } else if (isInsertParagraph && EvoEditor.mode == EvoEditor.MODE_PLAIN_TEXT) {
+ var node = selection.anchorNode, childNode;
+
+ node = node ? node.previousElementSibling : null;
+ if (node && node.tagName != "BLOCKQUOTE") {
+ node = node.previousElementSibling;
+ if (node && node.tagName != "BLOCKQUOTE")
+ node = null;
+ }
+
+ if (node) {
+ EvoUndoRedo.StartRecord(EvoUndoRedo.RECORD_KIND_CUSTOM, "blockquoteFixup",
node, node,
+ EvoEditor.CLAIM_CONTENT_FLAG_SAVE_HTML);
+ try {
+ var blockquoteLevel = 1;
+
+ EvoEditor.removeQuoteMarks(node);
+ EvoEditor.convertParagraphs(node, blockquoteLevel,
+ EvoEditor.NORMAL_PARAGRAPH_WIDTH - (blockquoteLevel * 2),
false);
+ } finally {
+ EvoUndoRedo.StopRecord(EvoUndoRedo.RECORD_KIND_CUSTOM,
"blockquoteFixup");
+
+ var didRemove = 0;
+
+ didRemove += EvoEditor.removeEmptyElements("DIV");
+ didRemove += EvoEditor.removeEmptyElements("PRE");
+
+ EvoUndoRedo.GroupTopRecords(2 + didRemove,
"insertParagraph::blockquoteFixup");
+ EvoEditor.maybeUpdateFormattingState(EvoEditor.FORCE_MAYBE);
+ EvoEditor.EmitContentChanged();
+ }
+ }
}
}
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index 7905a2cfd4..528eba5afa 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -2504,6 +2504,41 @@ test_issue_1394 (TestFixture *fixture)
g_test_fail ();
}
+static void
+test_issue_1159 (TestFixture *fixture)
+{
+ if (!test_utils_process_commands (fixture,
+ "mode:plain\n")) {
+ g_test_fail ();
+ return;
+ }
+
+ test_utils_insert_content (fixture,
+ "<body><div>a</div>"
+ "<div>b</div>"
+ "<div>c</div>"
+ "<span class=\"-x-evo-to-body\" data-credits=\"Credits:\"></span>"
+ "<span class=\"-x-evo-cite-body\"></span></body>",
+ E_CONTENT_EDITOR_INSERT_REPLACE_ALL | E_CONTENT_EDITOR_INSERT_TEXT_HTML);
+
+ if (!test_utils_run_simple_test (fixture,
+ "seq:Cecn\n"
+ "seq:ChcddSdds\n"
+ "seq:n\n",
+ HTML_PREFIX "<div style=\"width: 71ch;\">Credits:</div>"
+ "<blockquote type=\"cite\">"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "a</div>"
+ "</blockquote>"
+ "<div style=\"width: 71ch;\"><br></div>"
+ "<div style=\"width: 71ch;\"><br></div>"
+ HTML_SUFFIX,
+ "Credits:\n"
+ "> a\n"
+ "\n"
+ "\n"))
+ g_test_fail ();
+}
+
void
test_add_html_editor_bug_tests (void)
{
@@ -2547,4 +2582,5 @@ test_add_html_editor_bug_tests (void)
test_utils_add_test ("/issue/1344", test_issue_1344);
test_utils_add_test ("/issue/1391", test_issue_1391);
test_utils_add_test ("/issue/1394", test_issue_1394);
+ test_utils_add_test ("/issue/1159", test_issue_1159);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]