mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-27 14:53:08 +02:00
TinyMCE: update to 4.0.14. Remove the fix for using init.setup in old plugins, now fixed upstream. See #24067.
Built from https://develop.svn.wordpress.org/trunk@27060 git-svn-id: http://core.svn.wordpress.org/trunk@26933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
79ad468c61
commit
314f9569e5
@ -446,12 +446,6 @@ final class _WP_Editors {
|
||||
$mceInit['toolbar4'] = '';
|
||||
}
|
||||
|
||||
// Fix 3.x callbacks added with init.setup
|
||||
if ( ! empty( $mceInit['setup'] ) ) {
|
||||
$func = $mceInit['setup'];
|
||||
$mceInit['setup'] = "function( editor ) { editor.on( 'PreInit', function(){ ($func).call( this, editor ); }); }";
|
||||
}
|
||||
|
||||
self::$mce_settings[$editor_id] = $mceInit;
|
||||
} // end if self::$this_tinymce
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
(function(tinymce) {
|
||||
var reported;
|
||||
|
||||
function noop() {}
|
||||
|
||||
function log(apiCall) {
|
||||
if (!reported && window && window.console) {
|
||||
reported = true;
|
||||
@ -31,11 +33,11 @@
|
||||
function Dispatcher(target, newEventName, argsMap, defaultScope) {
|
||||
target = target || this;
|
||||
|
||||
if ( ! newEventName ) {
|
||||
this.add = this.addToTop = this.remove = this.dispatch = function(){};
|
||||
if (!newEventName) {
|
||||
this.add = this.addToTop = this.remove = this.dispatch = noop;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.add = function(callback, scope) {
|
||||
log('<target>.on' + newEventName + ".add(..)");
|
||||
|
||||
@ -95,8 +97,6 @@
|
||||
tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor");
|
||||
tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor");
|
||||
|
||||
function noop(){}
|
||||
|
||||
tinymce.util.Cookie = {
|
||||
get: noop, getHash: noop, remove: noop, set: noop, setHash: noop
|
||||
};
|
||||
@ -139,7 +139,7 @@
|
||||
return cmNoop();
|
||||
}
|
||||
|
||||
tinymce.each( methods.split(' '), function( method ) {
|
||||
tinymce.each(methods.split(' '), function(method) {
|
||||
obj[method] = _noop;
|
||||
});
|
||||
|
||||
|
@ -1 +1 @@
|
||||
!function(a){function b(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function c(a,c,d,e){return a=a||this,c?(this.add=function(f,g){function h(b){var h=[];if("string"==typeof d&&(d=d.split(" ")),d&&"function"!=typeof d)for(var i=0;i<d.length;i++)h.push(b[d[i]]);("function"!=typeof d||(h=d(c,b,a)))&&(d||(h=[b]),h.unshift(e||a),f.apply(g||e||a,h)===!1&&b.stopImmediatePropagation())}return b("<target>.on"+c+".add(..)"),a.on(c,h),h},this.addToTop=this.add,this.remove=function(b){return a.off(c,b)},this.dispatch=function(){return a.fire(c),!0},void 0):(this.add=this.addToTop=this.remove=this.dispatch=function(){},void 0)}function d(){}function e(e){function f(b,d){a.each(b.split(" "),function(a){e["on"+a]=new c(e,a,d)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function c(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return b("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=c}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,c){b("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(c)},setActive:function(a,c){b("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(c)},onAdd:new c,onPostRender:new c,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:d,get:d,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f,g,h;for(var i in c)"onpostrender"===i.toLowerCase()&&(f=c[i],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(g=(e.settings.language||"en")+"."+c.title,h=a.i18n.translate(g),g!==h&&(c.title=h)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new c(e,"Undo",g,null,a),a.onRedo=new c(e,"Redo",g,null,a),a.onBeforeAdd=new c(e,"BeforeAddUndo",null,a),a.onAdd=new c(e,"AddUndo",null,a),b.onBeforeGetContent=new c(e,"BeforeGetContent",h(!0),b),b.onGetContent=new c(e,"GetContent",h(!0),b),b.onBeforeSetContent=new c(e,"BeforeSetContent",h(!0),b),b.onSetContent=new c(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var d=e.windowManager;d.onOpen=new c,d.onClose=new c,d.createInstance=function(c,d,e,f,g,h){b("windowManager.createInstance(..)");var i=a.resolve(c);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=c,a.onBeforeUnload=new c(a,"BeforeUnload"),a.onAddEditor=new c(a,"AddEditor","editor"),a.onRemoveEditor=new c(a,"RemoveEditor","editor"),a.util.Cookie={get:d,getHash:d,remove:d,set:d,setHash:d},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?(d.add(b,c),void 0):(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}),void 0)}}(tinymce);
|
||||
!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){return a=a||this,d?(this.add=function(b,g){function h(c){var h=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i<e.length;i++)h.push(c[e[i]]);("function"!=typeof e||(h=e(d,c,a)))&&(e||(h=[c]),h.unshift(f||a),b.apply(g||f||a,h)===!1&&c.stopImmediatePropagation())}return c("<target>.on"+d+".add(..)"),a.on(d,h),h},this.addToTop=this.add,this.remove=function(b){return a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function b(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:b,get:b,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f,g,h;for(var i in c)"onpostrender"===i.toLowerCase()&&(f=c[i],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(g=(e.settings.language||"en")+"."+c.title,h=a.i18n.translate(g),g!==h&&(c.title=h)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",g,null,a),a.onRedo=new d(e,"Redo",g,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",h(!0),b),b.onGetContent=new d(e,"GetContent",h(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",h(!0),b),b.onSetContent=new d(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
|
@ -15,7 +15,10 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
var img = document.createElement('img');
|
||||
|
||||
function done(width, height) {
|
||||
img.parentNode.removeChild(img);
|
||||
if (img.parentNode) {
|
||||
img.parentNode.removeChild(img);
|
||||
}
|
||||
|
||||
callback({width: width, height: height});
|
||||
}
|
||||
|
||||
@ -27,8 +30,6 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
done();
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
|
||||
var style = img.style;
|
||||
style.visibility = 'hidden';
|
||||
style.position = 'fixed';
|
||||
@ -36,6 +37,7 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
style.width = style.height = 'auto';
|
||||
|
||||
document.body.appendChild(img);
|
||||
img.src = url;
|
||||
}
|
||||
|
||||
function createImageList(callback) {
|
||||
@ -73,7 +75,7 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
return imageListItems;
|
||||
}
|
||||
|
||||
function recalcSize(e) {
|
||||
function recalcSize() {
|
||||
var widthCtrl, heightCtrl, newWidth, newHeight;
|
||||
|
||||
widthCtrl = win.find('#width')[0];
|
||||
@ -83,7 +85,7 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
newHeight = heightCtrl.value();
|
||||
|
||||
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
|
||||
if (e.control == widthCtrl) {
|
||||
if (width != newWidth) {
|
||||
newHeight = Math.round((newWidth / width) * newHeight);
|
||||
heightCtrl.value(newHeight);
|
||||
} else {
|
||||
@ -119,6 +121,9 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
|
||||
imgElm.onerror = selectImage;
|
||||
}
|
||||
|
||||
updateStyle();
|
||||
recalcSize();
|
||||
|
||||
var data = win.toJSON();
|
||||
var caption = data.caption; // WP
|
||||
@ -166,6 +171,7 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
|
||||
if (!imgElm) {
|
||||
data.id = '__mcenew';
|
||||
editor.focus();
|
||||
editor.selection.setContent(dom.createHTML('img', data));
|
||||
imgElm = dom.get('__mcenew');
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
@ -252,9 +258,9 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
items: [
|
||||
{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
|
||||
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
|
||||
{type: 'label', text: 'x'},
|
||||
{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
|
||||
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
|
||||
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
|
||||
]
|
||||
}
|
||||
@ -272,6 +278,10 @@ tinymce.PluginManager.add('image', function(editor) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (!editor.settings.image_advtab) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = win.toJSON();
|
||||
var css = dom.parseStyle(data.style);
|
||||
|
||||
|
@ -1 +1 @@
|
||||
tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()},d.src=a;var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d)}function c(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):b(c)}}function d(c){function d(){var b=[{text:"None",value:""}];return tinymce.each(c,function(c){b.push({text:c.text||c.title,value:a.convertURL(c.value||c.url,"src"),menu:c.menu})}),b}function e(a){var b,c,d,e;b=j.find("#width")[0],c=j.find("#height")[0],d=b.value(),e=c.value(),j.find("#constrain")[0].checked()&&k&&l&&d&&e&&(a.control==b?(e=Math.round(d/k*e),c.value(e)):(d=Math.round(e/l*d),b.value(d))),k=d,l=e}function f(){function b(b){function d(){b.onload=b.onerror=null,a.selection.select(b),a.nodeChanged()}b.onload=function(){c.width||c.height||(o.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),a.fire("wpNewImageRefresh",{node:b})),d()},b.onerror=d}var c=j.toJSON(),d=c.caption;""===c.width&&(c.width=null),""===c.height&&(c.height=null),""===c.style&&(c.style=null),c={src:c.src,alt:c.alt,width:c.width,height:c.height,style:c.style},a.undoManager.transact(function(){var e={node:p,data:c,caption:d};return a.fire("wpImageFormSubmit",{imgData:e}),e.cancel?(b(e.node),void 0):c.src?(p?o.setAttribs(p,c):(c.id="__mcenew",a.selection.setContent(o.createHTML("img",c)),p=o.get("__mcenew"),o.setAttrib(p,"id",null)),b(p),void 0):(p&&(o.remove(p),a.nodeChanged()),void 0)})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(){m&&m.value(a.convertURL(this.value(),"src")),b(this.value(),function(a){a.width&&a.height&&(k=a.width,l=a.height,j.find("#width").value(k),j.find("#height").value(l))})}function i(){function a(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}var b=j.toJSON(),c=o.parseStyle(b.style);delete c.margin,c["margin-top"]=c["margin-bottom"]=a(b.vspace),c["margin-left"]=c["margin-right"]=a(b.hspace),c["border-width"]=a(b.border),j.find("#style").value(o.serializeStyle(o.parseStyle(o.serializeStyle(c))))}var j,k,l,m,n={},o=a.dom,p=a.selection.getNode();k=o.getAttrib(p,"width"),l=o.getAttrib(p,"height"),"IMG"!=p.nodeName||p.getAttribute("data-mce-object")||p.getAttribute("data-mce-placeholder")?p=null:(n={src:o.getAttrib(p,"src"),alt:o.getAttrib(p,"alt"),width:k,height:l},a.fire("wpLoadImageData",{imgData:{data:n,node:p}})),c&&(m={type:"listbox",label:"Image list",values:d(),value:n.src&&a.convertURL(n.src,"src"),onselect:function(a){var b=j.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),j.find("#src").value(a.control.value())},onPostRender:function(){m=this}});var q=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},m,{name:"alt",type:"textbox",label:"Image description"},{type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:3,size:3,onchange:e},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:3,size:3,onchange:e},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}];a.fire("wpLoadImageForm",{data:q}),a.settings.image_advtab?(p&&(n.hspace=g(p.style.marginLeft||p.style.marginRight),n.vspace=g(p.style.marginTop||p.style.marginBottom),n.border=g(p.style.borderWidth),n.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(p,"style")))),j=a.windowManager.open({title:"Insert/edit image",data:n,bodyType:"tabpanel",body:[{title:"General",type:"form",items:q},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox"},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:i},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):j=a.windowManager.open({title:"Insert/edit image",data:n,body:q,onSubmit:f})}a.addCommand("mceImage",function(){c(d)()}),a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:c(d),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert image",onclick:c(d),context:"insert",prependToContext:!0})});
|
||||
tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):b(c)}}function d(c){function d(){var b=[{text:"None",value:""}];return tinymce.each(c,function(c){b.push({text:c.text||c.title,value:a.convertURL(c.value||c.url,"src"),menu:c.menu})}),b}function e(){var a,b,c,d;a=j.find("#width")[0],b=j.find("#height")[0],c=a.value(),d=b.value(),j.find("#constrain")[0].checked()&&k&&l&&c&&d&&(k!=c?(d=Math.round(c/k*d),b.value(d)):(c=Math.round(d/l*c),a.value(c))),k=c,l=d}function f(){function b(b){function d(){b.onload=b.onerror=null,a.selection.select(b),a.nodeChanged()}b.onload=function(){c.width||c.height||(o.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),a.fire("wpNewImageRefresh",{node:b})),d()},b.onerror=d}i(),e();var c=j.toJSON(),d=c.caption;""===c.width&&(c.width=null),""===c.height&&(c.height=null),""===c.style&&(c.style=null),c={src:c.src,alt:c.alt,width:c.width,height:c.height,style:c.style},a.undoManager.transact(function(){var e={node:p,data:c,caption:d};return a.fire("wpImageFormSubmit",{imgData:e}),e.cancel?void b(e.node):c.src?(p?o.setAttribs(p,c):(c.id="__mcenew",a.focus(),a.selection.setContent(o.createHTML("img",c)),p=o.get("__mcenew"),o.setAttrib(p,"id",null)),void b(p)):void(p&&(o.remove(p),a.nodeChanged()))})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(){m&&m.value(a.convertURL(this.value(),"src")),b(this.value(),function(a){a.width&&a.height&&(k=a.width,l=a.height,j.find("#width").value(k),j.find("#height").value(l))})}function i(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=j.toJSON(),d=o.parseStyle(c.style);delete d.margin,d["margin-top"]=d["margin-bottom"]=b(c.vspace),d["margin-left"]=d["margin-right"]=b(c.hspace),d["border-width"]=b(c.border),j.find("#style").value(o.serializeStyle(o.parseStyle(o.serializeStyle(d))))}}var j,k,l,m,n={},o=a.dom,p=a.selection.getNode();k=o.getAttrib(p,"width"),l=o.getAttrib(p,"height"),"IMG"!=p.nodeName||p.getAttribute("data-mce-object")||p.getAttribute("data-mce-placeholder")?p=null:(n={src:o.getAttrib(p,"src"),alt:o.getAttrib(p,"alt"),width:k,height:l},a.fire("wpLoadImageData",{imgData:{data:n,node:p}})),c&&(m={type:"listbox",label:"Image list",values:d(),value:n.src&&a.convertURL(n.src,"src"),onselect:function(a){var b=j.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),j.find("#src").value(a.control.value())},onPostRender:function(){m=this}});var q=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},m,{name:"alt",type:"textbox",label:"Image description"},{type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}];a.fire("wpLoadImageForm",{data:q}),a.settings.image_advtab?(p&&(n.hspace=g(p.style.marginLeft||p.style.marginRight),n.vspace=g(p.style.marginTop||p.style.marginBottom),n.border=g(p.style.borderWidth),n.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(p,"style")))),j=a.windowManager.open({title:"Insert/edit image",data:n,bodyType:"tabpanel",body:[{title:"General",type:"form",items:q},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox"},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:i},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):j=a.windowManager.open({title:"Insert/edit image",data:n,body:q,onSubmit:f})}a.addCommand("mceImage",function(){c(d)()}),a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:c(d),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert image",onclick:c(d),context:"insert",prependToContext:!0})});
|
@ -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, linkListCtrl, relListCtrl, targetListCtrl;
|
||||
var win, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl;
|
||||
|
||||
function linkListChangeHandler(e) {
|
||||
var textCtrl = win.find('#text');
|
||||
@ -71,9 +71,10 @@ tinymce.PluginManager.add('link', function(editor) {
|
||||
}
|
||||
|
||||
function buildTargetList(targetValue) {
|
||||
var targetListItems = [{text: 'None', value: ''}];
|
||||
var targetListItems = [];
|
||||
|
||||
if (!editor.settings.target_list) {
|
||||
targetListItems.push({text: 'None', value: ''});
|
||||
targetListItems.push({text: 'New window', value: '_blank'});
|
||||
}
|
||||
|
||||
@ -121,7 +122,7 @@ tinymce.PluginManager.add('link', function(editor) {
|
||||
linkListCtrl.value(editor.convertURL(this.value(), 'href'));
|
||||
}
|
||||
|
||||
if (!initialText && data.text.length === 0) {
|
||||
if (!initialText && data.text.length === 0 && onlyText) {
|
||||
this.parent().parent().find('#text')[0].value(this.value());
|
||||
}
|
||||
}
|
||||
@ -129,13 +130,38 @@ tinymce.PluginManager.add('link', function(editor) {
|
||||
selectedElm = selection.getNode();
|
||||
anchorElm = dom.getParent(selectedElm, 'a[href]');
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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') : '';
|
||||
data.target = anchorElm ? dom.getAttrib(anchorElm, 'target') : (editor.settings.default_link_target || '');
|
||||
data.rel = anchorElm ? dom.getAttrib(anchorElm, 'rel') : '';
|
||||
|
||||
if (selectedElm.nodeName == "IMG") {
|
||||
data.text = initialText = " ";
|
||||
if (onlyText) {
|
||||
textListCtrl = {
|
||||
name: 'text',
|
||||
type: 'textbox',
|
||||
size: 40,
|
||||
label: 'Text to display',
|
||||
onchange: function() {
|
||||
data.text = this.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (linkList) {
|
||||
@ -183,9 +209,7 @@ tinymce.PluginManager.add('link', function(editor) {
|
||||
onchange: urlChange,
|
||||
onkeyup: urlChange
|
||||
},
|
||||
{name: 'text', type: 'textbox', size: 40, label: 'Text to display', onchange: function() {
|
||||
data.text = this.value();
|
||||
}},
|
||||
textListCtrl,
|
||||
buildAnchorListControl(data.href),
|
||||
linkListCtrl,
|
||||
relListCtrl,
|
||||
@ -207,31 +231,35 @@ tinymce.PluginManager.add('link', function(editor) {
|
||||
}
|
||||
|
||||
function insertLink() {
|
||||
if (data.text != initialText) {
|
||||
if (anchorElm) {
|
||||
editor.focus();
|
||||
anchorElm.innerHTML = data.text;
|
||||
if (anchorElm) {
|
||||
editor.focus();
|
||||
|
||||
dom.setAttribs(anchorElm, {
|
||||
href: href,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null
|
||||
});
|
||||
if (onlyText && data.text != initialText) {
|
||||
anchorElm.innerText = data.text;
|
||||
}
|
||||
|
||||
selection.select(anchorElm);
|
||||
} else {
|
||||
dom.setAttribs(anchorElm, {
|
||||
href: href,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null
|
||||
});
|
||||
|
||||
selection.select(anchorElm);
|
||||
editor.undoManager.add();
|
||||
} else {
|
||||
if (onlyText) {
|
||||
editor.insertContent(dom.createHTML('a', {
|
||||
href: href,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null
|
||||
}, data.text));
|
||||
}, dom.encode(data.text)));
|
||||
} else {
|
||||
editor.execCommand('mceInsertLink', false, {
|
||||
href: href,
|
||||
target: data.target,
|
||||
rel: data.rel ? data.rel : null
|
||||
});
|
||||
}
|
||||
} else {
|
||||
editor.execCommand('mceInsertLink', false, {
|
||||
href: href,
|
||||
target: data.target,
|
||||
rel: data.rel ? data.rel : null
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,4 +333,4 @@ tinymce.PluginManager.add('link', function(editor) {
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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=[{text:"None",value:""}];return e.settings.target_list||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(){d&&d.value(e.convertURL(this.value(),"href")),c||0!==x.text.length||this.parent().parent().find("#text")[0].value(this.value())}var u,s,c,f,d,h,v,x={},g=e.selection,m=e.dom;u=g.getNode(),s=m.getParent(u,"a[href]"),x.text=c=s?s.innerText||s.textContent:g.getContent({format:"text"}),x.href=s?m.getAttrib(s,"href"):"",x.target=s?m.getAttrib(s,"target"):"",x.rel=s?m.getAttrib(s,"rel"):"","IMG"==u.nodeName&&(x.text=c=" "),t&&(d={type:"listbox",label:"Link list",values:l(),onselect:n,value:e.convertURL(x.href,"href"),onPostRender:function(){d=this}}),e.settings.target_list!==!1&&(v={name:"target",type:"listbox",label:"Target",values:r(x.target)}),e.settings.rel_list&&(h={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},{name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){x.text=this.value()}},a(x.href),d,h,v],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(){i.text!=c?s?(e.focus(),s.innerHTML=i.text,m.setAttribs(s,{href:r,target:i.target?i.target:null,rel:i.rel?i.rel:null}),g.select(s)):e.insertContent(m.createHTML("a",{href:r,target:i.target?i.target:null,rel:i.rel?i.rel:null},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:")?(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()}),void 0):/^\s*www\./i.test(r)?(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 0):(l(),void 0):(e.execCommand("unlink"),void 0)}})}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){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})});
|
@ -112,9 +112,9 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
items: [
|
||||
{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
|
||||
{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
|
||||
{type: 'label', text: 'x'},
|
||||
{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
|
||||
{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize},
|
||||
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
|
||||
]
|
||||
}
|
||||
@ -197,8 +197,8 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
||||
|
||||
data.source1 = url;
|
||||
data.type = pattern.type;
|
||||
data.width = pattern.w;
|
||||
data.height = pattern.h;
|
||||
data.width = data.width || pattern.w;
|
||||
data.height = data.height || pattern.h;
|
||||
}
|
||||
});
|
||||
|
||||
@ -651,4 +651,4 @@ tinymce.PluginManager.add('media', function(editor, url) {
|
||||
context: 'insert',
|
||||
prependToContext: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
@ -294,29 +294,40 @@ define("tinymce/pasteplugin/Clipboard", [
|
||||
* so that resize handles doesn't get produced on IE or Drag handles or Firefox.
|
||||
*/
|
||||
function createPasteBin() {
|
||||
var dom = editor.dom, body = editor.getBody(), viewport = editor.dom.getViewPort(editor.getWin());
|
||||
var height = editor.inline ? body.clientHeight : viewport.h;
|
||||
var dom = editor.dom, body = editor.getBody();
|
||||
var viewport = editor.dom.getViewPort(editor.getWin()), scrollTop, top = 20;
|
||||
|
||||
removePasteBin();
|
||||
lastRng = editor.selection.getRng();
|
||||
scrollTop = editor.inline ? editor.selection.getScrollContainer().scrollTop : viewport.y;
|
||||
|
||||
// Calculate top cordinate this is needed to avoid scrolling to top of document
|
||||
// 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) {
|
||||
top = scrollTop + (rects[0].top - dom.getPos(body).y);
|
||||
}
|
||||
}
|
||||
|
||||
// Create a pastebin
|
||||
pasteBinElm = dom.add(editor.getBody(), 'div', {
|
||||
id: "mcepastebin",
|
||||
contentEditable: true,
|
||||
"data-mce-bogus": "1",
|
||||
style: 'position: fixed; top: 20px;' +
|
||||
'width: 10px; height: ' + (height - 40) + 'px; overflow: hidden; opacity: 0'
|
||||
style: 'position: absolute; top: ' + top + 'px;' +
|
||||
'width: 10px; height: 10px; overflow: hidden; opacity: 0'
|
||||
}, pasteBinDefaultContent);
|
||||
|
||||
// Move paste bin out of sight since the controlSelection rect gets displayed otherwise
|
||||
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) == 'rtl' ? 0xFFFF : -0xFFFF);
|
||||
// Move paste bin out of sight since the controlSelection rect gets displayed otherwise on IE and Gecko
|
||||
if (Env.ie || Env.gecko) {
|
||||
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) == 'rtl' ? 0xFFFF : -0xFFFF);
|
||||
}
|
||||
|
||||
// Prevent focus events from bubbeling fixed FocusManager issues
|
||||
dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
lastRng = editor.selection.getRng();
|
||||
pasteBinElm.focus();
|
||||
editor.selection.select(pasteBinElm, true);
|
||||
}
|
||||
@ -326,8 +337,15 @@ define("tinymce/pasteplugin/Clipboard", [
|
||||
*/
|
||||
function removePasteBin() {
|
||||
if (pasteBinElm) {
|
||||
editor.dom.unbind(pasteBinElm);
|
||||
editor.dom.remove(pasteBinElm);
|
||||
var pasteBinClone;
|
||||
|
||||
// WebKit/Blink might clone the div so
|
||||
// lets make sure we remove all clones
|
||||
// TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it!
|
||||
while ((pasteBinClone = editor.dom.get('mcepastebin'))) {
|
||||
editor.dom.remove(pasteBinClone);
|
||||
editor.dom.unbind(pasteBinClone);
|
||||
}
|
||||
|
||||
if (lastRng) {
|
||||
editor.selection.setRng(lastRng);
|
||||
@ -344,7 +362,26 @@ define("tinymce/pasteplugin/Clipboard", [
|
||||
* @return {String} Get the contents of the paste bin.
|
||||
*/
|
||||
function getPasteBinHtml() {
|
||||
return pasteBinElm ? pasteBinElm.innerHTML : pasteBinDefaultContent;
|
||||
var html = pasteBinDefaultContent, pasteBinClones, i;
|
||||
|
||||
// Since WebKit/Chrome might clone the paste bin when pasting
|
||||
// for example: <img style="float: right"> we need to check if any of them contains some useful html.
|
||||
// TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it!
|
||||
pasteBinClones = editor.dom.select('div[id=mcepastebin]');
|
||||
i = pasteBinClones.length;
|
||||
while (i--) {
|
||||
var cloneHtml = pasteBinClones[i].innerHTML;
|
||||
|
||||
if (html == pasteBinDefaultContent) {
|
||||
html = '';
|
||||
}
|
||||
|
||||
if (cloneHtml.length > html.length) {
|
||||
html = cloneHtml;
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -394,123 +431,137 @@ define("tinymce/pasteplugin/Clipboard", [
|
||||
return rng;
|
||||
}
|
||||
|
||||
editor.on('keydown', function(e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ctrl+V or Shift+Insert
|
||||
if ((VK.metaKeyPressed(e) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45)) {
|
||||
keyboardPastePlainTextState = e.shiftKey && e.keyCode == 86;
|
||||
|
||||
// Prevent undoManager keydown handler from making an undo level with the pastebin in it
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
keyboardPasteTimeStamp = new Date().getTime();
|
||||
|
||||
// IE doesn't support Ctrl+Shift+V and it doesn't even produce a paste event
|
||||
// so lets fake a paste event and let IE use the execCommand/dataTransfer methods
|
||||
if (Env.ie && keyboardPastePlainTextState) {
|
||||
e.preventDefault();
|
||||
editor.fire('paste', {ieFake: true});
|
||||
function registerEventHandlers() {
|
||||
editor.on('keydown', function(e) {
|
||||
if (e.isDefaultPrevented()) {
|
||||
return;
|
||||
}
|
||||
|
||||
createPasteBin();
|
||||
}
|
||||
});
|
||||
// Ctrl+V or Shift+Insert
|
||||
if ((VK.metaKeyPressed(e) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45)) {
|
||||
keyboardPastePlainTextState = e.shiftKey && e.keyCode == 86;
|
||||
|
||||
editor.on('paste', function(e) {
|
||||
var clipboardContent = getClipboardContent(e);
|
||||
var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp < 1000;
|
||||
var plainTextMode = self.pasteFormat == "text" || keyboardPastePlainTextState;
|
||||
// Prevent undoManager keydown handler from making an undo level with the pastebin in it
|
||||
e.stopImmediatePropagation();
|
||||
|
||||
// Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs
|
||||
if (!isKeyBoardPaste) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
// Try IE only method if paste isn't a keyboard paste
|
||||
if (Env.ie && (!isKeyBoardPaste || e.ieFake)) {
|
||||
createPasteBin();
|
||||
|
||||
editor.dom.bind(pasteBinElm, 'paste', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
editor.getDoc().execCommand('Paste', false, null);
|
||||
clipboardContent["text/html"] = getPasteBinHtml();
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
var html = getPasteBinHtml();
|
||||
|
||||
// WebKit has a nice bug where it clones the paste bin if you paste from for example notepad
|
||||
if (pasteBinElm && pasteBinElm.firstChild && pasteBinElm.firstChild.id === 'mcepastebin') {
|
||||
plainTextMode = true;
|
||||
}
|
||||
|
||||
removePasteBin();
|
||||
|
||||
if (html == pasteBinDefaultContent || !isKeyBoardPaste) {
|
||||
html = clipboardContent['text/html'] || clipboardContent['text/plain'] || pasteBinDefaultContent;
|
||||
|
||||
if (html == pasteBinDefaultContent) {
|
||||
if (!isKeyBoardPaste) {
|
||||
editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
|
||||
}
|
||||
keyboardPasteTimeStamp = new Date().getTime();
|
||||
|
||||
// IE doesn't support Ctrl+Shift+V and it doesn't even produce a paste event
|
||||
// so lets fake a paste event and let IE use the execCommand/dataTransfer methods
|
||||
if (Env.ie && keyboardPastePlainTextState) {
|
||||
e.preventDefault();
|
||||
editor.fire('paste', {ieFake: true});
|
||||
return;
|
||||
}
|
||||
|
||||
removePasteBin();
|
||||
createPasteBin();
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('paste', function(e) {
|
||||
var clipboardContent = getClipboardContent(e);
|
||||
var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp < 1000;
|
||||
var plainTextMode = self.pasteFormat == "text" || keyboardPastePlainTextState;
|
||||
|
||||
if (e.isDefaultPrevented()) {
|
||||
removePasteBin();
|
||||
return;
|
||||
}
|
||||
|
||||
if (plainTextMode) {
|
||||
pasteText(clipboardContent['text/plain'] || Utils.innerText(html));
|
||||
} else {
|
||||
pasteHtml(html);
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
|
||||
editor.on('dragstart', function(e) {
|
||||
if (e.dataTransfer.types) {
|
||||
e.dataTransfer.setData('mce-internal', editor.selection.getContent());
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('drop', function(e) {
|
||||
var rng = getCaretRangeFromEvent(e);
|
||||
|
||||
if (rng) {
|
||||
var dropContent = getDataTransferItems(e.dataTransfer);
|
||||
var content = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
|
||||
|
||||
if (content) {
|
||||
// Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs
|
||||
if (!isKeyBoardPaste) {
|
||||
e.preventDefault();
|
||||
|
||||
editor.undoManager.transact(function() {
|
||||
if (dropContent['mce-internal']) {
|
||||
editor.execCommand('Delete');
|
||||
}
|
||||
|
||||
editor.selection.setRng(rng);
|
||||
|
||||
if (!dropContent['text/html']) {
|
||||
pasteText(content);
|
||||
} else {
|
||||
pasteHtml(content);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Try IE only method if paste isn't a keyboard paste
|
||||
if (Env.ie && (!isKeyBoardPaste || e.ieFake)) {
|
||||
createPasteBin();
|
||||
|
||||
editor.dom.bind(pasteBinElm, 'paste', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
editor.getDoc().execCommand('Paste', false, null);
|
||||
clipboardContent["text/html"] = getPasteBinHtml();
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
var html = getPasteBinHtml();
|
||||
|
||||
// WebKit has a nice bug where it clones the paste bin if you paste from for example notepad
|
||||
if (pasteBinElm && pasteBinElm.firstChild && pasteBinElm.firstChild.id === 'mcepastebin') {
|
||||
plainTextMode = true;
|
||||
}
|
||||
|
||||
removePasteBin();
|
||||
|
||||
if (html == pasteBinDefaultContent || !isKeyBoardPaste) {
|
||||
html = clipboardContent['text/html'] || clipboardContent['text/plain'] || pasteBinDefaultContent;
|
||||
|
||||
if (html == pasteBinDefaultContent) {
|
||||
if (!isKeyBoardPaste) {
|
||||
editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plainTextMode) {
|
||||
pasteText(clipboardContent['text/plain'] || Utils.innerText(html));
|
||||
} else {
|
||||
pasteHtml(html);
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
|
||||
editor.on('dragstart', function(e) {
|
||||
if (e.dataTransfer.types) {
|
||||
try {
|
||||
e.dataTransfer.setData('mce-internal', editor.selection.getContent());
|
||||
} catch (ex) {
|
||||
// IE 10 throws an error since it doesn't support custom data items
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('drop', function(e) {
|
||||
var rng = getCaretRangeFromEvent(e);
|
||||
|
||||
if (rng && !e.isDefaultPrevented()) {
|
||||
var dropContent = getDataTransferItems(e.dataTransfer);
|
||||
var content = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
|
||||
|
||||
if (content) {
|
||||
e.preventDefault();
|
||||
|
||||
editor.undoManager.transact(function() {
|
||||
if (dropContent['mce-internal']) {
|
||||
editor.execCommand('Delete');
|
||||
}
|
||||
|
||||
editor.selection.setRng(rng);
|
||||
|
||||
if (!dropContent['text/html']) {
|
||||
pasteText(content);
|
||||
} else {
|
||||
pasteHtml(content);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.pasteHtml = pasteHtml;
|
||||
self.pasteText = pasteText;
|
||||
|
||||
// Remove all data images from paste for example from Gecko
|
||||
// except internal images like video elements
|
||||
editor.on('preInit', function() {
|
||||
registerEventHandlers();
|
||||
|
||||
// Remove all data images from paste for example from Gecko
|
||||
// except internal images like video elements
|
||||
editor.parser.addNodeFilter('img', function(nodes) {
|
||||
if (!editor.settings.paste_data_images) {
|
||||
var i = nodes.length;
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(b){function c(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&c(a.parentNode)}function f(a){return a.tabIndex||"INPUT"==a.nodeName||"TEXTAREA"==a.nodeName}function i(a){return!f(a)&&"-1"!=a.getAttribute("tabindex")&&c(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),b>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey)&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null)}),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)});
|
||||
tinymce.PluginManager.add("tabfocus",function(e){function n(e){9!==e.keyCode||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()}function t(n){function t(n){function t(e){return"BODY"===e.nodeName||"hidden"!=e.type&&"none"!=e.style.display&&"hidden"!=e.style.visibility&&t(e.parentNode)}function r(e){return e.tabIndex||"INPUT"==e.nodeName||"TEXTAREA"==e.nodeName}function c(e){return!r(e)&&"-1"!=e.getAttribute("tabindex")&&t(e)}if(u=i.select(":input:enabled,*[tabindex]:not(iframe)"),o(u,function(n,t){return n.id==e.id?(a=t,!1):void 0}),n>0){for(d=a+1;d<u.length;d++)if(c(u[d]))return u[d]}else for(d=a-1;d>=0;d--)if(c(u[d]))return u[d];return null}var a,u,c,d;if(!(9!==n.keyCode||n.ctrlKey||n.altKey||n.metaKey)&&(c=r(e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))),1==c.length&&(c[1]=c[0],c[0]=":prev"),u=n.shiftKey?":prev"==c[0]?t(-1):i.get(c[0]):":next"==c[1]?t(1):i.get(c[1]))){var y=tinymce.get(u.id||u.name);u.id&&y?y.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),u.focus()},10),n.preventDefault()}}var i=tinymce.DOM,o=tinymce.each,r=tinymce.explode;e.on("init",function(){e.inline&&tinymce.DOM.setAttrib(e.getBody(),"tabIndex",null)}),e.on("keyup",n),tinymce.Env.gecko?e.on("keypress keydown",t):e.on("keydown",t)});
|
@ -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{background:url(img/wline.gif) repeat-x bottom left;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}.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{background:url(img/wline.gif) repeat-x bottom left;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}.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}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -340,7 +340,7 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
*
|
||||
* @return {Object} Name/value object with theme data.
|
||||
*/
|
||||
function renderInlineUI() {
|
||||
function renderInlineUI(args) {
|
||||
var panel, inlineToolbarContainer;
|
||||
|
||||
if (settings.fixed_toolbar_container) {
|
||||
@ -423,11 +423,21 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
editor.on('nodeChange', reposition);
|
||||
editor.on('activate', show);
|
||||
editor.on('deactivate', hide);
|
||||
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
settings.content_editable = true;
|
||||
|
||||
editor.on('focus', render);
|
||||
editor.on('focus', function() {
|
||||
// Render only when the CSS file has been loaded
|
||||
if (args.skinUiCss) {
|
||||
tinymce.DOM.styleSheetLoader.load(args.skinUiCss, render, render);
|
||||
} else {
|
||||
render();
|
||||
}
|
||||
});
|
||||
|
||||
editor.on('blur', hide);
|
||||
|
||||
// Remove the panel when the editor is removed
|
||||
@ -438,6 +448,11 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
}
|
||||
});
|
||||
|
||||
// Preload skin css
|
||||
if (args.skinUiCss) {
|
||||
tinymce.DOM.styleSheetLoader.load(args.skinUiCss);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -450,6 +465,10 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
function renderIframeUI(args) {
|
||||
var panel, resizeHandleCtrl, startSize;
|
||||
|
||||
if (args.skinUiCss) {
|
||||
tinymce.DOM.loadCSS(args.skinUiCss);
|
||||
}
|
||||
|
||||
// Basic UI layout
|
||||
panel = self.panel = Factory.create({
|
||||
type: 'panel',
|
||||
@ -543,9 +562,9 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
// Load special skin for IE7
|
||||
// TODO: Remove this when we drop IE7 support
|
||||
if (tinymce.Env.documentMode <= 7) {
|
||||
tinymce.DOM.loadCSS(skinUrl + '/skin.ie7.min.css');
|
||||
args.skinUiCss = skinUrl + '/skin.ie7.min.css';
|
||||
} else {
|
||||
tinymce.DOM.loadCSS(skinUrl + '/skin.min.css');
|
||||
args.skinUiCss = skinUrl + '/skin.min.css';
|
||||
}
|
||||
|
||||
// Load content.min.css or content.inline.min.css
|
||||
@ -563,12 +582,10 @@ tinymce.ThemeManager.add('modern', function(editor) {
|
||||
}
|
||||
});
|
||||
|
||||
// Render inline UI
|
||||
if (settings.inline) {
|
||||
return renderInlineUI(args);
|
||||
}
|
||||
|
||||
// Render iframe UI
|
||||
return renderIframeUI(args);
|
||||
};
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
// 4.0.12 (2013-12-18)
|
||||
// 4.0.14 (2014-01-30)
|
||||
|
||||
/**
|
||||
* Compiled inline version. (Library mode)
|
||||
@ -232,7 +232,7 @@ define("tinymce/dom/EventUtils", [], function() {
|
||||
}
|
||||
|
||||
function waitForDomLoaded() {
|
||||
if (doc.readyState === "complete") {
|
||||
if (doc.readyState === "complete" || doc.readyState === "interactive") {
|
||||
removeEvent(doc, "readystatechange", waitForDomLoaded);
|
||||
readyHandler();
|
||||
}
|
||||
@ -253,7 +253,7 @@ define("tinymce/dom/EventUtils", [], function() {
|
||||
|
||||
// Use W3C method
|
||||
if (doc.addEventListener) {
|
||||
if (doc.readyState === "complete") {
|
||||
if (doc.readyState === "complete" || doc.readyState === "interactive") {
|
||||
readyHandler();
|
||||
} else {
|
||||
addEvent(win, 'DOMContentLoaded', readyHandler);
|
||||
@ -263,7 +263,7 @@ define("tinymce/dom/EventUtils", [], function() {
|
||||
addEvent(doc, "readystatechange", waitForDomLoaded);
|
||||
|
||||
// Wait until we can scroll, when we can the DOM is initialized
|
||||
if (doc.documentElement.doScroll && win === win.top) {
|
||||
if (doc.documentElement.doScroll && win.self === win.top) {
|
||||
tryScroll();
|
||||
}
|
||||
}
|
||||
@ -5390,6 +5390,194 @@ define("tinymce/Env", [], function() {
|
||||
};
|
||||
});
|
||||
|
||||
// Included from: js/tinymce/classes/dom/StyleSheetLoader.js
|
||||
|
||||
/**
|
||||
* StyleSheetLoader.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class handles loading of external stylesheets and fires events when these are loaded.
|
||||
*
|
||||
* @class tinymce.dom.StyleSheetLoader
|
||||
* @private
|
||||
*/
|
||||
define("tinymce/dom/StyleSheetLoader", [], function() {
|
||||
"use strict";
|
||||
|
||||
return function(document, settings) {
|
||||
var idCount = 0, loadedStates = {}, maxLoadTime;
|
||||
|
||||
settings = settings || {};
|
||||
maxLoadTime = settings.maxLoadTime || 5000;
|
||||
|
||||
function appendToHead(node) {
|
||||
document.getElementsByTagName('head')[0].appendChild(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the specified css style sheet file and call the loadedCallback once it's finished loading.
|
||||
*
|
||||
* @method load
|
||||
* @param {String} url Url to be loaded.
|
||||
* @param {Function} loadedCallback Callback to be executed when loaded.
|
||||
* @param {Function} errorCallback Callback to be executed when failed loading.
|
||||
*/
|
||||
function load(url, loadedCallback, errorCallback) {
|
||||
var link, style, startTime, state;
|
||||
|
||||
function passed() {
|
||||
var callbacks = state.passed, i = callbacks.length;
|
||||
|
||||
while (i--) {
|
||||
callbacks[i]();
|
||||
}
|
||||
|
||||
state.status = 2;
|
||||
state.passed = [];
|
||||
state.failed = [];
|
||||
}
|
||||
|
||||
function failed() {
|
||||
var callbacks = state.failed, i = callbacks.length;
|
||||
|
||||
while (i--) {
|
||||
callbacks[i]();
|
||||
}
|
||||
|
||||
state.status = 3;
|
||||
state.passed = [];
|
||||
state.failed = [];
|
||||
}
|
||||
|
||||
// Sniffs for older WebKit versions that have the link.onload but a broken one
|
||||
function isOldWebKit() {
|
||||
var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/);
|
||||
return !!(webKitChunks && webKitChunks[1] < 536);
|
||||
}
|
||||
|
||||
// Calls the waitCallback until the test returns true or the timeout occurs
|
||||
function wait(testCallback, waitCallback) {
|
||||
if (!testCallback()) {
|
||||
// Wait for timeout
|
||||
if ((new Date().getTime()) - startTime < maxLoadTime) {
|
||||
window.setTimeout(waitCallback, 0);
|
||||
} else {
|
||||
failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workaround for WebKit that doesn't properly support the onload event for link elements
|
||||
// Or WebKit that fires the onload event before the StyleSheet is added to the document
|
||||
function waitForWebKitLinkLoaded() {
|
||||
wait(function() {
|
||||
var styleSheets = document.styleSheets, styleSheet, i = styleSheets.length, owner;
|
||||
|
||||
while (i--) {
|
||||
styleSheet = styleSheets[i];
|
||||
owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement;
|
||||
if (owner && owner.id === link.id) {
|
||||
passed();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}, waitForWebKitLinkLoaded);
|
||||
}
|
||||
|
||||
// Workaround for older Geckos that doesn't have any onload event for StyleSheets
|
||||
function waitForGeckoLinkLoaded() {
|
||||
wait(function() {
|
||||
try {
|
||||
// Accessing the cssRules will throw an exception until the CSS file is loaded
|
||||
var cssRules = style.sheet.cssRules;
|
||||
passed();
|
||||
return !!cssRules;
|
||||
} catch (ex) {
|
||||
// Ignore
|
||||
}
|
||||
}, waitForGeckoLinkLoaded);
|
||||
}
|
||||
|
||||
if (!loadedStates[url]) {
|
||||
state = {
|
||||
passed: [],
|
||||
failed: []
|
||||
};
|
||||
|
||||
loadedStates[url] = state;
|
||||
} else {
|
||||
state = loadedStates[url];
|
||||
}
|
||||
|
||||
if (loadedCallback) {
|
||||
state.passed.push(loadedCallback);
|
||||
}
|
||||
|
||||
if (errorCallback) {
|
||||
state.failed.push(errorCallback);
|
||||
}
|
||||
|
||||
// Is loading wait for it to pass
|
||||
if (state.status == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Has finished loading and was success
|
||||
if (state.status == 2) {
|
||||
passed();
|
||||
return;
|
||||
}
|
||||
|
||||
// Has finished loading and was a failure
|
||||
if (state.status == 3) {
|
||||
failed();
|
||||
return;
|
||||
}
|
||||
|
||||
// Start loading
|
||||
state.status = 1;
|
||||
link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.id = 'u' + (idCount++);
|
||||
link.async = false;
|
||||
link.defer = false;
|
||||
startTime = new Date().getTime();
|
||||
|
||||
// Feature detect onload on link element and sniff older webkits since it has an broken onload event
|
||||
if ("onload" in link && !isOldWebKit()) {
|
||||
link.onload = waitForWebKitLinkLoaded;
|
||||
link.onerror = failed;
|
||||
} else {
|
||||
// Sniff for old Firefox that doesn't support the onload event on link elements
|
||||
// TODO: Remove this in the future when everyone uses modern browsers
|
||||
if (navigator.userAgent.indexOf("Firefox") > 0) {
|
||||
style = document.createElement('style');
|
||||
style.textContent = '@import "' + url + '"';
|
||||
waitForGeckoLinkLoaded();
|
||||
appendToHead(style);
|
||||
return;
|
||||
} else {
|
||||
// Use the id owner on older webkits
|
||||
waitForWebKitLinkLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
appendToHead(link);
|
||||
link.href = url;
|
||||
}
|
||||
|
||||
this.load = load;
|
||||
};
|
||||
});
|
||||
|
||||
// Included from: js/tinymce/classes/dom/DOMUtils.js
|
||||
|
||||
/**
|
||||
@ -5421,8 +5609,9 @@ define("tinymce/dom/DOMUtils", [
|
||||
"tinymce/dom/Range",
|
||||
"tinymce/html/Entities",
|
||||
"tinymce/Env",
|
||||
"tinymce/util/Tools"
|
||||
], function(Sizzle, Styles, EventUtils, TreeWalker, Range, Entities, Env, Tools) {
|
||||
"tinymce/util/Tools",
|
||||
"tinymce/dom/StyleSheetLoader"
|
||||
], function(Sizzle, Styles, EventUtils, TreeWalker, Range, Entities, Env, Tools, StyleSheetLoader) {
|
||||
// Shorten names
|
||||
var each = Tools.each, is = Tools.is, grep = Tools.grep, trim = Tools.trim, extend = Tools.extend;
|
||||
var isWebKit = Env.webkit, isIE = Env.ie;
|
||||
@ -5448,6 +5637,7 @@ define("tinymce/dom/DOMUtils", [
|
||||
self.stdMode = !isIE || doc.documentMode >= 8;
|
||||
self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode;
|
||||
self.hasOuterHTML = "outerHTML" in doc.createElement("a");
|
||||
self.styleSheetLoader = new StyleSheetLoader(doc);
|
||||
this.boundEvents = [];
|
||||
|
||||
self.settings = settings = extend({
|
||||
@ -6395,8 +6585,8 @@ define("tinymce/dom/DOMUtils", [
|
||||
|
||||
// Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit
|
||||
// Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position
|
||||
x = pos.left + (doc.documentElement.scrollLeft || doc.body.scrollLeft) - rootElm.clientTop;
|
||||
y = pos.top + (doc.documentElement.scrollTop || doc.body.scrollTop) - rootElm.clientLeft;
|
||||
x = pos.left + (doc.documentElement.scrollLeft || doc.body.scrollLeft) - rootElm.clientLeft;
|
||||
y = pos.top + (doc.documentElement.scrollTop || doc.body.scrollTop) - rootElm.clientTop;
|
||||
|
||||
return {x: x, y: y};
|
||||
}
|
||||
@ -12189,11 +12379,13 @@ define("tinymce/dom/ControlSelection", [
|
||||
var controlElm;
|
||||
|
||||
function isChildOrEqual(node, parent) {
|
||||
do {
|
||||
if (node === parent) {
|
||||
return true;
|
||||
}
|
||||
} while ((node = node.parentNode));
|
||||
if (node) {
|
||||
do {
|
||||
if (node === parent) {
|
||||
return true;
|
||||
}
|
||||
} while ((node = node.parentNode));
|
||||
}
|
||||
}
|
||||
|
||||
// Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
|
||||
@ -12204,7 +12396,7 @@ define("tinymce/dom/ControlSelection", [
|
||||
controlElm = e.type == 'mousedown' ? e.target : selection.getNode();
|
||||
controlElm = dom.getParent(controlElm, isIE ? 'table' : 'table,img,hr');
|
||||
|
||||
if (controlElm) {
|
||||
if (isChildOrEqual(controlElm, editor.getBody())) {
|
||||
disableGeckoResize();
|
||||
|
||||
if (isChildOrEqual(selection.getStart(), controlElm) && isChildOrEqual(selection.getEnd(), controlElm)) {
|
||||
@ -12366,6 +12558,10 @@ define("tinymce/dom/ControlSelection", [
|
||||
}
|
||||
|
||||
return {
|
||||
isResizable: isResizable,
|
||||
showResizeRect: showResizeRect,
|
||||
hideResizeRect: hideResizeRect,
|
||||
updateResizeRect: updateResizeRect,
|
||||
controlSelect: controlSelect,
|
||||
destroy: destroy
|
||||
};
|
||||
@ -12800,7 +12996,7 @@ define("tinymce/dom/Selection", [
|
||||
|
||||
if (type == 2) {
|
||||
element = t.getNode();
|
||||
name = element.nodeName;
|
||||
name = element ? element.nodeName : null;
|
||||
|
||||
if (name == 'IMG') {
|
||||
return {name: name, index: findIndex(name, element)};
|
||||
@ -13184,7 +13380,8 @@ define("tinymce/dom/Selection", [
|
||||
}
|
||||
|
||||
// We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet
|
||||
if (isIE && rng && rng.setStart) {
|
||||
// IE 11 doesn't support the selection object so we check for that as well
|
||||
if (isIE && rng && rng.setStart && doc.selection) {
|
||||
try {
|
||||
// IE will sometimes throw an exception here
|
||||
ieRng = doc.selection.createRange();
|
||||
@ -15969,7 +16166,7 @@ define("tinymce/Formatter", [
|
||||
next = next ? 'nextSibling' : 'previousSibling';
|
||||
|
||||
for (node = inc ? node : node[next]; node; node = node[next]) {
|
||||
if (node.nodeType == 1 || !isWhiteSpaceNode(node)) {
|
||||
if (node.nodeType == 1 && !isWhiteSpaceNode(node)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
@ -16027,7 +16224,7 @@ define("tinymce/Formatter", [
|
||||
var name = attr.nodeName.toLowerCase();
|
||||
|
||||
// Don't compare internal attributes or style
|
||||
if (name.indexOf('_') !== 0 && name !== 'style') {
|
||||
if (name.indexOf('_') !== 0 && name !== 'style' && name !== 'data-mce-style') {
|
||||
attribs[name] = dom.getAttrib(node, name);
|
||||
}
|
||||
});
|
||||
@ -18166,10 +18363,10 @@ define("tinymce/EditorCommands", [
|
||||
}
|
||||
|
||||
each(selection.getSelectedBlocks(), function(element) {
|
||||
var indentStyleName;
|
||||
|
||||
if (element.nodeName != "LI") {
|
||||
indentStyleName = dom.getStyle(element, 'direction', true) == 'rtl' ? 'paddingRight' : 'paddingLeft';
|
||||
var indentStyleName = editor.getParam('indent_use_margin', false) ? 'margin' : 'padding';
|
||||
|
||||
indentStyleName += dom.getStyle(element, 'direction', true) == 'rtl' ? 'Right' : 'Left';
|
||||
|
||||
if (command == 'outdent') {
|
||||
value = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - intentValue);
|
||||
@ -19835,7 +20032,6 @@ define("tinymce/ui/Control", [
|
||||
|
||||
var Control = Class.extend({
|
||||
Statics: {
|
||||
controlIdLookup: {},
|
||||
elementIdCache: elementIdCache
|
||||
},
|
||||
|
||||
@ -19957,10 +20153,10 @@ define("tinymce/ui/Control", [
|
||||
* @return {tinymce.ui.Control} Control instance or undefined.
|
||||
*/
|
||||
getParentCtrl: function(elm) {
|
||||
var ctrl;
|
||||
var ctrl, lookup = this.getRoot().controlIdLookup;
|
||||
|
||||
while (elm) {
|
||||
ctrl = Control.controlIdLookup[elm.id];
|
||||
while (elm && lookup) {
|
||||
ctrl = lookup[elm.id];
|
||||
if (ctrl) {
|
||||
break;
|
||||
}
|
||||
@ -20840,7 +21036,7 @@ define("tinymce/ui/Control", [
|
||||
|
||||
if (self._rendered) {
|
||||
if (name == 'label') {
|
||||
elm.setAttribute('aria-labeledby', self._id);
|
||||
elm.setAttribute('aria-labelledby', self._id);
|
||||
}
|
||||
|
||||
elm.setAttribute(name == 'role' ? name : 'aria-' + name, value);
|
||||
@ -20936,7 +21132,11 @@ define("tinymce/ui/Control", [
|
||||
DomUtils.off(elm);
|
||||
}
|
||||
|
||||
delete Control.controlIdLookup[self._id];
|
||||
var lookup = self.getRoot().controlIdLookup;
|
||||
if (lookup) {
|
||||
delete lookup[self._id];
|
||||
}
|
||||
|
||||
delete elementIdCache[self._id];
|
||||
|
||||
if (elm && elm.parentNode) {
|
||||
@ -20950,6 +21150,8 @@ define("tinymce/ui/Control", [
|
||||
elm.parentNode.removeChild(elm);
|
||||
}
|
||||
|
||||
self._rendered = false;
|
||||
|
||||
return self;
|
||||
},
|
||||
|
||||
@ -21039,7 +21241,12 @@ define("tinymce/ui/Control", [
|
||||
}
|
||||
|
||||
// Add instance to lookup
|
||||
Control.controlIdLookup[self._id] = self;
|
||||
var root = self.getRoot();
|
||||
if (!root.controlIdLookup) {
|
||||
root.controlIdLookup = {};
|
||||
}
|
||||
|
||||
root.controlIdLookup[self._id] = self;
|
||||
|
||||
for (var key in self._aria) {
|
||||
self.aria(key, self._aria[key]);
|
||||
@ -21235,6 +21442,32 @@ define("tinymce/ui/Control", [
|
||||
}
|
||||
},
|
||||
|
||||
getRoot: function() {
|
||||
var ctrl = this, rootControl, parents = [];
|
||||
|
||||
while (ctrl) {
|
||||
if (ctrl.rootControl) {
|
||||
rootControl = ctrl.rootControl;
|
||||
break;
|
||||
}
|
||||
|
||||
parents.push(ctrl);
|
||||
rootControl = ctrl;
|
||||
ctrl = ctrl.parent();
|
||||
}
|
||||
|
||||
if (!rootControl) {
|
||||
rootControl = this;
|
||||
}
|
||||
|
||||
var i = parents.length;
|
||||
while (i--) {
|
||||
parents[i].rootControl = rootControl;
|
||||
}
|
||||
|
||||
return rootControl;
|
||||
},
|
||||
|
||||
/**
|
||||
* Reflows the current control and it's parents.
|
||||
* This should be used after you for example append children to the current control so
|
||||
@ -21783,13 +22016,13 @@ define("tinymce/ui/Container", [
|
||||
* @return {String} HTML representing the control.
|
||||
*/
|
||||
renderHtml: function() {
|
||||
var self = this, layout = self._layout;
|
||||
var self = this, layout = self._layout, role = this.settings.role;
|
||||
|
||||
self.preRender();
|
||||
layout.preRender(self);
|
||||
|
||||
return (
|
||||
'<div id="' + self._id + '" class="' + self.classes() + '" role="' + this.settings.role + '">' +
|
||||
'<div id="' + self._id + '" class="' + self.classes() + '"' + (role ? ' role="' + this.settings.role + '"' : '') + '>' +
|
||||
'<div id="' + self._id + '-body" class="' + self.classes('body') + '">'+
|
||||
(self.settings.html || '') + layout.renderHtml(self) +
|
||||
'</div>' +
|
||||
@ -22668,13 +22901,11 @@ define("tinymce/ui/FloatPanel", [
|
||||
if (settings.autohide) {
|
||||
if (!documentClickHandler) {
|
||||
documentClickHandler = function(e) {
|
||||
var i, clickCtrl = self.getParentCtrl(e.target);
|
||||
|
||||
// Hide any float panel when a click is out side that float panel and the
|
||||
// float panels direct parent for example a click on a menu button
|
||||
i = visiblePanels.length;
|
||||
var i = visiblePanels.length;
|
||||
while (i--) {
|
||||
var panel = visiblePanels[i];
|
||||
var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target);
|
||||
|
||||
if (panel.settings.autohide) {
|
||||
if (clickCtrl) {
|
||||
@ -23561,7 +23792,7 @@ define("tinymce/ui/Window", [
|
||||
focusCtrl = focusCtrl || ctrl;
|
||||
|
||||
// TODO: Figure out a better way
|
||||
if (ctrl.type == 'filepicker') {
|
||||
if (ctrl.subinput) {
|
||||
items.push(ctrl.getEl('inp'));
|
||||
|
||||
if (ctrl.getEl('open')) {
|
||||
@ -24264,7 +24495,7 @@ define("tinymce/util/Quirks", [
|
||||
});
|
||||
|
||||
editor.on('keypress', function(e) {
|
||||
if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode) {
|
||||
if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode && !VK.metaKeyPressed(e)) {
|
||||
e.preventDefault();
|
||||
customDelete(true);
|
||||
editor.selection.setContent(String.fromCharCode(e.charCode));
|
||||
@ -24415,7 +24646,7 @@ define("tinymce/util/Quirks", [
|
||||
// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event
|
||||
dom.bind(editor.getDoc(), 'mousedown', function(e) {
|
||||
if (e.target == editor.getDoc().documentElement) {
|
||||
editor.getWin().focus();
|
||||
editor.getBody().focus();
|
||||
selection.setRng(selection.getRng());
|
||||
}
|
||||
});
|
||||
@ -25064,6 +25295,13 @@ define("tinymce/util/Quirks", [
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the autolinking in IE 9+ this is then re-enabled by the autolink plugin.
|
||||
*/
|
||||
function disableAutoUrlDetect() {
|
||||
setEditorCommandState("AutoUrlDetect", false);
|
||||
}
|
||||
|
||||
// All browsers
|
||||
disableBackspaceIntoATable();
|
||||
removeBlockQuoteOnBackSpace();
|
||||
@ -25105,6 +25343,7 @@ define("tinymce/util/Quirks", [
|
||||
|
||||
if (Env.ie) {
|
||||
selectAll();
|
||||
disableAutoUrlDetect();
|
||||
}
|
||||
|
||||
// Gecko
|
||||
@ -25560,13 +25799,13 @@ define("tinymce/Editor", [
|
||||
var isGecko = Env.gecko, ie = Env.ie;
|
||||
|
||||
function getEventTarget(editor, eventName) {
|
||||
if (eventName == 'selectionchange' || eventName == 'drop') {
|
||||
if (eventName == 'selectionchange') {
|
||||
return editor.getDoc();
|
||||
}
|
||||
|
||||
// Need to bind mousedown/mouseup etc to document not body in iframe mode
|
||||
// Since the user might click on the HTML element not the BODY
|
||||
if (!editor.inline && /^mouse|click|contextmenu/.test(eventName)) {
|
||||
if (!editor.inline && /^mouse|click|contextmenu|drop/.test(eventName)) {
|
||||
return editor.getDoc();
|
||||
}
|
||||
|
||||
@ -25745,8 +25984,8 @@ define("tinymce/Editor", [
|
||||
self.inline = settings.inline;
|
||||
|
||||
// Call setup
|
||||
self.execCallback('setup', self);
|
||||
editorManager.fire('SetupEditor', self);
|
||||
self.execCallback('setup', self);
|
||||
}
|
||||
|
||||
Editor.prototype = {
|
||||
@ -25872,7 +26111,7 @@ define("tinymce/Editor", [
|
||||
function loadScripts() {
|
||||
var scriptLoader = ScriptLoader.ScriptLoader;
|
||||
|
||||
if (settings.language && settings.language != 'en') {
|
||||
if (settings.language && settings.language != 'en' && !settings.language_url) {
|
||||
settings.language_url = self.editorManager.baseURL + '/langs/' + settings.language + '.js';
|
||||
}
|
||||
|
||||
@ -27917,7 +28156,11 @@ define("tinymce/FocusManager", [
|
||||
if (!isUIElement(getActiveElement()) && focusedEditor == editor) {
|
||||
editor.fire('blur', {focusedEditor: null});
|
||||
editorManager.focusedEditor = null;
|
||||
editor.selection.lastFocusBookmark = null;
|
||||
|
||||
// Make sure selection is valid could be invalid if the editor is blured and removed before the timeout occurs
|
||||
if (editor.selection) {
|
||||
editor.selection.lastFocusBookmark = null;
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
@ -27929,7 +28172,11 @@ define("tinymce/FocusManager", [
|
||||
var activeEditor = editorManager.activeEditor;
|
||||
|
||||
if (activeEditor && e.target.ownerDocument == document) {
|
||||
activeEditor.selection.lastFocusBookmark = createBookmark(activeEditor.lastRng);
|
||||
|
||||
// Check to make sure we have a valid selection
|
||||
if (activeEditor.selection) {
|
||||
activeEditor.selection.lastFocusBookmark = createBookmark(activeEditor.lastRng);
|
||||
}
|
||||
|
||||
// Fire a blur event if the element isn't a UI element
|
||||
if (!isUIElement(e.target) && editorManager.focusedEditor == activeEditor) {
|
||||
@ -28007,7 +28254,7 @@ define("tinymce/EditorManager", [
|
||||
* @property minorVersion
|
||||
* @type String
|
||||
*/
|
||||
minorVersion : '0.12',
|
||||
minorVersion : '0.14',
|
||||
|
||||
/**
|
||||
* Release date of TinyMCE build.
|
||||
@ -28015,7 +28262,7 @@ define("tinymce/EditorManager", [
|
||||
* @property releaseDate
|
||||
* @type String
|
||||
*/
|
||||
releaseDate: '2013-12-18',
|
||||
releaseDate: '2014-01-30',
|
||||
|
||||
/**
|
||||
* Collection of editor instances.
|
||||
@ -30023,7 +30270,7 @@ define("tinymce/ui/Checkbox", [
|
||||
var self = this, id = self._id, prefix = self.classPrefix;
|
||||
|
||||
return (
|
||||
'<div id="' + id + '" class="' + self.classes() + '" unselectable="on" aria-labeledby="' + id + '-al" tabindex="-1">' +
|
||||
'<div id="' + id + '" class="' + self.classes() + '" unselectable="on" aria-labelledby="' + id + '-al" tabindex="-1">' +
|
||||
'<i class="' + prefix + 'ico ' + prefix + 'i-checkbox"></i>' +
|
||||
'<span id="' + id +'-al" class="' + prefix + 'label">' + self.encode(self._text) + '</span>' +
|
||||
'</div>'
|
||||
@ -30258,8 +30505,9 @@ define("tinymce/ui/ColorButton", [
|
||||
*/
|
||||
define("tinymce/ui/ComboBox", [
|
||||
"tinymce/ui/Widget",
|
||||
"tinymce/ui/Factory",
|
||||
"tinymce/ui/DomUtils"
|
||||
], function(Widget, DomUtils) {
|
||||
], function(Widget, Factory, DomUtils) {
|
||||
"use strict";
|
||||
|
||||
return Widget.extend({
|
||||
@ -30275,6 +30523,14 @@ define("tinymce/ui/ComboBox", [
|
||||
|
||||
self._super(settings);
|
||||
self.addClass('combobox');
|
||||
self.subinput = true;
|
||||
|
||||
settings = self.settings;
|
||||
settings.menu = settings.menu || settings.values;
|
||||
|
||||
if (settings.menu) {
|
||||
settings.icon = 'caret';
|
||||
}
|
||||
|
||||
self.on('click', function(e) {
|
||||
var elm = e.target;
|
||||
@ -30282,6 +30538,14 @@ define("tinymce/ui/ComboBox", [
|
||||
while (elm) {
|
||||
if (elm.id && elm.id.indexOf('-open') != -1) {
|
||||
self.fire('action');
|
||||
|
||||
if (settings.menu) {
|
||||
self.showMenu();
|
||||
|
||||
if (e.keyboard) {
|
||||
self.menu.items()[0].focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elm = elm.parentNode;
|
||||
@ -30330,6 +30594,55 @@ define("tinymce/ui/ComboBox", [
|
||||
}
|
||||
},
|
||||
|
||||
showMenu: function() {
|
||||
var self = this, settings = self.settings, menu;
|
||||
|
||||
if (!self.menu) {
|
||||
menu = settings.menu || [];
|
||||
|
||||
// Is menu array then auto constuct menu control
|
||||
if (menu.length) {
|
||||
menu = {
|
||||
type: 'menu',
|
||||
items: menu
|
||||
};
|
||||
} else {
|
||||
menu.type = menu.type || 'menu';
|
||||
}
|
||||
|
||||
self.menu = Factory.create(menu).parent(self).renderTo(self.getContainerElm());
|
||||
self.fire('createmenu');
|
||||
self.menu.reflow();
|
||||
self.menu.on('cancel', function(e) {
|
||||
if (e.control === self.menu) {
|
||||
self.focus();
|
||||
}
|
||||
});
|
||||
|
||||
self.menu.on('show hide', function(e) {
|
||||
e.control.items().each(function(ctrl) {
|
||||
ctrl.active(ctrl.value() == self.value());
|
||||
});
|
||||
}).fire('show');
|
||||
|
||||
self.menu.on('select', function(e) {
|
||||
self.value(e.control.value());
|
||||
});
|
||||
|
||||
self.on('focusin', function(e) {
|
||||
if (e.target.tagName == 'INPUT') {
|
||||
self.menu.hide();
|
||||
}
|
||||
});
|
||||
|
||||
self.aria('expanded', true);
|
||||
}
|
||||
|
||||
self.menu.show();
|
||||
self.menu.layoutRect({w: self.layoutRect().w});
|
||||
self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']);
|
||||
},
|
||||
|
||||
/**
|
||||
* Getter/setter function for the control value.
|
||||
*
|
||||
@ -30451,16 +30764,40 @@ define("tinymce/ui/ComboBox", [
|
||||
renderHtml: function() {
|
||||
var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;
|
||||
var value = settings.value || settings.placeholder || '';
|
||||
var icon, text, openBtnHtml = '';
|
||||
var icon, text, openBtnHtml = '', extraAttrs = '';
|
||||
|
||||
if ("spellcheck" in settings) {
|
||||
extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
|
||||
}
|
||||
|
||||
if (settings.maxLength) {
|
||||
extraAttrs += ' maxlength="' + settings.maxLength + '"';
|
||||
}
|
||||
|
||||
if (settings.size) {
|
||||
extraAttrs += ' size="' + settings.size + '"';
|
||||
}
|
||||
|
||||
if (settings.subtype) {
|
||||
extraAttrs += ' type="' + settings.subtype + '"';
|
||||
}
|
||||
|
||||
if (self.disabled()) {
|
||||
extraAttrs += ' disabled="disabled"';
|
||||
}
|
||||
|
||||
icon = settings.icon;
|
||||
if (icon && icon != 'caret') {
|
||||
icon = prefix + 'ico ' + prefix + 'i-' + settings.icon;
|
||||
}
|
||||
|
||||
icon = settings.icon ? prefix + 'ico ' + prefix + 'i-' + settings.icon : '';
|
||||
text = self._text;
|
||||
|
||||
if (icon || text) {
|
||||
openBtnHtml = (
|
||||
'<div id="' + id + '-open" class="' + prefix + 'btn ' + prefix + 'open" tabIndex="-1">' +
|
||||
'<button id="' + id + '-action" type="button" hidefocus tabindex="-1">' +
|
||||
(icon ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') +
|
||||
(icon != 'caret' ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') +
|
||||
(text ? (icon ? ' ' : '') + text : '') +
|
||||
'</button>' +
|
||||
'</div>'
|
||||
@ -30472,7 +30809,7 @@ define("tinymce/ui/ComboBox", [
|
||||
return (
|
||||
'<div id="' + id + '" class="' + self.classes() + '">' +
|
||||
'<input id="' + id + '-inp" class="' + prefix + 'textbox ' + prefix + 'placeholder" value="' +
|
||||
value + '" hidefocus="true"' + (self.disabled() ? ' disabled="disabled"' : '') + '>' +
|
||||
value + '" hidefocus="true"' + extraAttrs + '>' +
|
||||
openBtnHtml +
|
||||
'</div>'
|
||||
);
|
||||
@ -30844,7 +31181,7 @@ define("tinymce/ui/Form", [
|
||||
autoResize: "overflow",
|
||||
defaults: {flex: 1},
|
||||
items: [
|
||||
{type: 'label', text: label, flex: 0, forId: ctrl._id}
|
||||
{type: 'label', text: label, flex: 0, forId: ctrl._id, disabled: ctrl.disabled()}
|
||||
]
|
||||
});
|
||||
|
||||
@ -31457,7 +31794,7 @@ define("tinymce/ui/FormatControls", [
|
||||
// Default preview
|
||||
if (!previewStyles) {
|
||||
previewStyles = 'font-family font-size font-weight font-style text-decoration ' +
|
||||
'text-transform color background-color border border-radius';
|
||||
'text-transform color background-color border border-radius outline text-shadow';
|
||||
}
|
||||
|
||||
// Removes any variables since these can't be previewed
|
||||
@ -31679,17 +32016,31 @@ define("tinymce/ui/FormatControls", [
|
||||
return menu;
|
||||
}
|
||||
|
||||
function createStylesMenu() {
|
||||
var menu;
|
||||
|
||||
if (editor.settings.style_formats_merge) {
|
||||
if (editor.settings.style_formats) {
|
||||
menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats));
|
||||
} else {
|
||||
menu = createMenu(defaultStyleFormats);
|
||||
}
|
||||
} else {
|
||||
menu = createMenu(editor.settings.style_formats || defaultStyleFormats);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
editor.on('init', function() {
|
||||
each(newFormats, function(format) {
|
||||
editor.formatter.register(format.name, format);
|
||||
});
|
||||
});
|
||||
|
||||
var menu = createMenu(editor.settings.style_formats || defaultStyleFormats);
|
||||
|
||||
menu = {
|
||||
return {
|
||||
type: 'menu',
|
||||
items: menu,
|
||||
items: createStylesMenu(),
|
||||
onPostRender: function(e) {
|
||||
editor.fire('renderFormatsMenu', {control: e.control});
|
||||
},
|
||||
@ -31720,8 +32071,6 @@ define("tinymce/ui/FormatControls", [
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
formatMenu = createFormatMenu();
|
||||
@ -31781,7 +32130,7 @@ define("tinymce/ui/FormatControls", [
|
||||
|
||||
// Simple command controls with format state
|
||||
each({
|
||||
blockquote: ['Toggle blockquote', 'mceBlockQuote'],
|
||||
blockquote: ['Blockquote', 'mceBlockQuote'],
|
||||
numlist: ['Numbered list', 'InsertOrderedList'],
|
||||
bullist: ['Bullet list', 'InsertUnorderedList'],
|
||||
subscript: ['Subscript', 'Subscript'],
|
||||
@ -32476,7 +32825,7 @@ define("tinymce/ui/Label", [
|
||||
var self = this, forId = self.settings.forId;
|
||||
|
||||
return (
|
||||
'<label id="' + self._id + '" class="' + self.classes() + '"' + (forId ? ' for="' + forId : '') + '">' +
|
||||
'<label id="' + self._id + '" class="' + self.classes() + '"' + (forId ? ' for="' + forId +'"' : '') + '>' +
|
||||
self.encode(self._text) +
|
||||
'</label>'
|
||||
);
|
||||
@ -33478,7 +33827,7 @@ define("tinymce/ui/ResizeHandle", [
|
||||
self.fire('Resize', e);
|
||||
},
|
||||
|
||||
end: function() {
|
||||
stop: function() {
|
||||
self.fire('ResizeEnd');
|
||||
}
|
||||
});
|
||||
@ -34152,5 +34501,5 @@ define("tinymce/ui/Throbber", [
|
||||
};
|
||||
});
|
||||
|
||||
expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/util/Tools","tinymce/dom/Range","tinymce/html/Entities","tinymce/Env","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/Selection","tinymce/dom/RangeUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/KeyboardNavigation","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/ui/ComboBox","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]);
|
||||
})(this);
|
||||
expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/util/Tools","tinymce/dom/Range","tinymce/html/Entities","tinymce/Env","tinymce/dom/StyleSheetLoader","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/Selection","tinymce/dom/RangeUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/KeyboardNavigation","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/ui/ComboBox","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]);
|
||||
})(this);
|
||||
|
20
wp-includes/js/tinymce/tinymce.min.js
vendored
20
wp-includes/js/tinymce/tinymce.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -18,7 +18,7 @@ $wp_db_version = 26691;
|
||||
*
|
||||
* @global string $tinymce_version
|
||||
*/
|
||||
$tinymce_version = '4012-20140125';
|
||||
$tinymce_version = '4014-20140130';
|
||||
|
||||
/**
|
||||
* Holds the required PHP version
|
||||
|
Loading…
Reference in New Issue
Block a user