3 * Defines dialog for {{ plugin_label }} CKEditor plugin.
10 CKEDITOR.dialog.add('{{ command_name }}Dialog', function(editor) {
14 // Basic properties of the dialog window: title, minimum size.
15 title: Drupal.t('Abbreviation properties'),
19 // Dialog window content definition.
22 // Definition of the settings dialog tab.
29 // Text input field for the abbreviation text.
32 label: Drupal.t('Abbreviation'),
34 // Validation checking whether the field is not empty.
35 validate: CKEDITOR.dialog.validate.notEmpty(Drupal.t('Abbreviation field cannot be empty.'))
38 // Text input field for the abbreviation title (explanation).
41 label: Drupal.t('Explanation'),
42 validate: CKEDITOR.dialog.validate.notEmpty(Drupal.t('Explanation field cannot be empty.'))
48 // This method is invoked once a user clicks the OK button, confirming the
52 // The context of this function is the dialog object itself.
53 // See http://docs.ckeditor.com/#!/api/CKEDITOR.dialog.
56 // Create a new <abbr> element.
57 var abbr = editor.document.createElement('abbr');
59 // Set element attribute and text by getting the defined field values.
60 abbr.setAttribute('title', dialog.getValueOf('tab-settings', 'title'));
61 abbr.setText( dialog.getValueOf('tab-settings', 'abbr'));
63 // Finally, insert the element into the editor at the caret position.
64 editor.insertElement(abbr);