From 9fba19866d250a48d92b92bb46bae42aeb5672fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9B=E4=BA=BD?= <83791825+Soltus@users.noreply.github.com> Date: Sun, 21 Apr 2024 09:35:32 +0800 Subject: [PATCH 01/12] Update cd.yml (#11096) --- .github/workflows/cd.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8da70cb14d..b3071b9f3f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -14,6 +14,7 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} release_version: ${{ steps.release_info.outputs.release_version }} version: ${{ steps.version.outputs.value }} + packageManager: ${{ steps.packageManager.outputs.value }} steps: - name: Checkout code uses: actions/checkout@v3 @@ -52,6 +53,12 @@ jobs: with: cmd: 'jq .version app/package.json -r' + - name: Extract packageManager from package.json + uses: sergeysova/jq-action@v2 + id: packageManager + with: + cmd: "jq .packageManager app/package.json -r" + - name: Create Release id: create_release uses: ncipollo/release-action@v1 @@ -140,12 +147,12 @@ jobs: GOARCH: ${{ matrix.config.goarch }} - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install Node pnpm - run: npm install -g pnpm + run: npm install -g ${{ needs.create_release.outputs.packageManager }} working-directory: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/app - name: Install Node Dependencies From 2acea3dc8f857780b2932e89e99ed112b2d4e035 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 21 Apr 2024 09:36:30 +0800 Subject: [PATCH 02/12] :art: Update CD script --- .github/workflows/cd.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b3071b9f3f..25584b4abf 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -158,14 +158,10 @@ jobs: - name: Install Node Dependencies run: pnpm install --no-frozen-lockfile working-directory: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/app - env: - COREPACK_ENABLE_STRICT: 0 - + - name: Building UI run: pnpm run build working-directory: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/app - env: - COREPACK_ENABLE_STRICT: 0 - name: Remove Build Directory uses: JesseTG/rm@v1.0.2 @@ -210,8 +206,6 @@ jobs: - name: Building Electron run: pnpm run ${{ matrix.config.electron_args }} working-directory: ${{ github.workspace }}/go/src/github.com/siyuan-note/siyuan/app - env: - COREPACK_ENABLE_STRICT: 0 - name: Upload Release uses: actions/upload-release-asset@v1 From 0f4acbdb4f0cdffc745daab19933d9d643f61e49 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 21 Apr 2024 10:20:27 +0800 Subject: [PATCH 03/12] :memo: https://ld246.com/article/1713336942155/comment/1713534772847#comments --- app/appearance/langs/en_US.json | 2 +- app/appearance/langs/es_ES.json | 2 +- app/appearance/langs/fr_FR.json | 2 +- app/appearance/langs/zh_CHT.json | 2 +- app/appearance/langs/zh_CN.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 8f4aa91441..57b5edafb3 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -378,7 +378,7 @@ "sortByRankDesc": "Relevance DESC", "sortByRankAsc": "Relevance ASC", "saveCriterion": "Save query criteria", - "useCriterion": "After clearing, the last query condition can be used", + "useCriterion": "Search criteria will be saved for next query", "removeCriterion": "Remove query criteria", "group": "Group", "noGroupBy": "No grouping", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 4bcc8f827f..374e60d2dd 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -378,7 +378,7 @@ "sortByRankDesc": "Relevancia DESC", "sortByRankAsc": "Relevancia ASC", "saveCriterion": "Guardar criterios de consulta", - "useCriterion": "Después de borrar, se puede usar la última condición de consulta", + "useCriterion": "Los criterios de búsqueda se guardarán para la siguiente consulta", "removeCriterion": "Eliminar criterios de consulta", "grupo": "Grupo", "noGroupBy": "Sin agrupar", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 7259822715..b2507eb4c4 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -378,7 +378,7 @@ "sortByRankDesc": "DESC de pertinence", "sortByRankAsc": "ASC de pertinence", "saveCriterion": "Enregistrer les critères de requête", - "useCriterion": "Après effacement, la dernière condition de requête peut être utilisée", + "useCriterion": "Les critères de recherche seront enregistrés pour la prochaine requête", "removeCriterion": "Supprimer les critères de requête", "groupe": "Groupe", "noGroupBy": "Aucun regroupement", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 8556400ca2..8051322c9c 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -378,7 +378,7 @@ "sortByRankDesc": "按相關度降序", "sortByRankAsc": "按相關度升序", "saveCriterion": "保存查詢條件", - "useCriterion": "清空後可使用上一次的查詢條件", + "useCriterion": "搜尋條件將保存到下次查詢中", "removeCriterion": "清空查詢條件", "group": "分組", "noGroupBy": "不分組", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index d353283beb..e38259e49e 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -378,7 +378,7 @@ "sortByRankDesc": "按相关度降序", "sortByRankAsc": "按相关度升序", "saveCriterion": "保存查询条件", - "useCriterion": "清空后可使用上一次的查询条件", + "useCriterion": "搜索条件将保存到下一次查询中", "removeCriterion": "清空查询条件", "group": "分组", "noGroupBy": "不分组", From e094cb20c4c71f6448fe978906f40379f73c0b43 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 21 Apr 2024 10:35:34 +0800 Subject: [PATCH 04/12] :memo: https://ld246.com/article/1713618202536 --- app/src/protyle/render/av/action.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 7418fad4d0..6fe0f0bc1e 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -29,6 +29,7 @@ import {avRender} from "./render"; import {addView, openViewMenu} from "./view"; import {isOnlyMeta, writeText} from "../../util/compatibility"; import {openSearchAV} from "./relation"; +import {Constants} from "../../../constants"; export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => { if (isOnlyMeta(event)) { @@ -87,7 +88,9 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle searchElement.style.width = "128px"; searchElement.style.paddingLeft = ""; searchElement.style.paddingRight = ""; - searchElement.focus(); + setTimeout(() => { + searchElement.focus(); + }, Constants.TIMEOUT_TRANSITION); event.preventDefault(); event.stopPropagation(); return true; From d3eae7fa3d65d5de0faa2ac903396c519c9be4e6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 21 Apr 2024 11:24:00 +0800 Subject: [PATCH 05/12] :art: fix https://github.com/siyuan-note/siyuan/issues/11097 --- app/src/layout/dock/Backlink.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/layout/dock/Backlink.ts b/app/src/layout/dock/Backlink.ts index 0bbae16219..c1716a33f8 100644 --- a/app/src/layout/dock/Backlink.ts +++ b/app/src/layout/dock/Backlink.ts @@ -595,8 +595,7 @@ export class Backlink extends Model { this.status[this.blockId].backlinkMOpenIds.push(data.backmentions[index].id); } }); - if (window.siyuan.config.editor.backmentionExpandCount === 0) { - // 设置为 0 时需折叠 + if (data.mentionsCount === 0) { this.status[this.blockId].backlinkMStatus = 3; } else { if (data.linkRefsCount === 0) { From 943d8dac43483ecd3b8b8cdcce230cc78f9962d8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 21 Apr 2024 11:46:05 +0800 Subject: [PATCH 06/12] :art: fix https://github.com/siyuan-note/siyuan/issues/11057 --- app/src/protyle/wysiwyg/keydown.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index ac8721ac87..01378509ee 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -930,11 +930,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"); if (selectElements.length > 0) { selectElements[0].setAttribute("data-reftext", "true"); + focusByRange(getEditorRange(nodeElement)); + document.execCommand("copy"); } else { - nodeElement.setAttribute("data-reftext", "true"); + writeText(`((${nodeElement.getAttribute("data-node-id")} "*"))`); } - focusByRange(getEditorRange(nodeElement)); - document.execCommand("copy"); } event.preventDefault(); event.stopPropagation(); From 428d6e189de18db5b99b3516a092718180856b28 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 21 Apr 2024 12:14:18 +0800 Subject: [PATCH 07/12] :art: https://ld246.com/article/1713593768818 --- app/src/protyle/util/insertHTML.ts | 2 +- app/src/protyle/wysiwyg/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index e17c052d8f..7957912845 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -168,7 +168,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: updateCellsValue(protyle, blockElement as HTMLElement, text); } else if (cellsElement.length > 0) { updateCellsValue(protyle, blockElement as HTMLElement, text, cellsElement); - } else { + } else if (hasClosestByClassName(range.startContainer, "av__title")) { range.insertNode(document.createTextNode(text)); range.collapse(false); updateAVName(protyle, blockElement); diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 6b19ec5abe..e127c6f9b7 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1763,7 +1763,7 @@ export class WYSIWYG { return; } const blockElement = hasClosestBlock(event.target); - if (blockElement && (!getContenteditableElement(blockElement) || hasClosestByClassName(event.target, "av__cursor"))) { + if (blockElement && !getContenteditableElement(blockElement)) { event.stopPropagation(); event.preventDefault(); return; From 1db8269b9fda637e01e638619196c91d4d069dfb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 21 Apr 2024 17:52:08 +0800 Subject: [PATCH 08/12] :bug: Database unbind block causes entry to be deleted Fix https://github.com/siyuan-note/siyuan/issues/11101 --- kernel/model/attribute_view.go | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index ad8d3d96d9..eefa76e4a1 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1339,6 +1339,7 @@ func unbindAttributeViewBlock(operation *Operation, tx *Transaction) (err error) unbindBlockAv(tx, operation.AvID, value.BlockID) } value.BlockID = operation.NextID + value.IsDetached = true if nil != value.Block { value.Block.ID = operation.NextID } From 7f982138794d4099ad6f4933285f51520c046530 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 21 Apr 2024 18:18:23 +0800 Subject: [PATCH 09/12] :art: Improve mirror database blocks reload --- kernel/api/av.go | 16 ++++++---------- kernel/av/mirror.go | 13 ++++++++++--- kernel/model/attribute_view.go | 8 ++++---- kernel/model/transaction.go | 22 ++++++++++++++++++---- kernel/treenode/blocktree.go | 13 +++++++++++++ kernel/util/websocket.go | 4 ++++ 6 files changed, 55 insertions(+), 21 deletions(-) diff --git a/kernel/api/av.go b/kernel/api/av.go index 08fcc4415e..2cb0cc4520 100644 --- a/kernel/api/av.go +++ b/kernel/api/av.go @@ -135,7 +135,7 @@ func addAttributeViewValues(c *gin.Context) { return } - pushRefreshAttrView(avID) + util.PushReloadAttrView(avID) } func removeAttributeViewValues(c *gin.Context) { @@ -160,7 +160,7 @@ func removeAttributeViewValues(c *gin.Context) { return } - pushRefreshAttrView(avID) + util.PushReloadAttrView(avID) } func addAttributeViewKey(c *gin.Context) { @@ -186,7 +186,7 @@ func addAttributeViewKey(c *gin.Context) { return } - pushRefreshAttrView(avID) + util.PushReloadAttrView(avID) } func removeAttributeViewKey(c *gin.Context) { @@ -208,7 +208,7 @@ func removeAttributeViewKey(c *gin.Context) { return } - pushRefreshAttrView(avID) + util.PushReloadAttrView(avID) } func sortAttributeViewKey(c *gin.Context) { @@ -235,7 +235,7 @@ func sortAttributeViewKey(c *gin.Context) { return } - pushRefreshAttrView(avID) + util.PushReloadAttrView(avID) } func getAttributeViewFilterSort(c *gin.Context) { @@ -509,9 +509,5 @@ func setAttributeViewBlockAttr(c *gin.Context) { blockAttributeViewKeys := model.UpdateAttributeViewCell(nil, avID, keyID, rowID, cellID, value) ret.Data = blockAttributeViewKeys - pushRefreshAttrView(avID) -} - -func pushRefreshAttrView(avID string) { - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": avID}) + util.PushReloadAttrView(avID) } diff --git a/kernel/av/mirror.go b/kernel/av/mirror.go index 8814d8f566..bd9db29e0a 100644 --- a/kernel/av/mirror.go +++ b/kernel/av/mirror.go @@ -66,7 +66,7 @@ func IsMirror(avID string) bool { return nil != blockIDs && 1 < len(blockIDs) } -func RemoveBlockRel(avID, blockID string) { +func RemoveBlockRel(avID, blockID string, existBlockTree func(string) bool) (ret bool) { AttributeViewBlocksLock.Lock() defer AttributeViewBlocksLock.Unlock() @@ -95,10 +95,13 @@ func RemoveBlockRel(avID, blockID string) { var newBlockIDs []string for _, v := range blockIDs { if v != blockID { - newBlockIDs = append(newBlockIDs, v) + if existBlockTree(v) { + newBlockIDs = append(newBlockIDs, v) + } } } avBlocks[avID] = newBlockIDs + ret = len(newBlockIDs) != len(blockIDs) data, err = msgpack.Marshal(avBlocks) if nil != err { @@ -109,6 +112,7 @@ func RemoveBlockRel(avID, blockID string) { logging.LogErrorf("write attribute view blocks failed: %s", err) return } + return } func BatchUpsertBlockRel(nodes []*ast.Node) { @@ -161,7 +165,7 @@ func BatchUpsertBlockRel(nodes []*ast.Node) { } } -func UpsertBlockRel(avID, blockID string) { +func UpsertBlockRel(avID, blockID string) (ret bool) { AttributeViewBlocksLock.Lock() defer AttributeViewBlocksLock.Unlock() @@ -186,9 +190,11 @@ func UpsertBlockRel(avID, blockID string) { } blockIDs := avBlocks[avID] + oldLen := len(blockIDs) blockIDs = append(blockIDs, blockID) blockIDs = gulu.Str.RemoveDuplicatedElem(blockIDs) avBlocks[avID] = blockIDs + ret = oldLen != len(blockIDs) data, err := msgpack.Marshal(avBlocks) if nil != err { @@ -199,4 +205,5 @@ func UpsertBlockRel(avID, blockID string) { logging.LogErrorf("write attribute view blocks failed: %s", err) return } + return } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index eefa76e4a1..9d8f37c3e3 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1603,7 +1603,7 @@ func updateAttributeViewColRelation(operation *Operation) (err error) { } if !isSameAv { err = av.SaveAttributeView(destAv) - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": destAv.ID}) + util.PushReloadAttrView(destAv.ID) } av.UpsertAvBackRel(srcAv.ID, destAv.ID) @@ -2420,7 +2420,7 @@ func removeAttributeViewBlock(srcIDs []string, avID string, tx *Transaction) (er relatedAvIDs := av.GetSrcAvIDs(avID) for _, relatedAvID := range relatedAvIDs { - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": relatedAvID}) + util.PushReloadAttrView(relatedAvID) } err = av.SaveAttributeView(attrView) @@ -2935,7 +2935,7 @@ func RemoveAttributeViewKey(avID, keyID string) (err error) { } av.SaveAttributeView(destAv) - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": destAv.ID}) + util.PushReloadAttrView(destAv.ID) if !destAvRelSrcAv { av.RemoveAvRel(destAv.ID, attrView.ID) @@ -3251,7 +3251,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, relatedAvIDs := av.GetSrcAvIDs(avID) for _, relatedAvID := range relatedAvIDs { - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": relatedAvID}) + util.PushReloadAttrView(relatedAvID) } if err = av.SaveAttributeView(attrView); nil != err { diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 3f3e1ff1df..6747c7c628 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -799,6 +799,7 @@ func (tx *Transaction) doDelete(operation *Operation) (ret *TxErr) { } func removeAvBlockRel(node *ast.Node) { + var avIDs []string ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus { if !entering { return ast.WalkContinue @@ -806,10 +807,16 @@ func removeAvBlockRel(node *ast.Node) { if ast.NodeAttributeView == n.Type { avID := n.AttributeViewID - av.RemoveBlockRel(avID, n.ID) + if changed := av.RemoveBlockRel(avID, n.ID, treenode.ExistBlockTree); changed { + avIDs = append(avIDs, avID) + } } return ast.WalkContinue }) + avIDs = gulu.Str.RemoveDuplicatedElem(avIDs) + for _, avID := range avIDs { + util.PushReloadAttrView(avID) + } } func syncDelete2AttributeView(node *ast.Node) { @@ -854,7 +861,7 @@ func syncDelete2AttributeView(node *ast.Node) { }) for _, avID := range changedAvIDs.Values() { - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": avID}) + util.PushReloadAttrView(avID.(string)) } } @@ -1127,6 +1134,7 @@ func refreshHeadingChildrenUpdated(heading *ast.Node, updated string) { } func upsertAvBlockRel(node *ast.Node) { + var avIDs []string ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus { if !entering { return ast.WalkContinue @@ -1134,10 +1142,16 @@ func upsertAvBlockRel(node *ast.Node) { if ast.NodeAttributeView == n.Type { avID := n.AttributeViewID - av.UpsertBlockRel(avID, n.ID) + if changed := av.UpsertBlockRel(avID, n.ID); changed { + avIDs = append(avIDs, avID) + } } return ast.WalkContinue }) + avIDs = gulu.Str.RemoveDuplicatedElem(avIDs) + for _, avID := range avIDs { + util.PushReloadAttrView(avID) + } } func (tx *Transaction) doUpdateUpdated(operation *Operation) (ret *TxErr) { @@ -1471,7 +1485,7 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m } if changedAv { av.SaveAttributeView(attrView) - util.BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": avID}) + util.PushReloadAttrView(avID) } } } diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go index 823036acc8..03c3ddafd2 100644 --- a/kernel/treenode/blocktree.go +++ b/kernel/treenode/blocktree.go @@ -194,6 +194,19 @@ func GetBlockTreeRootByHPathPreferredParentID(boxID, hPath, preferredParentID st return } +func ExistBlockTree(id string) bool { + hash := btHash(id) + val, ok := blockTrees.Load(hash) + if !ok { + return false + } + slice := val.(*btSlice) + slice.m.Lock() + _, ok = slice.data[id] + slice.m.Unlock() + return ok +} + func GetBlockTree(id string) (ret *BlockTree) { if "" == id { return diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go index 8683157393..2c8bcbf10e 100644 --- a/kernel/util/websocket.go +++ b/kernel/util/websocket.go @@ -216,6 +216,10 @@ func PushClearProgress() { BroadcastByType("main", "cprogress", 0, "", nil) } +func PushReloadAttrView(avID string) { + BroadcastByType("protyle", "refreshAttributeView", 0, "", map[string]interface{}{"id": avID}) +} + func PushReloadDoc(rootID string) { BroadcastByType("main", "reloaddoc", 0, "", rootID) } From 4be13b85184786739cf981c60fd3aa27131f1893 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 21 Apr 2024 19:26:35 +0800 Subject: [PATCH 10/12] :art: Clean code --- kernel/model/attribute_view.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 9d8f37c3e3..c0446d9807 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2649,23 +2649,23 @@ func sortAttributeViewRow(operation *Operation) (err error) { } var rowID string - var index, previousIndex int + var idx, previousIndex int for i, r := range view.Table.RowIDs { if r == operation.ID { rowID = r - index = i + idx = i break } } if "" == rowID { rowID = operation.ID view.Table.RowIDs = append(view.Table.RowIDs, rowID) - index = len(view.Table.RowIDs) - 1 + idx = len(view.Table.RowIDs) - 1 } switch view.LayoutType { case av.LayoutTypeTable: - view.Table.RowIDs = append(view.Table.RowIDs[:index], view.Table.RowIDs[index+1:]...) + view.Table.RowIDs = append(view.Table.RowIDs[:idx], view.Table.RowIDs[idx+1:]...) for i, r := range view.Table.RowIDs { if r == operation.PreviousID { previousIndex = i + 1 From 1a62006e1c268a2642c00fa57368ac7724459466 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 21 Apr 2024 19:37:42 +0800 Subject: [PATCH 11/12] :art: Remove empty code block node from ast https://ld246.com/article/1713689223067 --- kernel/filesys/json_parser.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/filesys/json_parser.go b/kernel/filesys/json_parser.go index 45f8c4bc00..bb536ae26e 100644 --- a/kernel/filesys/json_parser.go +++ b/kernel/filesys/json_parser.go @@ -144,6 +144,21 @@ func genTreeByJSON(node *ast.Node, tree *parse.Tree, idMap *map[string]bool, nee *needFix = true return // 忽略空查询嵌入块 } + case ast.NodeCodeBlock: + if 4 > len(node.Children) { + // https://ld246.com/article/1713689223067 + existCode := false + for _, child := range node.Children { + if ast.NodeCodeBlockCode.String() == child.TypeStr { + existCode = true + break + } + } + if !existCode { + *needFix = true + return // 忽略空代码块 + } + } } fixLegacyData(tree.Context.Tip, node, idMap, needFix, needMigrate2Spec1) From 2a8d5ee3f832fd270e894bd969e0d043b365d1c4 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 21 Apr 2024 19:45:04 +0800 Subject: [PATCH 12/12] :art: Change marketplace install package timeout to 2 minutes https://github.com/siyuan-note/siyuan/issues/11106 --- kernel/bazaar/package.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.go index dafd7b8890..aa9f638415 100644 --- a/kernel/bazaar/package.go +++ b/kernel/bazaar/package.go @@ -554,7 +554,7 @@ func downloadPackage(repoURLHash string, pushProgress bool, systemID string) (da repoURLHash = strings.TrimPrefix(repoURLHash, "https://github.com/") u := util.BazaarOSSServer + "/package/" + repoURLHash buf := &bytes.Buffer{} - resp, err := httpclient.NewBrowserRequest().SetOutput(buf).SetDownloadCallback(func(info req.DownloadInfo) { + resp, err := httpclient.NewCloudFileRequest2m().SetOutput(buf).SetDownloadCallback(func(info req.DownloadInfo) { if pushProgress { progress := float32(info.DownloadedSize) / float32(info.Response.ContentLength) //logging.LogDebugf("downloading bazaar package [%f]", progress)