diff options
Diffstat (limited to 'plugins/link/dialogs/anchor.js')
| -rw-r--r--[-rwxr-xr-x] | plugins/link/dialogs/anchor.js | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/plugins/link/dialogs/anchor.js b/plugins/link/dialogs/anchor.js index 8d80730..db9fe43 100755..100644 --- a/plugins/link/dialogs/anchor.js +++ b/plugins/link/dialogs/anchor.js @@ -1,22 +1,8 @@ -/* - Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. +/* + Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license */ -CKEDITOR.dialog.add("anchor", function(c) { - function e(b, a) { return b.createFakeElement(b.document.createElement("a", { attributes: a }), "cke_anchor", "anchor") } return { - title: c.lang.link.anchor.title, minWidth: 300, minHeight: 60, onOk: function() { - var b = CKEDITOR.tools.trim(this.getValueOf("info", "txtName")), a = { id: b, name: b, "data-cke-saved-name": b }; this._.selectedElement ? this._.selectedElement.data("cke-realelement") ? (b = e(c, a), b.replace(this._.selectedElement), CKEDITOR.env.ie && c.getSelection().selectElement(b)) : this._.selectedElement.setAttributes(a) : - (b = (b = c.getSelection()) && b.getRanges()[0], b.collapsed ? (a = e(c, a), b.insertNode(a)) : (CKEDITOR.env.ie && 9 > CKEDITOR.env.version && (a["class"] = "cke_anchor"), a = new CKEDITOR.style({ element: "a", attributes: a }), a.type = CKEDITOR.STYLE_INLINE, a.applyToRange(b))) - }, onHide: function() { delete this._.selectedElement }, onShow: function() { - var b = c.getSelection(), a; a = b.getRanges()[0]; var d = b.getSelectedElement(); a.shrink(CKEDITOR.SHRINK_ELEMENT); a = (d = a.getEnclosedNode()) && d.type === CKEDITOR.NODE_ELEMENT && ("anchor" === d.data("cke-real-element-type") || - d.is("a")) ? d : void 0; var f = (d = a && a.data("cke-realelement")) ? CKEDITOR.plugins.link.tryRestoreFakeAnchor(c, a) : CKEDITOR.plugins.link.getSelectedLink(c); if (f) { this._.selectedElement = f; var e = f.data("cke-saved-name"); this.setValueOf("info", "txtName", e || ""); !d && b.selectElement(f); a && (this._.selectedElement = a) } this.getContentElement("info", "txtName").focus() - }, contents: [{ - id: "info", label: c.lang.link.anchor.title, accessKey: "I", elements: [{ - type: "text", id: "txtName", label: c.lang.link.anchor.name, required: !0, validate: function() { - return this.getValue() ? - !0 : (alert(c.lang.link.anchor.errorName), !1) - } - }] - }] - } -});
\ No newline at end of file +CKEDITOR.dialog.add("anchor",function(c){function d(b,a){return b.createFakeElement(b.document.createElement("a",{attributes:a}),"cke_anchor","anchor")}return{title:c.lang.link.anchor.title,minWidth:300,minHeight:60,getModel:function(b){var a=b.getSelection();b=a.getRanges()[0];a=a.getSelectedElement();b.shrink(CKEDITOR.SHRINK_ELEMENT);(a=b.getEnclosedNode())&&a.type===CKEDITOR.NODE_TEXT&&(a=a.getParent());b=a&&a.type===CKEDITOR.NODE_ELEMENT&&("anchor"===a.data("cke-real-element-type")||a.is("a"))? +a:void 0;return b||null},onOk:function(){var b=CKEDITOR.tools.trim(this.getValueOf("info","txtName")),b={id:b,name:b,"data-cke-saved-name":b},a=this.getModel(c);a?a.data("cke-realelement")?(b=d(c,b),b.replace(a),CKEDITOR.env.ie&&c.getSelection().selectElement(b)):a.setAttributes(b):(a=(a=c.getSelection())&&a.getRanges()[0],a.collapsed?(b=d(c,b),a.insertNode(b)):(CKEDITOR.env.ie&&9>CKEDITOR.env.version&&(b["class"]="cke_anchor"),b=new CKEDITOR.style({element:"a",attributes:b}),b.type=CKEDITOR.STYLE_INLINE, +b.applyToRange(a)))},onShow:function(){var b=c.getSelection(),a=this.getModel(c),d=a&&a.data("cke-realelement");if(a=d?CKEDITOR.plugins.link.tryRestoreFakeAnchor(c,a):CKEDITOR.plugins.link.getSelectedLink(c)){var e=a.data("cke-saved-name");this.setValueOf("info","txtName",e||"");!d&&b.selectElement(a)}this.getContentElement("info","txtName").focus()},contents:[{id:"info",label:c.lang.link.anchor.title,accessKey:"I",elements:[{type:"text",id:"txtName",label:c.lang.link.anchor.name,required:!0,validate:function(){return this.getValue()? +!0:(alert(c.lang.link.anchor.errorName),!1)}}]}]}});
\ No newline at end of file |
