I am trying to override a default control in jwysiwyg. Whenever I do this and click on the control I am overriding, I get this error: $.data(this, "wysiwyg") is undefined
. Here is the code I am using.
$('.wysiwyg').wysiwyg({
css: "css/wysiwyg.css",
controls: {
bold: {
visible: true,
exec: function() {
$('.wysiwyg').wysiwyg('insertImage', 'path/to/image.jpg');
},
}
}
});
Also, I can change the control I am overriding from bold, to any other default control (strikeThrough, ...) and I still get the same error.
Because function defined in exec operates not in your initial document, but in iframe document created by jwysiwig. And in iframe document there is no such thing as jwysiwig container.