feat: Ctrl/Cmd+S: prevent 'Save As' dialog (#1272)
* init * remove: force save * switch from event.key to event.code by sanua356
This commit is contained in:
parent
e51a93221c
commit
6792a191b1
1 changed files with 4 additions and 0 deletions
|
|
@ -217,6 +217,10 @@ export default function PageEditor({
|
||||||
scrollMargin: 80,
|
scrollMargin: 80,
|
||||||
handleDOMEvents: {
|
handleDOMEvents: {
|
||||||
keydown: (_view, event) => {
|
keydown: (_view, event) => {
|
||||||
|
if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
|
||||||
|
event.preventDefault();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {
|
if (["ArrowUp", "ArrowDown", "Enter"].includes(event.key)) {
|
||||||
const slashCommand = document.querySelector("#slash-command");
|
const slashCommand = document.querySelector("#slash-command");
|
||||||
if (slashCommand) {
|
if (slashCommand) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue