[evolution] e-editor.js: Remove all body attributes when using Plain Text mode
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] e-editor.js: Remove all body attributes when using Plain Text mode
- Date: Wed, 29 Apr 2020 11:46:02 +0000 (UTC)
commit 6d39ec9824c4da06e81dd38e899eb27abfffd0f6
Author: Milan Crha <mcrha redhat com>
Date: Wed Apr 29 13:48:33 2020 +0200
e-editor.js: Remove all body attributes when using Plain Text mode
data/webkit/e-editor.js | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index ff28aa65ce..231a1da797 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -2227,6 +2227,15 @@ EvoEditor.SetMode = function(mode)
if (mode == EvoEditor.MODE_PLAIN_TEXT) {
EvoEditor.convertTags();
EvoEditor.convertParagraphs(document.body, 0,
EvoEditor.NORMAL_PARAGRAPH_WIDTH, false);
+
+ if (document.body) {
+ // remove all body attributes, to not influence the Plain Text mode
+ var ii;
+
+ for (ii = document.body.attributes.length - 1; ii >= 0; ii--) {
+
document.body.removeAttribute(document.body.attributes[ii].nodeName);
+ }
+ }
} else {
EvoEditor.convertParagraphs(document.body, 0, -1, false);
}
@@ -5532,6 +5541,11 @@ EvoEditor.processLoadedContent = function()
EvoEditor.linkifyText(node, false);
}
}
+
+ // remove all body attributes, to not influence the Plain Text mode
+ for (ii = document.body.attributes.length - 1; ii >= 0; ii--) {
+ document.body.removeAttribute(document.body.attributes[ii].nodeName);
+ }
}
// remove comments at the beginning, like the Evolution's "<!-- text/html -->"
@@ -5539,6 +5553,18 @@ EvoEditor.processLoadedContent = function()
document.documentElement.removeChild(document.documentElement.firstChild);
}
+ // remove unneeded data from the <head> as well
+ if (document.head) {
+ list = document.head.childNodes;
+
+ for (ii = list.length; ii >= 0; ii--) {
+ node = list[ii];
+
+ if (node && (node.nodeType == node.COMMENT_NODE || node.tagName == "META"))
+ document.head.removeChild(node);
+ }
+ }
+
document.body.removeAttribute("data-evo-draft");
document.body.removeAttribute("data-evo-plain-text");
document.body.removeAttribute("spellcheck");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]