Happy Coder
Happy Coder

Reputation: 4682

invoke tinymce preview from outside

I have TinMCE installed and now I would like to invoke the preview functionality from outside the editor. I mean when another preview button in clicked, it needs to invoke the tinymce preview so that I can see the preview popup. This is possible ?

Upvotes: 1

Views: 1580

Answers (2)

yb007
yb007

Reputation: 1377

Try to follow this fiddle

Create a button outside editor. Invoke this command onclick of this button.

 tinyMCE.activeEditor.execCommand('mcePreview');

Hope this helps.

Upvotes: 4

Daniele
Daniele

Reputation: 1938

Try with a syntax like that for grab the content:

var content = tinyMCE.activeEditor.getContent();

Or for the preview:

$('textarea.tinymce').tinymce().execCommand('mcePreview');

Upvotes: 0

Related Questions