nnnjjj123
2020-11-17 1b2c1edb61190eeb19f465ff031eaa3b2a1b8dbc
1
2
3
4
5
6
7
8
9
10
11
12
13
//>>built
define("dojo dijit dojox dijit/_editor/_Plugin dijit/_base/manager dijit/_editor/range dijit/_Templated dijit/TooltipDialog dijit/form/ValidationTextBox dijit/form/Select dijit/form/Button dijit/form/DropDownButton dojo/_base/declare dojo/i18n dojo/string dojo/NodeList-dom dojox/editor/plugins/ToolbarLineBreak dojo/i18n!dojox/editor/plugins/nls/InsertAnchor dojo/i18n!dijit/nls/common".split(" "),function(c,d,g,h){var f=c.declare("dojox.editor.plugins.InsertAnchor",h,{htmlTemplate:'\x3ca name\x3d"${anchorInput}" class\x3d"dijitEditorPluginInsertAnchorStyle"\x3e${textInput}\x3c/a\x3e',
iconClassPrefix:"dijitAdditionalEditorIcon",_template:"\x3ctable role\x3d'presentation'\x3e\x3ctr\x3e\x3ctd\x3e\x3clabel for\x3d'${id}_anchorInput'\x3e${anchor}\x3c/label\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput dojoType\x3d'dijit.form.ValidationTextBox' required\x3d'true' id\x3d'${id}_anchorInput' name\x3d'anchorInput' intermediateChanges\x3d'true'\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd\x3e\x3clabel for\x3d'${id}_textInput'\x3e${text}\x3c/label\x3e\x3c/td\x3e\x3ctd\x3e\x3cinput dojoType\x3d'dijit.form.ValidationTextBox' required\x3d'true' id\x3d'${id}_textInput' name\x3d'textInput' intermediateChanges\x3d'true'\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd colspan\x3d'2'\x3e\x3cbutton dojoType\x3d'dijit.form.Button' type\x3d'submit' id\x3d'${id}_setButton'\x3e${set}\x3c/button\x3e\x3cbutton dojoType\x3d'dijit.form.Button' type\x3d'button' id\x3d'${id}_cancelButton'\x3e${cancel}\x3c/button\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e",
_initButton:function(){var a=this,b=c.i18n.getLocalization("dojox.editor.plugins","InsertAnchor",this.lang),e=this.dropDown=new d.TooltipDialog({title:b.title,execute:c.hitch(this,"setValue"),onOpen:function(){a._onOpenDialog();d.TooltipDialog.prototype.onOpen.apply(this,arguments)},onCancel:function(){setTimeout(c.hitch(a,"_onCloseDialog"),0)}});this.button=new d.form.DropDownButton({label:b.insertAnchor,showLabel:!1,iconClass:this.iconClassPrefix+" "+this.iconClassPrefix+"InsertAnchor",tabIndex:"-1",
dropDown:this.dropDown});b.id=d.getUniqueId(this.editor.id);this._uniqueId=b.id;this.dropDown.set("content",e.title+"\x3cdiv style\x3d'border-bottom: 1px black solid;padding-bottom:2pt;margin-bottom:4pt'\x3e\x3c/div\x3e"+c.string.substitute(this._template,b));e.startup();this._anchorInput=d.byId(this._uniqueId+"_anchorInput");this._textInput=d.byId(this._uniqueId+"_textInput");this._setButton=d.byId(this._uniqueId+"_setButton");this.connect(d.byId(this._uniqueId+"_cancelButton"),"onClick",function(){this.dropDown.onCancel()});
this._anchorInput&&this.connect(this._anchorInput,"onChange","_checkInput");this._textInput&&this.connect(this._anchorInput,"onChange","_checkInput");this.editor.contentDomPreFilters.push(c.hitch(this,this._preDomFilter));this.editor.contentDomPostFilters.push(c.hitch(this,this._postDomFilter));this._setup()},updateState:function(){this.button.set("disabled",this.get("disabled"))},setEditor:function(a){this.editor=a;this._initButton()},_checkInput:function(){var a=!0;this._anchorInput.isValid()&&
(a=!1);this._setButton.set("disabled",a)},_setup:function(){this.editor.onLoadDeferred.addCallback(c.hitch(this,function(){this.connect(this.editor.editNode,"ondblclick",this._onDblClick);setTimeout(c.hitch(this,function(){this._applyStyles()}),100)}))},getAnchorStyle:function(){var a=c.moduleUrl(g._scopeName,"editor/plugins/resources").toString();if(!a.match(/^https?:\/\//i)&&!a.match(/^file:\/\//i)){var b;b="/"===a.charAt(0)?c.doc.location.protocol+"//"+c.doc.location.host:this._calcBaseUrl(c.global.location.href);
"/"!==b[b.length-1]&&"/"!==a.charAt(0)&&(b+="/");a=b+a}return"@media screen {\n\t.dijitEditorPluginInsertAnchorStyle {\n\t\tbackground-image: url({MODURL}/images/anchor.gif);\n\t\tbackground-repeat: no-repeat;\n\t\tbackground-position: top left;\n\t\tborder-width: 1px;\n\t\tborder-style: dashed;\n\t\tborder-color: #D0D0D0;\n\t\tpadding-left: 20px;\n\t}\n}\n".replace(/\{MODURL\}/gi,a)},_applyStyles:function(){if(!this._styled)try{this._styled=!0;var a=this.editor.document,b=this.getAnchorStyle();if(c.isIE)a.createStyleSheet("").cssText=
b;else{var d=a.createElement("style");d.appendChild(a.createTextNode(b));a.getElementsByTagName("head")[0].appendChild(d)}}catch(k){}},_calcBaseUrl:function(a){var b=null;null!==a&&(b=a.indexOf("?"),-1!=b&&(a=a.substring(0,b)),b=a.lastIndexOf("/"),b=0<b&&b<a.length?a.substring(0,b):a);return b},_checkValues:function(a){a&&(a.anchorInput&&(a.anchorInput=a.anchorInput.replace(/"/g,"\x26quot;")),a.textInput||(a.textInput="\x26nbsp;"));return a},setValue:function(a){this._onCloseDialog();if(!this.editor.window.getSelection){var b=
d.range.getSelection(this.editor.window).getRangeAt(0).endContainer;3===b.nodeType&&(b=b.parentNode);b&&b.nodeName&&"a"!==b.nodeName.toLowerCase()&&(b=this.editor._sCall("getSelectedElement",["a"]));b&&b.nodeName&&"a"===b.nodeName.toLowerCase()&&this.editor.queryCommandEnabled("unlink")&&(this.editor._sCall("selectElementChildren",[b]),this.editor.execCommand("unlink"))}a=this._checkValues(a);this.editor.execCommand("inserthtml",c.string.substitute(this.htmlTemplate,a))},_onCloseDialog:function(){this.editor.focus()},
_getCurrentValues:function(a){var b,d;a&&"a"===a.tagName.toLowerCase()&&c.attr(a,"name")?(b=c.attr(a,"name"),d=a.textContent||a.innerText,this.editor._sCall("selectElement",[a,!0])):d=this.editor._sCall("getSelectedText");return{anchorInput:b||"",textInput:d||""}},_onOpenDialog:function(){var a;this.editor.window.getSelection?a=this.editor._sCall("getAncestorElement",["a"]):(a=d.range.getSelection(this.editor.window).getRangeAt(0).endContainer,3===a.nodeType&&(a=a.parentNode),a&&a.nodeName&&"a"!==
a.nodeName.toLowerCase()&&(a=this.editor._sCall("getSelectedElement",["a"])));this.dropDown.reset();this._setButton.set("disabled",!0);this.dropDown.set("value",this._getCurrentValues(a))},_onDblClick:function(a){a&&a.target&&(a=a.target,"a"===(a.tagName?a.tagName.toLowerCase():"")&&c.attr(a,"name")&&(this.editor.onDisplayChanged(),this.editor._sCall("selectElement",[a]),setTimeout(c.hitch(this,function(){this.button.set("disabled",!1);this.button.openDropDown();this.button.dropDown.focus&&this.button.dropDown.focus()}),
10)))},_preDomFilter:function(a){c.query("a[name]:not([href])",this.editor.editNode).addClass("dijitEditorPluginInsertAnchorStyle")},_postDomFilter:function(a){a&&c.query("a[name]:not([href])",a).removeClass("dijitEditorPluginInsertAnchorStyle");return a}});c.subscribe(d._scopeName+".Editor.getPlugin",null,function(a){if(!a.plugin){var b=a.args.name;b&&(b=b.toLowerCase());"insertanchor"===b&&(a.plugin=new f)}});return f});