I'm trying to enable my custom CKEditor plugin in Drupal, but the custom dropdown is never shown.

I'm using CKEditor module.

Here's what I did:

  1. I created a new folder in /ckeditor/plugins and saved my code in plugin.js file.
  2. The plugin became visible under "Editor appearance". I enabled it in /admin/config/content/ckeditor/edit/%my_profile.
  3. The plugin file is loaded, but the init method is never invoked and my dropdown is never added to the toolbar.

Here is the code of my plugin:

(function() {
  console.log('custom_richcombo plugin.js loaded');
  CKEDITOR.plugins.add('custom_richcombo', {
    requires: ['richcombo'],
    init: function(editor) {
      console.log('custom_richcombo plugin initialized');
      var config = editor.config;
      editor.ui.addRichCombo('editorLinksCombo', {
        label: 'Custom dropdown',
        title: 'Custom dropdown title',
        multiSelect: false,
        init: function() {
          this.startGroup('Test group');
          this.add(1, 'Option 1', 'Title for option 1');
          this.add(2, 'Option 2', 'Title for option 2');
          this.add(3, 'Option 3', 'Title for option 3');
        onClick: function(optionID) {
          console.log('Clicked on option', optionID);

This works perfectly fine on a standalone CKEditor installation.

Can someone please point me in the right direction?

  • I came here looking for an answer to this exact question. – icicleking Dec 13 '17 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.