Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/

like image 770
Bad Dub Avatar asked Nov 16 '22 14:11

Bad Dub


1 Answers

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;
}
like image 92
Bad Dub Avatar answered Feb 23 '23 00:02

Bad Dub