mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
TinyMCE: update to 4.0.26. Includes fixes for the 'paste' plugin (paste from Word/Excel, paste in WebKit/Blink), show/hide/isHidden in inline mode, drag/drop in tables and in Safari, and others. Fixes #28342, #28016, #28250 and #28067
git-svn-id: https://develop.svn.wordpress.org/trunk@28568 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -306,7 +306,9 @@ define("tinymce/pasteplugin/Clipboard", [
|
||||
if (editor.inline) {
|
||||
scrollContainer = editor.selection.getScrollContainer();
|
||||
|
||||
if (scrollContainer) {
|
||||
// Can't always rely on scrollTop returning a useful value.
|
||||
// It returns 0 if the browser doesn't support scrollTop for the element or is non-scrollable
|
||||
if (scrollContainer && scrollContainer.scrollTop > 0) {
|
||||
scrollTop = scrollContainer.scrollTop;
|
||||
}
|
||||
}
|
||||
@@ -1036,8 +1038,8 @@ define("tinymce/pasteplugin/WordFilter", [
|
||||
if (!href && !name) {
|
||||
node.unwrap();
|
||||
} else {
|
||||
// Remove all named anchors that isn't toc specific
|
||||
if (name && !/^_?toc/i.test(name)) {
|
||||
// Remove all named anchors that aren't specific to TOC, Footnotes or Endnotes
|
||||
if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
|
||||
node.unwrap();
|
||||
continue;
|
||||
}
|
||||
@@ -1184,39 +1186,57 @@ define("tinymce/pasteplugin/Quirks", [
|
||||
}
|
||||
|
||||
// Filter away styles that isn't matching the target node
|
||||
var webKitStyles = editor.settings.paste_webkit_styles;
|
||||
|
||||
var webKitStyles = editor.getParam("paste_webkit_styles", "color font-size font-family background-color").split(/[, ]/);
|
||||
if (editor.settings.paste_remove_styles_if_webkit === false || webKitStyles == "all") {
|
||||
return content;
|
||||
}
|
||||
|
||||
if (editor.settings.paste_remove_styles_if_webkit === false) {
|
||||
webKitStyles = "all";
|
||||
if (webKitStyles) {
|
||||
webKitStyles = webKitStyles.split(/[, ]/);
|
||||
}
|
||||
|
||||
// Keep specific styles that doesn't match the current node computed style
|
||||
if (webKitStyles != "all") {
|
||||
if (webKitStyles) {
|
||||
var dom = editor.dom, node = editor.selection.getNode();
|
||||
|
||||
content = content.replace(/ style=\"([^\"]+)\"/gi, function(a, value) {
|
||||
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function(all, before, value, after) {
|
||||
var inputStyles = dom.parseStyle(value, 'span'), outputStyles = {};
|
||||
|
||||
if (webKitStyles === "none") {
|
||||
return '';
|
||||
return before + after;
|
||||
}
|
||||
|
||||
for (var i = 0; i < webKitStyles.length; i++) {
|
||||
if (dom.toHex(dom.getStyle(node, webKitStyles[i], true)) != inputStyles[webKitStyles[i]]) {
|
||||
outputStyles[webKitStyles[i]] = inputStyles[webKitStyles[i]];
|
||||
var inputValue = inputStyles[webKitStyles[i]], currentValue = dom.getStyle(node, webKitStyles[i], true);
|
||||
|
||||
if (/color/.test(webKitStyles[i])) {
|
||||
inputValue = dom.toHex(inputValue);
|
||||
currentValue = dom.toHex(currentValue);
|
||||
}
|
||||
|
||||
if (currentValue != inputValue) {
|
||||
outputStyles[webKitStyles[i]] = inputValue;
|
||||
}
|
||||
}
|
||||
|
||||
outputStyles = dom.serializeStyle(outputStyles, 'span');
|
||||
if (outputStyles) {
|
||||
return ' style="' + outputStyles + '"';
|
||||
return before + ' style="' + outputStyles + '"' + after;
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
} else {
|
||||
// Remove all external styles
|
||||
content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
|
||||
}
|
||||
|
||||
// Keep internal styles
|
||||
content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function(all, before, value, after) {
|
||||
return before + ' style="' + value + '"' + after;
|
||||
});
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -1346,4 +1366,4 @@ define("tinymce/pasteplugin/Plugin", [
|
||||
});
|
||||
|
||||
expose(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks","tinymce/pasteplugin/Plugin"]);
|
||||
})(this);
|
||||
})(this);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user