fabianmichael / kirby-markdown-field

Super-sophisticated markdown editor for Kirby 3, community built.
Other
160 stars 14 forks source link

How to wrap string with a custom button? #156

Closed quentin-f451 closed 1 year ago

quentin-f451 commented 2 years ago

Hi there,

Is there any documentation for what is now possible with the new Extension API? The previous documentation was quite great to show various example of string manipulation but I can't find the same documentation for the new version of the plugin.

For example, I'd like to get the selected string when I click on a custom button, in order to wrap it on a custom HTML tag. I know it was possible with this.insert('<div>' + this.selection +'</div>') but can't find how to do that now.

Thanks in advance!

fabianmichael commented 1 year ago

@quentin-f451 I am afraid you have to figure this out by yourself, because I’m too busy at the moment. You could for example study, how other extensions and buttons access the editor API. Alternatively, you could also try to dig deeper into CM’s docs: