简体   繁体   English

jwysiwyg调用工具栏以编程方式单击

[英]jwysiwyg call a toolbar click programmatically

I am using jwysiwyg and I would like to be able to click some of the toolbar buttons such as bold, italic, etc programmatically. 我正在使用jwysiwyg ,我希望能够以编程方式单击一些工具栏按钮,例如粗体,斜体等。 Is this possible? 这可能吗?

Basically, I want something like this: 基本上,我想要这样的东西:

$('#editor').wysiwyg('click', 'bold');

Try $('#editor .toolbar .bold').click() . 尝试$('#editor .toolbar .bold').click() It's not the Jedi way, but it works correctly. 这不是绝地方式,但可以正常工作。

UPD UPD

After fast looking at wysiwyg sources I think that it's only correct way to do it. 快速浏览所见即所得的资料后,我认为这是唯一的正确方法。

UPD UPD

And the right answer is $('#editor-textarea').data('wysiwyg').triggerControl('bold',{}); 正确的答案是$('#editor-textarea').data('wysiwyg').triggerControl('bold',{});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM