Programmatically retrieve content from WYSIHTML5 editor

Dalen picture Dalen · Jun 11, 2012 · Viewed 10.3k times · Source

How do I programmatically retrieve content from a WYSIHTML5 editor? Suppose the editor is instantiated as this:

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

i would like to get the editor's content on blur event

editor.on
(
   "blur",
   function()
   {
      //what here?
   }
);

Answer

p3drosola picture p3drosola · Jul 4, 2012

It's much better to use the API editor.getValue()

(@dalen mentioned this in the comment above)