tinymcetinymce-plugins

TinyMCE HTML Editor Disable Image Insert Source Textbox


I'm using the TinyMCE HTML Editor with the insert image function. The application I'm working on isn't allowed to use images from external URLs. So they should only be able to use the Upload option. Is there a way to disable the Source textbox shown below? Is there an initialisation property that can be used?

Souce Image

Here is an example of the TinyMCE editor in question. https://www.tiny.cloud/docs/demo/local-upload/


Solution

  • I couldn't find an official way to do this so I just targeted all the associated HTML elements and hid them using CSS.

    .tox-dialog .tox-dialog__content-js .tox-dialog__body .tox-form__controls-h-stack input[type=url].tox-textfield {
        display: none;
    }
    
    .tox-dialog .tox-dialog__content-js .tox-dialog__body div.tox-form__group:first-child label {
        display: none;
    }
    
    .tox-dialog .tox-dialog__content-js .tox-dialog__body .tox-form__controls-h-stack div.tox-form__group:first-child label {
        display: block;
    }