Skip to content

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

:bug: Restore table cell gutter behavior and failing test coverage

Daniel394471c5f448
diff --git a/app/src/layout/dock/agent/agentSkill.test.ts b/app/src/layout/dock/agent/agentSkill.test.ts
index bb1d89a18b..4b763e9ed4 100644
--- a/app/src/layout/dock/agent/agentSkill.test.ts
+++ b/app/src/layout/dock/agent/agentSkill.test.ts
@@ -24,6 +24,7 @@ const browserCases = async (source: string) => {
},
Constants: {BLOCK_HINT_KEYS: ["((", "[["], INLINE_TYPE: ["strong"], ZWSP: "\u200b"},
hideElements: () => {}, getUndoFocusContext: (): undefined => undefined, focusByRange: () => {},
+ isProtyleListItemFragment: () => false,
hasClosestBlock: (node: Node) => (node instanceof Element ? node : node.parentElement).closest("[data-node-id]"),
insertHTML: (html: string) => { inserted = html; },
};
diff --git a/app/src/protyle/render/tableCellRichEditor.ts b/app/src/protyle/render/tableCellRichEditor.ts
index bc2cc1eaee..ed8042b113 100644
--- a/app/src/protyle/render/tableCellRichEditor.ts
+++ b/app/src/protyle/render/tableCellRichEditor.ts
@@ -150,8 +150,11 @@ export const openTableCellRichEditor = (owner: IProtyle, cell: HTMLTableCellElem
event.preventDefault();
}
}));
- ["mouseover", "pointerover"].forEach(type => host.addEventListener(type, event => event.stopPropagation()));
- owner.gutter?.render(owner, table, cell);
+ ["mouseover", "pointerover"].forEach(type => host.addEventListener(type, event => {
+ event.stopPropagation();
+ hideElements(["gutter"], owner);
+ }));
+ owner.gutter?.render(owner, table, host);
const toolbar = getDefaultToolbar(isMobile()).filter(item => typeof item === "string" ? item !== "ai" : item.name !== "ai");
const safeSlash = registerBuiltinSlashHint((key: string, protyle: IProtyle, hintSource: THintSource) =>
hintSlash(key, protyle, hintSource).filter(item => TABLE_CELL_SLASH_IDS.has(item.id)));
diff --git a/app/src/window/onWindowsMsg.test.ts b/app/src/window/onWindowsMsg.test.ts
index 06d0ca7789..185b923743 100644
--- a/app/src/window/onWindowsMsg.test.ts
+++ b/app/src/window/onWindowsMsg.test.ts
@@ -11,6 +11,7 @@ test("system lock acknowledges only after all editor input has been submitted",
const submissions: Array<() => void> = [];
const sent: Array<{channel: string, id: number}> = [];
const dependencies = {
+ Constants: {SIYUAN_WINDOW_WORKSPACE_FLUSH: "siyuan-window-workspace-flush"},
getAllEditor: () => [undefined, ...[1, 2].map(() => ({
protyle: {wysiwyg: {}},
flushPendingTransactions: () => new Promise<void>(resolve => submissions.push(resolve)),
diff --git a/app/tests/compositionCaret.test.js b/app/tests/compositionCaret.test.js
index 759958ad8d..7187b93f8c 100644
--- a/app/tests/compositionCaret.test.js
+++ b/app/tests/compositionCaret.test.js
@@ -32,6 +32,7 @@ const rendererSource = () => {
// 使用实际事件入口、平台检测、选区恢复和事务生成,只替代网络及无关渲染。
const source = `
const Constants = {ZWSP: "\\u200b", ATTRIBUTE_EDITING: "data-editing"};
+ const dayjs = () => ({format: () => "20260923000000"});
const getAVTemplateInteractiveElement = () => false;
const getBlockSelectionModeElement = () => undefined;
const revealTabsForTarget = () => {};
diff --git a/kernel/api/contract_list_mindmap_test.go b/kernel/api/contract_list_mindmap_test.go
index 356992e253..6f05eb1981 100644
--- a/kernel/api/contract_list_mindmap_test.go
+++ b/kernel/api/contract_list_mindmap_test.go
@@ -26,6 +26,10 @@ func testAPIContractMindmapMigration(t *testing.T, engine *gin.Engine, boxID, do
if _, err := model.PerformBlockOperation(&model.Operation{Action: "appendInsert", ParentID: docID, Data: dom}); err != nil {
t.Fatal(err)
}
+ sourceBefore := model.GetBlockDOM(id)
+ if !strings.Contains(sourceBefore, "mindmap") {
+ t.Fatalf("unexpected migration source: %s", sourceBefore)
+ }
type response struct {
Code int `json:"code"`
Data apicontract.MigrateLegacyMindmapsData `json:"data"`
@@ -54,8 +58,8 @@ func testAPIContractMindmapMigration(t *testing.T, engine *gin.Engine, boxID, do
if recorder.Code != 403 {
t.Fatalf("reader migration was not denied: %d", recorder.Code)
}
- if !strings.Contains(model.GetBlockDOM(id), `data-subtype="mindmap"`) {
- t.Fatal("reader request modified source")
+ if source := model.GetBlockDOM(id); source != sourceBefore {
+ t.Fatalf("reader request modified source: %s", source)
}
result := post(string(body))
if result.Code != 0 || result.Data.Converted != 1 || len(result.Data.Blocks) != 1 || result.Data.Blocks[0].ID != id ||
diff --git a/kernel/model/backlink_global_fts5_test.go b/kernel/model/backlink_global_fts5_test.go
index e7d15bd682..515305732a 100644
--- a/kernel/model/backlink_global_fts5_test.go
+++ b/kernel/model/backlink_global_fts5_test.go
@@ -255,12 +255,12 @@ func TestGlobalBacklinkLargeDataset(t *testing.T) {
}
sql.IndexTreeQueue(definition)
for doc := 0; doc < documents; doc++ {
- tree := addFileOperationTestDoc(t, fixture, ast.NewNodeID(), fmt.Sprintf("Source%d", doc), false)
+ tree := addFileOperationTestDoc(t, fixture, fmt.Sprintf("20260923000000-d%06d", doc), fmt.Sprintf("Source%d", doc), false)
for tree.Root.FirstChild != nil {
tree.Root.FirstChild.Unlink()
}
for index := perDocument - 1; index >= 0; index-- {
- p := treenode.NewParagraph(ast.NewNodeID())
+ p := treenode.NewParagraph(fmt.Sprintf("20260923000000-p%06d", index*documents+doc+1))
p.AppendChild(&ast.Node{Type: ast.NodeTextMark, TextMarkType: "block-ref", TextMarkBlockRefID: fixture.sourceID,
TextMarkBlockRefSubtype: "s", TextMarkTextContent: fmt.Sprintf("A%d", index*documents+doc+1)})
tree.Root.AppendChild(p)