[evolution/gnome-3-38] Revert "I#1269 - Composer: Paste plain text as Preformatted"
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-38] Revert "I#1269 - Composer: Paste plain text as Preformatted"
- Date: Thu, 28 Jan 2021 17:03:06 +0000 (UTC)
commit a8629ac47602b34134bf97ec13a70e7da02365ae
Author: Milan Crha <mcrha redhat com>
Date: Thu Jan 28 18:00:45 2021 +0100
Revert "I#1269 - Composer: Paste plain text as Preformatted"
This reverts commit 49d6231b822a2819130852ace31e873accb90506.
Related to https://gitlab.gnome.org/GNOME/evolution/-/issues/1269
data/webkit/e-editor.js | 4 +--
src/e-util/test-html-editor-units-bugs.c | 20 ++++++-------
src/e-util/test-html-editor-units.c | 46 ++++++++++++++---------------
src/modules/webkit-editor/e-webkit-editor.c | 6 ++++
4 files changed, 41 insertions(+), 35 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 8cfaaf8a4a..e85a37b465 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -5097,7 +5097,7 @@ EvoEditor.InsertContent = function(text, isHTML, quote)
}
var wasPlain = !isHTML;
- var content = document.createElement(quote ? "BLOCKQUOTE" : wasPlain ? "PRE" : "DIV");
+ var content = document.createElement(quote ? "BLOCKQUOTE" : "DIV");
if (quote) {
content.setAttribute("type", "cite");
@@ -5155,7 +5155,7 @@ EvoEditor.InsertContent = function(text, isHTML, quote)
for (ii = 0; ii < lines.length; ii++) {
line = lines[ii];
- divNode = document.createElement(wasPlain ? "PRE" : "DIV");
+ divNode = document.createElement("DIV");
content.appendChild(divNode);
diff --git a/src/e-util/test-html-editor-units-bugs.c b/src/e-util/test-html-editor-units-bugs.c
index d38a1247bf..2e44f7110e 100644
--- a/src/e-util/test-html-editor-units-bugs.c
+++ b/src/e-util/test-html-editor-units-bugs.c
@@ -761,12 +761,12 @@ test_bug_773164 (TestFixture *fixture)
"undo:undo:3\n"
"undo:test\n"
"undo:redo:3\n",
- HTML_PREFIX "<pre>This is paragraph 1</pre>"
- "<pre><br></pre>"
- "<pre>This is a longer paragraph 3</pre>"
- "<pre><br></pre>"
- "<pre>This is paragraph 2</pre>"
- "<pre><br></pre>"
+ HTML_PREFIX "<div style=\"width: 71ch;\">This is paragraph 1</div>"
+ "<div style=\"width: 71ch;\"><br></div>"
+ "<div style=\"width: 71ch;\">This is a longer paragraph 3</div>"
+ "<div style=\"width: 71ch;\"><br></div>"
+ "<div style=\"width: 71ch;\">This is paragraph 2</div>"
+ "<div style=\"width: 71ch;\"><br></div>"
HTML_SUFFIX,
"This is paragraph 1\n"
"\n"
@@ -982,8 +982,8 @@ test_bug_780275_html (TestFixture *fixture)
"undo:redo\n",
HTML_PREFIX "<div>line 0</div>"
"<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
- "<pre>Xline 1</pre>"
- "<pre>line 2</pre>"
+ "<div>Xline 1</div>"
+ "<div>line 2</div>"
"</blockquote>"
"<div>line 4</div>"
HTML_SUFFIX,
@@ -1020,8 +1020,8 @@ test_bug_780275_plain (TestFixture *fixture)
"undo:redo\n",
HTML_PREFIX "<div style=\"width: 71ch;\">line 0</div>"
"<blockquote type=\"cite\">"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "Xline 1</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 2</pre>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "Xline 1</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 2</div>"
"</blockquote>"
"<div style=\"width: 71ch;\">line 4</div>"
HTML_SUFFIX,
diff --git a/src/e-util/test-html-editor-units.c b/src/e-util/test-html-editor-units.c
index f5126d1a1d..75ec24f3ff 100644
--- a/src/e-util/test-html-editor-units.c
+++ b/src/e-util/test-html-editor-units.c
@@ -4353,7 +4353,7 @@ test_paste_multiline_plain2html (TestFixture *fixture)
"type:text before \n"
"action:paste\n"
"type:text after\n",
- HTML_PREFIX "<div>text before line 1</div><pre>line 2</pre><pre>line 3</pre><pre>text
after</pre>" HTML_SUFFIX,
+ HTML_PREFIX "<div>text before line 1</div><div>line 2</div><div>line 3</div><div>text
after</div>" HTML_SUFFIX,
"text before line 1\nline 2\nline 3\ntext after\n"))
g_test_fail ();
}
@@ -4369,9 +4369,9 @@ test_paste_multiline_plain2plain (TestFixture *fixture)
"action:paste\n"
"type:\\ntext after\n",
HTML_PREFIX "<div style=\"width: 71ch;\">text before line 1</div>"
- "<pre>line 2</pre>"
- "<pre>line 3</pre>"
- "<pre>text after</pre>" HTML_SUFFIX,
+ "<div style=\"width: 71ch;\">line 2</div>"
+ "<div style=\"width: 71ch;\">line 3</div>"
+ "<div style=\"width: 71ch;\">text after</div>" HTML_SUFFIX,
"text before line 1\nline 2\nline 3\ntext after\n"))
g_test_fail ();
}
@@ -4518,10 +4518,10 @@ test_paste_quoted_multiline_plain2html (TestFixture *fixture)
"type:\\n\n" /* stop quotting */
"type:text after\n",
HTML_PREFIX "<div>text before </div>"
- "<blockquote type=\"cite\" " BLOCKQUOTE_STYLE "><pre>line 1</pre>"
- "<pre>line 2</pre>"
- "<pre>line 3</pre>"
- "<pre><br></pre></blockquote>"
+ "<blockquote type=\"cite\" " BLOCKQUOTE_STYLE "><div>line 1</div>"
+ "<div>line 2</div>"
+ "<div>line 3</div>"
+ "<div><br></div></blockquote>"
"<div>text after</div>" HTML_SUFFIX,
"text before \n"
"> line 1\n"
@@ -4544,9 +4544,9 @@ test_paste_quoted_multiline_plain2plain (TestFixture *fixture)
"type:\\n\n" /* stop quotting */
"type:text after\n",
HTML_PREFIX "<div style=\"width: 71ch;\">text before </div>"
- "<blockquote type=\"cite\"><pre>" QUOTE_SPAN (QUOTE_CHR) "line 1</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 2</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 3</pre></blockquote>"
+ "<blockquote type=\"cite\"><div>" QUOTE_SPAN (QUOTE_CHR) "line 1</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 2</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 3</div></blockquote>"
"<div style=\"width: 71ch;\">text after</div>" HTML_SUFFIX,
"text before \n"
"> line 1\n"
@@ -6842,10 +6842,10 @@ test_delete_quoted_selection (TestFixture *fixture)
"type:X\n",
HTML_PREFIX "<div style=\"width: 71ch;\">line 0</div>"
"<blockquote type=\"cite\">"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 1</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "<br></pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 2</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "X</pre>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 1</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "<br></div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 2</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "X</div>"
"</blockquote>"
HTML_SUFFIX,
"line 0\n"
@@ -6868,8 +6868,8 @@ test_delete_quoted_multiselect (TestFixture *fixture)
"undo:save\n" /* 1 */
"seq:ChcrrSdsD\n",
HTML_PREFIX "<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
- "<pre>line 2</pre>"
- "<pre>line 3X</pre>"
+ "<div>line 2</div>"
+ "<div>line 3X</div>"
"</blockquote>"
HTML_SUFFIX,
"> line 2\n"
@@ -6886,8 +6886,8 @@ test_delete_quoted_multiselect (TestFixture *fixture)
"seq:Cec\n" /* Go to the end of the document (Ctrl+End) */
"type:\\nY\n",
HTML_PREFIX "<blockquote type=\"cite\" " BLOCKQUOTE_STYLE ">"
- "<pre>line 2</pre>"
- "<pre>line 3X</pre>"
+ "<div>line 2</div>"
+ "<div>line 3X</div>"
"</blockquote>"
"<div>Y</div>"
HTML_SUFFIX,
@@ -6907,8 +6907,8 @@ test_delete_quoted_multiselect (TestFixture *fixture)
"undo:save\n" /* 1 */
"seq:ChcrrSdsD\n",
HTML_PREFIX "<blockquote type=\"cite\">"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 2</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 3X</pre>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 2</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 3X</div>"
"</blockquote>"
HTML_SUFFIX,
"> line 2\n"
@@ -6924,8 +6924,8 @@ test_delete_quoted_multiselect (TestFixture *fixture)
"seq:Cec\n" /* Go to the end of the document (Ctrl+End) */
"type:\\nY\n",
HTML_PREFIX "<blockquote type=\"cite\">"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 2</pre>"
- "<pre>" QUOTE_SPAN (QUOTE_CHR) "line 3X</pre>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 2</div>"
+ "<div>" QUOTE_SPAN (QUOTE_CHR) "line 3X</div>"
"</blockquote>"
"<div style=\"width: 71ch;\">Y</div>"
HTML_SUFFIX,
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 4a2a07eae9..648059b71a 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -2047,6 +2047,12 @@ webkit_editor_insert_content (EContentEditor *editor,
g_strfreev (lines);
g_free (html);
+ } else if ((flags & E_CONTENT_EDITOR_INSERT_CONVERT) &&
+ !(flags & E_CONTENT_EDITOR_INSERT_REPLACE_ALL) &&
+ !(flags & E_CONTENT_EDITOR_INSERT_QUOTE_CONTENT)) {
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
+ "EvoEditor.InsertContent(%s, %x, %x);",
+ content, TRUE, FALSE);
} else if ((flags & E_CONTENT_EDITOR_INSERT_QUOTE_CONTENT) &&
!(flags & E_CONTENT_EDITOR_INSERT_REPLACE_ALL)) {
e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]