TinyMCE: update to 4.0.18, see #24067

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


git-svn-id: http://core.svn.wordpress.org/trunk@27235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-03-04 01:57:15 +00:00
parent 675a350ff9
commit 5525f32fd8
26 changed files with 1458 additions and 1133 deletions

View File

@ -294,9 +294,8 @@ tinymce.PluginManager.add('charmap', function(editor) {
for (x = 0; x < width; x++) {
var chr = charmap[y * width + x];
var id = 'g' + (y * width + x);
gridHtml += '<td title="' + chr[1] + '"><div id="' + id + '" tabIndex="-1">' +
gridHtml += '<td title="' + chr[1] + '"><div tabindex="-1" title="' + chr[1] + '" role="button">' +
(chr ? String.fromCharCode(parseInt(chr[0], 10)) : '&nbsp;') + '</div></td>';
}
@ -310,10 +309,10 @@ tinymce.PluginManager.add('charmap', function(editor) {
html: gridHtml,
onclick: function(e) {
var target = e.target;
if (target.nodeName == 'DIV') {
editor.execCommand('mceInsertContent', false, target.firstChild.nodeValue);
// WP, see #27107
if ( ! e.ctrlKey ) {
if (/^(TD|DIV)$/.test(target.nodeName)) {
editor.execCommand('mceInsertContent', false, tinymce.trim(target.innerText || target.textContent));
if (!e.ctrlKey) {
win.close();
}
}
@ -343,12 +342,7 @@ tinymce.PluginManager.add('charmap', function(editor) {
minHeight: 80
}
],
buttons: [
/* WP, see #27107
{text: "Close", onclick: function() {
win.close();
}} */
]
buttons: [] // WP, see #27107
});
}

File diff suppressed because one or more lines are too long

View File

@ -226,12 +226,14 @@
}
if ( settings.title ) {
// WP
string = (editor.settings.language || "en") + "." + settings.title;
translated = tinymce.i18n.translate(string);
if ( string !== translated ) {
settings.title = translated;
}
// WP end
}
return originalAddButton.call(this, name, settings);

View File

@ -59,7 +59,31 @@ tinymce.PluginManager.add('image', function(editor) {
function showDialog(imageList) {
var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode();
var width, height, imageListCtrl;
var width, height, imageListCtrl, classListCtrl;
function buildValues(listSettingName, dataItemName, defaultItems) {
var selectedItem, items = [];
tinymce.each(editor.settings[listSettingName] || defaultItems, function(target) {
var item = {
text: target.text || target.title,
value: target.value
};
items.push(item);
if (data[dataItemName] === target.value || (!selectedItem && target.selected)) {
selectedItem = item;
}
});
if (selectedItem && !data[dataItemName]) {
data[dataItemName] = selectedItem.value;
selectedItem.selected = true;
}
return items;
}
function buildImageList() {
var imageListItems = [{text: 'None', value: ''}];
@ -125,7 +149,7 @@ tinymce.PluginManager.add('image', function(editor) {
updateStyle();
recalcSize();
var data = win.toJSON();
data = tinymce.extend(data, win.toJSON());
var caption = data.caption; // WP
if (data.width === '') {
@ -145,9 +169,14 @@ tinymce.PluginManager.add('image', function(editor) {
alt: data.alt,
width: data.width,
height: data.height,
style: data.style
style: data.style,
"class": data["class"]
};
if (!data["class"]) {
delete data["class"];
}
editor.undoManager.transact(function() {
// WP
var eventData = { node: imgElm, data: data, caption: caption };
@ -163,6 +192,7 @@ tinymce.PluginManager.add('image', function(editor) {
if (!data.src) {
if (imgElm) {
dom.remove(imgElm);
editor.focus();
editor.nodeChanged();
}
@ -214,6 +244,7 @@ tinymce.PluginManager.add('image', function(editor) {
data = {
src: dom.getAttrib(imgElm, 'src'),
alt: dom.getAttrib(imgElm, 'alt'),
"class": dom.getAttrib(imgElm, 'class'),
width: width,
height: height
};
@ -245,6 +276,15 @@ tinymce.PluginManager.add('image', function(editor) {
};
}
if (editor.settings.image_class_list) {
classListCtrl = {
name: 'class',
type: 'listbox',
label: 'Class',
values: buildValues('image_class_list', 'class')
};
}
// General settings shared between simple and advanced dialogs
var generalFormItems = [
{name: 'src', type: 'filepicker', filetype: 'image', label: 'Source', autofocus: true, onchange: srcChange},
@ -258,12 +298,13 @@ tinymce.PluginManager.add('image', function(editor) {
align: 'center',
spacing: 5,
items: [
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'},
{type: 'label', text: 'x'},
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'},
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
]
}
},
classListCtrl
];
// WP

File diff suppressed because one or more lines are too long

View File

@ -30,7 +30,7 @@ tinymce.PluginManager.add('link', function(editor) {
function showDialog(linkList) {
var data = {}, selection = editor.selection, dom = editor.dom, selectedElm, anchorElm, initialText;
var win, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl;
var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl;
function linkListChangeHandler(e) {
var textCtrl = win.find('#text');
@ -56,37 +56,28 @@ tinymce.PluginManager.add('link', function(editor) {
return linkListItems;
}
function buildRelList(relValue) {
var relListItems = [{text: 'None', value: ''}];
function buildValues(listSettingName, dataItemName, defaultItems) {
var selectedItem, items = [];
tinymce.each(editor.settings.rel_list, function(rel) {
relListItems.push({
text: rel.text || rel.title,
value: rel.value,
selected: relValue === rel.value
});
tinymce.each(editor.settings[listSettingName] || defaultItems, function(target) {
var item = {
text: target.text || target.title,
value: target.value
};
items.push(item);
if (data[dataItemName] === target.value || (!selectedItem && target.selected)) {
selectedItem = item;
}
});
return relListItems;
}
function buildTargetList(targetValue) {
var targetListItems = [];
if (!editor.settings.target_list) {
targetListItems.push({text: 'None', value: ''});
targetListItems.push({text: 'New window', value: '_blank'});
if (selectedItem && !data[dataItemName]) {
data[dataItemName] = selectedItem.value;
selectedItem.selected = true;
}
tinymce.each(editor.settings.target_list, function(target) {
targetListItems.push({
text: target.text || target.title,
value: target.value,
selected: targetValue === target.value
});
});
return targetListItems;
return items;
}
function buildAnchorListControl(url) {
@ -127,30 +118,40 @@ tinymce.PluginManager.add('link', function(editor) {
}
}
selectedElm = selection.getNode();
anchorElm = dom.getParent(selectedElm, 'a[href]');
function isOnlyTextSelected(anchorElm) {
var html = selection.getContent();
// Partial html and not a fully selected anchor element
if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) {
return false;
}
if (anchorElm) {
var nodes = anchorElm.childNodes, i;
if (nodes.length === 0) {
return false;
}
var onlyText = true;
if (/</.test(selection.getContent())) {
onlyText = false;
} else if (anchorElm) {
var nodes = anchorElm.childNodes, i;
if (nodes.length === 0) {
onlyText = false;
} else {
for (i = nodes.length - 1; i >= 0; i--) {
if (nodes[i].nodeType != 3) {
onlyText = false;
break;
return false;
}
}
}
return true;
}
selectedElm = selection.getNode();
anchorElm = dom.getParent(selectedElm, 'a[href]');
onlyText = isOnlyTextSelected();
data.text = initialText = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({format: 'text'});
data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
data.target = anchorElm ? dom.getAttrib(anchorElm, 'target') : (editor.settings.default_link_target || '');
data.rel = anchorElm ? dom.getAttrib(anchorElm, 'rel') : '';
data.target = anchorElm ? dom.getAttrib(anchorElm, 'target') : (editor.settings.default_link_target || null);
data.rel = anchorElm ? dom.getAttrib(anchorElm, 'rel') : null;
data['class'] = anchorElm ? dom.getAttrib(anchorElm, 'class') : null;
if (onlyText) {
textListCtrl = {
@ -182,7 +183,7 @@ tinymce.PluginManager.add('link', function(editor) {
name: 'target',
type: 'listbox',
label: 'Target',
values: buildTargetList(data.target)
values: buildValues('target_list', 'target', [{text: 'None', value: ''}, {text: 'New window', value: '_blank'}])
};
}
@ -191,7 +192,16 @@ tinymce.PluginManager.add('link', function(editor) {
name: 'rel',
type: 'listbox',
label: 'Rel',
values: buildRelList(data.rel)
values: buildValues('rel_list', 'rel', [{text: 'None', value: ''}])
};
}
if (editor.settings.link_class_list) {
classListCtrl = {
name: 'class',
type: 'listbox',
label: 'Class',
values: buildValues('link_class_list', 'class')
};
}
@ -213,10 +223,14 @@ tinymce.PluginManager.add('link', function(editor) {
buildAnchorListControl(data.href),
linkListCtrl,
relListCtrl,
targetListCtrl
targetListCtrl,
classListCtrl
],
onSubmit: function(e) {
var data = e.data, href = data.href;
var href;
data = tinymce.extend(data, e.data);
href = data.href;
// Delay confirm since onSubmit will move focus
function delayedConfirm(message, callback) {
@ -241,7 +255,8 @@ tinymce.PluginManager.add('link', function(editor) {
dom.setAttribs(anchorElm, {
href: href,
target: data.target ? data.target : null,
rel: data.rel ? data.rel : null
rel: data.rel ? data.rel : null,
"class": data["class"] ? data["class"] : null
});
selection.select(anchorElm);
@ -251,7 +266,8 @@ tinymce.PluginManager.add('link', function(editor) {
editor.insertContent(dom.createHTML('a', {
href: href,
target: data.target ? data.target : null,
rel: data.rel ? data.rel : null
rel: data.rel ? data.rel : null,
"class": data["class"] ? data["class"] : null
}, dom.encode(data.text)));
} else {
editor.execCommand('mceInsertLink', false, {

View File

@ -1 +1 @@
tinymce.PluginManager.add("link",function(e){function t(t){return function(){var n=e.settings.link_list;"string"==typeof n?tinymce.util.XHR.send({url:n,success:function(e){t(tinymce.util.JSON.parse(e))}}):t(n)}}function n(t){function n(e){var t=f.find("#text");(!t.value()||e.lastControl&&t.value()==e.lastControl.text())&&t.value(e.control.text()),f.find("#href").value(e.control.value())}function l(){var n=[{text:"None",value:""}];return tinymce.each(t,function(t){n.push({text:t.text||t.title,value:e.convertURL(t.value||t.url,"href"),menu:t.menu})}),n}function i(t){var n=[{text:"None",value:""}];return tinymce.each(e.settings.rel_list,function(e){n.push({text:e.text||e.title,value:e.value,selected:t===e.value})}),n}function r(t){var n=[];return e.settings.target_list||(n.push({text:"None",value:""}),n.push({text:"New window",value:"_blank"})),tinymce.each(e.settings.target_list,function(e){n.push({text:e.text||e.title,value:e.value,selected:t===e.value})}),n}function a(t){var l=[];return tinymce.each(e.dom.select("a:not([href])"),function(e){var n=e.name||e.id;n&&l.push({text:n,value:"#"+n,selected:-1!=t.indexOf("#"+n)})}),l.length?(l.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:l,onselect:n}):void 0}function o(){h&&h.value(e.convertURL(this.value(),"href")),!c&&0===x.text.length&&k&&this.parent().parent().find("#text")[0].value(this.value())}var u,s,c,f,d,h,v,g,x={},m=e.selection,p=e.dom;u=m.getNode(),s=p.getParent(u,"a[href]");var k=!0;if(/</.test(m.getContent()))k=!1;else if(s){var y,b=s.childNodes;if(0===b.length)k=!1;else for(y=b.length-1;y>=0;y--)if(3!=b[y].nodeType){k=!1;break}}x.text=c=s?s.innerText||s.textContent:m.getContent({format:"text"}),x.href=s?p.getAttrib(s,"href"):"",x.target=s?p.getAttrib(s,"target"):e.settings.default_link_target||"",x.rel=s?p.getAttrib(s,"rel"):"",k&&(d={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){x.text=this.value()}}),t&&(h={type:"listbox",label:"Link list",values:l(),onselect:n,value:e.convertURL(x.href,"href"),onPostRender:function(){h=this}}),e.settings.target_list!==!1&&(g={name:"target",type:"listbox",label:"Target",values:r(x.target)}),e.settings.rel_list&&(v={name:"rel",type:"listbox",label:"Rel",values:i(x.rel)}),f=e.windowManager.open({title:"Insert link",data:x,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:o,onkeyup:o},d,a(x.href),h,v,g],onSubmit:function(t){function n(t,n){var l=e.selection.getRng();window.setTimeout(function(){e.windowManager.confirm(t,function(t){e.selection.setRng(l),n(t)})},0)}function l(){s?(e.focus(),k&&i.text!=c&&(s.innerText=i.text),p.setAttribs(s,{href:r,target:i.target?i.target:null,rel:i.rel?i.rel:null}),m.select(s),e.undoManager.add()):k?e.insertContent(p.createHTML("a",{href:r,target:i.target?i.target:null,rel:i.rel?i.rel:null},p.encode(i.text))):e.execCommand("mceInsertLink",!1,{href:r,target:i.target,rel:i.rel?i.rel:null})}var i=t.data,r=i.href;return r?r.indexOf("@")>0&&-1==r.indexOf("//")&&-1==r.indexOf("mailto:")?void n("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(e){e&&(r="mailto:"+r),l()}):/^\s*www\./i.test(r)?void n("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(e){e&&(r="http://"+r),l()}):void l():void e.execCommand("unlink")}})}e.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Ctrl+K",onclick:t(n),stateSelector:"a[href]"}),e.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),e.addShortcut("Ctrl+K","",t(n)),this.showDialog=n,e.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Ctrl+K",onclick:t(n),stateSelector:"a[href]",context:"insert",prependToContext:!0})});
tinymce.PluginManager.add("link",function(e){function t(t){return function(){var n=e.settings.link_list;"string"==typeof n?tinymce.util.XHR.send({url:n,success:function(e){t(tinymce.util.JSON.parse(e))}}):t(n)}}function n(t){function n(e){var t=f.find("#text");(!t.value()||e.lastControl&&t.value()==e.lastControl.text())&&t.value(e.control.text()),f.find("#href").value(e.control.value())}function l(){var n=[{text:"None",value:""}];return tinymce.each(t,function(t){n.push({text:t.text||t.title,value:e.convertURL(t.value||t.url,"href"),menu:t.menu})}),n}function i(t,n,l){var i,a=[];return tinymce.each(e.settings[t]||l,function(e){var t={text:e.text||e.title,value:e.value};a.push(t),(p[n]===e.value||!i&&e.selected)&&(i=t)}),i&&!p[n]&&(p[n]=i.value,i.selected=!0),a}function a(t){var l=[];return tinymce.each(e.dom.select("a:not([href])"),function(e){var n=e.name||e.id;n&&l.push({text:n,value:"#"+n,selected:-1!=t.indexOf("#"+n)})}),l.length?(l.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:l,onselect:n}):void 0}function r(){v&&v.value(e.convertURL(this.value(),"href")),!c&&0===p.text.length&&d&&this.parent().parent().find("#text")[0].value(this.value())}function o(e){var t=k.getContent();if(/</.test(t)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(t)||-1==t.indexOf("href=")))return!1;if(e){var n,l=e.childNodes;if(0===l.length)return!1;for(n=l.length-1;n>=0;n--)if(3!=l[n].nodeType)return!1}return!0}var s,u,c,f,d,h,v,x,g,m,p={},k=e.selection,y=e.dom;s=k.getNode(),u=y.getParent(s,"a[href]"),d=o(),p.text=c=u?u.innerText||u.textContent:k.getContent({format:"text"}),p.href=u?y.getAttrib(u,"href"):"",p.target=u?y.getAttrib(u,"target"):e.settings.default_link_target||null,p.rel=u?y.getAttrib(u,"rel"):null,p["class"]=u?y.getAttrib(u,"class"):null,d&&(h={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){p.text=this.value()}}),t&&(v={type:"listbox",label:"Link list",values:l(),onselect:n,value:e.convertURL(p.href,"href"),onPostRender:function(){v=this}}),e.settings.target_list!==!1&&(g={name:"target",type:"listbox",label:"Target",values:i("target_list","target",[{text:"None",value:""},{text:"New window",value:"_blank"}])}),e.settings.rel_list&&(x={name:"rel",type:"listbox",label:"Rel",values:i("rel_list","rel",[{text:"None",value:""}])}),e.settings.link_class_list&&(m={name:"class",type:"listbox",label:"Class",values:i("link_class_list","class")}),f=e.windowManager.open({title:"Insert link",data:p,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:r,onkeyup:r},h,a(p.href),v,x,g,m],onSubmit:function(t){function n(t,n){var l=e.selection.getRng();window.setTimeout(function(){e.windowManager.confirm(t,function(t){e.selection.setRng(l),n(t)})},0)}function l(){u?(e.focus(),d&&p.text!=c&&(u.innerText=p.text),y.setAttribs(u,{href:i,target:p.target?p.target:null,rel:p.rel?p.rel:null,"class":p["class"]?p["class"]:null}),k.select(u),e.undoManager.add()):d?e.insertContent(y.createHTML("a",{href:i,target:p.target?p.target:null,rel:p.rel?p.rel:null,"class":p["class"]?p["class"]:null},y.encode(p.text))):e.execCommand("mceInsertLink",!1,{href:i,target:p.target,rel:p.rel?p.rel:null})}var i;return p=tinymce.extend(p,t.data),(i=p.href)?i.indexOf("@")>0&&-1==i.indexOf("//")&&-1==i.indexOf("mailto:")?void n("The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(e){e&&(i="mailto:"+i),l()}):/^\s*www\./i.test(i)?void n("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(e){e&&(i="http://"+i),l()}):void l():void e.execCommand("unlink")}})}e.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Ctrl+K",onclick:t(n),stateSelector:"a[href]"}),e.addButton("unlink",{icon:"unlink",tooltip:"Remove link",cmd:"unlink",stateSelector:"a[href]"}),e.addShortcut("Ctrl+K","",t(n)),this.showDialog=n,e.addMenuItem("link",{icon:"link",text:"Insert link",shortcut:"Ctrl+K",onclick:t(n),stateSelector:"a[href]",context:"insert",prependToContext:!0})});

View File

@ -112,9 +112,9 @@ tinymce.PluginManager.add('media', function(editor, url) {
align: 'center',
spacing: 5,
items: [
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
{name: 'width', type: 'textbox', maxLength: 5, size: 3, ariaLabel: 'Width', onchange: recalcSize},
{type: 'label', text: 'x'},
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
{name: 'height', type: 'textbox', maxLength: 5, size: 3, ariaLabel: 'Height', onchange: recalcSize},
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
]
}
@ -135,9 +135,11 @@ tinymce.PluginManager.add('media', function(editor, url) {
items: [
{
type: 'label',
text: 'Paste your embed code below:'
text: 'Paste your embed code below:',
forId: 'mcemediasource'
},
{
id: 'mcemediasource',
type: 'textbox',
flex: 1,
name: 'embed',
@ -641,7 +643,7 @@ tinymce.PluginManager.add('media', function(editor, url) {
editor.addButton('media', {
tooltip: 'Insert/edit video',
onclick: showDialog,
stateSelector: 'img[data-mce-object=video]'
stateSelector: ['img[data-mce-object=video]', 'img[data-mce-object=iframe]']
});
editor.addMenuItem('media', {

File diff suppressed because one or more lines are too long

View File

@ -197,8 +197,10 @@ define("tinymce/pasteplugin/Utils", [
* This class contains logic for getting HTML contents out of the clipboard.
*
* We need to make a lot of ugly hacks to get the contents out of the clipboard since
* the W3C Clipboard API is broken in all browsers: Gecko/WebKit/Blink. We might rewrite
* this the way those API:s stabilize.
* the W3C Clipboard API is broken in all browsers that have it: Gecko/WebKit/Blink.
* We might rewrite this the way those API:s stabilize. Browsers doesn't handle pasting
* from applications like Word the same way as it does when pasting into a contentEditable area
* so we need to do lots of extra work to try to get to this clipboard data.
*
* Current implementation steps:
* 1. On keydown with paste keys Ctrl+V or Shift+Insert create
@ -290,17 +292,19 @@ define("tinymce/pasteplugin/Clipboard", [
}
/**
* Creates a paste bin element and moves the selection into that element. It will also move the element offscreen
* so that resize handles doesn't get produced on IE or Drag handles or Firefox.
* Creates a paste bin element as close as possible to the current caret location and places the focus inside that element
* so that when the real paste event occurs the contents gets inserted into this element
* instead of the current editor selection element.
*/
function createPasteBin() {
var dom = editor.dom, body = editor.getBody();
var viewport = editor.dom.getViewPort(editor.getWin()), scrollTop = viewport.y, top = 20;
var scrollContainer;
lastRng = editor.selection.getRng();
if (editor.inline) {
var scrollContainer = editor.selection.getScrollContainer();
scrollContainer = editor.selection.getScrollContainer();
if (scrollContainer) {
scrollTop = scrollContainer.scrollTop;
@ -311,8 +315,25 @@ define("tinymce/pasteplugin/Clipboard", [
// We want the paste bin to be as close to the caret as possible to avoid scrolling
if (lastRng.getClientRects) {
var rects = lastRng.getClientRects();
if (rects.length) {
// Client rects gets us closes to the actual
// caret location in for example a wrapped paragraph block
top = scrollTop + (rects[0].top - dom.getPos(body).y);
} else {
top = scrollTop;
// Check if we can find a closer location by checking the range element
var container = lastRng.startContainer;
if (container) {
if (container.nodeType == 3 && container.parentNode != body) {
container = container.parentNode;
}
if (container.nodeType == 1) {
top = dom.getPos(container, scrollContainer || body).y;
}
}
}
}
@ -401,7 +422,11 @@ define("tinymce/pasteplugin/Clipboard", [
var data = {};
if (dataTransfer && dataTransfer.types) {
data['text/plain'] = dataTransfer.getData('Text');
// Use old WebKit API
var legacyText = dataTransfer.getData('Text');
if (legacyText && legacyText.length > 0) {
data['text/plain'] = legacyText;
}
for (var i = 0; i < dataTransfer.types.length; i++) {
var contentType = dataTransfer.types[i];
@ -423,16 +448,58 @@ define("tinymce/pasteplugin/Clipboard", [
return getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
}
/**
* Checks if the clipboard contains image data if it does it will take that data
* and convert it into a data url image and paste that image at the caret location.
*
* @param {ClipboardEvent} e Paste event object.
* @param {Object} clipboardContent Collection of clipboard contents.
* @return {Boolean} true/false if the image data was found or not.
*/
function pasteImageData(e, clipboardContent) {
function pasteImage(item) {
if (items[i].type == 'image/png') {
var reader = new FileReader();
reader.onload = function() {
pasteHtml('<img src="' + reader.result + '">');
};
reader.readAsDataURL(item.getAsFile());
return true;
}
}
// If paste data images are disabled or there is HTML or plain text
// contents then proceed with the normal paste process
if (!editor.settings.paste_data_images || "text/html" in clipboardContent || "text/plain" in clipboardContent) {
return;
}
if (e.clipboardData) {
var items = e.clipboardData.items;
if (items) {
for (var i = 0; i < items.length; i++) {
if (pasteImage(items[i])) {
return true;
}
}
}
}
}
function getCaretRangeFromEvent(e) {
var doc = editor.getDoc(), rng;
if (doc.caretPositionFromPoint) {
var point = doc.caretPositionFromPoint(e.pageX, e.pageY);
var point = doc.caretPositionFromPoint(e.clientX, e.clientY);
rng = doc.createRange();
rng.setStart(point.offsetNode, point.offset);
rng.collapse(true);
} else if (doc.caretRangeFromPoint) {
rng = doc.caretRangeFromPoint(e.pageX, e.pageY);
rng = doc.caretRangeFromPoint(e.clientX, e.clientY);
}
return rng;
@ -476,6 +543,11 @@ define("tinymce/pasteplugin/Clipboard", [
return;
}
if (pasteImageData(e, clipboardContent)) {
removePasteBin();
return;
}
// Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs
if (!isKeyBoardPaste) {
e.preventDefault();
@ -815,7 +887,7 @@ define("tinymce/pasteplugin/WordFilter", [
var validElements = settings.paste_word_valid_elements;
if (!validElements) {
validElements = '@[style],-strong/b,-em/i,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' +
'-table,-tr,-td[colspan|rowspan],-th,-thead,-tfoot,-tbody,-a[href|name],sub,sup,strike,br';
'-table[width],-tr,-td[colspan|rowspan|width],-th,-thead,-tfoot,-tbody,-a[href|name],sub,sup,strike,br';
}
// Setup strict schema
@ -928,9 +1000,9 @@ define("tinymce/pasteplugin/Quirks", [
*/
function removeWebKitFragments(html) {
html = Utils.filter(html, [
/^[\s\S]*<!--StartFragment-->|<!--EndFragment-->[\s\S]*$/g, // WebKit fragment
/^[\s\S]*<!--StartFragment-->|<!--EndFragment-->[\s\S]*$/g, // WebKit fragment
[/<span class="Apple-converted-space">\u00a0<\/span>/g, '\u00a0'], // WebKit &nbsp;
/<br>$/ // Traling BR elements
/<br>$/ // Traling BR elements
]);
return html;

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,7 @@ tinymce.PluginManager.add('textcolor', function(editor) {
colors = mapColors();
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="presentation" cellspacing="0"><tbody>';
html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
last = colors.length - 1;
rows = editor.settings.textcolor_rows || 5;
cols = editor.settings.textcolor_cols || 8;
@ -113,6 +113,13 @@ tinymce.PluginManager.add('textcolor', function(editor) {
var buttonCtrl = this.parent(), value;
if ((value = e.target.getAttribute('data-mce-color'))) {
if (this.lastId) {
document.getElementById(this.lastId).setAttribute('aria-selected', false);
}
e.target.setAttribute('aria-selected', true);
this.lastId = e.target.id;
buttonCtrl.hidePanel();
value = '#' + value;
buttonCtrl.color(value);
@ -133,6 +140,8 @@ tinymce.PluginManager.add('textcolor', function(editor) {
tooltip: 'Text color',
selectcmd: 'ForeColor',
panel: {
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},
@ -144,6 +153,8 @@ tinymce.PluginManager.add('textcolor', function(editor) {
tooltip: 'Background color',
selectcmd: 'HiliteColor',
panel: {
role: 'application',
ariaRemember: true,
html: renderColorPicker,
onclick: onPanelClick
},

View File

@ -1 +1 @@
tinymce.PluginManager.add("textcolor",function(e){function o(){var o,t,r=[];for(t=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"],o=0;o<t.length;o+=2)r.push({text:t[o+1],color:t[o]});return r}function t(){var t,r,l,c,n,a,F,i,d,u=this;for(t=o(),l='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="presentation" cellspacing="0"><tbody>',c=t.length-1,n=e.settings.textcolor_rows||5,a=e.settings.textcolor_cols||8,i=0;n>i;i++){for(l+="<tr>",F=0;a>F;F++)d=i*a+F,d>c?l+="<td></td>":(r=t[d],l+='<td><div id="'+u._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(o){var t,r=this.parent();(t=o.target.getAttribute("data-mce-color"))&&(r.hidePanel(),t="#"+t,r.color(t),e.execCommand(r.settings.selectcmd,!1,t))}function l(){var o=this;o._color&&e.execCommand(o.settings.selectcmd,!1,o._color)}e.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",selectcmd:"ForeColor",panel:{html:t,onclick:r},onclick:l}),e.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",selectcmd:"HiliteColor",panel:{html:t,onclick:r},onclick:l})});
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})});

View File

@ -1 +1 @@
.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}
.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0px}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}

View File

@ -1 +1 @@
body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}
body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0px}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -160,6 +160,7 @@ img::selection {
#wp-image-toolbar .wrapper {
position: relative;
height: 33px;
background-color: #333; /* old IE */
background-color: rgba(0,0,0,0.3);
}

View File

@ -276,7 +276,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
var item = panel.find(type)[0];
if (item) {
item.focus();
item.focus(true);
}
}
@ -391,6 +391,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
// Render a plain panel inside the inlineToolbarContainer if it's defined
panel = self.panel = Factory.create({
type: inlineToolbarContainer ? 'panel' : 'floatpanel',
role: 'application',
classes: 'tinymce tinymce-inline',
layout: 'flex',
direction: 'column',
@ -402,7 +403,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
items: [
settings.menubar === false ? null : {type: 'menubar', border: '0 0 1 0', items: createMenuButtons()},
settings.toolbar === false ? null : {
type: 'panel', layout: 'stack', classes: "toolbar-grp", items: createToolbars()
type: 'panel', layout: 'stack', classes: "toolbar-grp", ariaRoot: true, ariaRemember: true, items: createToolbars()
}
]
});
@ -472,13 +473,16 @@ tinymce.ThemeManager.add('modern', function(editor) {
// Basic UI layout
panel = self.panel = Factory.create({
type: 'panel',
role: 'application',
classes: 'tinymce',
style: 'visibility: hidden',
layout: 'stack',
border: 1,
items: [
settings.menubar === false ? null : {type: 'menubar', border: '0 0 1 0', items: createMenuButtons()},
settings.toolbar === false ? null : {type: 'panel', layout: 'stack', classes: "toolbar-grp", items: createToolbars()},
settings.toolbar === false ? null : {
type: 'panel', layout: 'stack', classes: "toolbar-grp", ariaRoot: true, ariaRemember: true, items: createToolbars()
},
{type: 'panel', name: 'iframe', layout: 'stack', classes: 'edit-area', html: '', border: '1 0 0 0'}
]
});
@ -509,7 +513,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
// Add statusbar if needed
if (settings.statusbar !== false) {
panel.add({type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', items: [
panel.add({type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', ariaRoot: true, items: [
{type: 'elementpath'},
resizeHandleCtrl
]});

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@ var tinyMCEPopup = {
proxy: tinyMCEPopup._eventProxy
});
self.dom.bind(window, 'load', self._onDOMLoaded, self);
self.dom.bind(window, 'ready', self._onDOMLoaded, self);
// Enables you to skip loading the default css
if (self.features.popup_css !== false) {
@ -329,8 +329,9 @@ var tinyMCEPopup = {
_restoreSelection : function() {
var e = window.event.srcElement;
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) {
tinyMCEPopup.restoreSelection();
}
},
/* _restoreSelection : function() {
@ -386,11 +387,11 @@ var tinyMCEPopup = {
// Restore selection in IE when focus is placed on a non textarea or input element of the type text
if (tinymce.Env.ie) {
if ( tinymce.Env.ie < 11 ) {
if (tinymce.Env.ie < 11) {
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
// Add base target element for it since it would fail with modal dialogs
t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'});
t.dom.add(t.dom.select('head')[0], 'base', {target: '_self'});
} else {
document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false);
}
@ -440,7 +441,7 @@ var tinyMCEPopup = {
document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
if ( 'textContent' in document ) {
if ('textContent' in document) {
t.uiWindow.getEl('head').firstChild.textContent = document.title;
} else {
t.uiWindow.getEl('head').firstChild.innerText = document.title;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ $wp_db_version = 26691;
*
* @global string $tinymce_version
*/
$tinymce_version = '4016-20140302';
$tinymce_version = '4018-20140303';
/**
* Holds the required PHP version