自定义ContentTools的编辑按钮

Las*_*lar 6 javascript php jquery wysiwyg content-management-system

我很难理解如何在ContentTools(一个所见即所得的编辑器)中更改编辑(Ignition)按钮的外观和/或位置.

我发现我可以使用editor.start();editor.stop();触发页面的编辑,我想将这些功能映射到我自己的按钮,但我无法摆脱默认按钮.

他们网站上的文档和教程没有帮助我理解这一点.

谢谢!

Ant*_*haw 7

有两种方法我建议这样做,最简单的选择是隐藏点火按钮(就像它所说的那样)(参考SASS):

.ct-ignition {
    display: none;
}
Run Code Online (Sandbox Code Playgroud)

如果您希望完全从DOM中删除按钮,那么您可以从UI中卸载按钮(参考CoffeeScript):

// Once the Editor has been initialized
ContentTools.EditorApp.get()._ignition.unmount();
Run Code Online (Sandbox Code Playgroud)

我的建议是使用CSS隐藏点火并触发事件来通过自定义按钮手动调用功能,如下所示:

var editor = ContentTools.EditorApp.get();

// Starting the editor manually
editor._ignition.trigger('start');

// Stoping the editor manually (save)
editor._iginition.trigger('stop', true);

// Stoping the editor manually (cancel)
editor._iginition.trigger('stop', false);
Run Code Online (Sandbox Code Playgroud)

查看项目github问题列表中提出的这些问题可能也很有用: