diff --git a/js/plugins/tokenbrowser/plugin.js b/js/plugins/tokenbrowser/plugin.js index 8d93163..4470832 100644 --- a/js/plugins/tokenbrowser/plugin.js +++ b/js/plugins/tokenbrowser/plugin.js @@ -12,17 +12,17 @@ // The plugin initialization logic goes inside this method. beforeInit: function (editor) { - // Generic command + // Generic command. editor.addCommand('edittokenbrowser', { - modes: { wysiwyg : 1 }, + modes: {wysiwyg: 1}, canUndo: true, exec: function (editor, data) { data = data || {}; - // we have no current existingValues + // We have no current existingValues. var existingValues = {}; - // set all options for the model + // Set all options for the model. var dialogOptions = { dialogClass: 'token-browser-dialog', autoResize: false, @@ -31,9 +31,12 @@ }; var dialogSettings = drupalSettings.dialog; - // we have no current saveCallback + // We have no current saveCallback. var saveCallback = function (values) {}; + // Set the active CKEditor id. + Drupal.ckeditorActiveId = editor.name; + // Open token browser dialog. Drupal.ckeditor.openDialog(editor, data.link, existingValues, saveCallback, dialogOptions); @@ -47,7 +50,7 @@ editor.ui.addButton(button.id, { label: button.label, data: button, - click: function(editor) { + click: function (editor) { editor.execCommand('edittokenbrowser', this.data); }, icon: button.image