简体   繁体   中英

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.

I have some text inside a div and upon clicking a button, I'd like to have TinyMCE open for editing the text.

I believe you'd need something like Fancybox for your modal popup window. The rest is rather simple:

Script (in 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:

<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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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