是否打开“插入/编辑图像” Tinymce的对话活动? [英] Is there open "Insert/Edit image" dialog event in Tinymce?

查看:103
本文介绍了是否打开“插入/编辑图像” Tinymce的对话活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道对话框何时打开。但我没有找到任何体面的方式。我在文档中找到的唯一内容是 editor.on() 但它不适用于 mceImage 命令并且没有任何关于 mceImage 在文档中。它应该在对话框显示之前触发。我想到的只是在Image按钮上附加'click'事件并等待通过计时器对话,但它不是一个非常体面的解决方案。有没有更好的想法?

I need to get to know when the dialog has already been opened. But I didn't find any decent way for this. The only thing I found in the documentation is editor.on() but it doesn't work with the mceImagecommand and nothing is said about mceImage in the docs. And it supposed to fire before the dialog is shown. All that comes to my mind is to attach the 'click' event on the "Image" button and wait for the dialog through the timer but it wouldn't be a very decent solution. Any better ideas?

推荐答案

当打开图像对话框时,TinyMCE当前不会触发事件。如果您想这样做,您可以修改图像插件,以便在触发菜单选项或工具栏按钮时包含该命令。例如,你可以为菜单选项执行此操作:

TinyMCE does not currently fire an event when opening the image dialog. If you wanted to make it do so you can modify the image plugin to include the command when the menu option or toolbar button is triggered. For example you can do this for the menu option:

editor.addMenuItem('image', {
  icon: 'image',
  text: 'Image',
  onclick: Dialog(editor).open,
  context: 'insert',
  cmd: 'mceImage',
  prependToContext: true
}); 

请注意添加到该列表的 cmd 选项。它不在编辑器代码中,但您可以自己添加它并使该命令被触发。您也可以通过添加 cmd 选项为工具栏按钮执行相同操作。

Note the cmd option added to that list. Its not there in the editor code as delivered but you can add it yourself and get that command to be triggered. You can do the same for toolbar buttons by adding the cmd option as well.

这篇关于是否打开“插入/编辑图像” Tinymce的对话活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆