ttrss/lib/dijit/Editor.js

2 lines
11 KiB
JavaScript
Raw Normal View History

2012-08-14 14:59:10 +00:00
//>>built
2018-12-04 13:23:37 +00:00
define("dijit/Editor",["require","dojo/_base/array","dojo/_base/declare","dojo/Deferred","dojo/i18n","dojo/dom-attr","dojo/dom-class","dojo/dom-geometry","dojo/dom-style","dojo/keys","dojo/_base/lang","dojo/sniff","dojo/string","dojo/topic","./_Container","./Toolbar","./ToolbarSeparator","./layout/_LayoutWidget","./form/ToggleButton","./_editor/_Plugin","./_editor/plugins/EnterKeyHandling","./_editor/html","./_editor/range","./_editor/RichText","./main","dojo/i18n!./_editor/nls/commands"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19){var _1a=_3("dijit.Editor",_18,{plugins:null,extraPlugins:null,constructor:function(){if(!_b.isArray(this.plugins)){this.plugins=["undo","redo","|","cut","copy","paste","|","bold","italic","underline","strikethrough","|","insertOrderedList","insertUnorderedList","indent","outdent","|","justifyLeft","justifyRight","justifyCenter","justifyFull",_15];}this._plugins=[];this._editInterval=this.editActionInterval*1000;if(_c("ie")||_c("trident")||_c("edge")){this.events.push("onBeforeDeactivate");this.events.push("onBeforeActivate");}},postMixInProperties:function(){this.setValueDeferred=new _4();this.inherited(arguments);},postCreate:function(){this.inherited(arguments);this._steps=this._steps.slice(0);this._undoedSteps=this._undoedSteps.slice(0);if(_b.isArray(this.extraPlugins)){this.plugins=this.plugins.concat(this.extraPlugins);}this.commands=_5.getLocalization("dijit._editor","commands",this.lang);if(_c("webkit")){_9.set(this.domNode,"KhtmlUserSelect","none");}},startup:function(){this.inherited(arguments);if(!this.toolbar){this.toolbar=new _10({ownerDocument:this.ownerDocument,dir:this.dir,lang:this.lang,"aria-label":this.id});this.header.appendChild(this.toolbar.domNode);}_2.forEach(this.plugins,this.addPlugin,this);this.setValueDeferred.resolve(true);_7.add(this.iframe.parentNode,"dijitEditorIFrameContainer");_7.add(this.iframe,"dijitEditorIFrame");_6.set(this.iframe,"allowTransparency",true);this.toolbar.startup();this.onNormalizedDisplayChanged();},destroy:function(){_2.forEach(this._plugins,function(p){if(p&&p.destroy){p.destroy();}});this._plugins=[];this.toolbar.destroyRecursive();delete this.toolbar;this.inherited(arguments);},addPlugin:function(_1b,_1c){var _1d=_b.isString(_1b)?{name:_1b}:_b.isFunction(_1b)?{ctor:_1b}:_1b;if(!_1d.setEditor){var o={"args":_1d,"plugin":null,"editor":this};if(_1d.name){if(_14.registry[_1d.name]){o.plugin=_14.registry[_1d.name](_1d);}else{_e.publish(_19._scopeName+".Editor.getPlugin",o);}}if(!o.plugin){try{var pc=_1d.ctor||_b.getObject(_1d.name)||_1(_1d.name);if(pc){o.plugin=new pc(_1d);}}catch(e){throw new Error(this.id+": cannot find plugin ["+_1d.name+"]");}}if(!o.plugin){throw new Error(this.id+": cannot find plugin ["+_1d.name+"]");}_1b=o.plugin;}if(arguments.length>1){this._plugins[_1c]=_1b;}else{this._plugins.push(_1b);}_1b.setEditor(this);if(_b.isFunction(_1b.setToolbar)){_1b.setToolbar(this.toolbar);}},resize:function(_1e){if(_1e){_12.prototype.resize.apply(this,arguments);}},layout:function(){var _1f=(this._contentBox.h-(this.getHeaderHeight()+this.getFooterHeight()+_8.getPadBorderExtents(this.iframe.parentNode).h+_8.getMarginExtents(this.iframe.parentNode).h));this.editingArea.style.height=_1f+"px";if(this.iframe){this.iframe.style.height="100%";}this._layoutMode=true;},_onIEMouseDown:function(e){var _20;var b=this.document.body;var _21=b.clientWidth;var _22=b.clientHeight;var _23=b.clientLeft;var _24=b.offsetWidth;var _25=b.offsetHeight;var _26=b.offsetLeft;if(/^rtl$/i.test(b.dir||"")){if(_21<_24&&e.x>_21&&e.x<_24){_20=true;}}else{if(e.x<_23&&e.x>_26){_20=true;}}if(!_20){if(_22<_25&&e.y>_22&&e.y<_25){_20=true;}}if(!_20){delete this._cursorToStart;delete this._savedSelection;if(e.target.tagName=="BODY"){this.defer("placeCursorAtEnd");}this.inherited(arguments);}},onBeforeActivate:function(){this._restoreSelection();},onBeforeDeactivate:function(e){if(this.customUndo){this.endEditing(true);}if(e.target.tagName!="BODY"){this._saveSelection();}},customUndo:true,editActionInterval:3,beginEditing:fun