CKEditor plugin to set classes

后端 未结 2 1957
眼角桃花
眼角桃花 2021-01-13 22:41

What I want to do is something similar to the native foreground / background colors dialog. The difference is, it will have buttons with colors directly in a toolbar. So one

2条回答
  •  误落风尘
    2021-01-13 23:04

    First of all you have to add your own buttons. Check source of any plugin that does this - e.g. basicstyles/plugin.js. You've got to create command for each button and then register all buttons. Simple.

    Then I propose to use our styles implementation. It allows to apply/remove defined style from the given selection/range. In the style definition you can specify that it will apply span element with given classes. Check this style definition.

    And the last step - join these things together. Command associated with button should apply/remove this style. There's ready to use one - check CKEDITOR.styleCommand usage here.

    Everything you need is in basicstyles plugin, so just refer there.

    Pozdrawiam :)

提交回复
热议问题