TinyMCE: update to 4.0.18, see #24067
git-svn-id: https://develop.svn.wordpress.org/trunk@27387 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4c10cb2ec5
commit
e5bed6707f
|
@ -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)) : ' ') + '</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
|
@ -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);
|
||||
|
|
|
@ -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
|
@ -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
|
||||
});
|
||||
});
|
||||
|
||||
return relListItems;
|
||||
}
|
||||
|
||||
function buildTargetList(targetValue) {
|
||||
var targetListItems = [];
|
||||
|
||||
if (!editor.settings.target_list) {
|
||||
targetListItems.push({text: 'None', value: ''});
|
||||
targetListItems.push({text: 'New window', value: '_blank'});
|
||||
}
|
||||
|
||||
tinymce.each(editor.settings.target_list, function(target) {
|
||||
targetListItems.push({
|
||||
tinymce.each(editor.settings[listSettingName] || defaultItems, function(target) {
|
||||
var item = {
|
||||
text: target.text || target.title,
|
||||
value: target.value,
|
||||
selected: targetValue === target.value
|
||||
});
|
||||
value: target.value
|
||||
};
|
||||
|
||||
items.push(item);
|
||||
|
||||
if (data[dataItemName] === target.value || (!selectedItem && target.selected)) {
|
||||
selectedItem = item;
|
||||
}
|
||||
});
|
||||
|
||||
return targetListItems;
|
||||
if (selectedItem && !data[dataItemName]) {
|
||||
data[dataItemName] = selectedItem.value;
|
||||
selectedItem.selected = true;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
var onlyText = true;
|
||||
if (/</.test(selection.getContent())) {
|
||||
onlyText = false;
|
||||
} else if (anchorElm) {
|
||||
// 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) {
|
||||
onlyText = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
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, {
|
||||
|
|
|
@ -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})});
|
|
@ -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
|
@ -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
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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
|
||||
},
|
||||
|
|
|
@ -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})});
|
|
@ -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}
|
|
@ -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
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
@ -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
|
@ -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
|
||||
|
|
|
@ -198,7 +198,7 @@ define("tinymce/tableplugin/TableGrid", [
|
|||
|
||||
each(table.rows, function(row) {
|
||||
each(row.cells, function(cell) {
|
||||
if (dom.hasClass(cell, 'mce-item-selected') || cell == selectedCell.elm) {
|
||||
if (dom.hasClass(cell, 'mce-item-selected') || (selectedCell && cell == selectedCell.elm)) {
|
||||
rows.push(row);
|
||||
return false;
|
||||
}
|
||||
|
@ -303,6 +303,8 @@ define("tinymce/tableplugin/TableGrid", [
|
|||
// Restore selection to start position if it still exists
|
||||
buildGrid();
|
||||
|
||||
// If we have a valid startPos object
|
||||
if (startPos) {
|
||||
// Restore the selection to the closest table position
|
||||
row = grid[Math.min(grid.length - 1, startPos.y)];
|
||||
if (row) {
|
||||
|
@ -310,6 +312,7 @@ define("tinymce/tableplugin/TableGrid", [
|
|||
selection.collapse(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fillLeftDown(x, y, rows, cols) {
|
||||
var tr, x2, r, c, cell;
|
||||
|
@ -395,12 +398,14 @@ define("tinymce/tableplugin/TableGrid", [
|
|||
});
|
||||
});
|
||||
|
||||
// Use selection
|
||||
// Use selection, but make sure startPos is valid before accessing
|
||||
if (startPos) {
|
||||
startX = startPos.x;
|
||||
startY = startPos.y;
|
||||
endX = endPos.x;
|
||||
endY = endPos.y;
|
||||
}
|
||||
}
|
||||
|
||||
// Find start/end cells
|
||||
startCell = getCell(startX, startY);
|
||||
|
@ -478,6 +483,11 @@ define("tinymce/tableplugin/TableGrid", [
|
|||
}
|
||||
});
|
||||
|
||||
// If posY is undefined there is nothing for us to do here...just return to avoid crashing below
|
||||
if (posY === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (x = 0; x < grid[0].length; x++) {
|
||||
// Cell not found could be because of an invalid table structure
|
||||
if (!grid[posY][x]) {
|
||||
|
@ -1622,6 +1632,11 @@ define("tinymce/tableplugin/Plugin", [
|
|||
|
||||
cellElm = cellElm || cells[0];
|
||||
|
||||
if (!cellElm) {
|
||||
// If this element is null, return now to avoid crashing.
|
||||
return;
|
||||
}
|
||||
|
||||
data = {
|
||||
width: removePxSuffix(dom.getStyle(cellElm, 'width') || dom.getAttrib(cellElm, 'width')),
|
||||
height: removePxSuffix(dom.getStyle(cellElm, 'height') || dom.getAttrib(cellElm, 'height')),
|
||||
|
@ -1740,6 +1755,10 @@ define("tinymce/tableplugin/Plugin", [
|
|||
});
|
||||
|
||||
rowElm = rows[0];
|
||||
if (!rowElm) {
|
||||
// If this element is null, return now to avoid crashing.
|
||||
return;
|
||||
}
|
||||
|
||||
data = {
|
||||
height: removePxSuffix(dom.getStyle(rowElm, 'height') || dom.getAttrib(rowElm, 'height')),
|
||||
|
@ -1895,13 +1914,15 @@ define("tinymce/tableplugin/Plugin", [
|
|||
function generateTableGrid() {
|
||||
var html = '';
|
||||
|
||||
html = '<table role="presentation" class="mce-grid mce-grid-border">';
|
||||
html = '<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';
|
||||
|
||||
for (var y = 0; y < 10; y++) {
|
||||
html += '<tr>';
|
||||
|
||||
for (var x = 0; x < 10; x++) {
|
||||
html += '<td><a href="#" data-mce-index="' + x + ',' + y + '"></a></td>';
|
||||
html += '<td role="gridcell" tabindex="-1"><a id="mcegrid' + (y * 10 + x) + '" href="#" ' +
|
||||
'data-mce-x="' + x + '" data-mce-y="' + y + '" ' +
|
||||
'' + (x + y === 0 ? ' class="mce-active"' : '') + '></a></td>';
|
||||
}
|
||||
|
||||
html += '</tr>';
|
||||
|
@ -1909,77 +1930,145 @@ define("tinymce/tableplugin/Plugin", [
|
|||
|
||||
html += '</table>';
|
||||
|
||||
html += '<div class="mce-text-center">0 x 0</div>';
|
||||
html += '<div class="mce-text-center" role="presentation">1 x 1</div>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function selectGrid(tx, ty, control) {
|
||||
var table = control.getEl().getElementsByTagName('table')[0];
|
||||
var rel = control.parent().rel, x, y, focusCell, cell;
|
||||
|
||||
if (control.isRtl() || rel == 'tl-tr') {
|
||||
for (y = 9; y >= 0; y--) {
|
||||
for (x = 0; x < 10; x++) {
|
||||
cell = table.rows[y].childNodes[x].firstChild;
|
||||
|
||||
editor.dom.toggleClass(
|
||||
cell,
|
||||
'mce-active',
|
||||
x >= tx && y <= ty
|
||||
);
|
||||
|
||||
if (x >= tx && y <= ty) {
|
||||
focusCell = cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tx = 9 - tx;
|
||||
table.nextSibling.innerHTML = tx + ' x '+ (ty + 1);
|
||||
} else {
|
||||
for (y = 0; y < 10; y++) {
|
||||
for (x = 0; x < 10; x++) {
|
||||
cell = table.rows[y].childNodes[x].firstChild;
|
||||
|
||||
editor.dom.toggleClass(
|
||||
cell,
|
||||
'mce-active',
|
||||
x <= tx && y <= ty
|
||||
);
|
||||
|
||||
if (x <= tx && y <= ty) {
|
||||
focusCell = cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
table.nextSibling.innerHTML = (tx + 1) + ' x '+ (ty + 1);
|
||||
}
|
||||
|
||||
return focusCell.parentNode;
|
||||
}
|
||||
|
||||
editor.addMenuItem('inserttable', {
|
||||
text: 'Insert table',
|
||||
icon: 'table',
|
||||
context: 'table',
|
||||
onhide: function() {
|
||||
editor.dom.removeClass(this.menu.items()[0].getEl().getElementsByTagName('a'), 'mce-active');
|
||||
var elements = this.menu.items()[0].getEl().getElementsByTagName('a');
|
||||
editor.dom.removeClass(elements, 'mce-active');
|
||||
editor.dom.addClass(elements[0], 'mce-active');
|
||||
},
|
||||
menu: [
|
||||
{
|
||||
type: 'container',
|
||||
html: generateTableGrid(),
|
||||
|
||||
onPostRender: function() {
|
||||
this.lastX = this.lastY = 0;
|
||||
},
|
||||
|
||||
onmousemove: function(e) {
|
||||
var x, y, target = e.target;
|
||||
var target = e.target, x, y;
|
||||
|
||||
if (target.nodeName == 'A') {
|
||||
var table = editor.dom.getParent(target, 'table');
|
||||
var pos = target.getAttribute('data-mce-index');
|
||||
var rel = e.control.parent().rel;
|
||||
x = parseInt(target.getAttribute('data-mce-x'), 10);
|
||||
y = parseInt(target.getAttribute('data-mce-y'), 10);
|
||||
|
||||
if (pos != this.lastPos) {
|
||||
pos = pos.split(',');
|
||||
if (x !== this.lastX || y !== this.lastY) {
|
||||
selectGrid(x, y, e.control);
|
||||
|
||||
pos[0] = parseInt(pos[0], 10);
|
||||
pos[1] = parseInt(pos[1], 10);
|
||||
|
||||
if (e.control.isRtl() || rel == 'tl-tr') {
|
||||
for (y = 9; y >= 0; y--) {
|
||||
for (x = 0; x < 10; x++) {
|
||||
editor.dom.toggleClass(
|
||||
table.rows[y].childNodes[x].firstChild,
|
||||
'mce-active',
|
||||
x >= pos[0] && y <= pos[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pos[0] = 9 - pos[0];
|
||||
table.nextSibling.innerHTML = pos[0] + ' x '+ (pos[1] + 1);
|
||||
} else {
|
||||
for (y = 0; y < 10; y++) {
|
||||
for (x = 0; x < 10; x++) {
|
||||
editor.dom.toggleClass(
|
||||
table.rows[y].childNodes[x].firstChild,
|
||||
'mce-active',
|
||||
x <= pos[0] && y <= pos[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
table.nextSibling.innerHTML = (pos[0] + 1) + ' x '+ (pos[1] + 1);
|
||||
}
|
||||
|
||||
this.lastPos = pos;
|
||||
this.lastX = x;
|
||||
this.lastY = y;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onclick: function(e) {
|
||||
if (e.target.nodeName == 'A' && this.lastPos) {
|
||||
onkeydown: function(e) {
|
||||
var x = this.lastX, y = this.lastY, isHandled;
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 37: // DOM_VK_LEFT
|
||||
if (x > 0) {
|
||||
x--;
|
||||
isHandled = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 39: // DOM_VK_RIGHT
|
||||
isHandled = true;
|
||||
|
||||
if (x < 9) {
|
||||
x++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 38: // DOM_VK_UP
|
||||
isHandled = true;
|
||||
|
||||
if (y > 0) {
|
||||
y--;
|
||||
}
|
||||
break;
|
||||
|
||||
case 40: // DOM_VK_DOWN
|
||||
isHandled = true;
|
||||
|
||||
if (y < 9) {
|
||||
y++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (isHandled) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
insertTable(this.lastPos[0] + 1, this.lastPos[1] + 1);
|
||||
selectGrid(x, y, e.control).focus();
|
||||
|
||||
// TODO: Maybe rework this?
|
||||
this.parent().cancel(); // Close parent menu as if it was a click
|
||||
this.lastX = x;
|
||||
this.lastY = y;
|
||||
}
|
||||
},
|
||||
|
||||
onclick: function(e) {
|
||||
if (e.target.nodeName == 'A') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.parent().cancel();
|
||||
|
||||
insertTable(this.lastX + 1, this.lastY + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -55,7 +55,7 @@ test("Does not count asterisks, non-word characters", function() {
|
|||
test("Does not count htmlentities", function() {
|
||||
expect(1);
|
||||
|
||||
editor.setContent('<p>It’s my life – don\'t you forget.</p>');
|
||||
editor.setContent('<p>It’s my life – – – don\'t you forget.</p>');
|
||||
var result = editor.plugins.wordcount.getCount();
|
||||
equal(result, 6);
|
||||
});
|
||||
|
|
|
@ -715,7 +715,7 @@ test('indent/outdent', function() {
|
|||
test('RemoveFormat', function() {
|
||||
var t = this;
|
||||
|
||||
expect(3);
|
||||
expect(4);
|
||||
|
||||
editor.setContent('<p><em>test</em> <strong>123</strong> <a href="123">123</a> 123</p>');
|
||||
editor.execCommand('SelectAll');
|
||||
|
@ -731,6 +731,11 @@ test('RemoveFormat', function() {
|
|||
editor.selection.select(editor.dom.get('x'));
|
||||
editor.execCommand('RemoveFormat');
|
||||
equal(editor.getContent(), '<p><em>test</em><span id="x">test 123</span><em><a href="123">123</a> 123</em></p>');
|
||||
|
||||
editor.setContent('<p><dfn>dfn tag </dfn> <code>code tag </code> <samp>samp tag</samp> <kbd> kbd tag</kbd> <var> var tag</var> <cite> cite tag</cite> <mark> mark tag</mark> <q> q tag</q></p>');
|
||||
editor.execCommand('SelectAll');
|
||||
editor.execCommand('RemoveFormat');
|
||||
equal(editor.getContent(), '<p>dfn tag code tag samp tag kbd tag var tag cite tag mark tag q tag</p>');
|
||||
});
|
||||
|
||||
tinymce.init({
|
||||
|
|
|
@ -951,6 +951,14 @@ test('Caret format inside single inline wrapped word', function() {
|
|||
equal(editor.getContent(), '<p>abc <b><em>123</em></b> 456</p>');
|
||||
});
|
||||
|
||||
test('Caret format inside word before similar format', function() {
|
||||
editor.setContent('<p>abc 123 <b>456</b></p>');
|
||||
editor.formatter.register('format', {inline: 'b'});
|
||||
setSelection('p', 1, 'p', 1);
|
||||
editor.formatter.apply('format');
|
||||
equal(editor.getContent(), '<p><b>abc</b> 123 <b>456</b></p>');
|
||||
});
|
||||
|
||||
test('Caret format inside last inline wrapped word', function() {
|
||||
editor.setContent('<p>abc <em>abc 123</em> 456</p>');
|
||||
editor.formatter.register('format', {inline: 'b'});
|
||||
|
@ -1112,6 +1120,20 @@ test('Align specified table element with collapsed: false and selection collapse
|
|||
equal(getContent(), '<table style="float: right;"><tbody><tr><td>a</td></tr></tbody></table>');
|
||||
});
|
||||
|
||||
test('Apply ID format to around existing bookmark node', function() {
|
||||
editor.getBody().innerHTML = '<p>a<span id="b" data-mce-type="bookmark"></span>b</p>';
|
||||
|
||||
rng = editor.dom.createRng();
|
||||
rng.setStart(editor.dom.select('p')[0].firstChild, 0);
|
||||
rng.setEnd(editor.dom.select('p')[0].lastChild, 1);
|
||||
editor.selection.setRng(rng);
|
||||
|
||||
editor.formatter.register('format', {inline: 'span', attributes: {id: 'id'}});
|
||||
editor.formatter.apply('format');
|
||||
|
||||
equal(normalizeHtml(editor.getBody().innerHTML), '<p><span id="id">a<span data-mce-type="bookmark" id="b"></span>b</span></p>');
|
||||
});
|
||||
|
||||
test('Bug #5134 - TinyMCE removes formatting tags in the getContent', function() {
|
||||
editor.setContent('');
|
||||
editor.formatter.register('format', {inline : 'strong', toggle: false});
|
||||
|
@ -1159,13 +1181,16 @@ test('Bug #6518 - Apply div blocks to inline editor paragraph', function() {
|
|||
equal(inlineEditor.getContent(), '<div>a</div><p>b</p>');
|
||||
});
|
||||
|
||||
// WP
|
||||
var url = document.location.href.substring( 0, document.location.href.lastIndexOf('tinymce/') );
|
||||
|
||||
tinymce.init({
|
||||
selector: "#elm1",
|
||||
// WP
|
||||
external_plugins: {
|
||||
noneditable: url + 'external-plugins/noneditable/plugin.js'
|
||||
},
|
||||
// WP end
|
||||
add_unload_trigger: false,
|
||||
indent: false,
|
||||
theme_advanced_styles: 'test1=test1;test2=test2',
|
||||
|
@ -1189,9 +1214,11 @@ tinymce.init({
|
|||
tinymce.init({
|
||||
selector: "#elm2",
|
||||
inline: true,
|
||||
// WP
|
||||
external_plugins: {
|
||||
noneditable: url + 'external-plugins/noneditable/plugin.js'
|
||||
},
|
||||
// WP end
|
||||
add_unload_trigger: false,
|
||||
indent: false,
|
||||
theme_advanced_styles: 'test1=test1;test2=test2',
|
||||
|
|
|
@ -227,14 +227,17 @@ tinymce.init({
|
|||
}
|
||||
});
|
||||
|
||||
// WP
|
||||
var url = document.location.href.substring( 0, document.location.href.lastIndexOf('tinymce/') );
|
||||
|
||||
tinymce.init({
|
||||
selector: "#elm2",
|
||||
inline: true,
|
||||
// WP
|
||||
external_plugins: {
|
||||
noneditable: url + 'external-plugins/noneditable/plugin.js'
|
||||
},
|
||||
// WP end
|
||||
add_unload_trigger: false,
|
||||
indent: false,
|
||||
theme_advanced_styles: 'test1=test1;test2=test2',
|
||||
|
|
|
@ -360,14 +360,17 @@ test('Remove format bug 1', function() {
|
|||
});
|
||||
*/
|
||||
|
||||
// WP
|
||||
var url = document.location.href.substring( 0, document.location.href.lastIndexOf('tinymce/') );
|
||||
|
||||
tinymce.init({
|
||||
mode : "exact",
|
||||
elements : "elm1",
|
||||
// WP
|
||||
external_plugins: {
|
||||
noneditable: url + 'external-plugins/noneditable/plugin.js'
|
||||
},
|
||||
// WP end
|
||||
indent : false,
|
||||
add_unload_trigger : false,
|
||||
theme_advanced_styles : 'test1=test1;test2=test2',
|
||||
|
|
|
@ -159,8 +159,13 @@ test('Undo added when typing and losing focus', function() {
|
|||
editor.setContent("<p>some text</p>");
|
||||
setSelection('p', 4, 'p', 9);
|
||||
type('\b');
|
||||
window.focus();
|
||||
editor.dom.fire(editor.getBody(), 'focusout');
|
||||
|
||||
// Move focus to an input element
|
||||
var input = document.createElement('input');
|
||||
document.body.appendChild(input);
|
||||
input.focus();
|
||||
input.parentNode.removeChild(input);
|
||||
|
||||
editor.execCommand('FormatBlock', false, 'h1');
|
||||
editor.undoManager.undo();
|
||||
equal(editor.getContent(), "<p>some</p>");
|
||||
|
|
|
@ -803,6 +803,76 @@ if (!tinymce.isIE) {
|
|||
equal(rng.endContainer.nodeName, '#text');
|
||||
equal(rng.endOffset, 1);
|
||||
});
|
||||
|
||||
test('normalize caret after trailing BR', function() {
|
||||
var rng;
|
||||
|
||||
editor.setContent('<p>a<br /></p>');
|
||||
rng = editor.dom.createRng();
|
||||
rng.setStart(editor.getBody().firstChild, 2);
|
||||
rng.setEnd(editor.getBody().firstChild, 2);
|
||||
editor.selection.setRng(rng);
|
||||
editor.selection.normalize();
|
||||
|
||||
rng = editor.selection.getRng(true);
|
||||
equal(rng.startContainer.nodeName, '#text', 'startContainer node name');
|
||||
equal(rng.startOffset, 1, 'startContainer offset');
|
||||
equal(rng.endContainer.nodeName, '#text', 'endContainer node name');
|
||||
equal(rng.endOffset, 1, 'endOffset offset');
|
||||
});
|
||||
|
||||
test('normalize caret after bogus block BR', function() {
|
||||
var rng;
|
||||
|
||||
editor.setContent('<p><br /></p>');
|
||||
rng = editor.dom.createRng();
|
||||
rng.setStart(editor.getBody().firstChild, 1);
|
||||
rng.setEnd(editor.getBody().firstChild, 1);
|
||||
editor.selection.setRng(rng);
|
||||
editor.selection.normalize();
|
||||
|
||||
rng = editor.selection.getRng(true);
|
||||
equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
|
||||
equal(rng.startOffset, 0, 'startContainer offset');
|
||||
equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
|
||||
equal(rng.endOffset, 0, 'endOffset offset');
|
||||
});
|
||||
|
||||
/*
|
||||
test('normalize caret after last BR in block', function() {
|
||||
var rng;
|
||||
|
||||
editor.setContent('<p><br /><br /></p>');
|
||||
rng = editor.dom.createRng();
|
||||
rng.setStart(editor.getBody().firstChild, 2);
|
||||
rng.setEnd(editor.getBody().firstChild, 2);
|
||||
editor.selection.setRng(rng);
|
||||
editor.selection.normalize();
|
||||
|
||||
rng = editor.selection.getRng(true);
|
||||
equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
|
||||
equal(rng.startOffset, 1, 'startContainer offset');
|
||||
equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
|
||||
equal(rng.endOffset, 1, 'endOffset offset');
|
||||
});
|
||||
*/
|
||||
|
||||
test('normalize caret after double BR', function() {
|
||||
var rng;
|
||||
|
||||
editor.setContent('<p>a<br /><br /></p>');
|
||||
rng = editor.dom.createRng();
|
||||
rng.setStart(editor.getBody().firstChild, 3);
|
||||
rng.setEnd(editor.getBody().firstChild, 3);
|
||||
editor.selection.setRng(rng);
|
||||
editor.selection.normalize();
|
||||
|
||||
rng = editor.selection.getRng(true);
|
||||
equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
|
||||
equal(rng.startOffset, 3, 'startContainer offset');
|
||||
equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
|
||||
equal(rng.endOffset, 3, 'endOffset offset');
|
||||
});
|
||||
}
|
||||
|
||||
test('custom elements', function() {
|
||||
|
|
|
@ -166,13 +166,13 @@ test('getBlockElements', function() {
|
|||
|
||||
var schema = new tinymce.html.Schema();
|
||||
deepEqual(schema.getBlockElements(), {
|
||||
ASIDE: {}, HGROUP: {}, SECTION: {}, ARTICLE: {}, FOOTER: {}, HEADER: {}, SAMP: {},
|
||||
ASIDE: {}, HGROUP: {}, SECTION: {}, ARTICLE: {}, FOOTER: {}, HEADER: {},
|
||||
ISINDEX: {}, MENU: {}, NOSCRIPT: {}, FIELDSET: {}, DIR: {}, DD: {}, DT: {},
|
||||
DL: {}, CENTER: {}, BLOCKQUOTE: {}, CAPTION: {}, UL: {}, OL: {}, LI: {},
|
||||
TD: {}, TR: {}, TH: {}, TFOOT: {}, THEAD: {}, TBODY: {}, TABLE: {}, FORM: {},
|
||||
PRE: {}, ADDRESS: {}, DIV: {}, P: {}, HR: {}, H6: {}, H5: {}, H4: {}, H3: {},
|
||||
H2: {}, H1: {}, NAV: {}, FIGURE: {}, DATALIST: {}, OPTGROUP: {}, OPTION: {}, SELECT: {},
|
||||
aside: {}, hgroup: {}, section: {}, article: {}, footer: {}, header: {}, samp: {},
|
||||
aside: {}, hgroup: {}, section: {}, article: {}, footer: {}, header: {},
|
||||
isindex: {}, menu: {}, noscript: {}, fieldset: {}, dir: {}, dd: {}, dt: {}, dl: {}, center: {},
|
||||
blockquote: {}, caption: {}, ul: {}, ol: {}, li: {}, td: {}, tr: {}, th: {}, tfoot: {}, thead: {},
|
||||
tbody: {}, table: {}, form: {}, pre: {}, address: {}, div: {}, p: {}, hr: {}, h6: {},
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<script src="../../js/utils.js"></script>
|
||||
<script src="../../js/tinymce_loader.js"></script>
|
||||
<script src="../../js/jsrobot/robot.js"></script>
|
||||
<script src="../../plugins/js/dsl.js"></script>
|
||||
<script src="../../js/dsl/dsl.js"></script>
|
||||
<script>
|
||||
var editor;
|
||||
|
||||
|
|
|
@ -98,13 +98,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
// WP
|
||||
var url = document.location.href.substring( 0, document.location.href.lastIndexOf('tinymce/') );
|
||||
|
||||
tinymce.init({
|
||||
mode : "exact",
|
||||
// WP
|
||||
external_plugins: {
|
||||
noneditable: url + 'external-plugins/table/plugin.js'
|
||||
table: url + 'external-plugins/table/plugin.js'
|
||||
},
|
||||
// WP end
|
||||
elements : "elm1",
|
||||
indent: false,
|
||||
init_instance_callback : function(ed) {
|
||||
|
|
Loading…
Reference in New Issue