An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: set inline type
Vanessaf4c1687d4d61
diff --git a/app/src/block/popover.ts b/app/src/block/popover.tsindex 8f93383461..05f3a64b4e 100644--- a/app/src/block/popover.ts+++ b/app/src/block/popover.ts@@ -49,7 +49,7 @@ export const initBlockPopover = () => {}let popoverTargetElement = hasClosestByAttribute(event.target, "data-type", "block-ref") as HTMLElement ||hasClosestByAttribute(event.target, "data-type", "virtual-block-ref") as HTMLElement;- if (popoverTargetElement && popoverTargetElement.classList.contains("protyle-toolbar")) {+ if (popoverTargetElement && popoverTargetElement.classList.contains("b3-tooltips")) {popoverTargetElement = undefined;}if (!popoverTargetElement) {@@ -107,7 +107,7 @@ export const initBlockPopover = () => {}let popoverTargetElement = hasClosestByAttribute(event.target, "data-type", "block-ref") as HTMLElement ||hasClosestByAttribute(event.target, "data-type", "virtual-block-ref") as HTMLElement;- if (popoverTargetElement && popoverTargetElement.classList.contains("protyle-toolbar")) {+ if (popoverTargetElement && popoverTargetElement.classList.contains("b3-tooltips")) {popoverTargetElement = undefined;}if (!popoverTargetElement) {diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex f9dd1190cc..8e63324387 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -31,6 +31,7 @@ import {openFileById} from "../../editor/util";import {openMobileFileById} from "../../mobile/editor";import {getIconByType} from "../../editor/getIcon";import {processRender} from "../util/processCode";+import {getEventName} from "../util/compatibility";export class Hint {public timeId: number;@@ -245,7 +246,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;}if (hasSearch) {const searchElement = this.element.querySelector("input.b3-text-field") as HTMLInputElement;- const oldValue = this.element.querySelector("mark").textContent;+ const oldValue = this.element.querySelector("mark")?.textContent || "";searchElement.value = oldValue;searchElement.select();searchElement.addEventListener("keydown", (event: KeyboardEvent) => {@@ -531,6 +532,10 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;range.deleteContents();focusByRange(range);protyle.toolbar.range = range;+ if (["a", "block-ref", "inline-math", "inline-memo", "text"].includes(value)) {+ protyle.toolbar.element.querySelector(`[data-type="${value}"]`).dispatchEvent(new CustomEvent("block-ref" === value? getEventName() : "click"));+ return;+ }protyle.toolbar.setInlineMark(protyle, value, "range");return;} else if (value === "emoji") {diff --git a/app/src/protyle/toolbar/BlockRef.ts b/app/src/protyle/toolbar/BlockRef.tsindex f1291f3d7e..6c00f6c407 100644--- a/app/src/protyle/toolbar/BlockRef.ts+++ b/app/src/protyle/toolbar/BlockRef.ts@@ -9,6 +9,9 @@ export class BlockRef extends ToolbarItem {super(protyle, menuItem);// 不能用 getEventName,否则会导致光标位置变动到点击的文档中this.element.addEventListener("click", (event: MouseEvent & { changedTouches: MouseEvent[] }) => {+ if (protyle.toolbar.range.toString() === "") {+ return;+ }fixTableRange(protyle.toolbar.range);hintRef(protyle.toolbar.range.toString(), protyle, true);protyle.toolbar.element.classList.add("fn__none");diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.tsindex 852911fd21..8ea3c97fe0 100644--- a/app/src/protyle/toolbar/Font.ts+++ b/app/src/protyle/toolbar/Font.ts@@ -11,6 +11,9 @@ export class Font extends ToolbarItem {constructor(protyle: IProtyle, menuItem: IMenuItem) {super(protyle, menuItem);this.element.addEventListener(getEventName(), () => {+ if (protyle.toolbar.range.toString() === "") {+ return;+ }protyle.toolbar.element.classList.add("fn__none");protyle.toolbar.subElement.innerHTML = "";protyle.toolbar.subElement.style.width = "";diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 02d372eb1f..dbd549e5cb 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -237,10 +237,6 @@ export class Toolbar {}public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar", textObj?: ITextOption) {- if (["a", "block-ref", "inline-math", "inline-memo"].includes(type) || (type === "text" && !textObj)) {- protyle.toolbar.element.querySelector(`[data-type="${type}"]`).dispatchEvent(new CustomEvent("block-ref" === type ? getEventName() : "click"));- return;- }const nodeElement = hasClosestBlock(this.range.startContainer);if (!nodeElement) {return;diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 7d2c73d67b..ae44da9cee 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1,5 +1,5 @@import {hideElements} from "../ui/hideElements";-import {isCtrl, isMac, writeText} from "../util/compatibility";+import {getEventName, isCtrl, isMac, writeText} from "../util/compatibility";import {focusBlock,focusByRange,@@ -1197,6 +1197,10 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {}if (matchHotKey(menuItem.hotkey, event)) {protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element);+ if (["a", "block-ref", "inline-math", "inline-memo", "text"].includes(menuItem.name)) {+ protyle.toolbar.element.querySelector(`[data-type="${menuItem.name}"]`).dispatchEvent(new CustomEvent("block-ref" === menuItem.name ? getEventName() : "click"));+ return true;+ }protyle.toolbar.setInlineMark(protyle, menuItem.name, "range");return true;}