jodit icon indicating copy to clipboard operation
jodit copied to clipboard

Question: add a button to the image toolbar ?

Open perea1 opened this issue 4 years ago • 5 comments

Hi, how can i add a button to the image toolbar ?

image-toolbar

perea1 avatar Aug 11 '20 10:08 perea1

Use https://xdsoft.net/jodit/doc/options/popup/ option

Jodit.make('#editor', {
 popup: {
  img: [
     {
        name: 'yourbtn',
       ...
    }
   ]
 }
})

xdan avatar Aug 11 '20 12:08 xdan

Hello, thank you for the hint! It could add the new button but it replaces the first button: jodit_toolbar_btn-delete toolbar-console1

image-toolbar3

Please note that i´m working with v 3.3.24 (waiting for #473 fix)

My config: var editor = new Jodit('#content', { inline: true, toolbar: false, toolbarInline: true, popup: { img: [{ name: 'inlineUpload', iconURL: 'http://.../icon-upload.png', label: 'inlineUpload', tooltip: "Inline upload", exec: function (editor) { myFunc(); } } ], selection: [ ...

perea1 avatar Aug 12 '20 22:08 perea1

I was able to find a workaround: popup: { img: [ { name: "delete" }, { name: "pencil" }, { name: "valign" }, { name: "left" }, { ... custom buttons

perea1 avatar Aug 12 '20 23:08 perea1

Use Jodit.defaultOptions.popup.img and Jodit.Array for this

img: Jodit.Array([
{ name: "delete" },
...Jodit.defaultOptions.popup.img
])

When you use the usual array - it merges them. Jodit.Array will replace the old option.

xdan avatar Sep 02 '20 13:09 xdan

How can one implement this in Jodit react, through the config? I cant find Jodit.Array() , or Jodit.defaultOptions.popup.img..

joje1234 avatar Feb 22 '23 11:02 joje1234