I'm currently developping a text-to-symbol conversion tool (non-profit), and I'm having this problem:
For the WYSIWYG-editting of the text, I'd like to use a nice small wysiwyg editor (like jHtmlArea). This editor will show floating divs, so I'll have to intercept a lot of keypresses (spaces/arrows/etc)
Currently, my html area is loaded like this:
<script type="text/javascript">
$(function() {
$("#txtCustomHtmlArea").htmlarea({
loaded: function() {
$(this.editor).keydown(function(event) {
if(event.keyCode == 32) {
this.pasteHTML('<b>test</b>');
return false;
}
return true;
});
}
The problem with this code is that this.editor doesn't have the method pasteHTML. How can I use this method from this(=htmlarea).event?
This is most probably a fairly beginner question, but I'm really clueless towards where to look.
Thank you
Here's how I do it:
$("#my-text-area").htmlarea({
loaded: function () {
$.myControl = { jhtmlarea: this };
}
});
Then I can reference:
$($.myControl.jhtmlarea.editor.body).keypress(function (e) { });
This also gives me a handle to my the html area object from outside of the iFrame.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With