带弹出窗口的TinyMCE自定义按钮 [英] TinyMCE custom button with popup
问题描述
我正在为我的TinyMCE设置添加一个按钮:
I'm adding a button to my TinyMCE setup like this:
setup : function(ed) {
// Add a custom button
ed.addButton('mybutton', {
title : 'My button',
image : 'mybutton.jpg',
onclick : function() {
// Add you own code to execute something on click
ed.focus();
ed.selection.setContent('Hello world!');
}
});
},
我不知道在onclick事件中是否可以打开弹出窗口并从弹出窗口获取一些输入。然后可以将其粘贴到编辑器中。正如你正在做一个插件我只想创建自己的插件样式和函数..
I wan't to know if it's possible in the onclick event to open a popup and get some input from the popup. Which then can be pasted into the editor. Exactly like if you're doing a plugin i just want to create my own without all the plugin style and functions..
提前致谢。
推荐答案
有两种选择:
第一次你可以设置或者禁用常规弹出窗口的所有css。
First you can set or disable all css for the regular popup.
第二个选项是使用按钮单击或打开您自己的经典弹出窗口或模态对话框。单击编辑器中的指定元素。关闭弹出窗口时,您可以使用类似
Second option is to open a classical popup or modal dialogue of your own using a button click or a click onto a specified element in the editor. When closing the popup you can write something back to the editor using a command like
tinyMCE.get("my_editor_id").execCommand("mceInsertContent",false,'whatever');
这篇关于带弹出窗口的TinyMCE自定义按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!