From ddbace307e06a69170094a3c559010b6ad8ba062 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 2 Jul 2024 22:23:03 +0800 Subject: [PATCH 1/5] :memo: Improve user guide https://github.com/siyuan-note/siyuan/issues/11858 --- .../20200924093441-ft2rhps.sy | 17 +++++++++-------- .../20200825162036-4dx365o.sy | 17 +++++++++++------ .../20211226121319-emrk2yy.sy | 17 +++++++++-------- .../20240530133126-axarxgx/.siyuan/conf.json | 2 +- 4 files changed, 30 insertions(+), 23 deletions(-) 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.sy index 37edd65a68..da0fc43620 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": "20240506230853" + "updated": "20240702222031" }, "Children": [ { @@ -17,7 +17,7 @@ "HeadingLevel": 2, "Properties": { "id": "20210104091509-sg4pt12", - "updated": "20210604224332" + "updated": "20240702222031" }, "Children": [ { @@ -32,7 +32,7 @@ "ListData": {}, "Properties": { "id": "20210104091509-8csaq4j", - "updated": "20240506230853" + "updated": "20240702222031" }, "Children": [ { @@ -105,7 +105,7 @@ }, "Properties": { "id": "20220916200111-8pnrqr2", - "updated": "20240225111211" + "updated": "20240702222031" }, "Children": [ { @@ -141,9 +141,13 @@ "Type": "NodeParagraph", "Properties": { "id": "20220916200115-rstez65", - "updated": "20240225111211" + "updated": "20240702222031" }, "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, { "Type": "NodeImage", "Data": "span", @@ -171,9 +175,6 @@ "Type": "NodeCloseParen" } ] - }, - { - "Type": "NodeText" } ] } 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.sy index 5839c98063..8d599fb118 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": "20240506230804" + "updated": "20240702222051" }, "Children": [ { @@ -17,7 +17,7 @@ "HeadingLevel": 2, "Properties": { "id": "20210604182832-nm3hapx", - "updated": "20220916194920" + "updated": "20240702222051" }, "Children": [ { @@ -32,7 +32,7 @@ "ListData": {}, "Properties": { "id": "20210104091228-ttcj9nm", - "updated": "20240506230804" + "updated": "20240702222051" }, "Children": [ { @@ -105,7 +105,7 @@ }, "Properties": { "id": "20220916195046-bdzv6fy", - "updated": "20240225111151" + "updated": "20240702222051" }, "Children": [ { @@ -141,9 +141,13 @@ "Type": "NodeParagraph", "Properties": { "id": "20210604222158-w17nnmy", - "updated": "20240225111151" + "updated": "20240702222051" }, "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, { "Type": "NodeImage", "Data": "span", @@ -173,7 +177,8 @@ ] }, { - "Type": "NodeText" + "Type": "NodeText", + "Data": "​" } ] } 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.sy index c24bf3e324..aeba28eed4 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": "20240506230828" + "updated": "20240702222119" }, "Children": [ { @@ -17,7 +17,7 @@ "HeadingLevel": 2, "Properties": { "id": "20211226122008-i45akvs", - "updated": "20220916195925" + "updated": "20240702222119" }, "Children": [ { @@ -32,7 +32,7 @@ "ListData": {}, "Properties": { "id": "20211226122008-1e014nh", - "updated": "20240506230828" + "updated": "20240702222119" }, "Children": [ { @@ -105,7 +105,7 @@ }, "Properties": { "id": "20220916195409-g57vfyf", - "updated": "20240225111159" + "updated": "20240702222119" }, "Children": [ { @@ -141,9 +141,13 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226122008-poajwbi", - "updated": "20240225111159" + "updated": "20240702222119" }, "Children": [ + { + "Type": "NodeText", + "Data": "​" + }, { "Type": "NodeImage", "Data": "span", @@ -171,9 +175,6 @@ "Type": "NodeCloseParen" } ] - }, - { - "Type": "NodeText" } ] } diff --git a/app/guide/20240530133126-axarxgx/.siyuan/conf.json b/app/guide/20240530133126-axarxgx/.siyuan/conf.json index 3e1440e374..1f081d9899 100644 --- a/app/guide/20240530133126-axarxgx/.siyuan/conf.json +++ b/app/guide/20240530133126-axarxgx/.siyuan/conf.json @@ -10,4 +10,4 @@ "dailyNoteSavePath": "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}", "dailyNoteTemplatePath": "", "sortMode": 15 -} +} \ No newline at end of file From 2274b0b8dfc091eb0c9baebdcaa99f346f9c5f28 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 2 Jul 2024 22:49:08 +0800 Subject: [PATCH 2/5] :art: fix https://github.com/siyuan-note/siyuan/issues/11873 --- app/src/protyle/gutter/index.ts | 2 ++ app/src/protyle/wysiwyg/keydown.ts | 39 ++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 7170b20af3..16b66579f2 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -1035,6 +1035,7 @@ export class Gutter { turnIntoSubmenu.push(this.turnsOneInto({ icon: "iconParagraph", label: window.siyuan.languages.paragraph, + accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom, protyle, nodeElement, id, @@ -1102,6 +1103,7 @@ export class Gutter { turnIntoSubmenu.push(this.turnsOneInto({ icon: "iconParagraph", label: window.siyuan.languages.paragraph, + accelerator: window.siyuan.config.keymap.editor.heading.paragraph.custom, protyle, nodeElement, id, diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 0d19d50af9..f7fec93752 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1182,11 +1182,40 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // h1 - h6 hotkey if (matchHotKey(window.siyuan.config.keymap.editor.heading.paragraph.custom, event)) { - turnsIntoTransaction({ - protyle, - nodeElement, - type: "Blocks2Ps", - }); + const selectsElement = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")) + if (selectsElement.length === 0) { + selectsElement.push(nodeElement); + } + if (selectsElement.length > 1) { + turnsIntoTransaction({ + protyle, + nodeElement: selectsElement[0], + type: "Blocks2Ps", + }); + } else { + const type = selectsElement[0].getAttribute("data-type"); + if (type === "NodeHeading") { + turnsIntoTransaction({ + protyle, + nodeElement: selectsElement[0], + type: "Blocks2Ps", + }); + } else if (type === "NodeList") { + turnsOneInto({ + protyle, + nodeElement: selectsElement[0], + id: selectsElement[0].getAttribute("data-node-id"), + type: "CancelList", + }); + } else if (type === "NodeBlockquote") { + turnsOneInto({ + protyle, + nodeElement: selectsElement[0], + id: selectsElement[0].getAttribute("data-node-id"), + type: "CancelBlockquote", + }); + } + } event.preventDefault(); event.stopPropagation(); return true; From a4e61c8c37a85e6f7bb2be6dcac55a123ac75ec1 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Jul 2024 13:08:55 +0800 Subject: [PATCH 3/5] :art: fix https://github.com/siyuan-note/siyuan/issues/11868 --- app/src/protyle/wysiwyg/keydown.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index f7fec93752..aa2e1c6966 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -813,7 +813,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { // 段末反向删除 https://github.com/siyuan-note/insider/issues/274 if (position.end === editElement.textContent.length || // 软换行后删除 https://github.com/siyuan-note/siyuan/issues/11118 - (position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith("\n"))) { + (position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith("\n")) || + // 图片后无内容删除 https://github.com/siyuan-note/siyuan/issues/11868 + (position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith(Constants.ZWSP))) { const nextElement = getNextBlock(getTopAloneElement(nodeElement)); if (nextElement) { const nextRange = focusBlock(nextElement); From e70f1f9a8fa42b50aa72305324434936496475ed Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Jul 2024 14:05:32 +0800 Subject: [PATCH 4/5] :art: fix https://github.com/siyuan-note/siyuan/issues/11871 --- app/src/protyle/header/Title.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts index 3d56de7ac0..c8dffef784 100644 --- a/app/src/protyle/header/Title.ts +++ b/app/src/protyle/header/Title.ts @@ -116,7 +116,7 @@ export class Title { } } else if (event.key === "Enter") { const editElment = getContenteditableElement(protyle.wysiwyg.element.firstElementChild) - if (editElment && editElment.textContent === "") { + if (editElment && editElment.textContent === "" && !protyle.wysiwyg.element.firstElementChild.classList.contains("av")) { // 配合提示文本使用,避免提示文本挤压到第二个块中 focusBlock(protyle.wysiwyg.element.firstElementChild, protyle.wysiwyg.element); } else { From 80851be431618879bfedaf895344bf7500d5296d Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 3 Jul 2024 14:28:30 +0800 Subject: [PATCH 5/5] :art: fix https://github.com/siyuan-note/siyuan/issues/11828 --- app/src/protyle/gutter/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 16b66579f2..ea370232c4 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -1989,7 +1989,7 @@ data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" d if (type === "NodeListItem" && nodeElement.childElementCount > 3 || type === "NodeHeading") { const fold = nodeElement.getAttribute("fold"); foldHTML = ``; +data-type="fold" style="cursor:inherit;">`; } if (type === "NodeListItem" || type === "NodeList") { listItem = nodeElement;