Commit ce1c8233 authored by oknate's avatar oknate Committed by Wim Leers

Issue #2993323 by oknate: CKEditor Contextual Menu Item should be more specific

parent 04d5437a
......@@ -145,19 +145,29 @@
}
}
// Register context menu option for editing widget.
// Register context menu items for editing widget.
if (editor.contextMenu) {
editor.addMenuGroup('drupalentity');
editor.addMenuItem('drupalentity', {
label: Drupal.t('Edit Entity'),
icon: this.path + 'entity.png',
command: 'editdrupalentity',
group: 'drupalentity'
});
for (var key in editor.config.DrupalEntity_buttons) {
var button = editor.config.DrupalEntity_buttons[key];
var label = Drupal.t('Edit @buttonLabel', { '@buttonLabel': button.label });
editor.addMenuItem('drupalentity_' + button.id, {
label: label,
icon: button.image,
command: 'editdrupalentity',
group: 'drupalentity'
});
}
editor.contextMenu.addListener(function(element) {
if (isEditableEntityWidget(editor, element)) {
return { drupalentity: CKEDITOR.TRISTATE_OFF };
var button_id = element.getFirst().getAttribute('data-embed-button');
var returnData = {};
returnData['drupalentity_' + button_id] = CKEDITOR.TRISTATE_OFF;
return returnData;
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment