I found javascript wysiwyg editor wysiHTML5.
I'm trying to add element <a href=...>
to the editor or just turn on bold programmatically.
My code is:
var editor = new wysihtml5.Editor("textarea", {
toolbar: "toolbar",
stylesheets: "css/wysihtml5.css",
parserRules: wysihtml5ParserRules
});
editor.observe("load", function() {
editor.composer.commands.exec("bold");
});
Am I doing something wrong?
mateusmaso's solution gave me the following error:
So I've investigated some more and found the following solution, which (IMO) seems more ok:
Source
Actually no, but you have to be sure that your textarea (iframe) is focused. Try to use
on
instead ofobserve
. Here is a sample code that worked for me with insertHTML.assuming you have instantiated the editor previously using
$('#textarea-id').wysihtml5()
font