Opened 5 years ago

Closed 5 years ago

#11539 closed New Feature (invalid)

Add API method to define placement for new toolbar buttons

Reported by: moniuch Owned by:
Priority: Normal Milestone:
Component: UI : Toolbar Version:
Keywords: Cc:

Description

Please consider adding a new method to plugin/widget API to facilitate inserting toolbar buttons at a desired position by specifying an existing 'after' or 'before' member. The goal would be to avoid redefining the global toolbar in the config.

As an exercise I'm writing a simple plugin that allows user to insert a clearfix div. As developer I would expect to be able to easily specify that the button should be sitting next to the Insert Horizontal Line button, without need to redefine the whole toolbar through config.

I'm not sure at this point what kind of fallback should be supported should the target button not be available.

PS. For many reasons I'm close to think that config should be converted from a string into an object.

Change History (2)

comment:1 Changed 5 years ago by moniuch

A momentary lapse of reason > correction: I didn't mean the config is a string, rather I meant that we should not operate on strings, such as .removeButtons or .extraPlugins. Config should provide methods for such interactions.

comment:2 Changed 5 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed
Type: BugNew Feature
Version: 4.3.2

One plugin shouldn't know about other plugins. Therefore setting 'after', 'before' would be incorrect. What if horizontalrule is not loaded? How would it work then.

That's why CKEditor supports toolbar group + priority setting - e.g. 'insert,10'. If you want to display your button next to horizontal rule, check its position (it's 'insert,40') and specify similar one.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy