Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:lipstick: list

Vanessaca9b55ded2e3
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 0b3d282ccc..53a7fe8672 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -75,9 +75,9 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
inputElement.addEventListener("keydown", (event) => {
if (event.key === "Enter" && !event.isComposing) {
window.siyuan.menus.menu.remove();
+ } else if (electronUndo(event)) {
return;
}
- electronUndo(event);
});
}
}).element);
@@ -231,7 +231,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
const rect = element.getBoundingClientRect();
window.siyuan.menus.menu.popup({
x: rect.left,
- y: rect.top + 13,
+ y: rect.top + 26,
h: 26
});
window.siyuan.menus.menu.element.querySelector("input").select();
@@ -645,14 +645,13 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
focusByRange(protyle.toolbar.range);
}
window.siyuan.menus.menu.remove();
- return;
} else if (event.key === "Tab" && !event.isComposing) {
event.preventDefault();
event.stopPropagation();
element.nextElementSibling.querySelector("input").focus();
+ } else if (electronUndo(event)) {
return;
}
- electronUndo(event);
});
}
}).element);
@@ -688,7 +687,6 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
focusByRange(protyle.toolbar.range);
}
window.siyuan.menus.menu.remove();
- return;
} else if (event.key === "Tab" && !event.isComposing) {
event.preventDefault();
event.stopPropagation();
@@ -697,9 +695,9 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
} else {
element.nextElementSibling.querySelector("input").focus();
}
+ } else if (electronUndo(event)) {
return;
}
- electronUndo(event);
});
}
}).element);
@@ -729,14 +727,13 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
focusByRange(protyle.toolbar.range);
}
window.siyuan.menus.menu.remove();
- return;
} else if (event.key === "Tab" && event.shiftKey && !event.isComposing) {
event.preventDefault();
event.stopPropagation();
element.previousElementSibling.querySelector("input").focus();
+ } else if (electronUndo(event)) {
return;
}
- electronUndo(event);
});
}
}).element);
@@ -779,7 +776,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
const rect = linkElement.getBoundingClientRect();
window.siyuan.menus.menu.popup({
x: rect.left,
- y: rect.top + 13,
+ y: rect.top + 26,
h: 26
});
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index 1d2fe0c5d2..2588631418 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -316,7 +316,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg>&nbsp;${escapeHtml(item.memo)}</span>`;
}
if (attrHTML) {
- attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
+ attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
let value = `<span data-type="block-ref" data-id="${item.id}" data-subtype="d">${item.name || item.refText}</span>`;
if (isQuick) {
@@ -328,7 +328,7 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintD
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
</div>
-<div class="b3-list-item__meta">${item.hPath}</div>`,
+<div class="b3-list-item__meta b3-list-item__showall" style="margin-bottom: 4px">${item.hPath}</div>`,
});
});
if (isQuick) {
@@ -372,7 +372,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg>&nbsp;${escapeHtml(item.memo)}</span>`;
}
if (attrHTML) {
- attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
+ attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
dataList.push({
value: `{{select * from blocks where id='${item.id}'}}`,
@@ -380,7 +380,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
</div>
-<div class="b3-list-item__meta">${item.hPath}</div>`,
+<div class="b3-list-item__meta b3-list-item__showall" style="margin-bottom: 4px">${item.hPath}</div>`,
});
});
if (dataList.length === 0) {
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index f573e67706..703120f131 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -306,14 +306,14 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg>&nbsp;${escapeHtml(item.memo)}</span>`;
}
if (attrHTML) {
- attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
+ attrHTML = `<div class="fn__flex b3-list-item__meta b3-list-item__showall">${attrHTML}</div>`;
}
const blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${index === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefHTML)}">${attrHTML}<div class="b3-list-item__first">
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
<span class="b3-list-item__text">${escapeHtml(item.content)}</span>
</div>
-<div class="b3-list-item__meta">${item.hPath}</div></button>`;
+<div class="b3-list-item__meta b3-list-item__showall" style="margin-bottom: 4px">${item.hPath}</div></button>`;
});
if (searchHTML === "") {
searchHTML = `<button class="b3-list-item b3-list-item--two fn__block" data-value="">${window.siyuan.languages.emptyContent}</button>`;
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index ee30225a5d..5d31628f02 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -867,7 +867,6 @@ export class Toolbar {
if (event.isComposing) {
return;
}
- electronUndo(event);
if (event.key === "Escape" || matchHotKey("⌘↩", event)) {
this.subElement.classList.add("fn__none");
this.subElement.querySelector('[data-type="pin"]').classList.remove("block__icon--active");
@@ -883,6 +882,8 @@ export class Toolbar {
// https://github.com/siyuan-note/siyuan/issues/5270
document.execCommand("insertText", false, "\t");
event.preventDefault();
+ } else if (electronUndo(event)) {
+ return;
}
});
diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.ts
index e126be1e96..ba14dfac99 100644
--- a/app/src/protyle/undo/index.ts
+++ b/app/src/protyle/undo/index.ts
@@ -96,13 +96,14 @@ export const electronUndo = (event: KeyboardEvent) => {
getCurrentWindow().webContents.undo();
event.preventDefault();
event.stopPropagation();
- return;
+ return true;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) {
getCurrentWindow().webContents.redo();
event.preventDefault();
event.stopPropagation();
- return;
+ return true;
}
/// #endif
+ return false;
};
diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.ts
index e5b5defcd8..465c88b9ce 100644
--- a/app/src/util/pathName.ts
+++ b/app/src/util/pathName.ts
@@ -6,6 +6,7 @@ import {isMobile} from "./functions";
import {focusByRange} from "../protyle/util/selection";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
import {unicode2Emoji} from "../emoji";
+import {Constants} from "../constants";
export const addBaseURL = () => {
let baseURLElement = document.getElementById("baseURL");
@@ -105,7 +106,7 @@ export const movePathTo = async (notebookId: string, path: string, focus = true)
return;
}
fileHTML += `<li class="b3-list-item${fileHTML === "" ? " b3-list-item--focus" : ""}" data-path="${item.path}" data-box="${item.box}">
- ${item.boxIcon ? ('<span class="b3-list-item__icon">' + unicode2Emoji(item.boxIcon) + "</span>") : ""}
+ <span class="b3-list-item__icon">${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE)}</span>
<span class="b3-list-item__showall">${escapeHtml(item.hPath)}</span>
</li>`;
});