diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 3e2cde273e..710fd51f08 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -5393,10 +5393,17 @@ EvoEditor.InsertContent = function(text, isHTML, quote, preferPre)
}
if (isHTML) {
+ var isPaste = false;
+
content.innerHTML = text;
// paste can contain elements, like the one with Content-Type, which can be removed
while (content.firstElementChild && content.firstElementChild.tagName == "META") {
+ if (!isPaste &&
+ content.firstElementChild.hasAttribute("name") &&
+ content.firstElementChild.getAttribute("name") == "x-evolution-is-paste")
+ isPaste = true;
+
content.removeChild(content.firstElementChild);
}
@@ -5411,12 +5418,24 @@ EvoEditor.InsertContent = function(text, isHTML, quote, preferPre)
while (node) {
var removeNode = false;
+ // workaround https://bugs.webkit.org/show_bug.cgi?id=250003
+ if (isPaste && node.nodeType == node.ELEMENT_NODE && node.tagName != "SPAN" &&
+ node.hasAttribute("style")) {
+ node.removeAttribute("style");
+ }
+
if (node.nodeType == node.ELEMENT_NODE && node.tagName == "P") {
removeNode = true;
var div = document.createElement("DIV");
EvoEditor.moveNodeContent(node, div);
node.parentElement.insertBefore(div, node.nextSibling);
+ // workaround https://bugs.webkit.org/show_bug.cgi?id=250003
+ } else if (isPaste && node.nodeType == node.ELEMENT_NODE && node.tagName == "SPAN" &&
+ node.attributes.length == 1 && node.attributes[0].name == "style" &&
+ node.style.length > 0 && node.fontSize != "") {
+ EvoEditor.moveNodeContent(node, null);
+ removeNode = true;
}
next = EvoEditor.getNextNodeInHierarchy(node, content);
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index faa312f3e3..4c6db21b7d 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -5123,18 +5123,25 @@ webkit_editor_paste_clipboard_targets_cb (GtkClipboard *clipboard,
return;
}
- if (is_html)
+ if (is_html) {
+ gchar *paste_content;
+
+ paste_content = g_strconcat ("", content, NULL);
+
webkit_editor_insert_content (
E_CONTENT_EDITOR (wk_editor),
- content,
+ paste_content,
E_CONTENT_EDITOR_INSERT_TEXT_HTML);
- else
+
+ g_free (paste_content);
+ } else {
webkit_editor_insert_content (
E_CONTENT_EDITOR (wk_editor),
content,
E_CONTENT_EDITOR_INSERT_TEXT_PLAIN |
E_CONTENT_EDITOR_INSERT_CONVERT |
(wk_editor->priv->paste_plain_prefer_pre ? E_CONTENT_EDITOR_INSERT_CONVERT_PREFER_PRE : 0));
+ }
g_free (content);
}