Inscryb / inscryb-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Based off SimpleMDE by Sparksuite.
MIT License
90 stars 16 forks source link

Toolbar still gets wiped when setting a custom button? #26

Closed working-name closed 6 years ago

working-name commented 6 years ago

I'm submitting a...

Reproduction steps

N/A

Notes

Came here from a thread complaining of the same thing for SimpleMDE where the toolbar buttons get wiped when you set a custom one. It seems incrybMDE has not handled that yet, either?

      toolbar: [
        {
                name: "custom",
                action: function customFunction(editor){
                    // Add your own code
                },
                className: "fa fa-star",
                title: "Custom Button",
            },
      ],

Also, as a side note, moving to <button> makes a dark theme look uggo.

CWharton commented 6 years ago

What you are asking for is a feature request. I am assuming you wish to append a button to the existing toolbar?

This is not a feature I wish to implement into this project because to do not think it will provide much value and might even cause confusion. As it stands your code example is replacing the toolbar with one custom button. In the readme I provide an example on how to replace the toolbar and add a custom button. You can also use the example provided below.

var inscrybmde = new InscrybMDE({
    toolbar: [
            'undo', 'redo', '|', 'bold', 'italic', 'heading', '|', 'link',
            {
                name: "custom",
            action: function customFunction(editor){
                // Add your own code
            },
            className: "fa fa-star",
            title: "Custom Button",
            },
            'table', 'horizontal-rule', '|', 'preview', 'side-by-side', 'fullscreen', '|', 'in-shortcuts', 'guide', '|',
    ],
});

I hope this will helps you out.

working-name commented 6 years ago

My apologies, I didn't realize I could just name the buttons and they'd be pulled. Thank you, that's exactly it.