An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Preserve ordinary document format and remove table cell F2 editing https://github.com/siyuan-note/siyuan/issues/19188
Daniel2796db4ec37a
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.syindex b9a467aaea..2d3cd3a0ec 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy@@ -8,7 +8,7 @@"title": "Formatting elements","title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;","type": "doc",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2548,7 +2548,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091509-qr9enpx",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2576,21 +2576,12 @@"Type": "NodeParagraph","Properties": {"id": "20260908091355-rch0008",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{"Type": "NodeText",- "Data": "Click a cell to edit it. After creating a table, type directly without clicking again. You can also place the caret in a cell and press "- },- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- },- {- "Type": "NodeText",- "Data": " to start editing. When the cell contains only one ordinary paragraph, "+ "Data": "Click a cell to edit it. After creating a table, type directly without clicking again. When the cell contains only one ordinary paragraph, "},{"Type": "NodeTextMark",diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.syindex 78569ce9b1..a1e3f3ee31 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy@@ -7,7 +7,7 @@"id": "20200924100950-9op5xi1","title": "Shortcuts","type": "doc",- "updated": "20260909090822"+ "updated": "20260910080119"},"Children": [{@@ -4047,7 +4047,7 @@"HeadingLevel": 2,"Properties": {"id": "20210106154056-koo4wdj",- "updated": "20260906013806"+ "updated": "20260910080119"},"Children": [{@@ -12316,7 +12316,7 @@"HeadingLevel": 3,"Properties": {"id": "20210106154319-jeh8w1g",- "updated": "20260811122156"+ "updated": "20260910080119"},"Children": [{@@ -12362,7 +12362,7 @@"Properties": {"colgroup": "|","id": "20210106154319-otreidg",- "updated": "20260909090822"+ "updated": "20260910080119"},"Children": [{@@ -13033,30 +13033,6 @@}]},- {- "Type": "NodeTableRow",- "Children": [- {- "Type": "NodeTableCell",- "Children": [- {- "Type": "NodeText",- "Data": "Edit a table cell"- }- ]- },- {- "Type": "NodeTableCell",- "Children": [- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- }- ]- }- ]- },{"Type": "NodeTableRow","Children": [diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.syindex ce2b18c20a..59eead409e 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy@@ -8,7 +8,7 @@"title": "排版元素","title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);","type": "doc",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2540,7 +2540,7 @@"HeadingLevel": 2,"Properties": {"id": "20210104091228-1bq55o9",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2568,21 +2568,12 @@"Type": "NodeParagraph","Properties": {"id": "20260908091355-rch0005",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{"Type": "NodeText",- "Data": "点击单元格即可编辑;新建表格后可直接输入,无需再次点击。也可以将光标移入单元格后按 "- },- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- },- {- "Type": "NodeText",- "Data": " 开始编辑。单元格仅含一个普通段落时,"+ "Data": "点击单元格即可编辑;新建表格后可直接输入,无需再次点击。单元格仅含一个普通段落时,"},{"Type": "NodeTextMark",diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.syindex 8549a0bc14..4a50c2d449 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy@@ -7,7 +7,7 @@"id": "20200813004551-gm0pbn1","title": "快捷键","type": "doc",- "updated": "20260909090822"+ "updated": "20260910080119"},"Children": [{@@ -4045,7 +4045,7 @@"HeadingLevel": 2,"Properties": {"id": "20201227133317-rkh4bji",- "updated": "20260906013806"+ "updated": "20260910080119"},"Children": [{@@ -12302,7 +12302,7 @@"HeadingLevel": 3,"Properties": {"id": "20201227133317-xpgtzbg",- "updated": "20260811122156"+ "updated": "20260910080119"},"Children": [{@@ -12348,7 +12348,7 @@"Properties": {"colgroup": "|","id": "20201227133317-v7clw0j",- "updated": "20260909090822"+ "updated": "20260910080119"},"Children": [{@@ -13019,30 +13019,6 @@}]},- {- "Type": "NodeTableRow",- "Children": [- {- "Type": "NodeTableCell",- "Children": [- {- "Type": "NodeText",- "Data": "编辑单元格"- }- ]- },- {- "Type": "NodeTableCell",- "Children": [- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- }- ]- }- ]- },{"Type": "NodeTableRow","Children": [diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.syindex 793ea4cc28..af477a40dd 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy@@ -8,7 +8,7 @@"title": "排版元素","title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);","type": "doc",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2538,7 +2538,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122008-8glkpvq",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2566,21 +2566,12 @@"Type": "NodeParagraph","Properties": {"id": "20260908091355-rch0002",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{"Type": "NodeText",- "Data": "點擊儲存格即可編輯;新增表格後可直接輸入,無需再次點擊。也可以將游標移入儲存格後按 "- },- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- },- {- "Type": "NodeText",- "Data": " 開始編輯。儲存格僅含一個普通段落時,"+ "Data": "點擊儲存格即可編輯;新增表格後可直接輸入,無需再次點擊。儲存格僅含一個普通段落時,"},{"Type": "NodeTextMark",diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.syindex 471f0f7a1b..f17a0876c5 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy@@ -7,7 +7,7 @@"id": "20211226122549-jktxego","title": "快捷鍵","type": "doc",- "updated": "20260909090822"+ "updated": "20260910080119"},"Children": [{@@ -4039,7 +4039,7 @@"HeadingLevel": 2,"Properties": {"id": "20211226122652-htptsmh",- "updated": "20260906013806"+ "updated": "20260910080119"},"Children": [{@@ -12308,7 +12308,7 @@"HeadingLevel": 3,"Properties": {"id": "20211226122652-x2dmpab",- "updated": "20260811122156"+ "updated": "20260910080119"},"Children": [{@@ -12354,7 +12354,7 @@"Properties": {"colgroup": "|","id": "20211226122652-n2r88dm",- "updated": "20260909090822"+ "updated": "20260910080119"},"Children": [{@@ -13025,30 +13025,6 @@}]},- {- "Type": "NodeTableRow",- "Children": [- {- "Type": "NodeTableCell",- "Children": [- {- "Type": "NodeText",- "Data": "編輯儲存格"- }- ]- },- {- "Type": "NodeTableCell",- "Children": [- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- }- ]- }- ]- },{"Type": "NodeTableRow","Children": [diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.syindex 89fe495604..2951a59d16 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy@@ -9,7 +9,7 @@"title": "書式要素","title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;","type": "doc",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2704,7 +2704,7 @@"Properties": {"ID": "20240530101000-grqaq7u","id": "20240530101000-hen4g1y",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{@@ -2732,21 +2732,12 @@"Type": "NodeParagraph","Properties": {"id": "20260909090723-or0hf4r",- "updated": "20260909090723"+ "updated": "20260910080119"},"Children": [{"Type": "NodeText",- "Data": "セルをクリックすると編集できます。テーブルの作成直後は、再度クリックせずに入力できます。セルにカーソルを移動して "- },- {- "Type": "NodeTextMark",- "TextMarkType": "kbd",- "TextMarkTextContent": "F2"- },- {- "Type": "NodeText",- "Data": " を押しても編集を開始できます。セルに通常の段落が一つだけ含まれる場合、"+ "Data": "セルをクリックすると編集できます。テーブルの作成直後は、再度クリックせずに入力できます。セルに通常の段落が一つだけ含まれる場合、"},{"Type": "NodeTextMark",diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex d048fa358b..54d47d84e4 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -3906,19 +3906,6 @@ export class WYSIWYG {}});this.element.addEventListener("keydown", (event: KeyboardEvent) => {- if (event.key === "F2" && !event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey &&- !event.isComposing && !protyle.disabled) {- const selection = getSelection();- const target = selection?.focusNode;- const element = target instanceof Element ? target : target?.parentElement;- const cell = element?.closest<HTMLTableCellElement>("th, td");- if (cell && cell.closest(".protyle-wysiwyg") === this.element) {- event.preventDefault();- event.stopPropagation();- void import("../render/tableCellRichEditor").then(module => module.openTableCellRichEditor(protyle, cell));- return;- }- }if (isInAndroid()) {if (event.key === "Unidentified") {mobileUnidentifiedInputRange = undefined;diff --git a/kernel/model/file.go b/kernel/model/file.goindex b53ea83928..8631e6929c 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -2363,7 +2363,8 @@ func createDoc0(boxID, p, title, dom string, titleEmpty, syncWrite bool) (tree *tree.HPath = validation.hPathtree.ID = validation.idtree.Root.ID = validation.id- tree.Root.Spec = treenode.CurrentSpec+ tree.Root.Spec = treenode.BaseSpec+ treenode.UpgradeSpec(tree)updated := util.TimeFromID(validation.id)tree.Root.KramdownIAL = [][]string{{"id", validation.id}, {"title", html.EscapeAttrVal(validation.title)}, {"updated", updated}}if validation.isEmpty {diff --git a/kernel/model/file_test.go b/kernel/model/file_test.goindex 361ec9b72e..582d9046ac 100644--- a/kernel/model/file_test.go+++ b/kernel/model/file_test.go@@ -575,6 +575,29 @@ func TestCreateDocByMdConvertsHTMLTagsToTextMarks(t *testing.T) {}}+func TestCreateDocByMdKeepsOrdinaryTableSpec(t *testing.T) {+ fixture := setupFileOperationTest(t)+ tree, err := CreateDocByMd(fixture.box.ID, "/20260718000004-abcdefg.sy", "Ordinary table",+ "| Header |\n| --- |\n| **bold** |", nil, nil)+ if nil != err {+ t.Fatal(err)+ }+ t.Cleanup(func() {+ cache.RemoveTreeData(tree.ID)+ cache.RemoveDocIAL(tree.Path)+ })+ if tree.Root.Spec != treenode.BaseSpec {+ t.Fatalf("ordinary table must use base spec, got %s", tree.Root.Spec)+ }+ loaded, err := filesys.LoadTree(tree.Box, tree.Path, util.NewLute())+ if nil != err {+ t.Fatal(err)+ }+ if loaded.Root.Spec != treenode.BaseSpec {+ t.Fatalf("persisted ordinary table must use base spec, got %s", loaded.Root.Spec)+ }+}+func TestValidateCreateDocReportsClosedNotebook(t *testing.T) {fixture := setupFileOperationTest(t)boxConf := fixture.box.GetConf()