Search code examples
javascriptrichtextboxrich-text-editoronkeydownwysihtml5

Disable keyboard Keys in WYSIHTML5


I want to disable all keyboard keys in wysihtml5 text editor .
I am using this editor https://github.com/bassjobsen/wysihtml5-image-upload
can anyone help me to do this.
I have try "load" event and its works perfectly but i cannot use "onkeypress" or "onkeyup"\

var defaultOptions = $.fn.wysihtml5.defaultOptions = {
"font-styles": false,
    "color": false,
    "emphasis": false,
    "lists": false,
    "html": false,
    "link": false,
    "image": true,
    events: {
        "load": function() {
            console.log('loaded!');
        }
    },

Solution

  • I think that is the answer below

    var defaultOptions = $.fn.wysihtml5.defaultOptions = {
        "font-styles": false,
        "color": false,
        "emphasis": false,
        "lists": false,
        "html": false,
        "link": false,
        "image": true,
        events: {
            "load": function() {
                $('.wysihtml5-sandbox').contents().find('body').on("keydown",function(event) {
                    return false;
                });
            }
        },