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

Built from https://develop.svn.wordpress.org/trunk@28568


git-svn-id: http://core.svn.wordpress.org/trunk@28393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-05-24 01:44:15 +00:00
parent 8b7b72d75e
commit f7186fb198
16 changed files with 92 additions and 59 deletions

View File

@ -473,7 +473,6 @@ final class _WP_Editors {
'entities' => '38,amp,60,lt,62,gt',
'entity_encoding' => 'raw',
'keep_styles' => false,
'paste_webkit_styles' => 'font-weight font-style color',
// Limit the preview styles in the menu/toolbar
'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',

View File

@ -309,8 +309,13 @@ tinymce.PluginManager.add('charmap', function(editor) {
html: gridHtml,
onclick: function(e) {
var target = e.target;
if (/^(TD|DIV)$/.test(target.nodeName)) {
editor.execCommand('mceInsertContent', false, tinymce.trim(target.innerText || target.textContent));
if (target.tagName == 'TD') {
target = target.firstChild;
}
if (target.tagName == 'DIV') {
editor.execCommand('mceInsertContent', false, target.firstChild.data);
if (!e.ctrlKey) {
win.close();

File diff suppressed because one or more lines are too long

View File

@ -61,6 +61,8 @@ tinymce.PluginManager.add('image', function(editor) {
callback(tinymce.util.JSON.parse(text));
}
});
} else if (typeof(imageList) == "function") {
imageList(callback);
} else {
callback(imageList);
}
@ -174,7 +176,7 @@ tinymce.PluginManager.add('image', function(editor) {
data.height = null;
}
if (data.style === '') {
if (!data.style) {
data.style = null;
}

File diff suppressed because one or more lines are too long

View File

@ -200,30 +200,30 @@ tinymce.PluginManager.add('media', function(editor, url) {
data.poster = editor.convertURL(data.poster, "poster");
data.flashPlayerUrl = editor.convertURL(url + '/moxieplayer.swf', "movie");
tinymce.each(urlPatterns, function(pattern) {
var match, i, url;
if ((match = pattern.regex.exec(data.source1))) {
url = pattern.url;
for (i = 0; match[i]; i++) {
/*jshint loopfunc:true*/
/*eslint no-loop-func:0 */
url = url.replace('$' + i, function() {
return match[i];
});
}
data.source1 = url;
data.type = pattern.type;
data.width = data.width || pattern.w;
data.height = data.height || pattern.h;
}
});
if (data.embed) {
html = updateHtml(data.embed, data, true);
} else {
tinymce.each(urlPatterns, function(pattern) {
var match, i, url;
if ((match = pattern.regex.exec(data.source1))) {
url = pattern.url;
for (i = 0; match[i]; i++) {
/*jshint loopfunc:true*/
/*eslint no-loop-func:0 */
url = url.replace('$' + i, function() {
return match[i];
});
}
data.source1 = url;
data.type = pattern.type;
data.width = data.width || pattern.w;
data.height = data.height || pattern.h;
}
});
} else {
var videoScript = getVideoScriptMatch(data.source1);
if (videoScript) {
data.type = 'script';
@ -511,7 +511,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
});
// Allow elements
editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
//editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
// Set allowFullscreen attribs as boolean
var boolAttrs = editor.schema.getBoolAttrs();
@ -526,6 +526,9 @@ tinymce.PluginManager.add('media', function(editor, url) {
while (i--) {
node = nodes[i];
if (!node.parent) {
continue;
}
if (node.name == 'script') {
videoScript = getVideoScriptMatch(node.attr('src'));
@ -591,6 +594,10 @@ tinymce.PluginManager.add('media', function(editor, url) {
while (i--) {
node = nodes[i];
if (!node.parent) {
continue;
}
realElmName = node.attr(name);
realElm = new tinymce.html.Node(realElmName, 1);

File diff suppressed because one or more lines are too long

View File

@ -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);

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@ tinymce.PluginManager.add('textcolor', function(editor) {
"00FF00", "Lime",
"00FFFF", "Aqua",
"00CCFF", "Sky blue",
"993366", "Brown",
"993366", "Red violet",
"C0C0C0", "Silver",
"FF99CC", "Pink",
"FFCC99", "Peach",

View File

@ -1 +1 @@
tinymce.PluginManager.add("textcolor",function(e){function t(){var t,o,r=[];for(o=e.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Brown","C0C0C0","Silver","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum","FFFFFF","White"],t=0;t<o.length;t+=2)r.push({text:o[t+1],color:o[t]});return r}function o(){var o,r,l,a,c,i,n,F,d,s=this;for(o=t(),l='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',a=o.length-1,c=e.settings.textcolor_rows||5,i=e.settings.textcolor_cols||8,F=0;c>F;F++){for(l+="<tr>",n=0;i>n;n++)d=F*i+n,d>a?l+="<td></td>":(r=o[d],l+='<td><div id="'+s._id+"-"+d+'" data-mce-color="'+r.color+'" role="option" tabIndex="-1" style="'+(r?"background-color: #"+r.color:"")+'" title="'+r.text+'"></div></td>');l+="</tr>"}return l+="</tbody></table>"}function r(t){var o,r=this.parent();(o=t.target.getAttribute("data-mce-color"))&&(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),t.target.setAttribute("aria-selected",!0),this.lastId=t.target.id,r.hidePanel(),o="#"+o,r.color(o),e.execCommand(r.settings.selectcmd,!1,o))}function l(){var t=this;t._color&&e.execCommand(t.settings.selectcmd,!1,t._color)}e.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",selectcmd:"ForeColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:r},onclick:l}),e.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",selectcmd:"HiliteColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:r},onclick:l})});
tinymce.PluginManager.add("textcolor",function(e){function t(){var t,o,l=[];for(o=e.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","C0C0C0","Silver","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum","FFFFFF","White"],t=0;t<o.length;t+=2)l.push({text:o[t+1],color:o[t]});return l}function o(){var o,l,r,a,c,i,n,F,d,s=this;for(o=t(),r='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',a=o.length-1,c=e.settings.textcolor_rows||5,i=e.settings.textcolor_cols||8,F=0;c>F;F++){for(r+="<tr>",n=0;i>n;n++)d=F*i+n,d>a?r+="<td></td>":(l=o[d],r+='<td><div id="'+s._id+"-"+d+'" data-mce-color="'+l.color+'" role="option" tabIndex="-1" style="'+(l?"background-color: #"+l.color:"")+'" title="'+l.text+'"></div></td>');r+="</tr>"}return r+="</tbody></table>"}function l(t){var o,l=this.parent();(o=t.target.getAttribute("data-mce-color"))&&(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),t.target.setAttribute("aria-selected",!0),this.lastId=t.target.id,l.hidePanel(),o="#"+o,l.color(o),e.execCommand(l.settings.selectcmd,!1,o))}function r(){var t=this;t._color&&e.execCommand(t.settings.selectcmd,!1,t._color)}e.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",selectcmd:"ForeColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:l},onclick:r}),e.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",selectcmd:"HiliteColor",panel:{role:"application",ariaRemember:!0,html:o,onclick:l},onclick:r})});

View File

@ -460,7 +460,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
}
});
editor.on('blur', hide);
editor.on('blur hide', hide);
// Remove the panel when the editor is removed
editor.on('remove', function() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ $wp_db_version = 27916;
*
* @global string $tinymce_version
*/
$tinymce_version = '4021-20140423';
$tinymce_version = '4026-20140523';
/**
* Holds the required PHP version