These are chat archives for nmielnik/797ContextAwareToolbar

26th
Feb 2016
Nate Mielnik
@nmielnik
Feb 26 2016 05:03
@davideanderson I think this is pretty awesome
the one recommendation I would make is just to take example 1, and make that the default in the extension code
so in main.js, instead of initializing states: {}
you could just do this:
var MediumEditorToolbarStates = MediumEditor.Extension.extend({
    // ...
    states: {
        default: {
            buttons: ['bold', 'italic', 'underline', 'h2', 'h3', 'quote', 'anchor']
        },
        alternate: {
            buttons: ['h2', 'h3', 'h4', 'h5', 'quote'],
            nodeNames: ['H2', 'H3', 'H4', 'H5', 'BLOCKQUOTE']
        }
    },

    // ...
});
Nate Mielnik
@nmielnik
Feb 26 2016 05:08
that way, if someone can just initialize your extension as new MediumEditorToolbarStates(), and they'll get some working functionality
but if anyone passes a states: { /* props */ } option in, it'll override the default behavior to use whatever they pass
just a recommendation, but this is definitely up to you, I like this alot
feel free to add some stuff to your readme and/or create an npm package
and then you can add yourself into the Wiki on medium-editor, and we'll add your extension to the landing page here: https://yabwe.github.io/medium-editor/#extensions
thanks again for building this out, very cool and I expect that people will use this and also start suggesting improvements or submitting PRs to your repo