tinymce and Jquery UI dialog working nicely

笑着哭i 提交于 2019-12-25 04:33:43

问题


I'm having some problems with Jquery UI Dialog and TinyMCE.
Passing data to a text area works well with UI Dialog and Jquery.
So setting data in text area like this works fine:

        $("#MessageDialog #messageDto_Body").val(messagedata.Body);
        $("#MessageDialog").dialog("open");

When I attach a tinyMCE editor to the text area it correctly adds the editor (and without the UI window the content of the text area is preserved):

tinyMCE.execCommand('mceAddControl', false, 'messageDto.Body');

With UI Dialog the area is empty.

From what I have seen the tinyMCE works hiding the real text-area and adding a new one. I have also tried setting the content directly but no luck:

  tinyMCE.activeEditor.setContent(messagedata.Body, {format : 'bbcode'});

Any advice?

UPDATE: substituted Jquery UI Dialog with jqModal and everything works. I think the problem could rely not in TinyMce but in the Jquery UI Dialog


回答1:


Perhaps the jQuery TinyMCE plugin will be helpful.




回答2:


tinyMCE hides the textarea and adds multiple elements using the textarea's ID appended with '_' + element type. To access the contents of the iframe try something like this.

$("#content_ifr").contents().find("body").html(messagedata.Body);

Where #content is the ID of your textarea.




回答3:


I solved this by initializing the editr with the TinyMCE jQuery plugin with $('#myTextBox').tinymce(..., after opening the dialog. CLosing and reopening the dialog doesn't seem to cause a problem with jQ UI 1.8.16.



来源:https://stackoverflow.com/questions/752313/tinymce-and-jquery-ui-dialog-working-nicely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!