summaryrefslogtreecommitdiff
path: root/plugins/forms/dialogs/radio.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/forms/dialogs/radio.js')
-rw-r--r--[-rwxr-xr-x]plugins/forms/dialogs/radio.js30
1 files changed, 7 insertions, 23 deletions
diff --git a/plugins/forms/dialogs/radio.js b/plugins/forms/dialogs/radio.js
index c05da27..e85d3f4 100755..100644
--- a/plugins/forms/dialogs/radio.js
+++ b/plugins/forms/dialogs/radio.js
@@ -1,25 +1,9 @@
-/*
- 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("radio", function(c) {
- return {
- title: c.lang.forms.checkboxAndRadio.radioTitle, minWidth: 350, minHeight: 140, onShow: function() { delete this.radioButton; var a = this.getParentEditor().getSelection().getSelectedElement(); a && "input" == a.getName() && "radio" == a.getAttribute("type") && (this.radioButton = a, this.setupContent(a)) }, onOk: function() { var a, b = this.radioButton; b || (a = this.getParentEditor(), b = a.document.createElement("input"), b.setAttribute("type", "radio"), a.insertElement(b)); this.commitContent({ element: b }) },
- contents: [{
- id: "info", label: c.lang.forms.checkboxAndRadio.radioTitle, title: c.lang.forms.checkboxAndRadio.radioTitle, elements: [{ id: "name", type: "text", label: c.lang.common.name, "default": "", accessKey: "N", setup: function(a) { this.setValue(a.data("cke-saved-name") || a.getAttribute("name") || "") }, commit: function(a) { a = a.element; this.getValue() ? a.data("cke-saved-name", this.getValue()) : (a.data("cke-saved-name", !1), a.removeAttribute("name")) } }, {
- id: "value", type: "text", label: c.lang.forms.checkboxAndRadio.value, "default": "",
- accessKey: "V", setup: function(a) { this.setValue(a.getAttribute("value") || "") }, commit: function(a) { a = a.element; this.getValue() ? a.setAttribute("value", this.getValue()) : a.removeAttribute("value") }
- }, {
- id: "checked", type: "checkbox", label: c.lang.forms.checkboxAndRadio.selected, "default": "", accessKey: "S", value: "checked", setup: function(a) { this.setValue(a.getAttribute("checked")) }, commit: function(a) {
- var b = a.element; if (CKEDITOR.env.ie) {
- var d = b.getAttribute("checked"), e = !!this.getValue(); d != e && (d = CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"radio"' +
- (e ? ' checked\x3d"checked"' : "") + "\x3e\x3c/input\x3e", c.document), b.copyAttributes(d, { type: 1, checked: 1 }), d.replace(b), e && d.setAttribute("checked", "checked"), c.getSelection().selectElement(d), a.element = d)
- } else a = this.getValue(), CKEDITOR.env.webkit && (b.$.checked = a), a ? b.setAttribute("checked", "checked") : b.removeAttribute("checked")
- }
- }, {
- id: "required", type: "checkbox", label: c.lang.forms.checkboxAndRadio.required, "default": "", accessKey: "Q", value: "required", setup: CKEDITOR.plugins.forms._setupRequiredAttribute,
- commit: function(a) { a = a.element; this.getValue() ? a.setAttribute("required", "required") : a.removeAttribute("required") }
- }]
- }]
- }
-}); \ No newline at end of file
+CKEDITOR.dialog.add("radio",function(c){return{title:c.lang.forms.checkboxAndRadio.radioTitle,minWidth:350,minHeight:140,getModel:function(a){return(a=a.getSelection().getSelectedElement())&&"input"==a.getName()&&"radio"==a.getAttribute("type")?a:null},onShow:function(){var a=this.getModel(this.getParentEditor());a&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),b=this.getModel(a);b||(b=a.document.createElement("input"),b.setAttribute("type","radio"),a.insertElement(b));this.commitContent({element:b})},
+contents:[{id:"info",label:c.lang.forms.checkboxAndRadio.radioTitle,title:c.lang.forms.checkboxAndRadio.radioTitle,elements:[{id:"name",type:"text",label:c.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"value",type:"text",label:c.lang.forms.checkboxAndRadio.value,"default":"",
+accessKey:"V",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:function(a){a=a.element;this.getValue()?a.setAttribute("value",this.getValue()):a.removeAttribute("value")}},{id:"checked",type:"checkbox",label:c.lang.forms.checkboxAndRadio.selected,"default":"",accessKey:"S",value:"checked",setup:function(a){this.setValue(a.getAttribute("checked"))},commit:function(a){var b=a.element;if(CKEDITOR.env.ie){var d=b.getAttribute("checked"),e=!!this.getValue();d!=e&&(d=CKEDITOR.dom.element.createFromHtml('\x3cinput type\x3d"radio"'+
+(e?' checked\x3d"checked"':"")+"\x3e\x3c/input\x3e",c.document),b.copyAttributes(d,{type:1,checked:1}),d.replace(b),e&&d.setAttribute("checked","checked"),c.getSelection().selectElement(d),a.element=d)}else a=this.getValue(),CKEDITOR.env.webkit&&(b.$.checked=a),a?b.setAttribute("checked","checked"):b.removeAttribute("checked")}},{id:"required",type:"checkbox",label:c.lang.forms.checkboxAndRadio.required,"default":"",accessKey:"Q",value:"required",setup:CKEDITOR.plugins.forms._setupRequiredAttribute,
+commit:function(a){a=a.element;this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}}); \ No newline at end of file