Programmatically retrieve content from the WYSIHTML5 editor

How to programmatically get content from the editor WYSIHTML5? Suppose the editor is created like this:

var editor = new wysihtml5.Editor
(
   $(this.el).find('textarea').get(0),
   {
      toolbar:      "toolbar",
      parserRules:  wysihtml5ParserRules
   }
);

I would like to get editor content for the event blur

editor.on
(
   "blur",
   function()
   {
      //what here?
   }
);
+5
source share
2 answers

API is much better editor.getValue()

(@dalen mentioned this in a comment above)

+11
source

Here's how (jQuery is used here):

$('iframe').contents().find('.wysihtml5-editor').html();

To find text, use text()instead html().

FYI:

jQueryify, jQuery , .


, - , :)

+5

All Articles