Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/5215

Vanessa9117bf9ad18a
diff --git a/app/src/layout/dock/Bookmark.ts b/app/src/layout/dock/Bookmark.ts
index 21771cb4c8..ca9c08e597 100644
--- a/app/src/layout/dock/Bookmark.ts
+++ b/app/src/layout/dock/Bookmark.ts
@@ -88,7 +88,7 @@ export class Bookmark extends Model {
},
rightClick: (element: HTMLElement, event: MouseEvent) => {
window.siyuan.menus.menu.remove();
- const id = element.getAttribute("data-node-id")
+ const id = element.getAttribute("data-node-id");
if (!id) {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.rename,
@@ -129,7 +129,7 @@ export class Bookmark extends Model {
icon: "iconTrashcan",
label: window.siyuan.languages.remove,
click: () => {
- const bookmark = (id ? element.parentElement.previousElementSibling : element).querySelector(".b3-list-item__text").textContent
+ const bookmark = (id ? element.parentElement.previousElementSibling : element).querySelector(".b3-list-item__text").textContent;
confirmDialog(window.siyuan.languages.delete, `${window.siyuan.languages.confirmDelete} <b>${escapeHtml(bookmark)}</b>?`, () => {
if (id) {
fetchPost("/api/attr/setBlockAttrs", {id, attrs: {bookmark: ""}}, () => {
diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts
index a245c68d85..d7c9a00f86 100644
--- a/app/src/protyle/header/Title.ts
+++ b/app/src/protyle/header/Title.ts
@@ -30,7 +30,7 @@ import {code160to32} from "../util/code160to32";
export class Title {
public element: HTMLElement;
public editElement: HTMLElement;
- private timeout: number
+ private timeout: number;
constructor(protyle: IProtyle) {
this.element = document.createElement("div");
@@ -229,7 +229,7 @@ export class Title {
}
private rename(protyle: IProtyle) {
- clearTimeout(this.timeout)
+ clearTimeout(this.timeout);
if (!validateName(this.editElement.textContent)) {
return false;
}
@@ -240,8 +240,8 @@ export class Title {
path: protyle.path,
title: fileName,
});
- this.setTitle(fileName)
- }, Constants.TIMEOUT_INPUT)
+ this.setTitle(fileName);
+ }, Constants.TIMEOUT_INPUT);
}
private renderMenu(protyle: IProtyle, iconElement: Element, position: { x: number, y: number }) {
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 351ed0ed82..cb9444f279 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -172,9 +172,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
} else if (previousElement) {
// https://github.com/siyuan-note/siyuan/issues/3913
- const foldElement = hasTopClosestByAttribute(previousElement, "fold", "1")
+ const foldElement = hasTopClosestByAttribute(previousElement, "fold", "1");
if (foldElement && (foldElement.classList.contains("sb") || foldElement.classList.contains("bq"))) {
- previousElement = foldElement
+ previousElement = foldElement;
}
}
} else if (protyle.title && (protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") === "true" ||
@@ -485,7 +485,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
// https://github.com/siyuan-note/siyuan/issues/5185
if (range.startOffset === 0 && range.startContainer.nodeType === 3) {
- const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement
+ const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement;
if (previousSibling && previousSibling.nodeType !== 3 && previousSibling.getAttribute("data-type") === "inline-math") {
protyle.toolbar.showRender(protyle, previousSibling);
return;
@@ -550,7 +550,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (previousElement) {
previousElement = getLastBlock(previousElement) as HTMLElement;
if (previousElement) {
- previousElement = hasClosestByAttribute(previousElement, "fold", "1") as HTMLElement
+ previousElement = hasClosestByAttribute(previousElement, "fold", "1") as HTMLElement;
if (previousElement && previousElement.getAttribute("data-type") !== "NodeListItem") {
// 遇到折叠块
focusBlock(previousElement, undefined, true);
@@ -581,7 +581,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
}
if (event.key === "ArrowDown") {
- const foldElement = hasClosestByAttribute(range.startContainer, "fold", "1")
+ const foldElement = hasClosestByAttribute(range.startContainer, "fold", "1");
if (foldElement) {
let nextElement = getNextBlock(foldElement) as HTMLElement;
if (nextElement) {
@@ -645,6 +645,10 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.preventDefault();
return;
}
+ } else if (position.end === editElement.textContent.length - 1 && nodeElement.getAttribute("data-type") === "NodeCodeBlock") {
+ event.stopPropagation();
+ event.preventDefault();
+ return;
}
} else {
const currentNode = range.startContainer.childNodes[range.startOffset - 1] as HTMLElement;
diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.ts
index d45802dc6c..d036b2df7f 100644
--- a/app/src/protyle/wysiwyg/list.ts
+++ b/app/src/protyle/wysiwyg/list.ts
@@ -242,7 +242,7 @@ export const breakList = (protyle: IProtyle, blockElement: Element, range: Range
}
});
- const parentId = listItemElement.parentElement.getAttribute("data-node-id")
+ const parentId = listItemElement.parentElement.getAttribute("data-node-id");
if (listItemElement.parentElement.childElementCount === 2) {
undoOperations.splice(0, 0, {
id: parentId,