Skip to content

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

:bug: 聚焦列表 * 1 * 2,第一个列表项反向缩进后刷新会关闭页签

Vanessa99ec37e78c6b
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index a5e0cf1639..b5c8b44a18 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -39,7 +39,6 @@ import {pushBack} from "../mobile/util/MobileBackFoward";
import {exportAsset} from "./util";
import {removeLink} from "../protyle/toolbar/Link";
import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";
-import {getEnableHTML} from "../protyle/wysiwyg/removeEmbed";
import {renameTag} from "../util/noRelyPCFunction";
export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
@@ -666,13 +665,13 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
openMenu(imgSrc, false, false);
}
window.siyuan.menus.menu.popup({x: position.clientX, y: position.clientY});
- const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea")
+ const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea");
textElements[0].focus();
window.siyuan.menus.menu.removeCB = () => {
imgElement.setAttribute("alt", textElements[2].value.replace(/\n|\r\n|\r|\u2028|\u2029/g, ""));
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
- }
+ };
};
export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText = false) => {
@@ -824,7 +823,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
y: rect.top + 26,
h: 26
});
- const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea")
+ const textElements = window.siyuan.menus.menu.element.querySelectorAll("textarea");
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
textElements[1].select();
} else {
@@ -846,7 +845,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
}
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
- }
+ };
};
export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 666e5dea66..c759813a72 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -21,7 +21,7 @@ import {hideElements} from "../ui/hideElements";
import {processRender} from "../util/processCode";
import {highlightRender} from "../markdown/highlightRender";
import {blockRender} from "../markdown/blockRender";
-import {getEnableHTML, removeEmbed} from "../wysiwyg/removeEmbed";
+import {removeEmbed} from "../wysiwyg/removeEmbed";
import {getContenteditableElement, getTopAloneElement, isNotEditBlock} from "../wysiwyg/getBlock";
import * as dayjs from "dayjs";
import {fetchPost, fetchSyncPost} from "../../util/fetch";
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index 567f23067e..fc5756c5c3 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -168,8 +168,8 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
const range = getEditorRange(protyle.wysiwyg.element);
if (siyuanHTML) {
// 编辑器内部粘贴
- const tempElement = document.createElement("div")
- tempElement.innerHTML = siyuanHTML
+ const tempElement = document.createElement("div");
+ tempElement.innerHTML = siyuanHTML;
let isBlock = false;
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
const newId = Lute.NewNodeID();
diff --git a/app/src/protyle/wysiwyg/list.ts b/app/src/protyle/wysiwyg/list.ts
index 04994be415..12decd2668 100644
--- a/app/src/protyle/wysiwyg/list.ts
+++ b/app/src/protyle/wysiwyg/list.ts
@@ -406,6 +406,10 @@ export const listOutdent = (protyle: IProtyle, liItemElements: Element[], range:
action: "delete",
id: liId
});
+ // 聚焦列表,第一个列表项反向缩进后刷新会关闭页签
+ if (liId === protyle.block.id) {
+ protyle.block.id = protyle.block.parentID;
+ }
undoOperations.splice(0, 0, {
action: "insert",
data: movedHTML,