Search code examples
imagefirefoxresizecontenteditabledesignmode

Firefox - designMode: disable image resizing handles


How can I prevent the user from being able to resize an image in designMode? (disable the handles when image is clicked)


Solution

  • Say you turn contentEditable on like this:

    document.body.contentEditable = true;
    

    All you have to do is turn it off for all (or some) images.

    var imgs = document.getElementsByTagName("IMG");
    for (var i = 0; i < imgs.length; ++i) {
        imgs[i].contentEditable = false;
    }