jodit / jodit-react

React wrapper for Jodit
MIT License
363 stars 120 forks source link

How to hide the file upload option on hyper link #180

Open naganand123 opened 2 years ago

naganand123 commented 2 years ago

I want to hide the file upload and fill color options, please help me how to hide.

image

xdan commented 2 years ago

https://github.com/xdan/jodit/blob/master/src/plugins/inline-popup/config/items/a.ts#L14 Define popup.a option

const config = {
   popup: {
      a: Jodit.atom(Jodit.defaultOptions.popup.a.slice(0, 3))
    }
}
naganand123 commented 2 years ago
import JoditEditor from 'jodit-react';

function markAsAtomic(obj) {
    Object.defineProperty(obj, 'isAtom', {
        enumerable: false,
        value: true,
        configurable: false
    });

    return obj;
}

const config = {
    readonly: false,
    showCharsCounter: false,
    showWordsCounter: false,
    showXPathInStatusbar: false,
    height: '200',
    toolbarAdaptive: false,
    askBeforePasteFromWord: false,
    askBeforePasteHTML: false,
    popup: {
        a: markAsAtomic([
            {
                name: 'eye',
                tooltip: 'Open link',
                exec: (editor, current) => {
                    const href = attr(current, 'href');

                    if (current && href) {
                        editor.ow.open(href);
                    }
                }
            },
            {
                name: 'link',
                tooltip: 'Edit link',
                icon: 'pencil'
            },
            'unlink',
            'brush'
        ])
    }
};

<JoditEditor
    ref={editor}
    value={content}
    config={config}
    tabIndex={1} // tabIndex of textarea
    onBlur={newContent => setContent(newContent)}
/>;
naganand123 commented 2 years ago

I am not getting where to add that code. Can we hide file upload button using CSS?

xdan commented 2 years ago

@naganand123 Updated your example

naganand123 commented 2 years ago

Thank you every much