mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 10:50:23 +02:00
fix(slash): do not handle / + shift/alt, support for ascii keyboard
This commit is contained in:
parent
9542551d84
commit
9759294e96
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
### 2.29.1
|
||||||
|
|
||||||
|
- `Fix` — Toolbox wont be shown when Slash pressed with along with Shift or Alt
|
||||||
|
- `Fix` — Toolbox will be opened when Slash pressed in ASCII-capable keyboard layout.
|
||||||
|
|
||||||
### 2.29.0
|
### 2.29.0
|
||||||
|
|
||||||
- `New` — Editor Config now has the `style.nonce` attribute that could be used to allowlist editor style tag for Content Security Policy "style-src"
|
- `New` — Editor Config now has the `style.nonce` attribute that could be used to allowlist editor style tag for Content Security Policy "style-src"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@editorjs/editorjs",
|
"name": "@editorjs/editorjs",
|
||||||
"version": "2.29.0",
|
"version": "2.29.1",
|
||||||
"description": "Editor.js — Native JS, based on API and Open Source",
|
"description": "Editor.js — Native JS, based on API and Open Source",
|
||||||
"main": "dist/editorjs.umd.js",
|
"main": "dist/editorjs.umd.js",
|
||||||
"module": "dist/editorjs.mjs",
|
"module": "dist/editorjs.mjs",
|
||||||
|
|
|
@ -52,13 +52,17 @@ export default class BlockEvents extends Module {
|
||||||
case _.keyCodes.TAB:
|
case _.keyCodes.TAB:
|
||||||
this.tabPressed(event);
|
this.tabPressed(event);
|
||||||
break;
|
break;
|
||||||
case _.keyCodes.SLASH:
|
}
|
||||||
if (event.ctrlKey || event.metaKey) {
|
|
||||||
this.commandSlashPressed();
|
/**
|
||||||
} else {
|
* Keyboard-layout independent handling of Slash key
|
||||||
this.slashPressed();
|
*/
|
||||||
}
|
if (event.key === '/' || event.code === 'Slash') {
|
||||||
break;
|
if (event.ctrlKey || event.metaKey) {
|
||||||
|
this.commandSlashPressed();
|
||||||
|
} else if (!event.shiftKey && !event.altKey) {
|
||||||
|
this.slashPressed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,36 @@ describe('Slash keydown', function () {
|
||||||
.get('.ce-popover')
|
.get('.ce-popover')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[
|
||||||
|
'{shift}',
|
||||||
|
'{alt}',
|
||||||
|
'{option}',
|
||||||
|
].forEach((key) => {
|
||||||
|
it(`should not open Toolbox if Slash pressed with ${key}`, () => {
|
||||||
|
cy.createEditor({
|
||||||
|
data: {
|
||||||
|
blocks: [
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
data: {
|
||||||
|
text: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('[data-cy=editorjs]')
|
||||||
|
.find('.ce-paragraph')
|
||||||
|
.click()
|
||||||
|
.type(`${key}/`);
|
||||||
|
|
||||||
|
cy.get('[data-cy="toolbox"]')
|
||||||
|
.get('.ce-popover')
|
||||||
|
.should('not.be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('pressed in non-empty block', function () {
|
describe('pressed in non-empty block', function () {
|
||||||
|
|
Loading…
Reference in a new issue