mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-13 23:52:29 +08:00
🎨 移除顶层冒泡
This commit is contained in:
parent
54b5652c24
commit
acbc573e97
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"recentDocs": "Recently opened documents",
|
||||||
"autoLaunch": "Automatic launch at boot",
|
"autoLaunch": "Automatic launch at boot",
|
||||||
"autoLaunchTip": "After enabling, the application will be automatically launched after logging into the operating system",
|
"autoLaunchTip": "After enabling, the application will be automatically launched after logging into the operating system",
|
||||||
"sortByRankDesc": "Relevance DESC",
|
"sortByRankDesc": "Relevance DESC",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"recentDocs": "Documentos abiertos recientemente",
|
||||||
"autoLaunch": "Inicio automático al arrancar",
|
"autoLaunch": "Inicio automático al arrancar",
|
||||||
"autoLaunchTip": "Después de habilitar, la aplicación se iniciará automáticamente después de iniciar sesión en el sistema operativo",
|
"autoLaunchTip": "Después de habilitar, la aplicación se iniciará automáticamente después de iniciar sesión en el sistema operativo",
|
||||||
"sortByRankDesc": "Relevancia DESC",
|
"sortByRankDesc": "Relevancia DESC",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"recentDocs": "Documents récemment ouverts",
|
||||||
"autoLaunch": "Lancement automatique au démarrage",
|
"autoLaunch": "Lancement automatique au démarrage",
|
||||||
"autoLaunchTip": "Après l'activation, l'application sera automatiquement lancée après la connexion au système d'exploitation",
|
"autoLaunchTip": "Après l'activation, l'application sera automatiquement lancée après la connexion au système d'exploitation",
|
||||||
"sortByRankDesc": "DESC de pertinence",
|
"sortByRankDesc": "DESC de pertinence",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"recentDocs": "最近打开的文档",
|
||||||
"autoLaunch": "開機自動啟動",
|
"autoLaunch": "開機自動啟動",
|
||||||
"autoLaunchTip": "啟用後會在登錄操作系統後自動啟動應用",
|
"autoLaunchTip": "啟用後會在登錄操作系統後自動啟動應用",
|
||||||
"sortByRankDesc": "按相關度降序",
|
"sortByRankDesc": "按相關度降序",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"recentDocs": "最近打开的文档",
|
||||||
"autoLaunch": "开机自动启动",
|
"autoLaunch": "开机自动启动",
|
||||||
"autoLaunchTip": "启用后会在登录操作系统后自动启动应用",
|
"autoLaunchTip": "启用后会在登录操作系统后自动启动应用",
|
||||||
"sortByRankDesc": "按相关度降序",
|
"sortByRankDesc": "按相关度降序",
|
||||||
|
@ -102,6 +102,7 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
|
min-height: 18px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,7 @@ export abstract class Constants {
|
|||||||
dataHistory: {default: "⌥H", custom: "⌥H"},
|
dataHistory: {default: "⌥H", custom: "⌥H"},
|
||||||
toggleWin: {default: "⌥M", custom: "⌥M"},
|
toggleWin: {default: "⌥M", custom: "⌥M"},
|
||||||
lockScreen: {default: "⌥N", custom: "⌥N"},
|
lockScreen: {default: "⌥N", custom: "⌥N"},
|
||||||
|
recentDocs: {default: "⌘E", custom: "⌘E"},
|
||||||
move: {default: "", custom: ""},
|
move: {default: "", custom: ""},
|
||||||
selectOpen1: {default: "", custom: ""},
|
selectOpen1: {default: "", custom: ""},
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,6 @@ const getRightBlock = (element: HTMLElement, x: number, y: number) => {
|
|||||||
|
|
||||||
const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
|
const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
while (!target.isSameNode(switchDialog.element)) {
|
while (!target.isSameNode(switchDialog.element)) {
|
||||||
if (target.classList.contains("b3-list-item")) {
|
if (target.classList.contains("b3-list-item")) {
|
||||||
@ -218,11 +217,9 @@ export const globalShortcut = () => {
|
|||||||
|
|
||||||
window.addEventListener("mouseup", (event) => {
|
window.addEventListener("mouseup", (event) => {
|
||||||
if (event.button === 3) {
|
if (event.button === 3) {
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
goBack();
|
goBack();
|
||||||
} else if (event.button === 4) {
|
} else if (event.button === 4) {
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
goForward();
|
goForward();
|
||||||
}
|
}
|
||||||
@ -397,6 +394,16 @@ export const globalShortcut = () => {
|
|||||||
(sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus");
|
(sideElement.querySelector(`[data-index="${currentLiElement.getAttribute("data-index")}"]`) || sideElement.lastElementChild).classList.add("b3-list-item--focus");
|
||||||
}
|
}
|
||||||
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus")
|
currentLiElement = switchDialog.element.querySelector(".b3-list-item--focus")
|
||||||
|
const rootId = currentLiElement.getAttribute("data-node-id");
|
||||||
|
if (rootId) {
|
||||||
|
fetchPost("/api/filetree/getFullHPathByID", {
|
||||||
|
id: rootId
|
||||||
|
}, (response) => {
|
||||||
|
currentLiElement.parentElement.parentElement.nextElementSibling.innerHTML = escapeHtml(response.data);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
currentLiElement.parentElement.parentElement.nextElementSibling.innerHTML = currentLiElement.querySelector(".b3-list-item__text").innerHTML;
|
||||||
|
}
|
||||||
const currentRect = currentLiElement.getBoundingClientRect();
|
const currentRect = currentLiElement.getBoundingClientRect();
|
||||||
const currentParentRect = currentLiElement.parentElement.getBoundingClientRect();
|
const currentParentRect = currentLiElement.parentElement.getBoundingClientRect();
|
||||||
if (currentRect.top < currentParentRect.top) {
|
if (currentRect.top < currentParentRect.top) {
|
||||||
@ -476,15 +483,24 @@ export const globalShortcut = () => {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (matchHotKey(window.siyuan.config.keymap.general.recentDocs.custom, event)) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (window.siyuan.dialogs.length > 0) {
|
||||||
|
hideElements(["dialog"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.syncNow.custom, event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
syncGuide(document.querySelector("#barSync"));
|
syncGuide(document.querySelector("#barSync"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.editMode.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.editMode.custom, event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
editor.setMode();
|
editor.setMode();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -495,19 +511,16 @@ export const globalShortcut = () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.dataHistory.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.dataHistory.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();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
@ -524,7 +537,6 @@ export const globalShortcut = () => {
|
|||||||
target.blur();
|
target.blur();
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -539,13 +551,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,14 +633,12 @@ export const globalShortcut = () => {
|
|||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.goForward.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.goForward.custom, event)) {
|
||||||
goForward();
|
goForward();
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.goBack.custom, event)) {
|
if (matchHotKey(window.siyuan.config.keymap.general.goBack.custom, event)) {
|
||||||
goBack();
|
goBack();
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -645,7 +653,6 @@ export const globalShortcut = () => {
|
|||||||
// close tab
|
// close tab
|
||||||
if (matchHotKey(window.siyuan.config.keymap.general.closeTab.custom, event) && !event.repeat) {
|
if (matchHotKey(window.siyuan.config.keymap.general.closeTab.custom, event) && !event.repeat) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
let activeTabElement = document.querySelector(".layout__tab--active");
|
let activeTabElement = document.querySelector(".layout__tab--active");
|
||||||
if (activeTabElement && activeTabElement.getBoundingClientRect().width > 0) {
|
if (activeTabElement && activeTabElement.getBoundingClientRect().width > 0) {
|
||||||
let type: TDockType;
|
let type: TDockType;
|
||||||
@ -683,7 +690,6 @@ export const globalShortcut = () => {
|
|||||||
openGlobalSearch("", false);
|
openGlobalSearch("", false);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,14 +723,12 @@ export const globalShortcut = () => {
|
|||||||
openSearch(searchKey);
|
openSearch(searchKey);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/siyuan-note/insider/issues/445
|
// https://github.com/siyuan-note/insider/issues/445
|
||||||
if (matchHotKey("⌘S", event)) {
|
if (matchHotKey("⌘S", event)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -753,7 +757,6 @@ export const globalShortcut = () => {
|
|||||||
writeText(copyElement.parentElement.nextElementSibling.textContent.trimEnd());
|
writeText(copyElement.parentElement.nextElementSibling.textContent.trimEnd());
|
||||||
showMessage(window.siyuan.languages.copied, 2000);
|
showMessage(window.siyuan.languages.copied, 2000);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击空白,pdf 搜索、更多消失
|
// 点击空白,pdf 搜索、更多消失
|
||||||
@ -827,7 +830,6 @@ 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)) {
|
||||||
@ -851,7 +853,6 @@ const editKeydown = (event: KeyboardEvent) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
@ -861,7 +862,6 @@ 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) && !protyle.options.backlinkData) {
|
if (matchHotKey(window.siyuan.config.keymap.editor.general.wysiwyg.custom, event) && !protyle.options.backlinkData) {
|
||||||
@ -874,20 +874,17 @@ 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;
|
||||||
@ -901,7 +898,6 @@ 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 > .fn__flex > .layout-tab-bar > .item--focus") ||
|
const element = document.querySelector(".layout__wnd--active > .fn__flex > .layout-tab-bar > .item--focus") ||
|
||||||
document.querySelector(".layout-tab-bar > .item--focus");
|
document.querySelector(".layout-tab-bar > .item--focus");
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -945,7 +941,6 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
|||||||
type: isFile ? "file" : "notebook",
|
type: isFile ? "file" : "notebook",
|
||||||
});
|
});
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (matchHotKey("⌘/", event)) {
|
if (matchHotKey("⌘/", event)) {
|
||||||
@ -967,7 +962,6 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
|||||||
moveToPath(pathes, toNotebook[0], toPath[0]);
|
moveToPath(pathes, toNotebook[0], toPath[0]);
|
||||||
}, pathes);
|
}, pathes);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let searchKey = "";
|
let searchKey = "";
|
||||||
@ -984,7 +978,6 @@ 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;
|
||||||
@ -992,7 +985,6 @@ const fileTreeKeydown = (event: KeyboardEvent) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (bindMenuKeydown(event)) {
|
if (bindMenuKeydown(event)) {
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user