ckeditor动态更改按钮图标
我正在尝试为 ckeditor 编写一个插件,如下面的链接所示 CKEditor自定义插件按钮
问题是,我希望按钮在我单击它,然后更改回来,以便用户知道发生了什么事。添加按钮后如何更改图标的路径?有类似 editor.ui.editButton 的东西吗?
谢谢!
I am trying to write a plugin for ckeditor, like in the link below
CKEditor Custom Plugins Button
the problem is, I want the button to change once I click it, and change back, so the users knows something happened. how can i change the path to the icon after the button is added? is there something like editor.ui.editButton?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
$('.cke_button__BUTTONNAME_icon').css('background-position', '0 0').css('background-image', 'url(pathtoimage< /strong>)').css('背景重复','不重复');
其中BUTTONNAME全部为小写字母,pathtoimage相对于html文件。
使用 this.path 来改变相对于 plugin.js 的图像路径。重要的是 this.path 应该在函数范围之外,如下所示:
var _p = this.path;
$('.cke_button__BUTTONNAME_icon').css('background-position', '0 0').css('background-image', 'url(pathtoimage)').css('background-repeat','no-repeat');
Where BUTTONNAME is all in small letters and pathtoimage is relative to html file.
To chance image path to relative to the plugin.js by using this.path. Important thing this.path should be outside the scope of function as shown below:
var _p = this.path;
我有一个肮脏的黑客:(使用jQuery)
其中Commandname是按钮的名称,这个路径是我在插件中启动的一个var
i have a dirty hack: (with jQuery)
Where Commandname the name of the Button is and this path is a var wich i initiate in the plugin with