Skip to content

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

:bug: Prevent an error when exiting the format painter https://github.com/siyuan-note/siyuan/issues/12732

Daniel869f06852349
diff --git a/app/src/layout/status.ts b/app/src/layout/status.ts
index e337311df5..30efc6b0b6 100644
--- a/app/src/layout/status.ts
+++ b/app/src/layout/status.ts
@@ -32,8 +32,8 @@ export const initStatus = (isWindow = false) => {
<svg><use xlink:href="#iconHelp"></use></svg>
</div>`;
document.querySelector("#status").addEventListener("click", (event) => {
- let target = event.target as HTMLElement;
- while (target.id !== "status") {
+ let target = event.target as HTMLElement | null;
+ while (target && target.id !== "status") {
if (target.id === "barDock") {
toggleDockBar(target.firstElementChild.firstElementChild);
event.stopPropagation();
diff --git a/app/src/protyle/toolbar/FormatPainter.ts b/app/src/protyle/toolbar/FormatPainter.ts
index e366e2182d..620d56c85d 100644
--- a/app/src/protyle/toolbar/FormatPainter.ts
+++ b/app/src/protyle/toolbar/FormatPainter.ts
@@ -173,7 +173,10 @@ class FormatPainterController {
element.id = "statusFormatPainter";
element.className = "toolbar__item ariaLabel status__format-painter";
element.innerHTML = '<svg><use xlink:href="#iconPaintRoller"></use></svg>';
- element.addEventListener("click", () => this.deactivate());
+ element.addEventListener("click", (event) => {
+ event.stopPropagation();
+ this.deactivate();
+ });
const helpElement = statusElement.querySelector("#statusHelp");
if (helpElement) {
helpElement.before(element);