[evolution] I#1439 - Composer: Paste single-line HTML without DIV into LI
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1439 - Composer: Paste single-line HTML without DIV into LI
- Date: Wed, 24 Mar 2021 16:35:33 +0000 (UTC)
commit 83207521995d9b8d56f8fdeda74cc76eb8ed1c30
Author: Milan Crha <mcrha redhat com>
Date: Wed Mar 24 17:34:52 2021 +0100
I#1439 - Composer: Paste single-line HTML without DIV into LI
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1439
data/webkit/e-editor.js | 5 +++++
src/e-util/test-html-editor-units-bugs.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 054d387f41..67245f71a5 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -5407,6 +5407,11 @@ EvoEditor.InsertContent = function(text, isHTML, quote, preferPre)
!content.getElementsByTagName("DIV").length &&
!content.getElementsByTagName("PRE").length;
+ /* Insert inside LI should not keep the top-most DIV/PRE */
+ if (useOuterHTML && selection.focusNode && (selection.focusNode.tagName == "LI" ||
+ EvoEditor.hasElementWithTagNameAsParent(selection.focusNode, "LI")))
+ useOuterHTML = false;
+
if (!useOuterHTML && selection.isCollapsed && selection.focusNode &&
EvoEditor.isEmptyParagraph(selection.focusNode)) {
var node = selection.focusNode, lastNode = null;
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index bf496442f7..377405094a 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -2660,6 +2660,36 @@ test_issue_1424_level2 (TestFixture *fixture)
}
}
+static void
+test_issue_1439 (TestFixture *fixture)
+{
+ if (!test_utils_process_commands (fixture,
+ "mode:html\n")) {
+ g_test_fail ();
+ return;
+ }
+
+ test_utils_set_clipboard_text ("The <a href='http://www.example.com/'>example com</a> site", TRUE);
+
+ if (!test_utils_run_simple_test (fixture,
+ "action:style-list-bullet\n"
+ "type:l1\\nl2\\n\n"
+ "action:paste\n"
+ "type:\\nl4\n",
+ HTML_PREFIX "<ul>"
+ "<li>l1</li>"
+ "<li>l2</li>"
+ "<li>The <a href='http://www.example.com/'>example com</a> site</li>"
+ "<li>l4</li>"
+ "</ul>"
+ HTML_SUFFIX,
+ " * l1\n"
+ " * l2\n"
+ " * The example com site\n"
+ " * l4\n"))
+ g_test_fail ();
+}
+
void
test_add_html_editor_bug_tests (void)
{
@@ -2706,4 +2736,5 @@ test_add_html_editor_bug_tests (void)
test_utils_add_test ("/issue/1159", test_issue_1159);
test_utils_add_test ("/issue/1424-level1", test_issue_1424_level1);
test_utils_add_test ("/issue/1424-level2", test_issue_1424_level2);
+ test_utils_add_test ("/issue/1439", test_issue_1439);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]