codex-team / codex-team/editor.js
[Bug] Unable to deactivate an inline tool’s formatting using its keyboard shortcut
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
I’ve made custom _Strong_ and _Emphasis_ inline tools because I want consistent and modern HTML output from EditorJS. I’ve assigned the shortcuts `CMD+B` and `CMD+I` to them, respectively.
I’ve overridden all the rich text compatible blocks I’m using as shown below, in order to get rid of the built-in bold and italic inline tools, while keeping the link tool;
```javascript
tools: {
...,
paragraph: {
class: Paragraph,
inlineToolbar: ['strong', 'emphasis', 'link']
}
}
```
**Steps to reproduce:**
1. Select some text
1. Trigger the assigned keyboard shortcut
1. Watch the formatting being applied correctly
1. Trigger the assigned keyboard shortcut again
1. The formatting unexpectedly stays put, nothing happens
**Expected behavior:**
That I can toggle the text formatting on and off by triggering the tool’s keyboard shortcut.
**Device, Browser, OS:**
Chrome 81, macOS
**Editor.js version:**
2.17.0
**Plugins you use with their versions:**
- delimiter 1.1.0
- header 2.4.1
- list 1.4.0
- paragraph 2.6.1
---
I also have another problem which is possibly related, or at least in the same realm; defining the shortcuts in the inline class definition seemingly does not have any effect at all. Only when I do it in the initialize config, it works;
```javascript
tools: {
...,
strong: {
class: Strong,
shortcut: 'CMD+B'
},
emphasis: {
class: Emphasis,
shortcut: 'CMD+I'
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.