Ionaru / Ionaru/easy-markdown-editor
Easy way to redefine an action?
- Dominant language
- JavaScript
- Stars
- 3.1k
- Forks
- 363
- PR merge metrics
- No merged PRs in 30d
Description
### I'm submitting a...
- [ ] Bug report
- [x] Feature request
I would like to redefine some actions. The only way I found to do this is to use the `toolbar` option, but this one overwrite all default items, so I need to set all default icons and create a new icon with the same values instead the custom action, like this:
```js
toolbar: [
'bold', 'italic', 'heading', '|', 'quote', 'unordered-list', 'ordered-list', '|', 'link',
{
name: 'image',
action: function customFunction(editor){
alert('Hey!')
},
className: 'fa fa-image',
title: 'Insert image'
},
'|', 'preview', 'side-by-side', 'fullscreen', 'guide'
]
```
Is there an easier way to do this?
If not, I would suggest a `toolbarAction` option, which could work like this:
```js
new EasyMDE({
toolbarAction: {
image: function customFunction(editor){
alert('Hey!')
},
}
});
```
Contributor guide
Research direction
Start by tracing how the toolbar option and the EasyMDE constructor process toolbar items. Determine whether a toolbarAction-style option can override one named action while preserving the default items; done means the image action can be replaced without copying the entire toolbar configuration, with existing toolbar behavior retained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100