Dzhuneyt
Dzhuneyt

Reputation: 8701

Remove "Browse" button from TinyMCE's "Insert Link" dialog when using MoxieManager

I have correctly configured MoxieManager to be integrated with TinyMCE and all works fine. But I'd like to remove the "browse" button (which opens the MoxieManager dialog) from the "Insert link" dialog.

So from the following screenshot, the green should stay but the red should go.

enter image description here

Upvotes: 1

Views: 2244

Answers (3)

bowen shi
bowen shi

Reputation: 114

add it to you config

file_picker_types: 'media image'

file_picker_types

This option enables you to specify what types of file pickers you need by a space or comma separated list of type names. There are currently three valid types: file, image and media.

https://www.tiny.cloud/docs/tinymce/6/file-image-upload/#file_picker_types

Upvotes: 1

jsplaine
jsplaine

Reputation: 621

Or, if you don't want to change the source .. say you're using a minified version etc, you can disable it via CSS:

div[aria-label="Insert link"] .mce-btn.mce-open {
  display: none;
}

Upvotes: 2

Dzhuneyt
Dzhuneyt

Reputation: 8701

Self answer, but I guess it will be helpful to other people as well.

Each TinyMCE plugin usually has a JS file located under plugins/[plugin_name]/plugin.js (or plugin.min.js, depending on if you are using the minified version). Those plugins usually call the editor.windowManager.open(), passing an object of configuration options to be applied to the newly opened window.

One of the values this object can have is body which is an array of the items to be displayed in the dialog. Each item has some options to be configured on its own, including the type property.

In the below example, I have used plugins/link/plugin.js to show the difference needed to replace the (default) text field with the file browser button - with the standard text field without the browse button.

win = editor.windowManager.open({
        // ...
        body: [
            {
                name: 'href',
                type: 'filepicker',
                filetype: 'file',
                // ...
            },
// More code follows here

And the new version:

win = editor.windowManager.open({
        // ...
        body: [
            {
                name: 'href',
                type: 'textbox',
                filetype: 'file',
                // ...
            },
// More code follows here

Upvotes: 7

Related Questions