寻找详尽的命令列表和设置样式的方法
我目前正在使用 CKEditor (http://ckeditor.com/)。我正在寻找:
1)默认情况下通过“execCommand”可用的命令的详尽列表。
2) 设置样式的机制(与 FONT 和 SIZE 组合框的方式相同)。我在文档中看到了名为“setStyle”的函数,但它似乎需要一个 exact 元素。我无法根据选择弄清楚如何执行此操作 - 无法使用 ID 或 CLASS,因为所选部分没有。
我已经在论坛上发帖了,但就回复而言,他们似乎不太活跃。任何帮助将不胜感激。
最好的。
I'm currently working with CKEditor (http://ckeditor.com/). I'm looking for:
1) an exhaustive list of commands available by default via 'execCommand'.
2) a mechanism by which to set styles (as in the same way the FONT and SIZE combo boxes do it). I saw the function called 'setStyle' in the documentation, however it seems to require an exact element. I can't for the life of me figure out how to do so based on the selection -- there is no way to use ID or CLASS, as the selected portions have none.
I've posted to the forums but they don't seem to be terribly active as far as replies are concerned. Any assistance would be most appreciated.
Best.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以在 _source 文件夹中搜索“.addCommand”,这将为您提供可以在编辑器上执行的所有命令的完整列表。我猜您只对该列表的一部分感兴趣,因为其中一些是供内部使用的。
You can do a little search in the _source folder for ".addCommand" and that will give you a full list of all commands that can be executed on an editor. I guess that you are interested only in a part of that list, as some are meant for internal use.
对于 CKEditor 4,每个编辑器的可用命令会有所不同,具体取决于:
下面是两个列出可用命令的函数。
注意:在编辑器实例准备就绪之前,这两个函数将返回不完整的列表。
要在编辑器准备就绪时获取每个编辑器的所有命令列表,您可以执行以下操作:
要创建包含所有可能命令的编辑器,然后获取这些命令,您可以执行以下操作:
For CKEditor 4 the available commands vary for each editor based on:
Below are two functions that will list available commands.
Note: Until an editor instance is ready, these two functions will return an incomplete list.
To get a list of all commands per editor as the editor becomes ready you would do something like:
To create an editor with all possible commands and then to get those commands you can do the following:
我可以推荐的最好的事情是查看 javscript api
可以进行一些研究和尝试错误 我能够更改字体颜色,
只需付出一点努力即可得到你想要的东西,我的朋友。
best thing I can recommend is to to look at the javscript api
ok with a little research some trial and error I was able to change the font color
just got to put in a little elbow grease to get what you want my friend.
我没有使用 execCommand,但根据我的理解,您可以执行工具栏中的任何内容。
要设置样式,请将其添加到您的 config.js 文件中。
I have not used the execCommand, but from my understanding you can execute anything that is in the toolbar.
To set style add this to you config.js file.
尽管我知道这不是一个详尽的列表,并且会根据配置而有所不同。如果您不想仅仅为了获得基本命令列表而输入所有这些内容,那么以下是我在 CKEDITOR 4 上执行内联编辑器时得到的结果:
Though I know this is not an exhaustive list and will differ based on configuration. If you don't want to have to type in all of this just to get a basic list of commands, here is what I get when doing an inline editor on CKEDITOR 4: