Adding a button that injects text in editor


#1

Hey there! Love StackEdit.

Currently working on my own fork, on a feature that fetches static asset references to Amazon S3. I list the assets in a new component in the sidebar. When clicking an asset from the list, it should inject it’s URL in to the editor.

I have been looking at how the button actions for Bold, Italic, etc. work and they are registered as buttons, with commands attached to them via a “command manager” through an “ui manager”. They are aware of which “chunk” is currently being selected.

But I’ve made a few attempts and can’t seem to figure out how to extend the command manager’s behaviour to accept events from an arbitrary number of buttons tied to asset references. The ownership patterns around “command manager” and “ui manager” are not obvious to me.

All help, explanations and pointers that help me understand what I should do are greatly appreciated!

Thanks in advance,
Halldór Eldjárn