6

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/

Bad Dub
  • 1,503
  • 2
  • 22
  • 52
  • Hey. did you find an answer for this? I need to remove the source input also – Action_Turtle Feb 11 '21 at 10:37
  • @Action_Turtle Yeah I actually just targeted all the HTML elements and hide them using css. I will add my solution as an answer to the question as I forgot to do so way back. – Bad Dub Feb 15 '21 at 11:35

2 Answers2

2

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;
}
Bad Dub
  • 1,503
  • 2
  • 22
  • 52
0

You can actually make the images_upload_handler in the init object return a rejected Promise.

images_upload_handler: () => Promise.reject({ remove: true })
Tyler2P
  • 2,324
  • 26
  • 22
  • 31