Skip to content

How to add custom button to react-trumbowyg? #17

@nllsdfx

Description

@nllsdfx

I'm trying add a custom button but it doesn't work (works normal in vanilla js):

const btnsDef = {
        uploadImage: {
            fn: function () {
               //todo
            },
            title: 'Upload Image',
            text: 'Upload Image',
            isSupported: function () {
                return true;
            },
            ico: 'upload',
            hasIcon: true
        }
    };

    return (
        <FormGroup>
            <Trumbowyg
                btnsDef={btnsDef}
                buttons={
                    [
                        ['viewHTML'],
                        ['undo', 'redo'],
                        ['formatting'],
                        ['strong', 'em', 'del'],
                        ['superscript', 'subscript'],
                        ['link'],
                        ['insertImage'],
                        ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
                        ['unorderedList', 'orderedList'],
                        ['horizontalRule'],
                        ['removeformat'],
                        ['uploadImage'],
                        ['fullscreen']

                    ]
                }
                id="editor"/>
        </FormGroup>
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions