mirror of
https://github.com/codex-team/editor.js
synced 2024-06-01 21:42:26 +02:00
feat: type / to trigger a popup action toolbox
This commit is contained in:
parent
41dc65274d
commit
45ede48bb6
|
@ -54,6 +54,11 @@ function BlockAPI(
|
|||
* @returns {boolean}
|
||||
*/
|
||||
get isEmpty(): boolean {
|
||||
// if block content is only a SLASH, replace the SLASH with selected Tool
|
||||
const holderContent = block.holder.innerText;
|
||||
if(holderContent === '/'){
|
||||
return true;
|
||||
}
|
||||
return block.isEmpty;
|
||||
},
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ export default class BlockEvents extends Module {
|
|||
case _.keyCodes.TAB:
|
||||
this.tabPressed(event);
|
||||
break;
|
||||
case _.keyCodes.SLASH:
|
||||
this.slashPressed();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +150,13 @@ export default class BlockEvents extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Type slash to open Toolbox
|
||||
*/
|
||||
public slashPressed(): void {
|
||||
this.activateToolbox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add drop target styles
|
||||
*
|
||||
|
|
|
@ -56,6 +56,7 @@ export const keyCodes = {
|
|||
RIGHT: 39,
|
||||
DELETE: 46,
|
||||
META: 91,
|
||||
SLASH: 191,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue