문제

I have a situation where I need to save the contents of the TinyMCE editor to a database, then retrieve them later with the caret/cursor position restored.

I see in the TinyMCE documentation that it might be possible using getBookmark(), for example:

var bm = tinyMCE.activeEditor.selection.getBookmark();

However, I cannot work out how to serialize the value returned by getBookmark() If I save it to a text box like this:

$('#myTextBoxId').val(bm);

the value just shows as [Object] [Object].

Is it even possible to save the bookmark across page postbacks?

도움이 되었습니까?

해결책

Thanks to @JoseM's comment, the answer is uber-simple:

var bm = tinyMCE.activeEditor.selection.getBookmark();
$('#myTextBoxId').val(JSON.stringify(bm));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top