nasa8x/v-markdown-editor

New custom button requires lowercase name

ngjuping opened this issue · 0 comments

I tried to register my own add link button according to this link: https://morioh.com/p/2a1c9c34024b

I named my new button with newLink and added handler for @command:newLink as well as the extend object.

<markdown-editor v-model="input" 
toolbar="bold italic strikethrough heading | numlist bullist code quote uploadimage newLink redo undo"
@command:uploadimage="uploadimage"
@command:newLink="newLink"
:extend="custom"></markdown-editor>

In my data() function in the script section of my Vue component:

 custom: {
                // Names should be all small letter
                'uploadimage': {
                    cmd: 'uploadimage',
                    ico: 'fas far fa-image mdi mdi-image',
                    title: 'Upload Image'
                },
                'newLink': {
                    cmd: 'newLink',
                    ico: 'fas far fa-link mdi mdi-link',
                    title: 'Upload Link'
                }
            }

handler for newLink:

newLink(md){
            let url = prompt("Insert link");
            md.drawLink({url:`${url}`, title:`${url}`});
        },

The vue components loaded with error as shown below:
image

Which did not happen if I changed every occurence of newLink to newlink.