user1643156
user1643156

Reputation: 4537

TinyMCE content not being updated when using hide

First of all, this is not about the tinyMCE.triggerSave();

Sometimes when editing content, I switch to the textarea mode with the following

$('#id').tinymce().hide(); // from the official example

which temporarily hides the rich editor from view so I can see the HTML codes.

But if I submit the form right after editing without switching back to rich editor [ using .show() ], the content will not be updated.

My question is how can I save the content of textarea to iframe?

  1. Please do not offer me the "use the code window" option, I have a customized show/hide button outside of TinyMCE.

  2. Switching by mceAddControl/mceRemoveControl will solve the problem. But when submitting, the content inside the textarea will not be formatted.

Upvotes: 1

Views: 645

Answers (1)

user1643156
user1643156

Reputation: 4537

Well, I just figured out a way to update content

$('#id').blur(function() {
    $('#id').html(document.getElementById('id').value);
});

UPDATE

this might be even better, for all instances

$('textarea.tinymce').blur(function() {
    var this_id = $(this).attr('id');
    $('#' + this_id).html(document.getElementById(this_id).value);
});

Any other solutions are really appreciated.

Upvotes: 2

Related Questions