Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/14820 https://github.com/siyuan-note/siyuan/issues/14820#issuecomment-2879645329

Vanessa886871001f4f
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index bed126f214..f7bc74ea15 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -328,6 +328,9 @@ export class Toolbar {
});
if (this.range.startContainer.nodeType !== 3) {
let emptyNode: Element = this.range.startContainer.childNodes[this.range.startOffset] as HTMLElement;
+ if (!emptyNode) {
+ emptyNode = this.range.startContainer.childNodes[this.range.startOffset - 1] as HTMLElement;
+ }
if (emptyNode && emptyNode.nodeType === 3) {
if ((this.range.startContainer as HTMLElement).tagName === "DIV") {
emptyNode = emptyNode.previousSibling as HTMLElement;