Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7713485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:53:15+00:00 2026-06-01T01:53:15+00:00

I’ve submitted a bug to the tinyMCE people, but i’m hoping someone else has

  • 0

I’ve submitted a bug to the tinyMCE people, but i’m hoping someone else has come across this and has a suitable workaround.

Here’s the situation:
I’ve got a form with a tinyMCE control that i load into a jquery dialog. it works great the first time, then after they close it, and open a new one. any interaction with the tinyMCE control gives:

"Node cannot be used in a document other than the one in which it was created" 

it also doesn’t fill the control with the text it’s supposed to be prepopulated with.

In my jquery dialogs i have the following scripts in my beforeClose handler:

if (typeof tinyMCE != 'undefined') {
                $(this).find(':tinymce').each(function () {
                    var theMce = $(this);

                    tinyMCE.execCommand('mceFocus', false, theMce.attr('id'));
                    tinyMCE.execCommand('mceRemoveControl', false, theMce.attr('id'));
                    $(this).remove();
                });
            }

and here’s my tinyMCE setup script:

$('#' + controlId).tinymce({
        script_url: v2ScriptPaths.TinyMCEPath,
        mode: "none",
        elements: controlId,
        theme: "advanced",
        plugins: "paste",
        paste_retain_style_properties: "*",
        theme_advanced_toolbar_location: "top",
        theme_advanced_buttons1: "bold, italic, underline, strikethrough, separator, justifyleft, justifycenter, justifyright, justifyfull, indent, outdent, separator, undo, redo, separator, numlist, bullist, hr, link, unlink,removeformat",
        theme_advanced_buttons2: "fontsizeselect, forecolor, backcolor, charmap, pastetext,pasteword,selectall, sub, sup",
        theme_advanced_buttons3: "",
        language: v2LocalizedSettings.languageCode,
        gecko_spellcheck : true,
        onchange_callback: function (editor) {
            tinyMCE.triggerSave();
        },
        setup: function (editor) {
            editor.onInit.add(function (editor, event) {
                if (typeof v2SetInitialContent == 'function') {
                    v2SetInitialContent();
                }
            })
        }
    });

is there anything obvious here? i’ve got all that complicated removal stuff in the close b/c tinymce doesn’t like having it’s html removed without it being removed.

the setInitialContent() stuff is just so i can pre-load it with their email signature if they have one. it’s broken with or without that code so that’s not the problem.

i was forced to update to 3.4.9 because of this issue:

http://www.tinymce.com/forum/viewtopic.php?id=28400

so if someone can solve that, it would help this situation to. I have tried the suggestion from aknosis with no luck.

EDIT: I originally thought this only affected firefox 11, but i have downloaded 10, and it is also affected.

EDIT: Ok, i’ve trimmed down all my convoluted dynamic forms and links that cause this into a fairly simple example.

the code for the base page:

<a href="<%=Url.Action(MVC.Temp.GetRTEDialogContent)%>" id="TestSendEmailDialog">Get Dialog</a>
<div id="TestDialog"></div>
<script type="text/javascript">
    $('#TestSendEmailDialog').click(function (e) {
        e.preventDefault();

        var theDialog = buildADialog('Test', 500, 800, 'TestDialog');
        theDialog.dialog('open');
        theDialog.empty().load($(this).attr('href'), function () {

        });

    });

    function buildADialog(title, height, width, dialogId, maxHeight) {
        var customDialog = $('#' + dialogId);

        customDialog.dialog('destory');

        customDialog.dialog({
            title: title,
            autoOpen: false,
            height: height,
            modal: true,
            width: width,
            close: function (ev, ui) {

                $(this).dialog("destroy");
                $(this).empty();

            },
            beforeClose: function (event, ui) {

                if (typeof tinyMCE != 'undefined') {
                    $(this).find(':tinymce').each(function () {
                        var theMce = $(this);

                        tinyMCE.execCommand('mceFocus', false, theMce.attr('id'));
                        tinyMCE.execCommand('mceRemoveControl', false, theMce.attr('id'));
                        $(this).remove();
                    });
                }

            }
        });

        return customDialog;

    }

</script>

and the code for the page that is loaded into the dialog:

<form id="SendAnEmailForm" name="SendAnEmailForm" enctype="multipart/form-data" method="post">
   <textarea cols="50" id="MessageBody" name="MessageBody" rows="10" style="width: 710px; height:200px;"></textarea>
</form>

<script type="text/javascript">

    $(function () {
        $('#MessageBody').tinymce({
            script_url: v2ScriptPaths.TinyMCEPath,
            mode: "exact",
            elements: 'MessageBody',
            theme: "advanced",
            plugins: "paste, preview",
            paste_retain_style_properties: "*",
            theme_advanced_toolbar_location: "top",
            theme_advanced_buttons1: "bold, italic, underline, strikethrough, separator, justifyleft, justifycenter, justifyright, justifyfull, indent, outdent, separator, undo, redo, separator, numlist, bullist, hr, link, unlink,removeformat",
            theme_advanced_buttons2: "fontsizeselect, forecolor, backcolor, charmap, pastetext,pasteword,selectall, sub, sup, preview",
            theme_advanced_buttons3: "",
            language: 'EN',
            gecko_spellcheck: true,
            onchange_callback: function (editor) {
                tinyMCE.triggerSave();
            }
        });
    });

</script>

a very interesting thing i noticed, if i move the tinyMCE setup into the load callback, it seems to work. this isn’t really a solution though, because when i’m loading dialogs, i don’t know in the code ahead of time if it has tinyMCE controls or not!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:53:17+00:00Added an answer on June 1, 2026 at 1:53 am

    i solved this by moving the tinyMCE setup into a function, and then in my load() calls, checking if that function exists, and then calling it.

    not the best solution, but it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.