Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.38k stars 314 forks source link

Override icon class names #448

Open vanillajonathan opened 2 years ago

vanillajonathan commented 2 years ago

Is your feature request related to a problem? Please describe. I already use a icon set, and don't want to also use Font Awesome.

Describe the solution you'd like A iconClassNames option which provides a dictionary/map to define the icon class names.

Additional context See Bootstrap Icons.

Would be:

iconClassNames: {
    toggleBold: 'bi bi-type-bold',
    toggleItalic: 'bi bi-type-italic',
    toggleStrikethrough: 'bi bi-type-strikethrough',
    toggleHeading1: 'bi bi-type-h1',
    toggleHeading2: 'bi bi-type-h2',
    toggleHeading3: 'bi bi-type-h3',
    toggleCodeBlock: 'bi bi-code',
    toggleBlockquote: 'bi bi-quote',
    toggleOrderedList: 'bi bi-list-ol',
    toggleUnorderedList: 'bi bi-list-ul',
    cleanBlock: 'bi bi-eraser',
    drawLink: 'bi bi-link',
    drawImage: 'bi bi-image',
    drawTable: 'bi bi-table',
    drawHorizontalRule: 'bi bi-hr',
    togglePreview: 'bi bi-eye',
    toggleSideBySide: 'bi bi-layout-split',
    toggleFullScreen: 'bi bi-fullscreen',
    guide: 'bi bi-question-circle',
    undo: 'bi bi-arrow-counterclockwise',
    redo: 'bi bi-arrow-clockwise'
}
vanillajonathan commented 2 years ago

Starting out by refactoring into a map #454

Ionaru commented 2 years ago

You can use autoDownloadFontAwesome: false and provide the toolbar configuration option with buttons that use other icons with the className attribute.

vanillajonathan commented 2 years ago

Yes, but then integrator would have to manually recreate their own custom buttons for every button.

This commit separates concerns so it relies on a map which we can later override to make it easier for integrators to use their own icons.

Ionaru commented 2 years ago

While I appreciate the work you're doing to make the editor as user-friendly as possible, I fear that all this work will go to waste when #447 happens, especially for extra configuration options to handle things that are already possible using other methods.

vanillajonathan commented 2 years ago

Yeah, maybe, but then there is always the option for integrators to stay with the latest EasyMDE 2 version.

I would hope to see this merged.