简体   繁体   English

有没有办法通过按钮打开TinyMCE弹出对话框?

[英]Is there a way to open TinyMCE popup dialog from a button?

I'd like to have TinyMCE open up as a popup dialog and load specified content for editing. 我想打开TinyMCE作为弹出对话框,并加载指定的内容进行编辑。

I have some text inside a div and upon clicking a button, I'd like to have TinyMCE open for editing the text. 我在div中有一些文本,单击按钮后,我想打开TinyMCE来编辑文本。

I believe you'd need something like Fancybox for your modal popup window. 我相信您的模态弹出窗口需要Fancybox之类的东西。 The rest is rather simple: 其余的很简单:

Script (in page1.htm) 脚本(在page1.htm中)

<script>
$(document).ready(function() {
    $(".element").fancybox({
        fitToView   : false,
        width       : '500px',
        height      : '500px',
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'none',
        closeEffect : 'none',

    });
});
</script>

Then you'd need your whole Load TinyMCE code and your textarea code (as in the TinyMCE demos on their site and in their dowloads) loaded in an external page (page2.htm), and you'd then need to call page2.htm as an iframe in Fancybox, not sure if this is the proper way to do it, but it works in Chrome and FireFox: 然后,您需要将整个Load TinyMCE代码和textarea代码(如其网站上的TinyMCE演示以及其下载中的内容)加载到外部页面(page2.htm)中,然后需要调用page2.htm作为Fancybox中的iframe,不确定这样做是否正确,但是可以在Chrome和FireFox中使用:

<a class="element" data-fancybox-type="iframe" href="page2.htm"><input type="button" value="Your Value Text"></a>

Something along those lines should do just what you're wanting done. 遵循这些原则,应该可以完成您想要做的事情。

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

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