This commit is contained in:
Vanessa 2022-07-09 15:53:52 +08:00
parent 45aa7ae744
commit 5bdaa3d9fd
4 changed files with 59 additions and 11 deletions

View File

@ -268,7 +268,7 @@ export const keymap = {
} }
if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) || if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) ||
["⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) { ["⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) {
showMessage(tip + "] " + window.siyuan.languages.invalid); showMessage(tip + "] " + window.siyuan.languages.invalid);
return; return;
} }

View File

@ -83,7 +83,7 @@ export abstract class Constants {
}; };
// "⌘", "⇧", "⌥", "⌃" // "⌘", "⇧", "⌥", "⌃"
// "⌘S", "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义 // "⌘A", "⌘X", "⌘C", "⌘V", "⌘/", "⌘↑", "⌘↓", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦" 不可自定义
public static readonly SIYUAN_KEYMAP: IKeymap = { public static readonly SIYUAN_KEYMAP: IKeymap = {
general: { general: {
syncNow: {default: "F9", custom: "F9"}, syncNow: {default: "F9", custom: "F9"},

View File

@ -381,12 +381,14 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
topNodeElement = topNodeElement.parentElement; topNodeElement = topNodeElement.parentElement;
} }
zoomOut(protyle, topNodeElement.getAttribute("data-node-id")); zoomOut(protyle, topNodeElement.getAttribute("data-node-id"));
event.preventDefault();
event.stopPropagation(); event.stopPropagation();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.general.enterBack.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.enterBack.custom, event)) {
zoomOut(protyle, protyle.block.parent2ID, nodeElement.getAttribute("data-node-id")); zoomOut(protyle, protyle.block.parent2ID, nodeElement.getAttribute("data-node-id"));
event.preventDefault();
event.stopPropagation(); event.stopPropagation();
return; return;
} }
@ -813,6 +815,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
} }
writeText(`siyuan://blocks/${actionElement.getAttribute("data-node-id")}`); writeText(`siyuan://blocks/${actionElement.getAttribute("data-node-id")}`);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
/// #if !MOBILE /// #if !MOBILE
@ -837,6 +840,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}); });
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockEmbed.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.copyBlockEmbed.custom, event)) {
@ -849,6 +853,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
} }
writeText(`{{select * from blocks where id='${actionElement.getAttribute("data-node-id")}'}}`); writeText(`{{select * from blocks where id='${actionElement.getAttribute("data-node-id")}'}}`);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
@ -876,6 +881,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
updateTransaction(protyle, topElement.getAttribute("data-node-id"), topElement.outerHTML, oldHTML); updateTransaction(protyle, topElement.getAttribute("data-node-id"), topElement.outerHTML, oldHTML);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.rename.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.rename.custom, event)) {
@ -899,18 +905,21 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}); });
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (selectText.trim() && matchHotKey(window.siyuan.config.keymap.editor.general.newNameFile.custom, event)) { if (selectText.trim() && matchHotKey(window.siyuan.config.keymap.editor.general.newNameFile.custom, event)) {
newFileBySelect(selectText, protyle); newFileBySelect(selectText, protyle);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.newContentFile.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.newContentFile.custom, event)) {
newFileContentBySelect(protyle); newFileContentBySelect(protyle);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.alignLeft.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.alignLeft.custom, event)) {
@ -987,31 +996,37 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading1.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading1.custom, event)) {
phTransaction(protyle, range, nodeElement, 1); phTransaction(protyle, range, nodeElement, 1);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading2.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading2.custom, event)) {
phTransaction(protyle, range, nodeElement, 2); phTransaction(protyle, range, nodeElement, 2);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading3.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading3.custom, event)) {
phTransaction(protyle, range, nodeElement, 3); phTransaction(protyle, range, nodeElement, 3);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading4.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading4.custom, event)) {
phTransaction(protyle, range, nodeElement, 4); phTransaction(protyle, range, nodeElement, 4);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading5.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading5.custom, event)) {
phTransaction(protyle, range, nodeElement, 5); phTransaction(protyle, range, nodeElement, 5);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading6.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.heading.heading6.custom, event)) {
phTransaction(protyle, range, nodeElement, 6); phTransaction(protyle, range, nodeElement, 6);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.insert.code.custom, event) && nodeElement.getAttribute("data-type") !== "NodeCodeBlock") { if (matchHotKey(window.siyuan.config.keymap.editor.insert.code.custom, event) && nodeElement.getAttribute("data-type") !== "NodeCodeBlock") {
@ -1025,6 +1040,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
updateTransaction(protyle, id, newHTML, html); updateTransaction(protyle, id, newHTML, html);
highlightRender(newNodeElement); highlightRender(newNodeElement);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
// toolbar action // toolbar action
@ -1064,10 +1080,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (selectElements.length > 0 && selectElements[0].getAttribute("data-type") === "NodeListItem") { if (selectElements.length > 0 && selectElements[0].getAttribute("data-type") === "NodeListItem") {
listOutdent(protyle, Array.from(selectElements), range); listOutdent(protyle, Array.from(selectElements), range);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} else if (nodeElement.parentElement.classList.contains("li") && nodeElement.getAttribute("data-type") !== "NodeCodeBlock") { } else if (nodeElement.parentElement.classList.contains("li") && nodeElement.getAttribute("data-type") !== "NodeCodeBlock") {
listOutdent(protyle, [nodeElement.parentElement], range); listOutdent(protyle, [nodeElement.parentElement], range);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
} }
@ -1076,10 +1094,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (selectElements.length > 0 && selectElements[0].getAttribute("data-type") === "NodeListItem") { if (selectElements.length > 0 && selectElements[0].getAttribute("data-type") === "NodeListItem") {
listIndent(protyle, Array.from(selectElements), range); listIndent(protyle, Array.from(selectElements), range);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} else if (nodeElement.parentElement.classList.contains("li") && nodeElement.getAttribute("data-type") !== "NodeCodeBlock") { } else if (nodeElement.parentElement.classList.contains("li") && nodeElement.getAttribute("data-type") !== "NodeCodeBlock") {
listIndent(protyle, [nodeElement.parentElement], range); listIndent(protyle, [nodeElement.parentElement], range);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
} }
@ -1088,6 +1108,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle.hint.lastIndex = -1; protyle.hint.lastIndex = -1;
protyle.hint.fill("* [ ] " + Lute.Caret, protyle); protyle.hint.fill("* [ ] " + Lute.Caret, protyle);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
@ -1096,6 +1117,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
protyle.hint.lastIndex = -1; protyle.hint.lastIndex = -1;
protyle.hint.fill(`| col1${Lute.Caret} | col2 | col3 |\n| --- | --- | --- |\n| | | |\n| | | |`, protyle); protyle.hint.fill(`| col1${Lute.Caret} | col2 | col3 |\n| --- | --- | --- |\n| | | |\n| | | |`, protyle);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
@ -1115,6 +1137,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
taskItemElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss")); taskItemElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, taskItemElement.getAttribute("data-node-id"), taskItemElement.outerHTML, html); updateTransaction(protyle, taskItemElement.getAttribute("data-node-id"), taskItemElement.outerHTML, html);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.insertBefore.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.insertBefore.custom, event)) {
@ -1125,6 +1148,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (matchHotKey(window.siyuan.config.keymap.editor.general.insertAfter.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.insertAfter.custom, event)) {
insertEmptyBlock(protyle, "afterend"); insertEmptyBlock(protyle, "afterend");
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
@ -1329,6 +1353,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (matchHotKey(window.siyuan.config.keymap.editor.general.vLayout.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.vLayout.custom, event)) {
event.preventDefault(); event.preventDefault();
event.stopPropagation();
const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
if (selectsElement.length < 2) { if (selectsElement.length < 2) {
return; return;
@ -1343,6 +1368,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (matchHotKey(window.siyuan.config.keymap.editor.general.hLayout.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.hLayout.custom, event)) {
event.preventDefault(); event.preventDefault();
event.stopPropagation();
const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); const selectsElement: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
if (selectsElement.length < 2) { if (selectsElement.length < 2) {
return; return;
@ -1460,6 +1486,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
getCurrentWindow().webContents.pasteAndMatchStyle(); getCurrentWindow().webContents.pasteAndMatchStyle();
}, 100); }, 100);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
@ -1470,6 +1497,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (isLocalPath(linkAddress)) { if (isLocalPath(linkAddress)) {
openBy(linkAddress, "folder"); openBy(linkAddress, "folder");
event.preventDefault(); event.preventDefault();
event.stopPropagation();
} }
} }
return; return;

View File

@ -352,8 +352,9 @@ export const globalShortcut = () => {
}); });
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) {
if (event.key === window.siyuan.config.keymap.general.syncNow.custom) { event.preventDefault();
event.stopPropagation();
if (needSubscribe() || document.querySelector("#barSync svg").classList.contains("fn__rotate")) { if (needSubscribe() || document.querySelector("#barSync svg").classList.contains("fn__rotate")) {
return; return;
} }
@ -362,7 +363,6 @@ export const globalShortcut = () => {
return; return;
} }
fetchPost("/api/sync/performSync", {}); fetchPost("/api/sync/performSync", {});
event.preventDefault();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.lockScreen.custom, event)) {
@ -372,23 +372,20 @@ export const globalShortcut = () => {
}); });
}); });
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.general.history.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.history.custom, event)) {
openHistory(); openHistory();
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (!window.siyuan.config.readonly && matchHotKey(window.siyuan.config.keymap.general.config.custom, event)) { if (!window.siyuan.config.readonly && matchHotKey(window.siyuan.config.keymap.general.config.custom, event)) {
openSetting(); openSetting();
event.preventDefault();
return;
}
// https://github.com/siyuan-note/insider/issues/445
if (matchHotKey("⌘S", event)) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
return true; return;
} }
const target = event.target as HTMLElement; const target = event.target as HTMLElement;
if (matchHotKey("⌘A", event) && target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") { if (matchHotKey("⌘A", event) && target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") {
@ -404,6 +401,7 @@ export const globalShortcut = () => {
target.blur(); target.blur();
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
}); });
@ -418,11 +416,13 @@ export const globalShortcut = () => {
target.blur(); target.blur();
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
if (matchHotKey(window.siyuan.config.keymap.general.newFile.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.newFile.custom, event)) {
newFile(undefined, undefined, true); newFile(undefined, undefined, true);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
@ -587,6 +587,7 @@ export const globalShortcut = () => {
openGlobalSearch("", false); openGlobalSearch("", false);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
@ -615,8 +616,16 @@ export const globalShortcut = () => {
openSearch(searchKey); openSearch(searchKey);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return; return;
} }
// https://github.com/siyuan-note/insider/issues/445
if (matchHotKey("⌘S", event)) {
event.preventDefault();
event.stopPropagation();
return true;
}
}); });
window.addEventListener("blur", () => { window.addEventListener("blur", () => {
@ -717,6 +726,7 @@ const editKeydown = (event: KeyboardEvent) => {
openSearch(searchKey); openSearch(searchKey);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.general.move.custom, event)) { if (!isFileFocus && matchHotKey(window.siyuan.config.keymap.general.move.custom, event)) {
@ -732,6 +742,7 @@ const editKeydown = (event: KeyboardEvent) => {
movePathTo(protyle.notebookId, protyle.path); movePathTo(protyle.notebookId, protyle.path);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
const target = event.target as HTMLElement; const target = event.target as HTMLElement;
@ -741,6 +752,7 @@ const editKeydown = (event: KeyboardEvent) => {
if (matchHotKey(window.siyuan.config.keymap.editor.general.preview.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.preview.custom, event)) {
setEditMode(protyle, "preview"); setEditMode(protyle, "preview");
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.wysiwyg.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.wysiwyg.custom, event)) {
@ -753,17 +765,20 @@ const editKeydown = (event: KeyboardEvent) => {
onGet(getResponse, protyle); onGet(getResponse, protyle);
}); });
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
// 没有光标时,无法撤销 https://ld246.com/article/1624021111567 // 没有光标时,无法撤销 https://ld246.com/article/1624021111567
if (matchHotKey(window.siyuan.config.keymap.editor.general.undo.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.undo.custom, event)) {
protyle.undo.undo(protyle); protyle.undo.undo(protyle);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) {
protyle.undo.redo(protyle); protyle.undo.redo(protyle);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
return false; return false;
@ -777,6 +792,7 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
const files = dockFile.data.file as Files; const files = dockFile.data.file as Files;
if (matchHotKey(window.siyuan.config.keymap.general.selectOpen1.custom, event)) { if (matchHotKey(window.siyuan.config.keymap.general.selectOpen1.custom, event)) {
event.preventDefault(); event.preventDefault();
event.stopPropagation();
const element = document.querySelector(".layout__wnd--active > .layout-tab-bar > .item--focus") || const element = document.querySelector(".layout__wnd--active > .layout-tab-bar > .item--focus") ||
document.querySelector(".layout-tab-bar > .item--focus"); document.querySelector(".layout-tab-bar > .item--focus");
if (element) { if (element) {
@ -815,6 +831,8 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
name: isFile ? getDisplayName(liElement.getAttribute("data-name"), false, true) : getNotebookName(notebookId), name: isFile ? getDisplayName(liElement.getAttribute("data-name"), false, true) : getNotebookName(notebookId),
type: isFile ? "file" : "notebook", type: isFile ? "file" : "notebook",
}); });
event.preventDefault();
event.stopPropagation();
return true; return true;
} }
if (matchHotKey("⌘/", event)) { if (matchHotKey("⌘/", event)) {
@ -832,6 +850,7 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
if (isFile && matchHotKey(window.siyuan.config.keymap.general.move.custom, event)) { if (isFile && matchHotKey(window.siyuan.config.keymap.general.move.custom, event)) {
movePathTo(notebookId, pathString, false); movePathTo(notebookId, pathString, false);
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
let searchKey = ""; let searchKey = "";
@ -847,6 +866,7 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
openSearch(searchKey, undefined, notebookId); openSearch(searchKey, undefined, notebookId);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation();
return true; return true;
} }
const target = event.target as HTMLElement; const target = event.target as HTMLElement;