An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/10528
Vanessab73fa77f2bb4
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 4dd57d9229..ebcfb9cc13 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1,4 +1,5 @@{+ "emptyPlaceholder": "Write something, ' / ' for commands","publish": "Publish","publishService": "Publish service","publishServiceNotStarted": "Publish Service Not Started",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 1b173ed212..6df21954b3 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1,4 +1,5 @@{+ "emptyPlaceholder": "Escribe algo, ' / ' para los comandos","publish": "Publicar","publishService": "Publicar servicio","publishServiceNotStarted": "Servicio de publicación no iniciado",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex 8e1213085d..06152dd98c 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1,4 +1,5 @@{+ "emptyPlaceholder": "Écrivez quelque chose, ' / ' pour les commandes","publish": "Publier","publishService": "Publier le service","publishServiceNotStarted": "Service de publication non démarré",diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.jsonindex fe21964c6e..5df286c766 100644--- a/app/appearance/langs/ja_JP.json+++ b/app/appearance/langs/ja_JP.json@@ -1,4 +1,5 @@{+ "emptyPlaceholder": "何か書いてください。コマンドの場合は「/」","publish": "公開する","publishService": "サービスを公開","publishServiceNotStarted": "サービスが開始されていません",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 3b3d32d9c1..a2a8751580 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1,4 +1,5 @@{+ "emptyPlaceholder": "寫點什麼,或按下 ' / ' 查看指令","publish": "發布","publishService": "發布服務","publishServiceNotStarted": "發布服務未啟動",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 7229fdcec2..15f29f225d 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1,4 +1,5 @@{+ "emptyPlaceholder": "写点什么,或按下 ' / ' 查看命令","publish": "发布","publishService": "发布服务","publishServiceNotStarted": "发布服务未启动",diff --git a/app/src/assets/scss/mobile.scss b/app/src/assets/scss/mobile.scssindex b71ffac0bb..f5aa28348a 100644--- a/app/src/assets/scss/mobile.scss+++ b/app/src/assets/scss/mobile.scss@@ -475,15 +475,6 @@}}-html .protyle-wysiwyg [data-node-id]:last-child [spellcheck][contenteditable="true"]:empty:before {- content: "Enter text";- color: var(--b3-empty-color);-}--html[lang="zh_CN"] .protyle-wysiwyg [data-node-id]:last-child [spellcheck][contenteditable="true"]:empty:before {- content: "键入文字";-}-.av__views .block__icon {opacity: 1;}diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scssindex 6edde22c5f..23ddc88236 100644--- a/app/src/assets/scss/protyle/_wysiwyg.scss+++ b/app/src/assets/scss/protyle/_wysiwyg.scss@@ -5,6 +5,11 @@user-select: auto;overflow-x: clip;+ &--empty:empty:before {+ color: var(--b3-empty-color);+ content: attr(placeholder);+ }+.protyle-breadcrumb__bar {font-size: 14px;}diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.tsindex 47f516be30..3d56de7ac0 100644--- a/app/src/protyle/header/Title.ts+++ b/app/src/protyle/header/Title.ts@@ -16,7 +16,7 @@ import {isMac, readText, writeText} from "../util/compatibility";import * as dayjs from "dayjs";import {openFileById} from "../../editor/util";import {setTitle} from "../../dialog/processSystem";-import {getNoContainerElement} from "../wysiwyg/getBlock";+import {getContenteditableElement, getNoContainerElement} from "../wysiwyg/getBlock";import {commonHotkey} from "../wysiwyg/commonHotkey";import {code160to32} from "../util/code160to32";import {genEmptyElement} from "../../block/util";@@ -115,19 +115,25 @@ export class Title {event.stopPropagation();}} else if (event.key === "Enter") {- const newId = Lute.NewNodeID();- const newElement = genEmptyElement(false, true, newId);- protyle.wysiwyg.element.insertAdjacentElement("afterbegin", newElement);- focusByWbr(newElement, protyle.toolbar.range || getEditorRange(newElement));- transaction(protyle, [{- action: "insert",- data: newElement.outerHTML,- id: newId,- parentID: protyle.block.parentID- }], [{- action: "delete",- id: newId,- }]);+ const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild)+ if (editElment && editElment.textContent === "") {+ // 配合提示文本使用,避免提示文本挤压到第二个块中+ focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element);+ } else {+ const newId = Lute.NewNodeID();+ const newElement = genEmptyElement(false, true, newId);+ protyle.wysiwyg.element.insertAdjacentElement("afterbegin", newElement);+ focusByWbr(newElement, protyle.toolbar.range || getEditorRange(newElement));+ transaction(protyle, [{+ action: "insert",+ data: newElement.outerHTML,+ id: newId,+ parentID: protyle.block.parentID+ }], [{+ action: "delete",+ id: newId,+ }]);+ }event.preventDefault();event.stopPropagation();} else if (matchHotKey(window.siyuan.config.keymap.editor.general.attr.custom, event)) {diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 6bcee1029c..38918ef2b8 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -19,6 +19,7 @@ import {avRender} from "../render/av/render";import {hideTooltip} from "../../dialog/tooltip";import {stickyRow} from "../render/av/row";import {updateReadonly as updateReadonlyMethod} from "../breadcrumb/action";+import {getContenteditableElement} from "../wysiwyg/getBlock";export const onGet = (options: {data: IWebSocketData,@@ -180,6 +181,15 @@ const setHTML = (options: {} else {protyle.wysiwyg.element.innerHTML = options.content;}+ // https://github.com/siyuan-note/siyuan/issues/10528+ if (!protyle.block.showAll && protyle.wysiwyg.element.childElementCount === 1 && protyle.wysiwyg.element.firstElementChild.classList.contains("p")) {+ const editElement = getContenteditableElement(protyle.wysiwyg.element.firstElementChild);+ if (editElement && editElement.textContent === "") {+ editElement.classList.add("protyle-wysiwyg--empty");+ editElement.setAttribute("placeholder", window.siyuan.languages.emptyPlaceholder);+ }+ }+if (options.action.includes(Constants.CB_GET_BACKLINK)) {foldPassiveType(options.expand, protyle.wysiwyg.element);}