CKEditor Dialogs: Binding Input Fields by ID

Each input field in the CKEditor dialogs is renamed with a unique number, but the number changes depending on which parameters are visible.

I need to reference 'txtUrl', which has an identifier similar to # 35_textInput.

So far, I have found that something like this should work:

alert(CKEDITOR.instances.myElement.document.$.body.getId('txtUrl'));

But this is not so. Please, help.

+1
source share
3 answers

@Rio, your decision was really close! This was the final decision:

var dialog = CKEDITOR.dialog.getCurrent();
dialog.setValueof('info','txtUrl',"http://google.com");
return false;
+3
source
var dialog = this.getDialog();
var elem = dialog.getContentElement('info','txtUrl');
+2
source

,

dialog = this.getDialog();  
alert(dialog.getContentElement('info', 'grootte').getInputElement().$.id);  

"cke_117_select". ( selectbox)

alert(dialog.getContentElement('info', 'txtUrl').getInputElement().$.id);  

'cke_107_textInput'.
, , ( ) .

SetValueOf still does not provide an identifier that you might need if you want to do more than fill a text field with specific text.

0
source

Source: https://habr.com/ru/post/1745570/


All Articles