WordPress/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js

1 line
2.9 KiB
JavaScript
Raw Normal View History

!function(n){function e(n){!i&&window&&window.console&&(i=!0,console.log("Deprecated TinyMCE API call: "+n))}function t(n,t,o,i){n=n||this,this.add=function(r,a){function d(e){var d=[];if("string"==typeof o&&(o=o.split(" ")),o&&"function"!=typeof o)for(var s=0;s<o.length;s++)d.push(e[o[s]]);("function"!=typeof o||(d=o(t,e,n)))&&(o||(d=[e]),d.unshift(i||n),r.apply(a||i||n,d)===!1&&e.stopImmediatePropagation())}return e("<target>.on"+t+".add(..)"),n.on(t,d),d},this.addToTop=this.add,this.remove=function(e){return n.off(t,e)},this.dispatch=function(){return n.fire(t),!0}}function o(o){function i(e,i){n.each(e.split(" "),function(n){o["on"+n]=new t(o,n,i)})}function r(n,e,t){return[e.level,t]}function a(n){return function(e,t){return!t.selection&&!n||t.selection==n?[t]:void 0}}if(!o.controlManager){o.controlManager={buttons:{},setDisabled:function(n,t){e("controlManager.setDisabled(..)"),this.buttons[n]&&this.buttons[n].disabled(t)},setActive:function(n,t){e("controlManager.setActive(..)"),this.buttons[n]&&this.buttons[n].active(t)}},i("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),i("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),i("BeforeExecCommand ExecCommand","command ui value args"),i("PreProcess PostProcess LoadContent SaveContent Change"),i("BeforeSetContent BeforeGetContent SetContent GetContent",a(!1)),i("SetProgressState","state time"),i("VisualAid","element hasVisual"),i("Undo Redo",r),i("NodeChange",function(n,e){return[o.controlManager,e.element,o.selection.isCollapsed(),e]});var d=o.addButton;o.addButton=function(e,t){function i(){return o.controlManager.buttons[e]=this,r?r.call(this):void 0}var r;for(var a in t)"onpostrender"===a.toLowerCase()&&(r=t[a],t.onPostRender=i);return r||(t.onPostRender=i),t.title=n.i18n.translate((o.settings.language||"en")+"."+t.title),d.call(this,e,t)},o.on("init",function(){var i=o.undoManager,d=o.selection;i.onUndo=new t(o,"Undo",r,null,i),i.onRedo=new t(o,"Redo",r,null,i),i.onBeforeAdd=new t(o,"BeforeAddUndo",null,i),i.onAdd=new t(o,"AddUndo",null,i),d.onBeforeGetContent=new t(o,"BeforeGetContent",a(!0),d),d.onGetContent=new t(o,"GetContent",a(!0),d),d.onBeforeSetContent=new t(o,"BeforeSetContent",a(!0),d),d.onSetContent=new t(o,"SetContent",a(!0),d),o.windowManager.createInstance=function(t,o,i,r,a,d){e("windowManager.createInstance(..)");var s=n.resolve(t);return new s(o,i,r,a,d)}})}}var i;n.onBeforeUnload=new t(n,"BeforeUnload"),n.onAddEditor=new t(n,"AddEditor","editor"),n.onRemoveEditor=new t(n,"RemoveEditor","editor"),n.on("SetupEditor",o),n.PluginManager.add("compat3x",o),n.addI18n=function(e,t){var o=n.util.I18n,i=n.each;return"string"==typeof e&&-1===e.indexOf(".")?(o.add(e,t),void 0):(n.is(e,"string")?i(t,function(n,t){o.data[e+"."+t]=n}):i(e,function(n,e){i(n,function(n,t){i(n,function(n,i){"common"===t?o.data[e+"."+i]=n:o.data[e+"."+t+"."+i]=n})})}),void 0)}}(tinymce);