Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9099807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:42:45+00:00 2026-06-17T00:42:45+00:00

Answered: Result can bee seen here: http://apitecture.com/dev/cked/index.2.html Working code excerpt: $(‘a.color’).on({ click : function()

  • 0

Answered:

Result can bee seen here: http://apitecture.com/dev/cked/index.2.html

Working code excerpt:

$('a.color').on({
    click : function()
    {
        var self = $(this);

        var editor = self.data('editor-instance') || CKEDITOR.instances['one'];
        var button = self.data('editor-button') || editor.ui.create('TextColor');

        if (!self.data('editor-instance'))
        {
            self.data('editor-instance', editor);
        }

        if (!self.data('editor-button'))
        {
            button._.id = self.attr('id');
            self.data('editor-button', button);
        }

        button.click( editor );
    }
});

I am working on a rich GUI based content editor.

I have come to conclusion, to use CKEditor for the text styling part, because it’s 4th version comes with a lot of customization and configuration options, plus, is very well built.

I started to implement some of the commands in CK to my own toolbar, that isn’t connected with CK. Apparently, my ventures weren’t as easy as I thought they’d be…

http://apitecture.com/dev/cked/ <- here I have deployed a sandbox version.

On the left hand side, you can see a veeeery stripped down version of CK, and a custom toolbar.

On the right, exact replica, but with CK’s native toolbar.

Simple commands, like Link and Bold, as you can see, are working, due to their simple nature.

The problem is with the Text Color button. It isn’t bound to a command in CK, therefore I cannot execute it externally – well, at least I haven’t found a way how.

Maybe somebody is pro enough with CK and could help me to figure this out?

The goal is to have the same functionality on my toolbar’s button as the CK one.

I have found out, that upon clicking the Text Color, the color selection popup is appended to body, so, it doesn’t extend upon CK styles and should, in theory, work standalone. Though, I cannot seem to find the code where the HTML is appended to body.

I have tried to get the UI button instance:

var color = CKEDITOR.instances['one'].ui.create('TextColor');

// and fire click on it
color.click();

But, that caused a partially expected (due to click not being started from toolbar) exception:

Uncaught TypeError: Cannot read property 'elementMode' of undefined ckeditor.js:552
    CKEDITOR.ui.floatPanel.CKEDITOR.tools.createClass.$ ckeditor.js:552
    CKEDITOR.ui.panelButton.CKEDITOR.tools.createClass.proto.createPanel ckeditor.js:541
    e ckeditor.js:540
    $.on.click cktest.js:59
    v.event.dispatch jquery.min.js:2
    o.handle.u

Seeing (from: console.log(color.click)) that the function accepts a parameter, I thought that I could provide any DOM element to it, by calling color.click( element );, that also caused error:

Uncaught TypeError: Cannot read property 'baseFloatZIndex' of undefined ckeditor.js:547
    CKEDITOR.ui.panel.render ckeditor.js:547
    o ckeditor.js:552
    CKEDITOR.ui.floatPanel.CKEDITOR.tools.createClass.$ ckeditor.js:553
    CKEDITOR.ui.panelButton.CKEDITOR.tools.createClass.proto.createPanel ckeditor.js:541
    e ckeditor.js:540
    $.on.click cktest.js:59
    v.event.dispatch jquery.min.js:2
    o.handle.u

Here is link to the source where the color plugin and it’s buttons is introduced: https://github.com/ckeditor/ckeditor-dev/blob/master/plugins/colorbutton/plugin.js

Update:

I think this happens with every single button, that has dropdowns instead of dialogs.

Update 2:

Reinmar’s answer did show some light at the end of the tunnel: http://apitecture.com/dev/cked/index.2.html

In the example, the "Color" text-link on the right can be clicked, and the dropdown shows, plus, it functions perfectly (besides that the shadow is enforced). The only catch here is, it works for the first time. Resulting in:

TypeError: Cannot read property 'title' of undefined
    at CKEDITOR.ui.panel.block.CKEDITOR.tools.createClass.$ (http://apitecture.com/dev/cked/ckeditor/ckeditor.js:549:298)
    at new b (http://apitecture.com/dev/cked/ckeditor/ckeditor.js:26:149)
    at Object.CKEDITOR.ui.panel.addBlock (http://apitecture.com/dev/cked/ckeditor/ckeditor.js:547:503)
    at CKEDITOR.ui.floatPanel.CKEDITOR.tools.createClass.proto.addBlock (http://apitecture.com/dev/cked/ckeditor/ckeditor.js:553:409)
    at CKEDITOR.ui.panelButton.CKEDITOR.tools.createClass.proto.createPanel (http://apitecture.com/dev/cked/ckeditor/ckeditor.js:541:333)
    at e [as click] (http://apitecture.com/dev/cked/ckeditor/ckeditor.js:540:304)
    at HTMLAnchorElement.$.on.click (http://apitecture.com/dev/cked/cktest.2.js:64:24)
    at HTMLAnchorElement.v.event.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js:2:38053)
    at HTMLAnchorElement.o.handle.u (http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js:2:33916) 

For every subsequent click.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T00:42:46+00:00Added an answer on June 17, 2026 at 12:42 am

    You’ve asked a hardcore question :). I’m CKEditor core dev for last 1 year and I had to spend an hour digging in toolbar, panels and buttons. This part of CKE’s API is really twisty and definitely lacks of documentation. But the worst part of it is that it’s not really reusable, cause all the parts are tightly coupled.

    Anyway. I tried to reuse colorbutton and I succeeded. On editor without toolbar plugin (this is important) I was able to open it for specified element:

    Reusing colorbutton

    And it even seems to work 🙂 (at least on Chrome).

    I’m curious how hard it will be for you to replace toolbar plugin with your own basic implementation (perhaps without a11y support and other heavy stuff). At the moment your bold and link buttons work correctly on Chrome, FF, Opera and IE7-9 (this in fact proves how cool CKE is because it does a lot in the background ;). I hope that you won’t encounter any serious troubles.

    Some tips:

    • You don’t need to call editor.getCommand().exec(). There is an editor.execCommand() method.
    • You’ll probably want to activate/deactivate buttons depending on context (caret location). Each command has its state and it’s automatically updated on selectionChange event.

    Good luck. And it will be cool if you share your thoughts and result of work with us :). Feedback will be very useful if someday we’ll decide to improve this part of API.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is some code that is not working how it is supposed to work.
I know this must have been answered before here, but I simply can't find
I've just answered problem with sockets in c# where in my example code I
I recently asked a question (and had it answered) here: jQuery Load JSON I
I'm sure this must have been asked and answered, but I can't find it...
I can't find this question answered in any other place, so I finally decided
In my very first impression of Haskell, it's a language can handle execute-then-result things
This could be a simple question, but it's one I've never seen answered before.
This is a follow up question to the one answered here: Excluding dates from
I suspect this has already been answered somewhere, but I can't find it, so...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.