ttrss/lib/dijit/_editor/RichText.js

2 lines
38 KiB
JavaScript
Raw Permalink Normal View History

2012-08-14 14:59:10 +00:00
//>>built
2018-12-04 13:23:37 +00:00
define("dijit/_editor/RichText",["dojo/_base/array","dojo/_base/config","dojo/_base/declare","dojo/_base/Deferred","dojo/dom","dojo/dom-attr","dojo/dom-class","dojo/dom-construct","dojo/dom-geometry","dojo/dom-style","dojo/_base/kernel","dojo/keys","dojo/_base/lang","dojo/on","dojo/query","dojo/domReady","dojo/sniff","dojo/string","dojo/topic","dojo/_base/unload","dojo/_base/url","dojo/window","../_Widget","../_CssStateMixin","../selection","./range","./html","../focus","../main"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,on,_e,_f,has,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b){var _1c=_3("dijit._editor.RichText",[_15,_16],{constructor:function(_1d){this.contentPreFilters=[];this.contentPostFilters=[];this.contentDomPreFilters=[];this.contentDomPostFilters=[];this.editingAreaStyleSheets=[];this.events=[].concat(this.events);this._keyHandlers={};if(_1d&&_d.isString(_1d.value)){this.value=_1d.value;}this.onLoadDeferred=new _4();},baseClass:"dijitEditor",inheritWidth:false,focusOnLoad:false,name:"",styleSheets:"",height:"300px",minHeight:"1em",isClosed:true,isLoaded:false,_SEPARATOR:"@@**%%__RICHTEXTBOUNDRY__%%**@@",_NAME_CONTENT_SEP:"@@**%%:%%**@@",onLoadDeferred:null,isTabIndent:false,disableSpellCheck:false,postCreate:function(){if("textarea"===this.domNode.tagName.toLowerCase()){console.warn("RichText should not be used with the TEXTAREA tag. See dijit._editor.RichText docs.");}this.contentPreFilters=[_d.trim,_d.hitch(this,"_preFixUrlAttributes")].concat(this.contentPreFilters);if(has("mozilla")){this.contentPreFilters=[this._normalizeFontStyle].concat(this.contentPreFilters);this.contentPostFilters=[this._removeMozBogus].concat(this.contentPostFilters);}if(has("webkit")){this.contentPreFilters=[this._removeWebkitBogus].concat(this.contentPreFilters);this.contentPostFilters=[this._removeWebkitBogus].concat(this.contentPostFilters);}if(has("ie")||has("trident")){this.contentPostFilters=[this._normalizeFontStyle].concat(this.contentPostFilters);this.contentDomPostFilters=[_d.hitch(this,"_stripBreakerNodes")].concat(this.contentDomPostFilters);}this.contentDomPostFilters=[_d.hitch(this,"_stripTrailingEmptyNodes")].concat(this.contentDomPostFilters);this.inherited(arguments);_11.publish(_1b._scopeName+"._editor.RichText::init",this);},startup:function(){this.inherited(arguments);this.open();this.setupDefaultShortcuts();},setupDefaultShortcuts:function(){var _1e=_d.hitch(this,function(cmd,arg){return function(){return !this.execCommand(cmd,arg);};});var _1f={b:_1e("bold"),i:_1e("italic"),u:_1e("underline"),a:_1e("selectall"),s:function(){this.save(true);},m:function(){this.isTabIndent=!this.isTabIndent;},"1":_1e("formatblock","h1"),"2":_1e("formatblock","h2"),"3":_1e("formatblock","h3"),"4":_1e("formatblock","h4"),"\\":_1e("insertunorderedlist")};if(!has("ie")){_1f.Z=_1e("redo");}var key;for(key in _1f){this.addKeyHandler(key,true,false,_1f[key]);}},events:["onKeyDown","onKeyUp"],captureEvents:[],_editorCommandsLocalized:false,_localizeEditorCommands:function(){if(_1c._editorCommandsLocalized){this._local2NativeFormatNames=_1c._local2NativeFormatNames;this._native2LocalFormatNames=_1c._native2LocalFormatNames;return;}_1c._editorCommandsLocalized=true;_1c._local2NativeFormatNames={};_1c._native2LocalFormatNames={};this._local2NativeFormatNames=_1c._local2NativeFormatNames;this._native2LocalFormatNames=_1c._native2LocalFormatNames;var _20=["div","p","pre","h1","h2","h3","h4","h5","h6","ol","ul","address"];var _21="",_22,i=0;while((_22=_20[i++])){if(_22.charAt(1)!=="l"){_21+="<"+_22+"><span>content</span></"+_22+"><br/>";}else{_21+="<"+_22+"><li>content</li></"+_22+"><br/>";}}var _23={position:"absolute",top:"0px",zIndex:10,opacity:0.01};var div=_8.create("div",{style:_23,innerHTML:_21});this.ownerDocumentBody.appendChild(div);var _24=_d.hitch(this,function(){var _25=div.firstChild;while(_25){try{this.selection.selectElement(_25.firstChild);var _26=_25.tagName.toLowerCase();this._local2NativeFormatNames[_26]=document.queryCommandValue("formatblock");this._native2LocalFormatNames[this._local2NativeFormatNames[_26]]=