From d5cd9e671b859a49001df614e78a4e5703e396a3 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 13 Apr 2024 22:38:47 +0800 Subject: [PATCH 01/51] :bug: https://github.com/siyuan-note/siyuan/issues/11015 --- kernel/av/sort.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/av/sort.go b/kernel/av/sort.go index 04d79587b4..37c36aea86 100644 --- a/kernel/av/sort.go +++ b/kernel/av/sort.go @@ -233,8 +233,8 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int { } oContent := strings.TrimSpace(oContentBuf.String()) - v1, ok1 := util.Convert2Float(value.Template.Content) - v2, ok2 := util.Convert2Float(other.Template.Content) + v1, ok1 := util.Convert2Float(vContent) + v2, ok2 := util.Convert2Float(oContent) if ok1 && ok2 { if v1 > v2 { return 1 @@ -262,8 +262,8 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int { } oContent := strings.TrimSpace(oContentBuf.String()) - v1, ok1 := util.Convert2Float(value.Template.Content) - v2, ok2 := util.Convert2Float(other.Template.Content) + v1, ok1 := util.Convert2Float(vContent) + v2, ok2 := util.Convert2Float(oContent) if ok1 && ok2 { if v1 > v2 { return 1 From 4e63228c2da6a51f3b975d53de083322d028c095 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 13 Apr 2024 23:33:40 +0800 Subject: [PATCH 02/51] :bug: https://github.com/siyuan-note/siyuan/issues/11018 --- kernel/model/attribute_view.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 24a177923e..df37a86995 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -3003,6 +3003,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, return } + if "" == val.ID { + // 有时前端会误调用该接口(比如创建完快速切换),这里判断一下,避免误更新刚刚创建的值 + // https://github.com/siyuan-note/siyuan/issues/11018 + return + } + if av.KeyTypeNumber == val.Type { if nil != val.Number && !val.Number.IsNotEmpty { val.Number.Content = 0 From 5c77101271ac0f1cc20a1ec29c98272476d27847 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 13 Apr 2024 23:36:13 +0800 Subject: [PATCH 03/51] :bug: https://github.com/siyuan-note/siyuan/issues/11018 --- kernel/model/attribute_view.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index df37a86995..d3cfdbd71e 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -3005,7 +3005,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, if "" == val.ID { // 有时前端会误调用该接口(比如创建完快速切换),这里判断一下,避免误更新刚刚创建的值 - // https://github.com/siyuan-note/siyuan/issues/11018 + // Primary key value unexpectedly updated when database adds row https://github.com/siyuan-note/siyuan/issues/11018 return } From e8017741d95027c3cc6e4bd3491731144f3afcf2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 14 Apr 2024 08:45:42 +0800 Subject: [PATCH 04/51] =?UTF-8?q?:art:=20=E5=88=9A=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=97=B6=E6=97=A0=20id=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=9C=80?= =?UTF-8?q?=E5=92=8C=20oldValue=20=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/cell.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 5c4ca21cac..c909c551e5 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -554,8 +554,8 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va } const rowID = rowElement.getAttribute("data-id"); - const cellId = item.getAttribute("data-id"); - const colId = item.getAttribute("data-col-id"); + const cellId = item.dataset.id; // 刚创建时无 id,更新需和 oldValue 保持一致 + const colId = item.dataset.colId; text += getCellText(item) + ((cellElements[elementIndex + 1] && item.nextElementSibling && item.nextElementSibling.isSameNode(cellElements[elementIndex + 1])) ? "\t" : "\n\n"); const oldValue = genCellValueByElement(type, item); From 20fb74c8d744067b8c8315847e9170194acbbd11 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 09:01:22 +0800 Subject: [PATCH 05/51] :bug: Database date field between filter calculation error Fix https://github.com/siyuan-note/siyuan/issues/10979 --- kernel/av/filter.go | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/kernel/av/filter.go b/kernel/av/filter.go index 2517038bbf..8ad9ec0e0a 100644 --- a/kernel/av/filter.go +++ b/kernel/av/filter.go @@ -55,7 +55,7 @@ const ( type RelativeDate struct { Count int `json:"count"` // 数量 Unit RelativeDateUnit `json:"unit"` // 单位:0 天、1 周、2 月、3 年 - Direction RelativeDateDirection `json:"direction"` // 方向:-1 前、0 这、1 后 + Direction RelativeDateDirection `json:"direction"` // 方向:-1 前、0 当前、1 后 } type FilterOperator string @@ -571,19 +571,19 @@ func calcRelativeTimeRegion(count int, unit RelativeDateUnit, direction Relative case RelativeDateUnitDay: switch direction { case RelativeDateDirectionBefore: - // 结束时间使用今天的开始时间 + // 结束时间:今天的 0 点 end = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) - // 开始时间使用结束时间减去 count 天 + // 开始时间:结束时间减去 count 天 start = end.AddDate(0, 0, -count) case RelativeDateDirectionThis: - // 开始时间使用今天的开始时间 + // 开始时间:今天的 0 点 start = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) - // 结束时间使用开始时间加上 count 天 - end = start.AddDate(0, 0, count) + // 结束时间:今天的 23:59:59.999999999 + end = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999999999, now.Location()) case RelativeDateDirectionAfter: - // 开始时间使用今天的结束时间 + // 开始时间:今天的 23:59:59.999999999 start = time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999999999, now.Location()) - // 结束时间使用开始时间加上 count 天 + // 结束时间:开始时间加上 count 天 end = start.AddDate(0, 0, count) } case RelativeDateUnitWeek: @@ -593,55 +593,55 @@ func calcRelativeTimeRegion(count int, unit RelativeDateUnit, direction Relative } switch direction { case RelativeDateDirectionBefore: - // 结束时间使用本周的开始时间 - end = time.Date(now.Year(), now.Month(), now.Day()-weekday, 0, 0, 0, 0, now.Location()) - // 开始时间使用结束时间减去 count*7 天 + // 结束时间:本周的周一 + end = time.Date(now.Year(), now.Month(), now.Day()-weekday+1, 0, 0, 0, 0, now.Location()) + // 开始时间:结束时间减去 count*7 天 start = end.AddDate(0, 0, -count*7) case RelativeDateDirectionThis: - // 开始时间使用本周的开始时间 - start = time.Date(now.Year(), now.Month(), now.Day()-weekday, 0, 0, 0, 0, now.Location()) - // 结束时间使用开始时间加上 count*7 天 - end = start.AddDate(0, 0, count*7) + // 开始时间:本周的周一 + start = time.Date(now.Year(), now.Month(), now.Day()-weekday+1, 0, 0, 0, 0, now.Location()) + // 结束时间:本周的周日 + end = time.Date(now.Year(), now.Month(), now.Day()-weekday+7, 23, 59, 59, 999999999, now.Location()) case RelativeDateDirectionAfter: - // 开始时间使用本周的结束时间 + // 开始时间:本周的周日 start = time.Date(now.Year(), now.Month(), now.Day()-weekday+7, 23, 59, 59, 999999999, now.Location()) - // 结束时间使用开始时间加上 count*7 天 + // 结束时间:开始时间加上 count*7 天 end = start.AddDate(0, 0, count*7) } case RelativeDateUnitMonth: switch direction { case RelativeDateDirectionBefore: - // 结束时间使用本月的开始时间 + // 结束时间:本月的 1 号 end = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()) - // 开始时间使用结束时间减去 count 个月 + // 开始时间:结束时间减去 count 个月 start = end.AddDate(0, -count, 0) case RelativeDateDirectionThis: - // 开始时间使用本月的开始时间 + // 开始时间:本月的 1 号 start = time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location()) - // 结束时间使用开始时间加上 count 个月 - end = start.AddDate(0, count, 0) + // 结束时间:下个月的 1 号减去 1 纳秒 + end = time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) case RelativeDateDirectionAfter: - // 开始时间使用本月的结束时间 + // 开始时间:下个月的 1 号减去 1 纳秒 start = time.Date(now.Year(), now.Month()+1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) - // 结束时间使用开始时间加上 count 个月 + // 结束时间:开始时间加上 count 个月 end = start.AddDate(0, count, 0) } case RelativeDateUnitYear: switch direction { case RelativeDateDirectionBefore: - // 结束时间使用今年的开始时间 + // 结束时间:今年的 1 月 1 号 end = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, now.Location()) - // 开始时间使用结束时间减去 count 年 + // 开始时间:结束时间减去 count 年 start = end.AddDate(-count, 0, 0) case RelativeDateDirectionThis: - // 开始时间使用今年的开始时间 + // 开始时间:今年的 1 月 1 号 start = time.Date(now.Year(), 1, 1, 0, 0, 0, 0, now.Location()) - // 结束时间使用开始时间加上 count 年 - end = start.AddDate(count, 0, 0) + // 结束时间:明年的 1 月 1 号减去 1 纳秒 + end = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) case RelativeDateDirectionAfter: - // 开始时间使用今年的结束时间 - start = time.Date(now.Year()+1, 1, 1, 0, 0, 0, 0, now.Location()).Add(-time.Nanosecond) - // 结束时间使用开始时间加上 count 年 + // 开始时间:今年的 12 月 31 号 + start = time.Date(now.Year(), 12, 31, 23, 59, 59, 999999999, now.Location()) + // 结束时间:开始时间加上 count 年 end = start.AddDate(count, 0, 0) } } From bc8b2957338603911ba65343e306f04c2b373a06 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 09:51:54 +0800 Subject: [PATCH 06/51] :bug: Primary key value unexpectedly updated when database adds row https://github.com/siyuan-note/siyuan/issues/11018 --- kernel/av/av.go | 6 ++++++ kernel/model/attribute_view.go | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/av/av.go b/kernel/av/av.go index 0120effb15..9713035d46 100644 --- a/kernel/av/av.go +++ b/kernel/av/av.go @@ -340,6 +340,7 @@ func SaveAttributeView(av *AttributeView) (err error) { // 补全 block 的创建时间和更新时间 for _, v := range kv.Values { if 0 == v.Block.Created { + logging.LogWarnf("block [%s] created time is empty", v.BlockID) if "" == v.Block.ID { v.Block.ID = v.BlockID if "" == v.Block.ID { @@ -357,6 +358,7 @@ func SaveAttributeView(av *AttributeView) (err error) { } } if 0 == v.Block.Updated { + logging.LogWarnf("block [%s] updated time is empty", v.BlockID) v.Block.Updated = v.Block.Created } } @@ -375,6 +377,7 @@ func SaveAttributeView(av *AttributeView) (err error) { val.KeyID = kv.Key.ID } if "" == v.KeyID { + logging.LogWarnf("value [%s] key id is empty", v.ID) v.KeyID = kv.Key.ID } @@ -417,10 +420,12 @@ func SaveAttributeView(av *AttributeView) (err error) { // 补全值的创建时间和更新时间 if "" == v.ID { + logging.LogWarnf("value id is empty") v.ID = ast.NewNodeID() } if 0 == v.CreatedAt { + logging.LogWarnf("value [%s] created time is empty", v.ID) createdStr := v.ID[:len("20060102150405")] created, parseErr := time.ParseInLocation("20060102150405", createdStr, time.Local) if nil == parseErr { @@ -431,6 +436,7 @@ func SaveAttributeView(av *AttributeView) (err error) { } if 0 == v.UpdatedAt { + logging.LogWarnf("value [%s] updated time is empty", v.ID) v.UpdatedAt = v.CreatedAt } } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index d3cfdbd71e..b34ff39778 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2971,7 +2971,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, } for _, value := range keyValues.Values { - if cellID == value.ID { + if cellID == value.ID || rowID == value.BlockID { val = value val.Type = keyValues.Key.Type break @@ -3003,12 +3003,6 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string, return } - if "" == val.ID { - // 有时前端会误调用该接口(比如创建完快速切换),这里判断一下,避免误更新刚刚创建的值 - // Primary key value unexpectedly updated when database adds row https://github.com/siyuan-note/siyuan/issues/11018 - return - } - if av.KeyTypeNumber == val.Type { if nil != val.Number && !val.Number.IsNotEmpty { val.Number.Content = 0 From 3a798c4533dc83015e414f36d6cf1ba737b9f59b Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 10:00:08 +0800 Subject: [PATCH 07/51] :art: https://github.com/siyuan-note/siyuan/issues/11013 --- kernel/model/attribute_view.go | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index b34ff39778..d7bcd69183 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2129,7 +2129,6 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string, blockValue.IsDetached = isDetached blockValue.Block.Content = content blockValue.UpdatedAt = now - util.PushMsg(Conf.language(242), 3000) err = av.SaveAttributeView(attrView) } return From 640abbf87f85edbac910e602bbf9979274433b1e Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 14 Apr 2024 11:11:18 +0800 Subject: [PATCH 08/51] :art: fix https://github.com/siyuan-note/siyuan/issues/11028 --- app/src/protyle/gutter/index.ts | 7 ++++++- app/src/protyle/wysiwyg/transaction.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index fc2efd0f2a..84f368bdfd 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -49,6 +49,7 @@ import {insertAttrViewBlockAnimation} from "../render/av/row"; import {avContextmenu} from "../render/av/action"; import {openSearchAV} from "../render/av/relation"; import {getPlainText} from "../util/paste"; +import {Menu} from "../../plugin/Menu"; export class Gutter { public element: HTMLElement; @@ -64,6 +65,7 @@ export class Gutter { this.element.className = "protyle-gutters"; this.element.addEventListener("dragstart", (event: DragEvent & { target: HTMLElement }) => { hideTooltip(); + window.siyuan.menus.menu.remove(); const buttonElement = event.target.parentElement; let selectIds: string[] = []; let selectElements: Element[] = []; @@ -925,7 +927,10 @@ export class Gutter { return; } hideElements(["util", "toolbar", "hint"], protyle); - window.siyuan.menus.menu.remove(); + const menu = new Menu("gutter"); + if (menu.isOpen) { + return; + } if (isMobile()) { activeBlur(); } diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 0e7d443c42..7994fc931c 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -191,6 +191,7 @@ const promiseTransaction = () => { blockRender(protyle, item); } }); + hideElements(["gutter"], protyle); return; } if (operation.action === "move") { From 02415b8e9010b94f841ab8bfb55dae763c903ae3 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 14 Apr 2024 12:13:15 +0800 Subject: [PATCH 09/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10932 --- app/src/protyle/render/av/filter.ts | 132 ++++++++++++++------- app/src/protyle/render/av/openMenuPanel.ts | 1 + app/src/protyle/render/av/select.ts | 5 +- 3 files changed, 91 insertions(+), 47 deletions(-) diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index 7d7d563adf..929cfad739 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -10,6 +10,7 @@ import {unicode2Emoji} from "../../../emoji"; import {openMenuPanel} from "./openMenuPanel"; import {fetchSyncPost} from "../../../util/fetch"; import {showMessage} from "../../../dialog/message"; +import {upDownHint} from "../../../util/upDownHint"; export const getDefaultOperatorByType = (type: TAVCol) => { if (["select", "number", "date", "created", "updated"].includes(type)) { @@ -54,6 +55,20 @@ const toggleEmpty = (element: HTMLElement, operator: string, type: TAVCol) => { } }; +const filterSelect = (key: string) => { + window.siyuan.menus.menu.element.querySelectorAll(".b3-menu__item").forEach((item) => { + const nameElement = item.querySelector(".b3-chip.b3-chip--middle") as HTMLElement + if (nameElement) { + const itemName = nameElement.dataset.name.toLowerCase() + if (!key || (key.indexOf(itemName) > -1 || itemName.indexOf(key) > -1)) { + item.classList.remove("fn__none"); + } else { + item.classList.add("fn__none"); + } + } + }) +} + export const setFilter = async (options: { filter: IAVFilter, protyle: IProtyle, @@ -81,38 +96,7 @@ export const setFilter = async (options: { }; let hasMatch = false; let newValue; - if (textElements.length > 0) { - if (["date", "updated", "created"].includes(filterValue.type)) { - const typeElement = menu.element.querySelector('.b3-select[data-type="dateType"]') as HTMLSelectElement; - const directElements = menu.element.querySelectorAll('.b3-select[data-type="dataDirection"]') as NodeListOf; - if (typeElement.value === "custom") { - newFilter.relativeDate = { - count: parseInt((directElements[0].parentElement.querySelector(".b3-text-field") as HTMLInputElement).value || "1"), - unit: parseInt((directElements[0].parentElement.lastElementChild as HTMLSelectElement).value), - direction: parseInt(directElements[0].value) - }; - newFilter.relativeDate2 = { - count: parseInt((directElements[1].parentElement.querySelector(".b3-text-field") as HTMLInputElement).value || "1"), - unit: parseInt((directElements[1].parentElement.lastElementChild as HTMLSelectElement).value), - direction: parseInt(directElements[1].value) - }; - newValue = {type: filterValue.type}; - } else { - newValue = genCellValue(filterValue.type, { - isNotEmpty2: textElements[2].value !== "", - isNotEmpty: textElements[0].value !== "", - content: textElements[0].value ? new Date(textElements[0].value + " 00:00").getTime() : null, - content2: textElements[2].value ? new Date(textElements[2].value + " 00:00").getTime() : null, - hasEndDate: newFilter.operator === "Is between", - isNotTime: true, - }); - newFilter.relativeDate = null; - newFilter.relativeDate2 = null; - } - } else { - newValue = genCellValue(filterValue.type, textElements[0].value); - } - } else if (filterValue.type === "select" || filterValue.type === "mSelect") { + if (filterValue.type === "select" || filterValue.type === "mSelect") { const mSelect: { color: string, content: string @@ -127,6 +111,35 @@ export const setFilter = async (options: { } }); newValue = genCellValue(filterValue.type, mSelect); + } else if (["date", "updated", "created"].includes(filterValue.type)) { + const typeElement = menu.element.querySelector('.b3-select[data-type="dateType"]') as HTMLSelectElement; + const directElements = menu.element.querySelectorAll('.b3-select[data-type="dataDirection"]') as NodeListOf; + if (typeElement.value === "custom") { + newFilter.relativeDate = { + count: parseInt((directElements[0].parentElement.querySelector(".b3-text-field") as HTMLInputElement).value || "1"), + unit: parseInt((directElements[0].parentElement.lastElementChild as HTMLSelectElement).value), + direction: parseInt(directElements[0].value) + }; + newFilter.relativeDate2 = { + count: parseInt((directElements[1].parentElement.querySelector(".b3-text-field") as HTMLInputElement).value || "1"), + unit: parseInt((directElements[1].parentElement.lastElementChild as HTMLSelectElement).value), + direction: parseInt(directElements[1].value) + }; + newValue = {type: filterValue.type}; + } else { + newValue = genCellValue(filterValue.type, { + isNotEmpty2: textElements[2].value !== "", + isNotEmpty: textElements[0].value !== "", + content: textElements[0].value ? new Date(textElements[0].value + " 00:00").getTime() : null, + content2: textElements[2].value ? new Date(textElements[2].value + " 00:00").getTime() : null, + hasEndDate: newFilter.operator === "Is between", + isNotTime: true, + }); + newFilter.relativeDate = null; + newFilter.relativeDate2 = null; + } + } else if (["text", "url", "block", "email", "phone", "template", "relation", "number"].includes(filterValue.type)) { + newValue = genCellValue(filterValue.type, textElements[0].value); } else if (filterValue.type === "checkbox") { newValue = genCellValue(filterValue.type, { checked: newFilter.operator === "Is true" @@ -313,6 +326,37 @@ export const setFilter = async (options: { label: `` }); if (filterValue.type === "select" || filterValue.type === "mSelect") { + if (colData.options?.length > 0) { + menu.addItem({ + iconHTML: "", + type: "readonly", + label: ``, + bind(element) { + const selectSearchElement = element.querySelector("input") + selectSearchElement.addEventListener("keydown", (event: KeyboardEvent) => { + if (event.isComposing) { + return; + } + let currentElement = upDownHint(menu.element.querySelector(".b3-menu__items"), event, "b3-menu__item--current", element.nextElementSibling); + if (event.key === "Enter") { + if (!currentElement) { + currentElement = menu.element.querySelector(".b3-menu__item--current"); + } + currentElement.dispatchEvent(new CustomEvent("click")); + } + }) + selectSearchElement.addEventListener("input", (event: InputEvent) => { + if (event.isComposing) { + return; + } + filterSelect(selectSearchElement.value.toLowerCase()); + }) + selectSearchElement.addEventListener("compositionend", () => { + filterSelect(selectSearchElement.value.toLowerCase()); + }) + } + }) + } colData.options?.forEach((option) => { let icon = "iconUncheck"; filterValue?.mSelect?.find((optionItem: IAVCellSelectValue) => { @@ -483,18 +527,20 @@ export const setFilter = async (options: { }); const textElements: NodeListOf = menu.element.querySelectorAll(".b3-text-field"); - textElements.forEach(item => { - item.addEventListener("keydown", (event: KeyboardEvent) => { - if (event.isComposing) { - event.preventDefault(); - return; - } - if (event.key === "Enter") { - menu.close(); - event.preventDefault(); - } + if (filterValue.type !== "select" && filterValue.type !== "mSelect") { + textElements.forEach(item => { + item.addEventListener("keydown", (event: KeyboardEvent) => { + if (event.isComposing) { + event.preventDefault(); + return; + } + if (event.key === "Enter") { + menu.close(); + event.preventDefault(); + } + }); }); - }); + } toggleEmpty(selectElement, selectElement.value, filterValue.type); menu.open({x: rectTarget.left, y: rectTarget.bottom}); if (textElements.length > 0) { diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index fd02eac68e..819382aa9b 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -583,6 +583,7 @@ export const openMenuPanel = (options: { data.view.filters = []; menuElement.innerHTML = getFiltersHTML(data.view); setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height); + window.siyuan.menus.menu.remove(); event.preventDefault(); event.stopPropagation(); break; diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index 57fb025c83..b2bb40069d 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -405,10 +405,7 @@ export const bindSelectEvent = (protyle: IProtyle, data: IAV, menuElement: HTMLE } listElement.innerHTML = filterSelectHTML(inputElement.value, colData.options); }); - inputElement.addEventListener("compositionend", (event: InputEvent) => { - if (event.isComposing) { - return; - } + inputElement.addEventListener("compositionend", () => { listElement.innerHTML = filterSelectHTML(inputElement.value, colData.options); }); inputElement.addEventListener("keydown", (event: KeyboardEvent) => { From bf4ad0972b9d1c1e9e212c5464106aac5e927987 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 12:34:06 +0800 Subject: [PATCH 10/51] :art: Improve database sort/calc for relation and rollup --- kernel/av/sort.go | 61 ++++++++++++++++++---------------- kernel/av/table.go | 16 ++++----- kernel/av/value.go | 23 +++++++------ kernel/model/attribute_view.go | 6 ++-- kernel/model/export.go | 4 +-- kernel/treenode/node.go | 4 +-- 6 files changed, 60 insertions(+), 54 deletions(-) diff --git a/kernel/av/sort.go b/kernel/av/sort.go index 37c36aea86..bef5378655 100644 --- a/kernel/av/sort.go +++ b/kernel/av/sort.go @@ -220,59 +220,62 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int { } case KeyTypeRelation: if nil != value.Relation && nil != other.Relation { + if 1 < len(value.Relation.Contents) && 1 < len(other.Relation.Contents) && KeyTypeNumber == value.Relation.Contents[0].Type && KeyTypeNumber == other.Relation.Contents[0].Type { + v1, ok1 := util.Convert2Float(value.Relation.Contents[0].String(false)) + v2, ok2 := util.Convert2Float(other.Relation.Contents[0].String(false)) + if ok1 && ok2 { + if v1 > v2 { + return 1 + } + if v1 < v2 { + return -1 + } + return 0 + } + } + vContentBuf := bytes.Buffer{} for _, c := range value.Relation.Contents { - vContentBuf.WriteString(c.String()) + vContentBuf.WriteString(c.String(true)) vContentBuf.WriteByte(' ') } vContent := strings.TrimSpace(vContentBuf.String()) oContentBuf := bytes.Buffer{} for _, c := range other.Relation.Contents { - oContentBuf.WriteString(c.String()) + oContentBuf.WriteString(c.String(true)) oContentBuf.WriteByte(' ') } oContent := strings.TrimSpace(oContentBuf.String()) - - v1, ok1 := util.Convert2Float(vContent) - v2, ok2 := util.Convert2Float(oContent) - if ok1 && ok2 { - if v1 > v2 { - return 1 - } - - if v1 < v2 { - return -1 - } - return 0 - } return strings.Compare(vContent, oContent) } case KeyTypeRollup: if nil != value.Rollup && nil != other.Rollup { + if 1 < len(value.Rollup.Contents) && 1 < len(other.Rollup.Contents) && KeyTypeNumber == value.Rollup.Contents[0].Type && KeyTypeNumber == other.Rollup.Contents[0].Type { + v1, ok1 := util.Convert2Float(value.Rollup.Contents[0].String(false)) + v2, ok2 := util.Convert2Float(other.Rollup.Contents[0].String(false)) + if ok1 && ok2 { + if v1 > v2 { + return 1 + } + if v1 < v2 { + return -1 + } + return 0 + } + } + vContentBuf := bytes.Buffer{} for _, c := range value.Rollup.Contents { - vContentBuf.WriteString(c.String()) + vContentBuf.WriteString(c.String(true)) vContentBuf.WriteByte(' ') } vContent := strings.TrimSpace(vContentBuf.String()) oContentBuf := bytes.Buffer{} for _, c := range other.Rollup.Contents { - oContentBuf.WriteString(c.String()) + oContentBuf.WriteString(c.String(true)) oContentBuf.WriteByte(' ') } oContent := strings.TrimSpace(oContentBuf.String()) - - v1, ok1 := util.Convert2Float(vContent) - v2, ok2 := util.Convert2Float(oContent) - if ok1 && ok2 { - if v1 > v2 { - return 1 - } - if v1 < v2 { - return -1 - } - return 0 - } return strings.Compare(vContent, oContent) } } diff --git a/kernel/av/table.go b/kernel/av/table.go index ec7264fcb1..fb7afc8497 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -1586,8 +1586,8 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - if !uniqueValues[content.String()] { - uniqueValues[content.String()] = true + if !uniqueValues[content.String(true)] { + uniqueValues[content.String(true)] = true countUniqueValues++ } } @@ -1635,7 +1635,7 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup && 0 < len(row.Cells[colIndex].Value.Rollup.Contents) { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - val, _ := util.Convert2Float(content.String()) + val, _ := util.Convert2Float(content.String(false)) sum += val } } @@ -1647,7 +1647,7 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup && 0 < len(row.Cells[colIndex].Value.Rollup.Contents) { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - val, _ := util.Convert2Float(content.String()) + val, _ := util.Convert2Float(content.String(false)) sum += val count++ } @@ -1661,7 +1661,7 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup && 0 < len(row.Cells[colIndex].Value.Rollup.Contents) { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - val, _ := util.Convert2Float(content.String()) + val, _ := util.Convert2Float(content.String(false)) values = append(values, val) } } @@ -1679,7 +1679,7 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup && 0 < len(row.Cells[colIndex].Value.Rollup.Contents) { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - val, _ := util.Convert2Float(content.String()) + val, _ := util.Convert2Float(content.String(false)) if val < minVal { minVal = val } @@ -1694,7 +1694,7 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup && 0 < len(row.Cells[colIndex].Value.Rollup.Contents) { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - val, _ := util.Convert2Float(content.String()) + val, _ := util.Convert2Float(content.String(false)) if val > maxVal { maxVal = val } @@ -1710,7 +1710,7 @@ func (table *Table) calcColRollup(col *TableColumn, colIndex int) { for _, row := range table.Rows { if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.Rollup && 0 < len(row.Cells[colIndex].Value.Rollup.Contents) { for _, content := range row.Cells[colIndex].Value.Rollup.Contents { - val, _ := util.Convert2Float(content.String()) + val, _ := util.Convert2Float(content.String(false)) if val < minVal { minVal = val } diff --git a/kernel/av/value.go b/kernel/av/value.go index 0a2728d5c0..5b188eedd3 100644 --- a/kernel/av/value.go +++ b/kernel/av/value.go @@ -64,7 +64,7 @@ func (value *Value) SetUpdatedAt(mills int64) { } } -func (value *Value) String() string { +func (value *Value) String(format bool) string { if nil == value { return "" } @@ -84,7 +84,10 @@ func (value *Value) String() string { if nil == value.Number { return "" } - return value.Number.FormattedContent + if format { + return value.Number.FormattedContent + } + return fmt.Sprintf("%f", value.Number.Content) case KeyTypeDate: if nil == value.Date { return "" @@ -158,7 +161,7 @@ func (value *Value) String() string { } var ret []string for _, v := range value.Relation.Contents { - ret = append(ret, v.String()) + ret = append(ret, v.String(format)) } return strings.TrimSpace(strings.Join(ret, ", ")) case KeyTypeRollup: @@ -167,7 +170,7 @@ func (value *Value) String() string { } var ret []string for _, v := range value.Rollup.Contents { - ret = append(ret, v.String()) + ret = append(ret, v.String(format)) } return strings.TrimSpace(strings.Join(ret, ", ")) default: @@ -679,8 +682,8 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) { countUniqueValues := 0 uniqueValues := map[string]bool{} for _, v := range r.Contents { - if _, ok := uniqueValues[v.String()]; !ok { - uniqueValues[v.String()] = true + if _, ok := uniqueValues[v.String(true)]; !ok { + uniqueValues[v.String(true)] = true countUniqueValues++ } } @@ -688,7 +691,7 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) { case CalcOperatorCountEmpty: countEmpty := 0 for _, v := range r.Contents { - if "" == v.String() { + if "" == v.String(true) { countEmpty++ } } @@ -696,7 +699,7 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) { case CalcOperatorCountNotEmpty: countNonEmpty := 0 for _, v := range r.Contents { - if "" != v.String() { + if "" != v.String(true) { countNonEmpty++ } } @@ -704,7 +707,7 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) { case CalcOperatorPercentEmpty: countEmpty := 0 for _, v := range r.Contents { - if "" == v.String() { + if "" == v.String(true) { countEmpty++ } } @@ -714,7 +717,7 @@ func (r *ValueRollup) RenderContents(calc *RollupCalc, destKey *Key) { case CalcOperatorPercentNotEmpty: countNonEmpty := 0 for _, v := range r.Contents { - if "" != v.String() { + if "" != v.String(true) { countNonEmpty++ } } diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index d7bcd69183..d0731f4172 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -89,7 +89,7 @@ func GetAttributeViewPrimaryKeyValues(avID, keyword string, page, pageSize int) } keyValues.Values = []*av.Value{} for _, v := range tmp { - if strings.Contains(strings.ToLower(v.String()), strings.ToLower(keyword)) { + if strings.Contains(strings.ToLower(v.String(true)), strings.ToLower(keyword)) { keyValues.Values = append(keyValues.Values, v) } } @@ -912,7 +912,7 @@ func renderTemplateCol(ial map[string]string, flashcard *Flashcard, rowValues [] dataModel[rowValue.Key.Name] = v.Rollup.Contents[0].Number.Content } } else { - dataModel[rowValue.Key.Name] = v.String() + dataModel[rowValue.Key.Name] = v.String(true) } } } @@ -1218,7 +1218,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s hit := false for _, cell := range row.Cells { for _, keyword := range keywords { - if strings.Contains(strings.ToLower(cell.Value.String()), strings.ToLower(keyword)) { + if strings.Contains(strings.ToLower(cell.Value.String(true)), strings.ToLower(keyword)) { hit = true break } diff --git a/kernel/model/export.go b/kernel/model/export.go index f3012adfe2..c86f9165b8 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -148,7 +148,7 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) { } } - val = cell.Value.String() + val = cell.Value.String(true) } rowVal = append(rowVal, val) @@ -2335,7 +2335,7 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros, keepFold bool, } } - val = cell.Value.String() + val = cell.Value.String(true) } mdTableCell.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(val)}) } diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go index 91b31af858..810b978c9a 100644 --- a/kernel/treenode/node.go +++ b/kernel/treenode/node.go @@ -598,7 +598,7 @@ func getAttributeViewContent(avID string) (content string) { if nil == cell.Value { continue } - buf.WriteString(cell.Value.String()) + buf.WriteString(cell.Value.String(true)) buf.WriteByte(' ') } } @@ -1055,7 +1055,7 @@ func renderTemplateCol(ial map[string]string, rowValues []*av.KeyValues, tplCont dataModel[rowValue.Key.Name] = v.Rollup.Contents[0].Number.Content } } else { - dataModel[rowValue.Key.Name] = v.String() + dataModel[rowValue.Key.Name] = v.String(true) } } } From 077944bb43786db5e5dd0a79045b8d8f7428b36a Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 13:02:06 +0800 Subject: [PATCH 11/51] :art: Improve database template field to use relation/rollup field Fix https://github.com/siyuan-note/siyuan/issues/11029 --- kernel/model/attribute_view.go | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index d0731f4172..17051cb596 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -905,11 +905,30 @@ func renderTemplateCol(ial map[string]string, flashcard *Flashcard, rowValues [] dataModel[rowValue.Key.Name] = time.UnixMilli(v.Date.Content) } } else if av.KeyTypeRollup == v.Type { - if 0 < len(v.Rollup.Contents) && av.KeyTypeNumber == v.Rollup.Contents[0].Type { - // 模板使用汇总时支持数字计算 - // Template supports numerical calculations when using rollup https://github.com/siyuan-note/siyuan/issues/10810 - // 汇总数字时仅取第一个数字填充模板 - dataModel[rowValue.Key.Name] = v.Rollup.Contents[0].Number.Content + if 0 < len(v.Rollup.Contents) { + var numbers []float64 + var contents []string + for _, content := range v.Rollup.Contents { + if av.KeyTypeNumber == content.Type { + numbers = append(numbers, content.Number.Content) + } else { + contents = append(contents, content.String(true)) + } + } + + if 0 < len(numbers) { + dataModel[rowValue.Key.Name] = numbers + } else { + dataModel[rowValue.Key.Name] = contents + } + } + } else if av.KeyTypeRelation == v.Type { + if 0 < len(v.Relation.Contents) { + var contents []string + for _, content := range v.Relation.Contents { + contents = append(contents, content.String(true)) + } + dataModel[rowValue.Key.Name] = contents } } else { dataModel[rowValue.Key.Name] = v.String(true) From 1ae39777a6755f33ee16b6521f746a0221a8296f Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 21:26:02 +0800 Subject: [PATCH 12/51] :art: Improve database template field to use relation/rollup field Fix https://github.com/siyuan-note/siyuan/issues/11029 --- kernel/treenode/node.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/kernel/treenode/node.go b/kernel/treenode/node.go index 810b978c9a..db65da824e 100644 --- a/kernel/treenode/node.go +++ b/kernel/treenode/node.go @@ -1050,9 +1050,30 @@ func renderTemplateCol(ial map[string]string, rowValues []*av.KeyValues, tplCont dataModel[rowValue.Key.Name] = time.UnixMilli(v.Date.Content) } } else if av.KeyTypeRollup == v.Type { - if 0 < len(v.Rollup.Contents) && av.KeyTypeNumber == v.Rollup.Contents[0].Type { - // 汇总数字时仅取第一个数字填充模板 - dataModel[rowValue.Key.Name] = v.Rollup.Contents[0].Number.Content + if 0 < len(v.Rollup.Contents) { + var numbers []float64 + var contents []string + for _, content := range v.Rollup.Contents { + if av.KeyTypeNumber == content.Type { + numbers = append(numbers, content.Number.Content) + } else { + contents = append(contents, content.String(true)) + } + } + + if 0 < len(numbers) { + dataModel[rowValue.Key.Name] = numbers + } else { + dataModel[rowValue.Key.Name] = contents + } + } + } else if av.KeyTypeRelation == v.Type { + if 0 < len(v.Relation.Contents) { + var contents []string + for _, content := range v.Relation.Contents { + contents = append(contents, content.String(true)) + } + dataModel[rowValue.Key.Name] = contents } } else { dataModel[rowValue.Key.Name] = v.String(true) From 16c665bfa738efd9af8686efb5c98f2d85504d6b Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 22:16:46 +0800 Subject: [PATCH 13/51] :art: `tree not found` appears when rebuilding index https://github.com/siyuan-note/siyuan/issues/11036 --- kernel/model/box.go | 5 +++-- kernel/model/tree.go | 4 ++-- kernel/task/queue.go | 12 ++++-------- kernel/treenode/blocktree.go | 7 +++++++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/kernel/model/box.go b/kernel/model/box.go index 450d9014b9..8b2ad4d455 100644 --- a/kernel/model/box.go +++ b/kernel/model/box.go @@ -506,14 +506,15 @@ func FullReindex() { } func fullReindex() { - util.PushMsg(Conf.Language(35), 7*1000) + util.PushEndlessProgress(Conf.language(35)) + defer util.PushClearProgress() + WaitForWritingFiles() if err := sql.InitDatabase(true); nil != err { os.Exit(logging.ExitCodeReadOnlyDatabase) return } - treenode.InitBlockTree(true) sql.IndexIgnoreCached = false openedBoxes := Conf.GetOpenedBoxes() diff --git a/kernel/model/tree.go b/kernel/model/tree.go index db9d62d1d0..a83e09a066 100644 --- a/kernel/model/tree.go +++ b/kernel/model/tree.go @@ -162,7 +162,7 @@ func LoadTreeByBlockIDWithReindex(id string) (ret *parse.Tree, err error) { bt := treenode.GetBlockTree(id) if nil == bt { - if task.Contain(task.DatabaseIndex, task.DatabaseIndexFull) { + if task.ContainIndexTask() { err = ErrIndexing return } @@ -187,7 +187,7 @@ func LoadTreeByBlockID(id string) (ret *parse.Tree, err error) { bt := treenode.GetBlockTree(id) if nil == bt { - if task.Contain(task.DatabaseIndex, task.DatabaseIndexFull) { + if task.ContainIndexTask() { err = ErrIndexing return } diff --git a/kernel/task/queue.go b/kernel/task/queue.go index 4eba696ba5..2baf64609e 100644 --- a/kernel/task/queue.go +++ b/kernel/task/queue.go @@ -115,17 +115,13 @@ var uniqueActions = []string{ AssetContentDatabaseIndexCommit, } -func Contain(action string, moreActions ...string) bool { - actions := append(moreActions, action) - actions = gulu.Str.RemoveDuplicatedElem(actions) - - queueLock.Lock() - for _, task := range taskQueue { - if gulu.Str.Contains(task.Action, actions) { +func ContainIndexTask() bool { + actions := getCurrentActions() + for _, action := range actions { + if gulu.Str.Contains(action, []string{DatabaseIndexFull, DatabaseIndex}) { return true } } - queueLock.Unlock() return false } diff --git a/kernel/treenode/blocktree.go b/kernel/treenode/blocktree.go index 536a141c5f..823036acc8 100644 --- a/kernel/treenode/blocktree.go +++ b/kernel/treenode/blocktree.go @@ -31,6 +31,7 @@ import ( "github.com/panjf2000/ants/v2" util2 "github.com/siyuan-note/dejavu/util" "github.com/siyuan-note/logging" + "github.com/siyuan-note/siyuan/kernel/task" "github.com/siyuan-note/siyuan/kernel/util" "github.com/vmihailenco/msgpack/v5" ) @@ -504,6 +505,12 @@ func SaveBlockTree(force bool) { blockTreeLock.Lock() defer blockTreeLock.Unlock() + if task.ContainIndexTask() { + //logging.LogInfof("skip saving block tree because indexing") + return + } + //logging.LogInfof("saving block tree") + start := time.Now() if err := os.MkdirAll(util.BlockTreePath, 0755); nil != err { logging.LogErrorf("create block tree dir [%s] failed: %s", util.BlockTreePath, err) From afeea6a80e841efb3b848cc6992a04cf1cdbb6fb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 14 Apr 2024 23:52:09 +0800 Subject: [PATCH 14/51] :art: Improve marketplace loading performance https://github.com/siyuan-note/siyuan/issues/10973 https://github.com/siyuan-note/siyuan/issues/11007 --- kernel/bazaar/icon.go | 10 ++-------- kernel/bazaar/package.go | 22 +++++++++++++++++++++- kernel/bazaar/plugin.go | 11 ++--------- kernel/bazaar/template.go | 10 ++-------- kernel/bazaar/theme.go | 10 ++-------- kernel/bazaar/widget.go | 11 ++--------- kernel/model/bazzar.go | 29 +++++++++++------------------ 7 files changed, 42 insertions(+), 61 deletions(-) diff --git a/kernel/bazaar/icon.go b/kernel/bazaar/icon.go index 94c669d519..3e1cab908f 100644 --- a/kernel/bazaar/icon.go +++ b/kernel/bazaar/icon.go @@ -17,7 +17,6 @@ package bazaar import ( - "errors" "os" "path/filepath" "sort" @@ -184,14 +183,9 @@ func InstallIcon(repoURL, repoHash, installPath string, systemID string) error { if nil != err { return err } - return installPackage(data, installPath) + return installPackage(data, installPath, repoURLHash) } func UninstallIcon(installPath string) error { - if err := os.RemoveAll(installPath); nil != err { - logging.LogErrorf("remove icon [%s] failed: %s", installPath, err) - return errors.New("remove community icon failed") - } - //logging.Logger.Infof("uninstalled icon [%s]", installPath) - return nil + return uninstallPackage(installPath) } diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.go index f96161d4b6..dafd7b8890 100644 --- a/kernel/bazaar/package.go +++ b/kernel/bazaar/package.go @@ -19,6 +19,7 @@ package bazaar import ( "bytes" "errors" + "fmt" "os" "path/filepath" "strings" @@ -588,7 +589,26 @@ func incPackageDownloads(repoURLHash, systemID string) { }).Post(u) } -func installPackage(data []byte, installPath string) (err error) { +func uninstallPackage(installPath string) (err error) { + if err = os.RemoveAll(installPath); nil != err { + logging.LogErrorf("remove [%s] failed: %s", installPath, err) + return fmt.Errorf("remove community package [%s] failed", filepath.Base(installPath)) + } + packageCache.Flush() + return +} + +func installPackage(data []byte, installPath, repoURLHash string) (err error) { + err = installPackage0(data, installPath) + if nil != err { + return + } + + packageCache.Delete(strings.TrimPrefix(repoURLHash, "https://github.com/")) + return +} + +func installPackage0(data []byte, installPath string) (err error) { tmpPackage := filepath.Join(util.TempDir, "bazaar", "package") if err = os.MkdirAll(tmpPackage, 0755); nil != err { return diff --git a/kernel/bazaar/plugin.go b/kernel/bazaar/plugin.go index 0b70157ef5..0b460e5186 100644 --- a/kernel/bazaar/plugin.go +++ b/kernel/bazaar/plugin.go @@ -17,7 +17,6 @@ package bazaar import ( - "errors" "os" "path/filepath" "runtime" @@ -27,7 +26,6 @@ import ( "github.com/dustin/go-humanize" ants "github.com/panjf2000/ants/v2" - "github.com/siyuan-note/filelock" "github.com/siyuan-note/httpclient" "github.com/siyuan-note/logging" "github.com/siyuan-note/siyuan/kernel/util" @@ -220,16 +218,11 @@ func InstallPlugin(repoURL, repoHash, installPath string, systemID string) error if nil != err { return err } - return installPackage(data, installPath) + return installPackage(data, installPath, repoURLHash) } func UninstallPlugin(installPath string) error { - if err := filelock.Remove(installPath); nil != err { - logging.LogErrorf("remove plugin [%s] failed: %s", installPath, err) - return errors.New("remove community plugin failed") - } - //logging.Logger.Infof("uninstalled plugin [%s]", installPath) - return nil + return uninstallPackage(installPath) } func isIncompatiblePlugin(plugin *Plugin, currentFrontend string) bool { diff --git a/kernel/bazaar/template.go b/kernel/bazaar/template.go index ec5b130d81..e08f260d3e 100644 --- a/kernel/bazaar/template.go +++ b/kernel/bazaar/template.go @@ -17,7 +17,6 @@ package bazaar import ( - "errors" "os" "path/filepath" "sort" @@ -27,7 +26,6 @@ import ( "github.com/dustin/go-humanize" "github.com/panjf2000/ants/v2" - "github.com/siyuan-note/filelock" "github.com/siyuan-note/httpclient" "github.com/siyuan-note/logging" "github.com/siyuan-note/siyuan/kernel/util" @@ -182,15 +180,11 @@ func InstallTemplate(repoURL, repoHash, installPath string, systemID string) err if nil != err { return err } - return installPackage(data, installPath) + return installPackage(data, installPath, repoURLHash) } func UninstallTemplate(installPath string) error { - if err := filelock.Remove(installPath); nil != err { - logging.LogErrorf("remove template [%s] failed: %s", installPath, err) - return errors.New("remove community template failed") - } - return nil + return uninstallPackage(installPath) } func filterLegacyTemplates(templates []*Template) (ret []*Template) { diff --git a/kernel/bazaar/theme.go b/kernel/bazaar/theme.go index 1a32efdaa9..af1ec06c0a 100644 --- a/kernel/bazaar/theme.go +++ b/kernel/bazaar/theme.go @@ -17,7 +17,6 @@ package bazaar import ( - "errors" "os" "path/filepath" "sort" @@ -186,14 +185,9 @@ func InstallTheme(repoURL, repoHash, installPath string, systemID string) error if nil != err { return err } - return installPackage(data, installPath) + return installPackage(data, installPath, repoURLHash) } func UninstallTheme(installPath string) error { - if err := os.RemoveAll(installPath); nil != err { - logging.LogErrorf("remove theme [%s] failed: %s", installPath, err) - return errors.New("remove community theme failed") - } - //logging.Logger.Infof("uninstalled theme [%s]", installPath) - return nil + return uninstallPackage(installPath) } diff --git a/kernel/bazaar/widget.go b/kernel/bazaar/widget.go index 1d6d64e5dc..901f9c7392 100644 --- a/kernel/bazaar/widget.go +++ b/kernel/bazaar/widget.go @@ -17,7 +17,6 @@ package bazaar import ( - "errors" "os" "path/filepath" "sort" @@ -26,7 +25,6 @@ import ( "github.com/dustin/go-humanize" ants "github.com/panjf2000/ants/v2" - "github.com/siyuan-note/filelock" "github.com/siyuan-note/httpclient" "github.com/siyuan-note/logging" "github.com/siyuan-note/siyuan/kernel/util" @@ -180,14 +178,9 @@ func InstallWidget(repoURL, repoHash, installPath string, systemID string) error if nil != err { return err } - return installPackage(data, installPath) + return installPackage(data, installPath, repoURLHash) } func UninstallWidget(installPath string) error { - if err := filelock.Remove(installPath); nil != err { - logging.LogErrorf("remove widget [%s] failed: %s", installPath, err) - return errors.New("remove community widget failed") - } - //logging.Logger.Infof("uninstalled widget [%s]", installPath) - return nil + return uninstallPackage(installPath) } diff --git a/kernel/model/bazzar.go b/kernel/model/bazzar.go index 432369ca20..dd77cdc424 100644 --- a/kernel/model/bazzar.go +++ b/kernel/model/bazzar.go @@ -19,16 +19,17 @@ package model import ( "errors" "fmt" - "github.com/88250/gulu" - "github.com/siyuan-note/logging" - "github.com/siyuan-note/siyuan/kernel/util" "path" "path/filepath" "strings" "sync" "time" + "github.com/88250/gulu" + "github.com/siyuan-note/logging" "github.com/siyuan-note/siyuan/kernel/bazaar" + "github.com/siyuan-note/siyuan/kernel/util" + "golang.org/x/mod/semver" ) func BatchUpdateBazaarPackages(frontend string) { @@ -202,9 +203,7 @@ func BazaarPlugins(frontend, keyword string) (plugins []*bazaar.Plugin) { plugin.Installed = util.IsPathRegularDirOrSymlinkDir(filepath.Join(util.DataDir, "plugins", plugin.Name)) if plugin.Installed { if pluginConf, err := bazaar.PluginJSON(plugin.Name); nil == err && nil != plugin { - if plugin.Version != pluginConf.Version { - plugin.Outdated = true - } + plugin.Outdated = 0 > semver.Compare("v"+pluginConf.Version, "v"+plugin.Version) } } } @@ -273,9 +272,7 @@ func BazaarWidgets(keyword string) (widgets []*bazaar.Widget) { widget.Installed = util.IsPathRegularDirOrSymlinkDir(filepath.Join(util.DataDir, "widgets", widget.Name)) if widget.Installed { if widgetConf, err := bazaar.WidgetJSON(widget.Name); nil == err && nil != widget { - if widget.Version != widgetConf.Version { - widget.Outdated = true - } + widget.Outdated = 0 > semver.Compare("v"+widgetConf.Version, "v"+widget.Version) } } } @@ -324,10 +321,8 @@ func BazaarIcons(keyword string) (icons []*bazaar.Icon) { for _, icon := range icons { if installed == icon.Name { icon.Installed = true - if themeConf, err := bazaar.IconJSON(icon.Name); nil == err { - if icon.Version != themeConf.Version { - icon.Outdated = true - } + if iconConf, err := bazaar.IconJSON(icon.Name); nil == err { + icon.Outdated = 0 > semver.Compare("v"+iconConf.Version, "v"+icon.Version) } } icon.Current = icon.Name == Conf.Appearance.Icon @@ -389,7 +384,7 @@ func BazaarThemes(keyword string) (ret []*bazaar.Theme) { if installed == theme.Name { theme.Installed = true if themeConf, err := bazaar.ThemeJSON(theme.Name); nil == err { - theme.Outdated = theme.Version != themeConf.Version + theme.Outdated = 0 > semver.Compare("v"+themeConf.Version, "v"+theme.Version) } theme.Current = theme.Name == Conf.Appearance.ThemeDark || theme.Name == Conf.Appearance.ThemeLight } @@ -462,10 +457,8 @@ func BazaarTemplates(keyword string) (templates []*bazaar.Template) { for _, template := range templates { template.Installed = util.IsPathRegularDirOrSymlinkDir(filepath.Join(util.DataDir, "templates", template.Name)) if template.Installed { - if themeConf, err := bazaar.TemplateJSON(template.Name); nil == err && nil != themeConf { - if template.Version != themeConf.Version { - template.Outdated = true - } + if templateConf, err := bazaar.TemplateJSON(template.Name); nil == err && nil != templateConf { + template.Outdated = 0 > semver.Compare("v"+templateConf.Version, "v"+template.Version) } } } From 8a354da50a4e2c67b9b924e2255cf8f78396d142 Mon Sep 17 00:00:00 2001 From: Silent Lee Date: Mon, 15 Apr 2024 00:49:48 +0800 Subject: [PATCH 15/51] Add database `lineNumber` field type (#11008) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :art: add database lineNumber type * :art: fix https://github.com/siyuan-note/siyuan/issues/10896 * :art: Improve mobile app appearance language https://github.com/siyuan-note/siyuan/issues/11009 * :art: Improve database template field calc https://github.com/siyuan-note/siyuan/issues/11011 * :arrow_up: Upgrade kernel deps * :arrow_up: Upgrade kernel deps * :art: fix https://github.com/siyuan-note/siyuan/issues/10896 * :art: fix https://github.com/siyuan-note/siyuan/issues/10896 * :bug: https://github.com/siyuan-note/siyuan/issues/11015 * :bug: https://github.com/siyuan-note/siyuan/issues/11018 * :bug: https://github.com/siyuan-note/siyuan/issues/11018 * :art: 刚创建时无 id,更新需和 oldValue 保持一致 * :bug: Database date field between filter calculation error Fix https://github.com/siyuan-note/siyuan/issues/10979 * :bug: Primary key value unexpectedly updated when database adds row https://github.com/siyuan-note/siyuan/issues/11018 * :art: https://github.com/siyuan-note/siyuan/issues/11013 * :art: 搜索可汇总字段时排除行号类型字段 https://github.com/siyuan-note/siyuan/pull/11008 * :art: lineNumber no need to join the calc op and remove useless todo tag --------- Co-authored-by: Vanessa Co-authored-by: Daniel <845765@qq.com> --- .gitignore | 1 + app/appearance/langs/en_US.json | 1 + app/appearance/langs/es_ES.json | 1 + app/appearance/langs/fr_FR.json | 1 + app/appearance/langs/zh_CHT.json | 1 + app/appearance/langs/zh_CN.json | 1 + app/src/protyle/render/av/action.ts | 3 +- app/src/protyle/render/av/cell.ts | 10 +- app/src/protyle/render/av/col.ts | 195 +++++++++++++-------- app/src/protyle/render/av/filter.ts | 3 +- app/src/protyle/render/av/openMenuPanel.ts | 40 +++++ app/src/protyle/render/av/render.ts | 16 +- app/src/protyle/render/av/sort.ts | 19 +- app/src/types/index.d.ts | 1 + kernel/av/av.go | 33 ++-- kernel/model/attribute_view.go | 6 +- 16 files changed, 224 insertions(+), 108 deletions(-) diff --git a/.gitignore b/.gitignore index 4cdcb33b37..beff8f1d98 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ electron/dist # IDE .idea/ +.vscode/ # Log logs diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index fa5a508899..62612e2ec1 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -119,6 +119,7 @@ "goToEditTabPrev": "Go to previous edited tab", "createdTime": "Created time", "updatedTime": "Updated time", + "lineNumber": "Line number", "removeBookmark": "Remove bookmark from ${x}?", "defaultMargin": "Default", "noneMargin": "None", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 620fa4b3c0..703991e492 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -119,6 +119,7 @@ "goToEditTabPrev": "Ir a la pestaña editada anteriormente", "createdTime": "Hora de creación", "updatedTime": "Hora actualizada", + "lineNumber": "Número de línea", "removeBookmark": "¿Eliminar marcador de ${x}?", "lockEdit": "Hacer que el documento sea de sólo lectura", "unlockEdit": "Hacer que el documento sea escribible", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index adbf842204..dd28a47237 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -119,6 +119,7 @@ "goToEditTabPrev": "Aller à l'onglet modifié précédent", "createdTime": "Heure de création", "updatedTime": "Heure mise à jour", + "lineNumber": "Numéro de ligne", "removeBookmark": "Supprimer le signet de ${x} ?", "lockEdit": "Rendre le document en lecture seule", "unlockEdit": "Rendre le document accessible en écriture", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index d21ac9f4c6..d88415cfba 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -119,6 +119,7 @@ "goToEditTabPrev": "跳到上一個編輯頁籤", "createdTime": "建立時間", "updatedTime": "更新時間", + "lineNumber": "行號", "removeBookmark": "移除 ${x} 中的書籤?", "lockEdit": "鎖定編輯", "unlockEdit": "解除鎖定", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 5325449e45..c418a93b24 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -119,6 +119,7 @@ "goToEditTabPrev": "跳转到上一个编辑页签", "createdTime": "创建时间", "updatedTime": "更新时间", + "lineNumber": "行号", "removeBookmark": "移除 ${x} 中的书签?", "lockEdit": "锁定编辑", "unlockEdit": "解除锁定", diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 073614c62f..595784b50c 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -251,7 +251,8 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle return; } const type = getTypeByCellElement(target); - if (type === "updated" || type === "created" || (type === "block" && !target.getAttribute("data-detached"))) { + // TODO 点击单元格的时候, lineNumber 选中整行 + if (type === "updated" || type === "created" || type === "lineNumber" || (type === "block" && !target.getAttribute("data-detached"))) { selectRow(rowElement.querySelector(".av__firstcol"), "toggle"); } else { scrollElement.querySelectorAll(".av__row--select").forEach(item => { diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index c909c551e5..18e1f53179 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -644,7 +644,7 @@ export const renderCellAttr = (cellElement: Element, value: IAVCellValue) => { } }; -export const renderCell = (cellValue: IAVCellValue) => { +export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => { let text = ""; if (["text", "template"].includes(cellValue.type)) { text = `${cellValue ? (cellValue[cellValue.type as "text"].content || "") : ""}`; @@ -683,6 +683,9 @@ export const renderCell = (cellValue: IAVCellValue) => { text += dayjs(dataValue.content).format("YYYY-MM-DD HH:mm"); } text += ""; + } else if (["lineNumber"].includes(cellValue.type)) { + // 渲染行号 + text = `${rowIndex + 1}`; } else if (cellValue.type === "mAsset") { cellValue?.mAsset?.forEach((item) => { if (item.type === "image") { @@ -713,8 +716,9 @@ export const renderCell = (cellValue: IAVCellValue) => { text = text.substring(0, text.length - 2); } } - if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated"].includes(cellValue.type) && - cellValue && cellValue[cellValue.type as "url"].content) { + + if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated", "lineNumber"].includes(cellValue.type) && + ( cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) { text += ``; } return text; diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 86bbae70b7..2dd6e6b9d6 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -252,6 +252,7 @@ export const getEditHTML = (options: { ${genUpdateColItem("template", colData.type)} ${genUpdateColItem("relation", colData.type)} ${genUpdateColItem("rollup", colData.type)} + ${genUpdateColItem("lineNumber", colData.type)} ${genUpdateColItem("created", colData.type)} ${genUpdateColItem("updated", colData.type)} `; @@ -482,6 +483,8 @@ export const getColNameByType = (type: TAVCol) => { return window.siyuan.languages.checkbox; case "block": return window.siyuan.languages["_attrView"].key; + case "lineNumber": + return window.siyuan.languages.lineNumber; } }; @@ -518,6 +521,8 @@ export const getColIconByType = (type: TAVCol) => { return "iconMath"; case "checkbox": return "iconCheck"; + case "lineNumber": + return "iconSpreadOdd"; } }; @@ -694,90 +699,94 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen } }); menu.addSeparator(); - menu.addItem({ - icon: "iconUp", - label: window.siyuan.languages.asc, - click() { - fetchPost("/api/av/renderAttributeView", { - id: avID, - }, (response) => { - transaction(protyle, [{ - action: "setAttrViewSorts", - avID: response.data.id, - data: [{ - column: colId, - order: "ASC" - }], - blockID - }], [{ - action: "setAttrViewSorts", - avID: response.data.id, - data: response.data.view.sorts, - blockID - }]); - }); - } - }); - menu.addItem({ - icon: "iconDown", - label: window.siyuan.languages.desc, - click() { - fetchPost("/api/av/renderAttributeView", { - id: avID, - }, (response) => { - transaction(protyle, [{ - action: "setAttrViewSorts", - avID: response.data.id, - data: [{ - column: colId, - order: "DESC" - }], - blockID - }], [{ - action: "setAttrViewSorts", - avID: response.data.id, - data: response.data.view.sorts, - blockID - }]); - }); - } - }); - if (type !== "mAsset") { + + // 行号 类型不参与 排序和筛选 + if (type !== "lineNumber") { menu.addItem({ - icon: "iconFilter", - label: window.siyuan.languages.filter, + icon: "iconUp", + label: window.siyuan.languages.asc, click() { fetchPost("/api/av/renderAttributeView", { id: avID, }, (response) => { - const avData = response.data as IAV; - let filter: IAVFilter; - avData.view.filters.find((item) => { - if (item.column === colId && item.value.type === type) { - filter = item; - return true; - } - }); - if (!filter) { - filter = { + transaction(protyle, [{ + action: "setAttrViewSorts", + avID: response.data.id, + data: [{ column: colId, - operator: getDefaultOperatorByType(type), - value: genCellValue(type, ""), - }; - avData.view.filters.push(filter); - } - setFilter({ - filter, - protyle, - data: avData, - blockElement: blockElement, - target: blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`), - }); + order: "ASC" + }], + blockID + }], [{ + action: "setAttrViewSorts", + avID: response.data.id, + data: response.data.view.sorts, + blockID + }]); }); } }); + menu.addItem({ + icon: "iconDown", + label: window.siyuan.languages.desc, + click() { + fetchPost("/api/av/renderAttributeView", { + id: avID, + }, (response) => { + transaction(protyle, [{ + action: "setAttrViewSorts", + avID: response.data.id, + data: [{ + column: colId, + order: "DESC" + }], + blockID + }], [{ + action: "setAttrViewSorts", + avID: response.data.id, + data: response.data.view.sorts, + blockID + }]); + }); + } + }); + if (type !== "mAsset") { + menu.addItem({ + icon: "iconFilter", + label: window.siyuan.languages.filter, + click() { + fetchPost("/api/av/renderAttributeView", { + id: avID, + }, (response) => { + const avData = response.data as IAV; + let filter: IAVFilter; + avData.view.filters.find((item) => { + if (item.column === colId && item.value.type === type) { + filter = item; + return true; + } + }); + if (!filter) { + filter = { + column: colId, + operator: getDefaultOperatorByType(type), + value: genCellValue(type, ""), + }; + avData.view.filters.push(filter); + } + setFilter({ + filter, + protyle, + data: avData, + blockElement: blockElement, + target: blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`), + }); + }); + } + }); + } + menu.addSeparator(); } - menu.addSeparator(); menu.addItem({ icon: "iconInsertLeft", @@ -1429,6 +1438,44 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st blockElement.setAttribute("updated", newUpdated); } }); + // 在创建时间前插入 lineNumber + menu.addItem({ + icon: "iconSpreadOdd", + label: window.siyuan.languages.lineNumber, + click() { + const id = Lute.NewNodeID(); + const newUpdated = dayjs().format("YYYYMMDDHHmmss"); + transaction(protyle, [{ + action: "addAttrViewCol", + name: window.siyuan.languages.lineNumber, + avID, + type: "lineNumber", + id, + previousID + }, { + action: "doUpdateUpdated", + id: blockId, + data: newUpdated, + }], [{ + action: "removeAttrViewCol", + id, + avID, + }, { + action: "doUpdateUpdated", + id: blockId, + data: blockElement.getAttribute("updated") + }]); + addAttrViewColAnimation({ + blockElement: blockElement, + protyle: protyle, + type: "lineNumber", + name: window.siyuan.languages.lineNumber, + id, + previousID + }); + blockElement.setAttribute("updated", newUpdated); + } + }); menu.addItem({ icon: "iconClock", label: window.siyuan.languages.createdTime, diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index 929cfad739..520e04c047 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -566,7 +566,8 @@ export const addFilter = (options: { return true; } }); - if (!filter && column.type !== "mAsset") { + // 该列是行号类型列,则不允许添加到过滤器 + if (!filter && column.type !== "mAsset" && column.type !== "lineNumber") { menu.addItem({ label: column.name, iconHTML: column.icon ? unicode2Emoji(column.icon, "b3-menu__icon", true) : ``, diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 819382aa9b..76f9eefad3 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -854,6 +854,46 @@ export const openMenuPanel = (options: { name, type: target.dataset.oldType as TAVCol, }]); + + // 需要取消 lineNumber 列的排序和过滤 + if (target.dataset.newType === "lineNumber") { + const sortExist = data.view.sorts.find((sort) => sort.column === options.colId); + if (sortExist) { + const oldSorts = Object.assign([], data.view.sorts); + const newSorts = data.view.sorts.filter((sort) => sort.column !== options.colId); + + transaction(options.protyle, [{ + action: "setAttrViewSorts", + avID: data.id, + data: newSorts, + blockID, + }], [{ + action: "setAttrViewSorts", + avID: data.id, + data: oldSorts, + blockID, + }]); + } + + const filterExist = data.view.filters.find((filter) => filter.column === options.colId); + if (filterExist) { + const oldFilters = JSON.parse(JSON.stringify(data.view.filters)); + const newFilters = data.view.filters.filter((filter) => filter.column !== options.colId); + + transaction(options.protyle, [{ + action: "setAttrViewFilters", + avID: data.id, + data: newFilters, + blockID + }], [{ + action: "setAttrViewFilters", + avID: data.id, + data: oldFilters, + blockID + }]); + } + + } } avPanelElement.remove(); event.preventDefault(); diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 7b826f5306..4d6dbe36da 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -129,8 +129,16 @@ style="width: ${column.width || "200px"};"> if (pinIndex === index) { tableHTML += ""; } - calcHTML += `
${getCalcValue(column) || '' + window.siyuan.languages.calc}
`; + + // lineNumber type 不参与计算操作 + if (column.type === "lineNumber") { + calcHTML += `
 
`; + } else { + calcHTML += `
${getCalcValue(column) || '' + window.siyuan.languages.calc}
`; + } + if (pinIndex === index) { calcHTML += ""; } @@ -142,7 +150,7 @@ style="width: ${index === 0 ? ((parseInt(column.width || "200") + 24) + "px") : `; // body - data.rows.forEach((row: IAVRow) => { + data.rows.forEach((row: IAVRow, rowIndex: number) => { tableHTML += `
`; if (pinIndex > -1) { tableHTML += '
'; @@ -165,7 +173,7 @@ ${cell.value?.isDetached ? ' data-detached="true"' : ""} style="width: ${data.columns[index].width || "200px"}; ${cell.valueType === "number" ? "text-align: right;" : ""} ${cell.bgColor ? `background-color:${cell.bgColor};` : ""} -${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value)}
`; +${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, rowIndex)}
`; if (pinIndex === index) { tableHTML += ""; diff --git a/app/src/protyle/render/av/sort.ts b/app/src/protyle/render/av/sort.ts index af727019b4..e56936c11a 100644 --- a/app/src/protyle/render/av/sort.ts +++ b/app/src/protyle/render/av/sort.ts @@ -16,12 +16,19 @@ export const addSort = (options: { const menu = new Menu("av-add-sort"); options.data.view.columns.forEach((column) => { let hasSort = false; - options.data.view.sorts.find((sort) => { - if (sort.column === column.id) { - hasSort = true; - return true; - } - }); + + // 如果该列是行号类型列,不允许添加排序 + if (column.type === "lineNumber") { + hasSort = true; + } else { + options.data.view.sorts.find((sort) => { + if (sort.column === column.id) { + hasSort = true; + return true; + } + }); + } + if (!hasSort) { menu.addItem({ label: column.name, diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index f927350c21..b06ba0815f 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -82,6 +82,7 @@ type TAVCol = | "created" | "updated" | "checkbox" + | "lineNumber" type THintSource = "search" | "av" | "hint"; type TAVFilterOperator = "=" diff --git a/kernel/av/av.go b/kernel/av/av.go index 9713035d46..a9242f4f68 100644 --- a/kernel/av/av.go +++ b/kernel/av/av.go @@ -64,22 +64,23 @@ func (kValues *KeyValues) GetValue(blockID string) (ret *Value) { type KeyType string const ( - KeyTypeBlock KeyType = "block" - KeyTypeText KeyType = "text" - KeyTypeNumber KeyType = "number" - KeyTypeDate KeyType = "date" - KeyTypeSelect KeyType = "select" - KeyTypeMSelect KeyType = "mSelect" - KeyTypeURL KeyType = "url" - KeyTypeEmail KeyType = "email" - KeyTypePhone KeyType = "phone" - KeyTypeMAsset KeyType = "mAsset" - KeyTypeTemplate KeyType = "template" - KeyTypeCreated KeyType = "created" - KeyTypeUpdated KeyType = "updated" - KeyTypeCheckbox KeyType = "checkbox" - KeyTypeRelation KeyType = "relation" - KeyTypeRollup KeyType = "rollup" + KeyTypeBlock KeyType = "block" + KeyTypeText KeyType = "text" + KeyTypeNumber KeyType = "number" + KeyTypeDate KeyType = "date" + KeyTypeSelect KeyType = "select" + KeyTypeMSelect KeyType = "mSelect" + KeyTypeURL KeyType = "url" + KeyTypeEmail KeyType = "email" + KeyTypePhone KeyType = "phone" + KeyTypeMAsset KeyType = "mAsset" + KeyTypeTemplate KeyType = "template" + KeyTypeCreated KeyType = "created" + KeyTypeUpdated KeyType = "updated" + KeyTypeCheckbox KeyType = "checkbox" + KeyTypeRelation KeyType = "relation" + KeyTypeRollup KeyType = "rollup" + KeyTypeLineNumber KeyType = "lineNumber" ) // Key 描述了属性视图属性列的基础结构。 diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 17051cb596..4db2283f86 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -145,7 +145,7 @@ func SearchAttributeViewNonRelationKey(avID, keyword string) (ret []*av.Key) { } for _, keyValues := range attrView.KeyValues { - if av.KeyTypeRelation != keyValues.Key.Type && av.KeyTypeRollup != keyValues.Key.Type && av.KeyTypeTemplate != keyValues.Key.Type && av.KeyTypeCreated != keyValues.Key.Type && av.KeyTypeUpdated != keyValues.Key.Type { + if av.KeyTypeRelation != keyValues.Key.Type && av.KeyTypeRollup != keyValues.Key.Type && av.KeyTypeTemplate != keyValues.Key.Type && av.KeyTypeCreated != keyValues.Key.Type && av.KeyTypeUpdated != keyValues.Key.Type && av.KeyTypeLineNumber != keyValues.Key.Type { if strings.Contains(strings.ToLower(keyValues.Key.Name), strings.ToLower(keyword)) { ret = append(ret, keyValues.Key) } @@ -2654,7 +2654,7 @@ func AddAttributeViewKey(avID, keyID, keyName, keyType, keyIcon, previousKeyID s switch keyTyp { case av.KeyTypeText, av.KeyTypeNumber, av.KeyTypeDate, av.KeyTypeSelect, av.KeyTypeMSelect, av.KeyTypeURL, av.KeyTypeEmail, av.KeyTypePhone, av.KeyTypeMAsset, av.KeyTypeTemplate, av.KeyTypeCreated, av.KeyTypeUpdated, av.KeyTypeCheckbox, - av.KeyTypeRelation, av.KeyTypeRollup: + av.KeyTypeRelation, av.KeyTypeRollup, av.KeyTypeLineNumber: key := av.NewKey(keyID, keyName, keyIcon, keyTyp) if av.KeyTypeRollup == keyTyp { @@ -2766,7 +2766,7 @@ func updateAttributeViewColumn(operation *Operation) (err error) { switch colType { case av.KeyTypeBlock, av.KeyTypeText, av.KeyTypeNumber, av.KeyTypeDate, av.KeyTypeSelect, av.KeyTypeMSelect, av.KeyTypeURL, av.KeyTypeEmail, av.KeyTypePhone, av.KeyTypeMAsset, av.KeyTypeTemplate, av.KeyTypeCreated, av.KeyTypeUpdated, av.KeyTypeCheckbox, - av.KeyTypeRelation, av.KeyTypeRollup: + av.KeyTypeRelation, av.KeyTypeRollup, av.KeyTypeLineNumber: for _, keyValues := range attrView.KeyValues { if keyValues.Key.ID == operation.ID { keyValues.Key.Name = strings.TrimSpace(operation.Name) From 693e89bd7bff0de15a50ed84c5d41173c0052f18 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 01:28:48 +0800 Subject: [PATCH 16/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10885 --- app/src/assets/scss/business/_av.scss | 40 ++++++++++++++-------- app/src/assets/scss/business/_custom.scss | 5 +++ app/src/protyle/render/av/blockAttr.ts | 2 +- app/src/protyle/render/av/openMenuPanel.ts | 2 +- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss index 5295f3797c..5a6b81b93a 100644 --- a/app/src/assets/scss/business/_av.scss +++ b/app/src/assets/scss/business/_av.scss @@ -48,8 +48,15 @@ background-color: transparent; font-size: 87.5%; + .item__graphic { + height: 1.625em; + width: calc(1.625em - 10px); + padding: 5px 5px 5px 8px; + } + .item__text { padding-left: 5px; + line-height: normal; } } } @@ -175,9 +182,9 @@ } svg { - height: 8px; - width: 8px; margin-left: 5px; + height: 1.625em; + width: calc(1.625em - 10px); } span { @@ -196,7 +203,7 @@ display: flex; .b3-button { - margin: 3px 0 3px 24px; + margin: 5px 0 5px 1.625em; color: var(--b3-theme-on-surface); background-color: transparent; font-size: 75%; @@ -209,8 +216,8 @@ } svg { - width: 12px; - height: 20px; + height: 1.625em; + width: calc(1.625em - 8px); &[data-type="set-page-size"] { margin: 0 0 0 4px; @@ -287,12 +294,11 @@ } .av__cellheadericon { - height: 1em; - width: 1em; + height: 1.625em; + width: calc(1.625em - 10px); color: var(--b3-theme-on-surface); margin: 0 5px 0 0; flex-shrink: 0; - line-height: 1em; font-size: inherit; &--pin { @@ -315,6 +321,8 @@ .b3-chip { margin: 1px 2px; padding: 2px 6px; + line-height: calc(1.625em - 6px); + font-size: inherit; } } @@ -345,7 +353,7 @@ text-overflow: ellipsis; display: inline-block; vertical-align: top; - height: 20px; + border-bottom: 0; } & > .av__cellicon { @@ -357,10 +365,11 @@ &__checkbox { color: var(--b3-theme-on-surface); - height: 14px; - width: 14px; - vertical-align: bottom; - padding: 4.5px 0; + height: 1.625em; + width: calc(1.625em - 10px); + box-sizing: border-box; + padding: 5px 0; + display: block; &:hover { color: var(--b3-theme-on-background); @@ -371,7 +380,7 @@ svg { @extend .av__checkbox; opacity: 0; - padding: 9.5px 5px; + margin: 5px; cursor: pointer; } @@ -515,11 +524,12 @@ } img.av__cellassetimg { - max-height: 20px; + max-height: calc(1.625em - 2px); border-radius: var(--b3-border-radius); margin: 1px 2px; max-width: none; vertical-align: top; + font-size: inherit; } html[data-theme-mode="dark"] .av__panel .b3-menu__item[draggable="true"] { diff --git a/app/src/assets/scss/business/_custom.scss b/app/src/assets/scss/business/_custom.scss index 8d9ce4ab3b..1e5712b42c 100644 --- a/app/src/assets/scss/business/_custom.scss +++ b/app/src/assets/scss/business/_custom.scss @@ -12,6 +12,11 @@ &:hover { background-color: var(--b3-theme-background); } + + .av__checkbox { + width: 16px; + height: 26px; + } } &__avheader { diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts index 8b1b81ebd0..e80ed1a3b3 100644 --- a/app/src/protyle/render/av/blockAttr.ts +++ b/app/src/protyle/render/av/blockAttr.ts @@ -102,7 +102,7 @@ export const genAVValueHTML = (value: IAVCellValue) => { `; break; case "checkbox": - html = ``; + html = ``; break; case "template": html = `
${value.template.content}
`; diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 819382aa9b..b6c7a640c0 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -462,7 +462,7 @@ export const openMenuPanel = (options: { } let target = event.target as HTMLElement; while (target && !target.isSameNode(avPanelElement) || type) { - type = target.dataset.type || type; + type = target?.dataset.type || type; if (type === "close") { if (!options.protyle.toolbar.subElement.classList.contains("fn__none")) { // 优先关闭资源文件搜索 From bdff61d91522145ec48de05dc96b5467055b8910 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 09:09:45 +0800 Subject: [PATCH 17/51] :art: Logging --- kernel/model/mount.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/model/mount.go b/kernel/model/mount.go index 1fd6fd23a8..1e5f9cea6a 100644 --- a/kernel/model/mount.go +++ b/kernel/model/mount.go @@ -62,6 +62,7 @@ func CreateBox(name string) (id string, err error) { boxConf.Name = name box.SaveConf(boxConf) IncSync() + logging.LogInfof("created box [%s]", id) return } @@ -86,6 +87,7 @@ func RenameBox(boxID, name string) (err error) { box.Name = name box.SaveConf(boxConf) IncSync() + logging.LogInfof("renamed box [%s] to [%s]", boxID, name) return } @@ -139,6 +141,8 @@ func RemoveBox(boxID string) (err error) { return } IncSync() + + logging.LogInfof("removed box [%s]", boxID) return } From 971201c528bce3f99bbfe3f92f12313da316dfeb Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 09:28:13 +0800 Subject: [PATCH 18/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10885 --- app/src/assets/scss/business/_av.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss index 5a6b81b93a..60fa2e0d11 100644 --- a/app/src/assets/scss/business/_av.scss +++ b/app/src/assets/scss/business/_av.scss @@ -69,6 +69,11 @@ opacity: 1; } + .block__icon svg { + height: 1em; + width: 1em; + } + .b3-text-field { transition: var(--b3-width-transition); } From 0093dc38e8d3e2a643b7f19dc6a696e11e481170 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 09:21:15 +0800 Subject: [PATCH 19/51] :art: Improve heading drag conversion doc subheading level https://github.com/siyuan-note/siyuan/issues/11037 --- kernel/model/heading.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/heading.go b/kernel/model/heading.go index c445f974ff..bfdf401f7a 100644 --- a/kernel/model/heading.go +++ b/kernel/model/heading.go @@ -342,7 +342,7 @@ func Heading2Doc(srcHeadingID, targetBoxID, targetPath string) (srcRootBlockID, topLevel := treenode.TopHeadingLevel(newTree) for c := newTree.Root.FirstChild; nil != c; c = c.Next { if ast.NodeHeading == c.Type { - c.HeadingLevel = c.HeadingLevel - topLevel + 1 + c.HeadingLevel = c.HeadingLevel - topLevel + 2 if 6 < c.HeadingLevel { c.HeadingLevel = 6 } From 77542ac8b1cb5cb7127bec2aab3d72c95de036ba Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 09:28:45 +0800 Subject: [PATCH 20/51] :art: Improve heading drag conversion doc subheading level Fix https://github.com/siyuan-note/siyuan/issues/11037 --- .../20201210233038-3xr19g5.sy | 133 +++++------------- .../20201210103036-1x3vm8t.sy | 95 ++----------- .../20211226120422-bkzsd2e.sy | 93 ++++-------- 3 files changed, 72 insertions(+), 249 deletions(-) diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201210233038-3xr19g5.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201210233038-3xr19g5.sy index 2dff686371..920c8e3e08 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201210233038-3xr19g5.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-6yi0dv5/20201210233038-3xr19g5.sy @@ -6,7 +6,7 @@ "id": "20201210233038-3xr19g5", "title": "Conversion of Document and Heading", "type": "doc", - "updated": "20211223192545" + "updated": "20240415092701" }, "Children": [ { @@ -266,7 +266,8 @@ "Num": -1 }, "Properties": { - "id": "20210104091550-zq0ph0f" + "id": "20210104091550-zq0ph0f", + "updated": "20240415092701" }, "Children": [ { @@ -310,19 +311,21 @@ "Num": -1 }, "Properties": { - "id": "20210104091550-hi3ky7o" + "id": "20210104091550-hi3ky7o", + "updated": "20240415092701" }, "Children": [ { "ID": "20210302223904-l78gsey", "Type": "NodeParagraph", "Properties": { - "id": "20210302223904-l78gsey" + "id": "20210302223904-l78gsey", + "updated": "20240415092701" }, "Children": [ { "Type": "NodeText", - "Data": "Logically, the document block is a first-level title, and the relative level will be changed according to the insertion position" + "Data": "Logically, the document block is a first-level heading, and the relative level will be changed according to the insertion position" } ] } @@ -441,13 +444,10 @@ "Type": "NodeHeading", "HeadingLevel": 2, "Properties": { - "id": "20210104091550-fualfrs" + "id": "20210104091550-fualfrs", + "updated": "20210104091550" }, "Children": [ - { - "Type": "NodeHeadingC8hMarker", - "Data": "## " - }, { "Type": "NodeText", "Data": "Convert Heading block to Document block" @@ -455,144 +455,79 @@ ] }, { - "ID": "20210104091550-1pe70bg", + "ID": "20240415092450-yckmprz", "Type": "NodeParagraph", "Properties": { - "id": "20210104091550-1pe70bg" + "id": "20240415092450-yckmprz", + "updated": "20240415092509" }, "Children": [ { "Type": "NodeText", - "Data": "In the editor tab, select the heading block to be converted, press and hold the heading block icon, and then drag it to the folder to be placed in the doc tree. If you need to place it on the notebook root folder, drag the heading block icon to the top notebook icon row." + "Data": "Select the heading block that needs to be converted in the editor tab, press and hold the heading block icon, and then drag it to the document tree for conversion. After the heading block is converted to a document block:" } ] }, { - "ID": "20210104091550-atbf12t", - "Type": "NodeParagraph", - "Properties": { - "id": "20210104091550-atbf12t" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "After the heading block is converted to a document block:" - } - ] - }, - { - "ID": "20210104091550-nsd8w2j", + "ID": "20240415092450-z9g5u00", "Type": "NodeList", - "ListData": { - "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 - }, + "ListData": {}, "Properties": { - "id": "20210104091550-nsd8w2j" + "id": "20240415092450-z9g5u00", + "updated": "20240415092640" }, "Children": [ { - "ID": "20210104091550-85231ks", + "ID": "20240415092511-wlz23no", "Type": "NodeListItem", - "Data": "*", "ListData": { "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 + "Marker": "Kg==" }, "Properties": { - "id": "20210104091550-85231ks" + "id": "20240415092511-wlz23no", + "updated": "20240415092523" }, "Children": [ { - "ID": "20210302223904-brosops", + "ID": "20240415092511-ek4fnkd", "Type": "NodeParagraph", "Properties": { - "id": "20210302223904-brosops" + "id": "20240415092511-ek4fnkd", + "updated": "20240415092523" }, "Children": [ { "Type": "NodeText", - "Data": "The heading name will become the document name" + "Data": "The heading name will become the document title" } ] } ] }, { - "ID": "20210104091550-s2nrev0", + "ID": "20240415092513-f6xngjx", "Type": "NodeListItem", - "Data": "*", "ListData": { - "Tight": true, "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 + "Marker": "Kg==" }, "Properties": { - "id": "20210104091550-s2nrev0" + "id": "20240415092513-f6xngjx", + "updated": "20240415092640" }, "Children": [ { - "ID": "20210302223904-mleww72", + "ID": "20240415092513-gteta4u", "Type": "NodeParagraph", "Properties": { - "id": "20210302223904-mleww72" + "id": "20240415092513-gteta4u", + "updated": "20240415092640" }, "Children": [ { "Type": "NodeText", - "Data": "If there are subtitles under the original heading block, the largest level of these subtitles will be used as the first level of the new document, and the remaining subtitles will be adjusted according to the relative level" - } - ] - }, - { - "ID": "20210104091550-c8bmph5", - "Type": "NodeList", - "ListData": { - "Tight": true, - "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 - }, - "Properties": { - "id": "20210104091550-c8bmph5" - }, - "Children": [ - { - "ID": "20210104091550-o45r6uw", - "Type": "NodeListItem", - "Data": "*", - "ListData": { - "Tight": true, - "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 - }, - "Properties": { - "id": "20210104091550-o45r6uw" - }, - "Children": [ - { - "ID": "20210302223904-62szx4g", - "Type": "NodeParagraph", - "Properties": { - "id": "20210302223904-62szx4g" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "For example, the original heading block contains three, four, and five levels of subtitles, and these subtitles will be converted into one, two, and three levels after being converted into a document block" - } - ] - } - ] + "Data": "If there are subheadings under the original heading block, the largest level among these subheadings will be used as the second-level heading in the new document. The remaining subheadings will be adjusted according to the relative levels. For example, the original heading block contains three, four, and five. level subheadings, these subheadings will be converted into second, third, and fourth level headings after conversion to document blocks." } ] } diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201210103036-1x3vm8t.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201210103036-1x3vm8t.sy index ecad88d285..c91e2f51ff 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201210103036-1x3vm8t.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj/20201210103036-1x3vm8t.sy @@ -6,7 +6,7 @@ "id": "20201210103036-1x3vm8t", "title": "文档块和标题块的转换", "type": "doc", - "updated": "20211223192452" + "updated": "20240415092415" }, "Children": [ { @@ -458,50 +458,31 @@ "ID": "20210104090801-9kyqggg", "Type": "NodeParagraph", "Properties": { - "id": "20210104090801-9kyqggg" + "id": "20210104090801-9kyqggg", + "updated": "20240415092405" }, "Children": [ { "Type": "NodeText", - "Data": "在编辑器页签中选择需要转换的标题块,按住该标题块标识图标,然后将其拖拽到文档树需要放置的文件夹中。如果需要放置到笔记本根文件夹上,就将标题块标识图标拖动到顶层的笔记本图标这一行上。" - } - ] - }, - { - "ID": "20210104090801-z3yxgmt", - "Type": "NodeParagraph", - "Properties": { - "id": "20210104090801-z3yxgmt" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "标题块转换为文档块后:" + "Data": "在编辑器页签中选择需要转换的标题块,按住该标题块标识图标,然后就可以将其拖拽到文档树上转换了,标题块转换为文档块后:" } ] }, { "ID": "20210104090801-2clqrmr", "Type": "NodeList", - "ListData": { - "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 - }, + "ListData": {}, "Properties": { - "id": "20210104090801-2clqrmr" + "id": "20210104090801-2clqrmr", + "updated": "20240415092415" }, "Children": [ { "ID": "20210104090801-u88ud0z", "Type": "NodeListItem", - "Data": "*", "ListData": { "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 + "Marker": "Kg==" }, "Properties": { "id": "20210104090801-u88ud0z" @@ -525,74 +506,26 @@ { "ID": "20210104090801-yg8oign", "Type": "NodeListItem", - "Data": "*", "ListData": { - "Tight": true, "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 + "Marker": "Kg==" }, "Properties": { - "id": "20210104090801-yg8oign" + "id": "20210104090801-yg8oign", + "updated": "20240415092415" }, "Children": [ { "ID": "20210302223313-g1q27b1", "Type": "NodeParagraph", "Properties": { - "id": "20210302223313-g1q27b1" + "id": "20210302223313-g1q27b1", + "updated": "20240415092415" }, "Children": [ { "Type": "NodeText", - "Data": "原标题块下如果有子标题,则会按照这些子标题中最大的层级作为新文档中一级标题,其余子标题会根据相对层级进行调整" - } - ] - }, - { - "ID": "20210104090801-p8uc6ob", - "Type": "NodeList", - "ListData": { - "Tight": true, - "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 - }, - "Properties": { - "id": "20210104090801-p8uc6ob" - }, - "Children": [ - { - "ID": "20210104090801-q88ezjk", - "Type": "NodeListItem", - "Data": "*", - "ListData": { - "Tight": true, - "BulletChar": 42, - "Padding": 2, - "Marker": "Kg==", - "Num": -1 - }, - "Properties": { - "id": "20210104090801-q88ezjk" - }, - "Children": [ - { - "ID": "20210302223313-6qh35f3", - "Type": "NodeParagraph", - "Properties": { - "id": "20210302223313-6qh35f3" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "比如原标题块下包含了三、四、五级子标题,则转换为文档块后会将这些子标题转换为一、二、三级标题" - } - ] - } - ] + "Data": "原标题块下如果有子标题,则会按照这些子标题中最大的层级作为新文档中二级标题,其余子标题会根据相对层级进行调整,比如原标题块下包含了三、四、五级子标题,则转换为文档块后会将这些子标题转换为二、三、四级标题" } ] } diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120422-bkzsd2e.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120422-bkzsd2e.sy index 4de9b36607..d311a262ce 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120422-bkzsd2e.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226115825-mhcslw2/20211226120422-bkzsd2e.sy @@ -5,7 +5,8 @@ "Properties": { "id": "20211226120422-bkzsd2e", "title": "文檔塊和標題塊的轉換", - "updated": "20211228131818" + "type": "doc", + "updated": "20240415092439" }, "Children": [ { @@ -393,125 +394,79 @@ ] }, { - "ID": "20211226120500-7k0tzto", + "ID": "20240415092439-6is1c68", "Type": "NodeParagraph", "Properties": { - "id": "20211226120500-7k0tzto", - "updated": "20211228131818" + "id": "20240415092439-6is1c68", + "updated": "20240415092439" }, "Children": [ { "Type": "NodeText", - "Data": "在編輯器分頁中選擇需要轉換的標題塊,按住該標題塊標識圖示,然後將其拖拽到文檔樹需要放置的文件夾中。如果需要放置到筆記本根文件夾上,就將標題塊標識圖示拖動到頂層的筆記本圖示這一行上。" + "Data": "在編輯器頁簽中選擇需要轉換的標題塊,按住該標題塊標識圖標,然後就可以將其拖曳到文檔樹上轉換了,標題塊轉換為文檔塊後:" } ] }, { - "ID": "20211226120500-ty32b36", - "Type": "NodeParagraph", - "Properties": { - "id": "20211226120500-ty32b36", - "updated": "20211225234143" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "標題塊轉換為文檔塊後:" - } - ] - }, - { - "ID": "20211226120500-u5prece", + "ID": "20240415092439-ffkmd1j", "Type": "NodeList", "ListData": {}, "Properties": { - "id": "20211226120500-u5prece", - "updated": "20211225234143" + "id": "20240415092439-ffkmd1j", + "updated": "20240415092439" }, "Children": [ { - "ID": "20211226120500-zwcr1cw", + "ID": "20240415092439-vuesltm", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20211226120500-zwcr1cw" + "id": "20240415092439-vuesltm", + "updated": "20240415092439" }, "Children": [ { - "ID": "20211226120500-xq6bldq", + "ID": "20240415092439-j4s1hut", "Type": "NodeParagraph", "Properties": { - "id": "20211226120500-xq6bldq" + "id": "20240415092439-j4s1hut", + "updated": "20240415092439" }, "Children": [ { "Type": "NodeText", - "Data": "標題名將變為文檔名" + "Data": "標題名將變為文件名" } ] } ] }, { - "ID": "20211226120500-xuzfjwh", + "ID": "20240415092439-smqxbga", "Type": "NodeListItem", "ListData": { "BulletChar": 42, "Marker": "Kg==" }, "Properties": { - "id": "20211226120500-xuzfjwh" + "id": "20240415092439-smqxbga", + "updated": "20240415092439" }, "Children": [ { - "ID": "20211226120500-605u9ez", + "ID": "20240415092439-t6bu4l9", "Type": "NodeParagraph", "Properties": { - "id": "20211226120500-605u9ez" + "id": "20240415092439-t6bu4l9", + "updated": "20240415092439" }, "Children": [ { "Type": "NodeText", - "Data": "原標題塊下如果有子標題,則會按照這些子標題中最大的層級作為新文檔中一級標題,其余子標題會根據相對層級進行調整" - } - ] - }, - { - "ID": "20211226120500-rqbu1p5", - "Type": "NodeList", - "ListData": {}, - "Properties": { - "id": "20211226120500-rqbu1p5" - }, - "Children": [ - { - "ID": "20211226120500-0brf3va", - "Type": "NodeListItem", - "ListData": { - "BulletChar": 42, - "Marker": "Kg==" - }, - "Properties": { - "id": "20211226120500-0brf3va" - }, - "Children": [ - { - "ID": "20211226120500-aw5oi3a", - "Type": "NodeParagraph", - "Properties": { - "id": "20211226120500-aw5oi3a" - }, - "Children": [ - { - "Type": "NodeText", - "Data": "比如原標題塊下包含了三、四、五級子標題,則轉換為文檔塊後會將這些子標題轉換為一、二、三級標題" - } - ] - } - ] + "Data": "原標題區塊下方如果有子標題,則會依照這些子標題中最大的層級作為新文件中二級標題,其餘子標題會根據相對層級進行調整,例如原標題區塊下方包含了三、四、五 層級子標題,則轉換為文件區塊後會將這些子標題轉換為二、三、四級標題" } ] } @@ -524,7 +479,7 @@ "Type": "NodeParagraph", "Properties": { "id": "20211226120500-8o1jmk7", - "updated": "20211226120500" + "updated": "20211225234143" } } ] From a7fae1d4fdcede1dac9f279abcc1e1b6b75ef838 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 11:43:46 +0800 Subject: [PATCH 21/51] :art: https://github.com/siyuan-note/siyuan/issues/10998 --- app/src/layout/index.ts | 11 ++-- app/src/layout/util.ts | 112 ++++++++++++++++++++++++++-------------- 2 files changed, 77 insertions(+), 46 deletions(-) diff --git a/app/src/layout/index.ts b/app/src/layout/index.ts index 2a6f5a7959..93e8f0b255 100644 --- a/app/src/layout/index.ts +++ b/app/src/layout/index.ts @@ -1,10 +1,11 @@ import {Wnd} from "./Wnd"; import {genUUID} from "../util/genID"; -import {addResize} from "./util"; +import {addResize, fixWndFlex1} from "./util"; import {resizeTabs} from "./tabUtil"; /// #if MOBILE // 检测移动端是否引入了桌面端的代码 console.error("Need remove unused code"); + /// #endif export class Layout { @@ -77,9 +78,6 @@ export class Layout { this.children.find((item, index) => { if (item.id === id) { this.children.splice(index + 1, 0, child); - item.element.style.width = ""; - item.element.style.height = ""; - item.element.classList.add("fn__flex-1"); if (this.direction === "lr") { // 向右分屏,左侧文档抖动,移除动画和边距 item.element.querySelectorAll(".protyle-content").forEach((element: HTMLElement) => { @@ -95,12 +93,9 @@ export class Layout { } }); } + fixWndFlex1(this); addResize(child); resizeTabs(false); - // https://ld246.com/article/1669858316295 - if (this.direction === "tb") { - child.element.style.minHeight = "64px"; - } child.parent = this; } } diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index e39e389ca5..2401df7158 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -1,39 +1,39 @@ -import { Layout } from "./index"; -import { Wnd } from "./Wnd"; -import { Tab } from "./Tab"; -import { Model } from "./Model"; -import { Graph } from "./dock/Graph"; -import { Editor } from "../editor"; -import { Files } from "./dock/Files"; -import { Outline } from "./dock/Outline"; -import { Bookmark } from "./dock/Bookmark"; -import { Tag } from "./dock/Tag"; -import { getAllModels, getAllTabs } from "./getAll"; -import { Asset } from "../asset"; -import { Search } from "../search"; -import { Dock } from "./dock"; -import { focusByOffset, focusByRange, getSelectionOffset } from "../protyle/util/selection"; -import { hideElements } from "../protyle/ui/hideElements"; -import { fetchPost } from "../util/fetch"; -import { hasClosestBlock, hasClosestByClassName } from "../protyle/util/hasClosest"; -import { getContenteditableElement } from "../protyle/wysiwyg/getBlock"; -import { Constants } from "../constants"; -import { saveScroll } from "../protyle/scroll/saveScroll"; -import { Backlink } from "./dock/Backlink"; -import { openFileById } from "../editor/util"; -import { isWindow } from "../util/functions"; +import {Layout} from "./index"; +import {Wnd} from "./Wnd"; +import {Tab} from "./Tab"; +import {Model} from "./Model"; +import {Graph} from "./dock/Graph"; +import {Editor} from "../editor"; +import {Files} from "./dock/Files"; +import {Outline} from "./dock/Outline"; +import {Bookmark} from "./dock/Bookmark"; +import {Tag} from "./dock/Tag"; +import {getAllModels, getAllTabs} from "./getAll"; +import {Asset} from "../asset"; +import {Search} from "../search"; +import {Dock} from "./dock"; +import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection"; +import {hideElements} from "../protyle/ui/hideElements"; +import {fetchPost} from "../util/fetch"; +import {hasClosestBlock, hasClosestByClassName} from "../protyle/util/hasClosest"; +import {getContenteditableElement} from "../protyle/wysiwyg/getBlock"; +import {Constants} from "../constants"; +import {saveScroll} from "../protyle/scroll/saveScroll"; +import {Backlink} from "./dock/Backlink"; +import {openFileById} from "../editor/util"; +import {isWindow} from "../util/functions"; /// #if !BROWSER -import { setTabPosition } from "../window/setHeader"; +import {setTabPosition} from "../window/setHeader"; /// #endif -import { showMessage } from "../dialog/message"; -import { getIdZoomInByPath } from "../util/pathName"; -import { Custom } from "./dock/Custom"; -import { newCardModel } from "../card/newCardTab"; -import { App } from "../index"; -import { afterLoadPlugin } from "../plugin/loader"; -import { setTitle } from "../dialog/processSystem"; -import { newCenterEmptyTab, resizeTabs } from "./tabUtil"; -import { setStorageVal } from "../protyle/util/compatibility"; +import {showMessage} from "../dialog/message"; +import {getIdZoomInByPath} from "../util/pathName"; +import {Custom} from "./dock/Custom"; +import {newCardModel} from "../card/newCardTab"; +import {App} from "../index"; +import {afterLoadPlugin} from "../plugin/loader"; +import {setTitle} from "../dialog/processSystem"; +import {newCenterEmptyTab, resizeTabs} from "./tabUtil"; +import {setStorageVal} from "../protyle/util/compatibility"; export const setPanelFocus = (element: Element) => { if (element.getAttribute("data-type") === "wnd") { @@ -169,7 +169,7 @@ const dockToJSON = (dock: Dock) => { }; export const resetLayout = () => { - fetchPost("/api/system/setUILayout", { layout: {} }, () => { + fetchPost("/api/system/setUILayout", {layout: {}}, () => { window.siyuan.storage[Constants.LOCAL_FILEPOSITION] = {}; setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION]); window.siyuan.storage[Constants.LOCAL_DIALOGPOSITION] = {}; @@ -290,9 +290,9 @@ const JSONToDock = (json: any, app: App) => { initInternalDock(existItem); }); window.siyuan.layout.centerLayout = window.siyuan.layout.layout.children[0].children[1] as Layout; - window.siyuan.layout.leftDock = new Dock({ position: "Left", data: json.left, app }); - window.siyuan.layout.rightDock = new Dock({ position: "Right", data: json.right, app }); - window.siyuan.layout.bottomDock = new Dock({ position: "Bottom", data: json.bottom, app }); + window.siyuan.layout.leftDock = new Dock({position: "Left", data: json.left, app}); + window.siyuan.layout.rightDock = new Dock({position: "Right", data: json.right, app}); + window.siyuan.layout.bottomDock = new Dock({position: "Bottom", data: json.bottom, app}); }; export const JSONToCenter = ( @@ -907,3 +907,39 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout. } }); }; + +export const fixWndFlex1 = (layout: Layout) => { + if (layout.children.length < 2) { + return + } + if (layout.children[layout.children.length - 2].element.classList.contains("fn__flex-1")) { + return; + } + layout.children.forEach((item, index) => { + if (index !== layout.children.length - 2) { + if (layout.direction === "lr") { + if (item.element.classList.contains("fn__flex-1")) { + item.element.style.width = item.element.clientWidth + "px" + item.element.classList.remove("fn__flex-1") + } + } else { + if (item.element.classList.contains("fn__flex-1")) { + item.element.style.height = item.element.clientHeight + "px" + item.element.classList.remove("fn__flex-1") + } + } + } + }) + const flex1Element = layout.children[layout.children.length - 2].element + if (layout.direction === "lr") { + if (flex1Element.style.width) { + flex1Element.style.width = "" + flex1Element.classList.add("fn__flex-1") + } + } else { + if (flex1Element.style.height) { + flex1Element.style.height = "" + flex1Element.classList.add("fn__flex-1") + } + } +} From 483ae3b671a1275476a08d946d8a49f7a7e59d1b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 13:10:04 +0800 Subject: [PATCH 22/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10998 --- app/src/layout/Wnd.ts | 11 +++-------- app/src/layout/dock/util.ts | 8 ++++---- app/src/layout/index.ts | 4 +++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index 1b9d56ec98..527a4765ad 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -1,6 +1,7 @@ import {Layout} from "./index"; import {genUUID} from "../util/genID"; import { + fixWndFlex1, getInstanceById, getWndByLayout, JSONToCenter, newModelByInitData, pdfIsLoading, saveLayout, @@ -716,7 +717,7 @@ export class Wnd { // 关闭分屏页签后光标消失 const editors = getAllModels().editor; if (editors.length === 0) { - clearOBG(); + clearOBG(); } else { editors.forEach(item => { if (!item.element.classList.contains("fn__none")) { @@ -965,13 +966,6 @@ export class Wnd { } previous.resize = undefined; previous.element.classList.add("fn__flex-1"); - } else if (!previous.element.classList.contains("fn__flex-1")) { - // 分屏后要均分 https://github.com/siyuan-note/siyuan/issues/5657 - if (layout.direction === "lr") { - previous.element.style.width = (previous.element.clientWidth + element.clientWidth) + "px"; - } else { - previous.element.style.height = (previous.element.clientHeight + element.clientHeight) + "px"; - } } // https://github.com/siyuan-note/siyuan/issues/5844 if (layout.children.length > 2 && index === 0) { @@ -988,6 +982,7 @@ export class Wnd { element.nextElementSibling.remove(); } element.remove(); + fixWndFlex1(layout); resizeTabs(); } } diff --git a/app/src/layout/dock/util.ts b/app/src/layout/dock/util.ts index d1b045d773..ef00f181fc 100644 --- a/app/src/layout/dock/util.ts +++ b/app/src/layout/dock/util.ts @@ -2,7 +2,7 @@ import {getAllModels} from "../getAll"; import {Tab} from "../Tab"; import {Graph} from "./Graph"; import {Outline} from "./Outline"; -import {getInstanceById, getWndByLayout, saveLayout, switchWnd} from "../util"; +import {fixWndFlex1, getInstanceById, getWndByLayout, saveLayout, switchWnd} from "../util"; import {resizeTabs} from "../tabUtil"; import {Backlink} from "./Backlink"; import {App} from "../../index"; @@ -159,10 +159,10 @@ export const openOutline = async (protyle: IProtyle) => { })); } }), false, false); + newWnd.element.style.width = "200px"; + newWnd.element.classList.remove("fn__flex-1") switchWnd(newWnd, wnd); - // https://github.com/siyuan-note/siyuan/issues/10500 - wnd.element.classList.remove("fn__flex-1"); - wnd.element.style.width = wnd.element.parentElement.clientWidth - 200 + "px"; + fixWndFlex1(newWnd.parent); saveLayout(); }; diff --git a/app/src/layout/index.ts b/app/src/layout/index.ts index 93e8f0b255..ee2dd74fb7 100644 --- a/app/src/layout/index.ts +++ b/app/src/layout/index.ts @@ -93,7 +93,9 @@ export class Layout { } }); } - fixWndFlex1(this); + if (id) { + fixWndFlex1(this); + } addResize(child); resizeTabs(false); child.parent = this; From a049eeec3e795e4d3b33bd17b6b8b28ec3c33b93 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 13:27:19 +0800 Subject: [PATCH 23/51] :art: Improve database field sorting Fix https://github.com/siyuan-note/siyuan/issues/11038 --- kernel/av/sort.go | 16 +++++++++++----- kernel/av/table.go | 16 ++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/kernel/av/sort.go b/kernel/av/sort.go index bef5378655..97ccb11565 100644 --- a/kernel/av/sort.go +++ b/kernel/av/sort.go @@ -119,13 +119,19 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int { return 0 } case KeyTypeSelect, KeyTypeMSelect: - if 0 < len(value.MSelect) && 0 < len(other.MSelect) { - v1 := value.MSelect[0].Content - v2 := other.MSelect[0].Content - if v1 == v2 { - return 0 + if nil != value.MSelect && nil != other.MSelect { + var v1 string + for _, v := range value.MSelect { + v1 += v.Content + break + } + var v2 string + for _, v := range other.MSelect { + v2 += v.Content + break } + // 按设置的选项顺序排序 key, _ := attrView.GetKey(value.KeyID) if nil != key { optionSort := map[string]int{} diff --git a/kernel/av/table.go b/kernel/av/table.go index fb7afc8497..a5d8dc3d0e 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -213,13 +213,17 @@ func (table *Table) SortRows(attrView *AttributeView) { sorted := true for _, colIndexSort := range colIndexSorts { val1 := editedRows[i].Cells[colIndexSort.Index].Value - if nil == val1 { - return colIndexSort.Order == SortOrderAsc - } - val2 := editedRows[j].Cells[colIndexSort.Index].Value - if nil == val2 { - return colIndexSort.Order != SortOrderAsc + if nil == val1 || val1.IsEmpty() { + if nil != val2 && !val2.IsEmpty() { + return false + } + sorted = false + continue + } else { + if nil == val2 || val2.IsEmpty() { + return true + } } result := val1.Compare(val2, attrView) From cab6e015d3b893f01de21e4075ca09e042c35422 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 14:57:33 +0800 Subject: [PATCH 24/51] :art: Improve database reference anchor text https://github.com/siyuan-note/siyuan/issues/11035 --- kernel/model/blockinfo.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index 4f773cc895..a2a0a79763 100644 --- a/kernel/model/blockinfo.go +++ b/kernel/model/blockinfo.go @@ -197,6 +197,12 @@ func getNodeRefText0(node *ast.Node) string { return "Video..." case ast.NodeAudio: return "Audio..." + case ast.NodeAttributeView: + ret, _ := av.GetAttributeViewName(node.AttributeViewID) + if "" == ret { + ret = "Database " + Conf.language(105) + } + return ret } if ast.NodeDocument != node.Type && node.IsContainerBlock() { From 8127b98acea1173d4ca2f9ad66cb8ff1950cfa21 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 14:57:52 +0800 Subject: [PATCH 25/51] :art: Improve gen ktree --- kernel/model/box.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/box.go b/kernel/model/box.go index 8b2ad4d455..e4d8ffd5a1 100644 --- a/kernel/model/box.go +++ b/kernel/model/box.go @@ -458,7 +458,7 @@ func genTreeID(tree *parse.Tree) { if "" == n.IALAttr("id") && (ast.NodeParagraph == n.Type || ast.NodeList == n.Type || ast.NodeListItem == n.Type || ast.NodeBlockquote == n.Type || ast.NodeMathBlock == n.Type || ast.NodeCodeBlock == n.Type || ast.NodeHeading == n.Type || ast.NodeTable == n.Type || ast.NodeThematicBreak == n.Type || - ast.NodeYamlFrontMatter == n.Type || ast.NodeBlockQueryEmbed == n.Type || ast.NodeSuperBlock == n.Type || + ast.NodeYamlFrontMatter == n.Type || ast.NodeBlockQueryEmbed == n.Type || ast.NodeSuperBlock == n.Type || ast.NodeAttributeView == n.Type || ast.NodeHTMLBlock == n.Type || ast.NodeIFrame == n.Type || ast.NodeWidget == n.Type || ast.NodeAudio == n.Type || ast.NodeVideo == n.Type) { n.ID = ast.NewNodeID() n.KramdownIAL = [][]string{{"id", n.ID}} From c2eefd81a5485df958fdd3f2c50883db27fbd108 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 15:19:00 +0800 Subject: [PATCH 26/51] :art: Improve database checkbox field sorting https://github.com/siyuan-note/siyuan/issues/11016 --- kernel/av/value.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/av/value.go b/kernel/av/value.go index 5b188eedd3..1974f09fa0 100644 --- a/kernel/av/value.go +++ b/kernel/av/value.go @@ -208,6 +208,11 @@ func (value *Value) IsEdited() bool { return true } + if KeyTypeCheckbox == value.Type { + // 勾选框不会为空,即使勾选框未勾选,也不算是空,所以不能用下面的 IsEmpty 判断,这里使用更新时间判断是否编辑过 https://github.com/siyuan-note/siyuan/issues/11016 + return value.CreatedAt != value.UpdatedAt + } + if !value.IsEmpty() { return true } @@ -279,7 +284,7 @@ func (value *Value) IsEmpty() bool { if nil == value.Checkbox { return true } - return !value.Checkbox.Checked + return false // 勾选框不会为空 case KeyTypeRelation: return 1 > len(value.Relation.Contents) case KeyTypeRollup: From cd8f2049ff3eaf0f06650c0b33cf877324461323 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 15:36:38 +0800 Subject: [PATCH 27/51] :art: Improve database checkbox field sorting https://github.com/siyuan-note/siyuan/issues/11016 --- kernel/av/table.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/av/table.go b/kernel/av/table.go index a5d8dc3d0e..850f86850b 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -179,6 +179,14 @@ func (table *Table) SortRows(attrView *AttributeView) { for i, row := range table.Rows { for _, colIndexSort := range colIndexSorts { val := table.Rows[i].Cells[colIndexSort.Index].Value + if KeyTypeCheckbox == val.Type { + if block := row.GetBlockValue(); nil != block && block.IsEdited() { + // 如果主键编辑过,则勾选框也算作编辑过,参与排序 https://github.com/siyuan-note/siyuan/issues/11016 + editedValRows[row.ID] = true + break + } + } + if val.IsEdited() { // 如果该行某列的值已经编辑过,则该行可参与排序 editedValRows[row.ID] = true From c11e943d4d8ea403f8272462e10dabf9c25b23a2 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 16:35:49 +0800 Subject: [PATCH 28/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10768 --- app/src/protyle/render/av/asset.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts index 583e2d301c..4e0a74dc92 100644 --- a/app/src/protyle/render/av/asset.ts +++ b/app/src/protyle/render/av/asset.ts @@ -249,11 +249,6 @@ ${window.siyuan.languages.title} window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element); } /// #endif - const textElements = menu.element.querySelectorAll("textarea"); - if (textElements.length > 1) { - textElements[1].value = target.dataset.name; - textElements[0].value = linkAddress; - } const rect = target.getBoundingClientRect(); menu.open({ x: rect.right, @@ -261,6 +256,12 @@ ${window.siyuan.languages.title} w: rect.width, h: rect.height, }); + const textElements = menu.element.querySelectorAll("textarea"); + if (textElements.length > 1) { + textElements[1].value = target.dataset.name; + textElements[0].value = linkAddress; + textElements[0].focus(); + } }; export const addAssetLink = (protyle: IProtyle, data: IAV, cellElements: HTMLElement[], target: HTMLElement, blockElement: Element) => { @@ -300,6 +301,7 @@ ${window.siyuan.languages.title} w: target.parentElement.clientWidth + 8, h: rect.height, }); + menu.element.querySelector("textarea").focus(); }; export const dragUpload = (files: string[], protyle: IProtyle, cellElement: HTMLElement, avID: string) => { From 3801e030df0b2b10274881e50a8868b68faa24c6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 16:47:00 +0800 Subject: [PATCH 29/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10732 --- app/src/protyle/hint/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index 0513dbade5..d466c5c37b 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -784,7 +784,7 @@ ${genHintItemHTML(item)} focusBlock(nodeElement); } else if (nodeElement.classList.contains("av")) { avRender(nodeElement, protyle, () => { - focusBlock(nodeElement); + (nodeElement.querySelector(".av__title") as HTMLInputElement).focus(); }); } else { focusByWbr(nodeElement, range); From 3e3b31965335476a60d50c98647a37634e4a9746 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 16:52:28 +0800 Subject: [PATCH 30/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10732 --- app/src/protyle/wysiwyg/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 433404f418..7ec4908e88 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1752,7 +1752,7 @@ export class WYSIWYG { return; } const blockElement = hasClosestBlock(event.target); - if (blockElement && !getContenteditableElement(blockElement)) { + if (blockElement && (!getContenteditableElement(blockElement) || hasClosestByClassName(event.target, "av__cursor"))) { event.stopPropagation(); event.preventDefault(); return; From 605e9e243a29e1cfa4d44fc157c48c8fb93d3f90 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 17:15:04 +0800 Subject: [PATCH 31/51] :art: Improve database unbind block https://github.com/siyuan-note/siyuan/issues/11013 --- kernel/model/attribute_view.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 4db2283f86..166d62547f 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -3171,11 +3171,9 @@ func unbindBlockAv(tx *Transaction, avID, blockID string) { avIDs := strings.Split(attrs[av.NodeAttrNameAvs], ",") avIDs = gulu.Str.RemoveElem(avIDs, avID) if 0 == len(avIDs) { - delete(attrs, av.NodeAttrNameAvs) - node.RemoveIALAttr(av.NodeAttrNameAvs) + attrs[av.NodeAttrNameAvs] = "" } else { attrs[av.NodeAttrNameAvs] = strings.Join(avIDs, ",") - node.SetIALAttr(av.NodeAttrNameAvs, strings.Join(avIDs, ",")) } avNames := getAvNames(attrs[av.NodeAttrNameAvs]) From 58c98ce697bb9ced9f81ef7e4867dbf4460a0104 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 17:47:03 +0800 Subject: [PATCH 32/51] :art: Improve database unbind block Improve database unbind block --- kernel/model/attribute_view.go | 55 ++++++++++++++++++++++++++++++++++ kernel/model/transaction.go | 2 ++ 2 files changed, 57 insertions(+) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 166d62547f..dc3cd05793 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1282,6 +1282,61 @@ func getRowBlockValue(keyValues []*av.KeyValues) (ret *av.Value) { return } +func (tx *Transaction) doUnbindAttrViewBlock(operation *Operation) (ret *TxErr) { + err := unbindAttributeViewBlock(operation, tx) + if nil != err { + return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID} + } + return +} + +func unbindAttributeViewBlock(operation *Operation, tx *Transaction) (err error) { + attrView, err := av.ParseAttributeView(operation.AvID) + if nil != err { + return + } + + node, _, _ := getNodeByBlockID(tx, operation.ID) + if nil == node { + return + } + + keyValues := attrView.GetBlockKeyValues() + for _, value := range keyValues.Values { + if value.BlockID != operation.ID { + continue + } + + unbindBlockAv(tx, operation.AvID, value.BlockID) + value.BlockID = operation.NextID + if nil != value.Block { + value.Block.ID = operation.NextID + } + break + } + + replacedRowID := false + for _, v := range attrView.Views { + switch v.LayoutType { + case av.LayoutTypeTable: + for i, rowID := range v.Table.RowIDs { + if rowID == operation.ID { + v.Table.RowIDs[i] = operation.NextID + replacedRowID = true + break + } + } + + if !replacedRowID { + v.Table.RowIDs = append(v.Table.RowIDs, operation.NextID) + } + } + } + + err = av.SaveAttributeView(attrView) + return +} + func (tx *Transaction) doSetAttrViewColDate(operation *Operation) (ret *TxErr) { err := setAttributeViewColDate(operation) if nil != err { diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index cf7fb02938..6d83031726 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -294,6 +294,8 @@ func performTx(tx *Transaction) (ret *TxErr) { ret = tx.doHideAttrViewName(op) case "setAttrViewColDate": ret = tx.doSetAttrViewColDate(op) + case "unbindAttrViewBlock": + ret = tx.doUnbindAttrViewBlock(op) } if nil != ret { From 97f8d6c013a8e7de60fe4cd9397f0f30cf7a1484 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 18:00:04 +0800 Subject: [PATCH 33/51] :art: Improve database unbind block https://github.com/siyuan-note/siyuan/issues/11013 --- kernel/model/attribute_view.go | 54 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index dc3cd05793..161602dc31 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1301,18 +1301,20 @@ func unbindAttributeViewBlock(operation *Operation, tx *Transaction) (err error) return } - keyValues := attrView.GetBlockKeyValues() - for _, value := range keyValues.Values { - if value.BlockID != operation.ID { - continue - } + for _, keyValues := range attrView.KeyValues { + for _, value := range keyValues.Values { + if value.BlockID != operation.ID { + continue + } - unbindBlockAv(tx, operation.AvID, value.BlockID) - value.BlockID = operation.NextID - if nil != value.Block { - value.Block.ID = operation.NextID + if av.KeyTypeBlock == value.Type { + unbindBlockAv(tx, operation.AvID, value.BlockID) + } + value.BlockID = operation.NextID + if nil != value.Block { + value.Block.ID = operation.NextID + } } - break } replacedRowID := false @@ -2956,25 +2958,27 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error for _, keyValues := range attrView.KeyValues { for _, value := range keyValues.Values { - if value.BlockID == operation.PreviousID { - if value.BlockID != operation.NextID { - // 换绑 - unbindBlockAv(tx, operation.AvID, value.BlockID) - } - - value.BlockID = operation.NextID - if nil != value.Block { - value.Block.ID = operation.NextID - value.IsDetached = operation.IsDetached - if !operation.IsDetached { - value.Block.Content = getNodeRefText(node) - } - } + if value.BlockID != operation.PreviousID { + continue + } + if av.KeyTypeBlock == value.Type && value.BlockID != operation.NextID { + // 换绑 + unbindBlockAv(tx, operation.AvID, value.BlockID) + } + + value.BlockID = operation.NextID + if av.KeyTypeBlock == value.Type && nil != value.Block { + value.Block.ID = operation.NextID + value.IsDetached = operation.IsDetached if !operation.IsDetached { - bindBlockAv(tx, operation.AvID, operation.NextID) + value.Block.Content = getNodeRefText(node) } } + + if av.KeyTypeBlock == value.Type && !operation.IsDetached { + bindBlockAv(tx, operation.AvID, operation.NextID) + } } } From 6c4dd3674d75aa2d481ed18d2eb8403257af3d63 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 18:54:33 +0800 Subject: [PATCH 34/51] :art: Improve database reference anchor text https://github.com/siyuan-note/siyuan/issues/11035 --- kernel/model/blockinfo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index a2a0a79763..44fba8752d 100644 --- a/kernel/model/blockinfo.go +++ b/kernel/model/blockinfo.go @@ -200,7 +200,7 @@ func getNodeRefText0(node *ast.Node) string { case ast.NodeAttributeView: ret, _ := av.GetAttributeViewName(node.AttributeViewID) if "" == ret { - ret = "Database " + Conf.language(105) + ret = "Database..." } return ret } From ee42be172982bb558a8f370af007d33e415c2655 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 19:30:25 +0800 Subject: [PATCH 35/51] :art: Database date field fill end var https://ld246.com/article/1713177507282 --- kernel/model/attribute_view.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 161602dc31..ce40460710 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -901,8 +901,13 @@ func renderTemplateCol(ial map[string]string, flashcard *Flashcard, rowValues [] dataModel[rowValue.Key.Name] = v.Number.Content } } else if av.KeyTypeDate == v.Type { - if nil != v.Date && v.Date.IsNotEmpty { - dataModel[rowValue.Key.Name] = time.UnixMilli(v.Date.Content) + if nil != v.Date { + if v.Date.IsNotEmpty { + dataModel[rowValue.Key.Name] = time.UnixMilli(v.Date.Content) + } + if v.Date.IsNotEmpty2 { + dataModel[rowValue.Key.Name+"_end"] = time.UnixMilli(v.Date.Content2) + } } } else if av.KeyTypeRollup == v.Type { if 0 < len(v.Rollup.Contents) { From 3403bdca999e00164694988c427140daef3e83ca Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 20:56:46 +0800 Subject: [PATCH 36/51] :art: Improve update time of database bound document blocks https://github.com/siyuan-note/siyuan/issues/11042 --- kernel/model/transaction.go | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 6d83031726..51dc1eec98 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -1245,6 +1245,7 @@ func createdUpdated(node *ast.Node) { parents := treenode.ParentNodes(node) for _, parent := range parents { // 更新所有父节点的更新时间字段 parent.SetIALAttr("updated", updated) + cache.PutBlockIAL(parent.ID, parse.IAL2Map(parent.KramdownIAL)) } } From e779c6566cc093245fa2ab314bca487973a8557c Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 15 Apr 2024 21:43:34 +0800 Subject: [PATCH 37/51] :memo: Update changelogs --- app/changelogs/v3.0.10/v3.0.10.md | 51 ++++++++++++++++++++++++ app/changelogs/v3.0.10/v3.0.10_zh_CHT.md | 51 ++++++++++++++++++++++++ app/changelogs/v3.0.10/v3.0.10_zh_CN.md | 51 ++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 app/changelogs/v3.0.10/v3.0.10.md create mode 100644 app/changelogs/v3.0.10/v3.0.10_zh_CHT.md create mode 100644 app/changelogs/v3.0.10/v3.0.10_zh_CN.md diff --git a/app/changelogs/v3.0.10/v3.0.10.md b/app/changelogs/v3.0.10/v3.0.10.md new file mode 100644 index 0000000000..4bb5aba440 --- /dev/null +++ b/app/changelogs/v3.0.10/v3.0.10.md @@ -0,0 +1,51 @@ +## Overview + +This version improves details related to data indexing and database views. + +## Changelogs + +Below are the detailed changes in this version. + +### Enhancement + +* [Database cursor focus is no longer automatically reset to the title input](https://github.com/siyuan-note/siyuan/issues/10732) +* [Improve database asset edit](https://github.com/siyuan-note/siyuan/issues/10768) +* [Improve database table view UI when setting font size](https://github.com/siyuan-note/siyuan/issues/10885) +* [Right-click on the input to provide a copy menu](https://github.com/siyuan-note/siyuan/issues/10896) +* [Blocks bound in the database support `Add to Database`](https://github.com/siyuan-note/siyuan/issues/10929) +* [Database filter option value supports search](https://github.com/siyuan-note/siyuan/issues/10932) +* [Improve marketplace loading performance](https://github.com/siyuan-note/siyuan/issues/10973) +* [Improve data indexing performance when editing doc](https://github.com/siyuan-note/siyuan/issues/10976) +* [`Ctrl+Shift+F` no longer overlay keywords](https://github.com/siyuan-note/siyuan/issues/10980) +* [Improve left and right swiping on mobile](https://github.com/siyuan-note/siyuan/issues/10983) +* [Improve `Del` before code, tags and kbd](https://github.com/siyuan-note/siyuan/issues/10984) +* [Improve data indexing performance when importing .sy.zip and markdown](https://github.com/siyuan-note/siyuan/issues/10986) +* [Improve exporting inline code markdown element](https://github.com/siyuan-note/siyuan/issues/10988) +* [Improve default search type filtering](https://github.com/siyuan-note/siyuan/issues/11003) +* [Improve data indexing performance for creating documents](https://github.com/siyuan-note/siyuan/issues/11005) +* [Remove spell check for links, audio and other URLs](https://github.com/siyuan-note/siyuan/issues/11006) +* [Add database `lineNumber` field type](https://github.com/siyuan-note/siyuan/pull/11008) +* [Improve mobile app appearance language setting](https://github.com/siyuan-note/siyuan/issues/11009) +* [Improve database template field calc](https://github.com/siyuan-note/siyuan/issues/11011) +* [Improve database checkbox field sorting](https://github.com/siyuan-note/siyuan/issues/11016) +* [The block icon menu will no longer be displayed after selecting Delete through the block icon menu](https://github.com/siyuan-note/siyuan/issues/11028) +* [Improve database template field to use relation/rollup field](https://github.com/siyuan-note/siyuan/issues/11029) +* [Improve database reference anchor text](https://github.com/siyuan-note/siyuan/issues/11035) +* [Improve heading drag conversion doc subheading level](https://github.com/siyuan-note/siyuan/issues/11037) +* [Improve database field sorting](https://github.com/siyuan-note/siyuan/issues/11038) +* [Improve update time of database bound document blocks](https://github.com/siyuan-note/siyuan/issues/11042) + +### Bugfix + +* [Database date field between filter calculation error](https://github.com/siyuan-note/siyuan/issues/10979) +* [An error occurs when pasting a file after selecting a database row](https://github.com/siyuan-note/siyuan/issues/10996) +* [Layout exception after opened the outline](https://github.com/siyuan-note/siyuan/issues/10998) +* [Code block line numbers should not be displayed after "Clear style"](https://github.com/siyuan-note/siyuan/issues/11000) +* [Hyperlinks affect backlink calculation issue](https://github.com/siyuan-note/siyuan/issues/11001) +* [Dynamic loading results in incomplete list display](https://github.com/siyuan-note/siyuan/issues/11004) +* [Primary key value unexpectedly updated when database adds row](https://github.com/siyuan-note/siyuan/issues/11018) + +## Download + +* [B3log](https://b3log.org/siyuan/en/download.html) +* [GitHub](https://github.com/siyuan-note/siyuan/releases) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md new file mode 100644 index 0000000000..6bc380b416 --- /dev/null +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md @@ -0,0 +1,51 @@ +## 概述 + +此版本改進了資料索引和資料庫視圖相關細節。 + +## 變更記錄 + +以下是此版本中的詳細變更。 + +### 改進功能 + +* [資料庫遊標焦點不再自動重置到標題輸入框](https://github.com/siyuan-note/siyuan/issues/10732) +* [改進資料庫資源欄位編輯](https://github.com/siyuan-note/siyuan/issues/10768) +* [改進設定字體大小後資料庫表格視圖介面](https://github.com/siyuan-note/siyuan/issues/10885) +* [右鍵輸入輸入框提供複製選單](https://github.com/siyuan-note/siyuan/issues/10896) +* [資料庫中綁定的區塊支援 `新增至資料庫`](https://github.com/siyuan-note/siyuan/issues/10929) +* [資料庫過濾選項值支援搜尋](https://github.com/siyuan-note/siyuan/issues/10932) +* [改善市集載入效能](https://github.com/siyuan-note/siyuan/issues/10973) +* [編輯文件時改進資料索引效能](https://github.com/siyuan-note/siyuan/issues/10976) +* [`Ctrl+Shift+F` 不再疊加關鍵字](https://github.com/siyuan-note/siyuan/issues/10980) +* [改良行動裝置上的左右滑動](https://github.com/siyuan-note/siyuan/issues/10983) +* [改進在程式碼、標籤和鍵盤之前 `Del`](https://github.com/siyuan-note/siyuan/issues/10984) +* [導入 .sy.zip 與 markdown 時改善資料索引效能](https://github.com/siyuan-note/siyuan/issues/10986) +* [改進匯出行級程式碼 markdown 元素](https://github.com/siyuan-note/siyuan/issues/10988) +* [改進預設搜尋類型過濾](https://github.com/siyuan-note/siyuan/issues/11003) +* [建立文件時改進資料索引效能](https://github.com/siyuan-note/siyuan/issues/11005) +* [移除連結、音訊和其他 URL 的拼字檢查](https://github.com/siyuan-note/siyuan/issues/11006) +* [新增資料庫 `行號` 欄位類型](https://github.com/siyuan-note/siyuan/pull/11008) +* [改進行動應用程式外觀語言設定](https://github.com/siyuan-note/siyuan/issues/11009) +* [改進資料庫範本欄位計算](https://github.com/siyuan-note/siyuan/issues/11011) +* [改進資料庫勾選方塊欄位排序](https://github.com/siyuan-note/siyuan/issues/11016) +* [透過區塊圖示選單選擇刪除後,區塊圖示選單將不再顯示](https://github.com/siyuan-note/siyuan/issues/11028) +* [改進資料庫範本欄位使用關聯/匯總欄位](https://github.com/siyuan-note/siyuan/issues/11029) +* [改進資料庫引用錨文本](https://github.com/siyuan-note/siyuan/issues/11035) +* [改進標題拖曳轉換文件子標題等級](https://github.com/siyuan-note/siyuan/issues/11037) +* [改進資料庫欄位排序](https://github.com/siyuan-note/siyuan/issues/11038) +* [改進資料庫綁定文件區塊的更新時間](https://github.com/siyuan-note/siyuan/issues/11042) + +### 修復缺陷 + +* [資料庫日期欄位間過濾計算錯誤](https://github.com/siyuan-note/siyuan/issues/10979) +* [選取資料庫行後貼上檔案報錯](https://github.com/siyuan-note/siyuan/issues/10996) +* [開啟大綱後版面異常](https://github.com/siyuan-note/siyuan/issues/10998) +* ["清除樣式"後不應顯示程式碼區塊行號](https://github.com/siyuan-note/siyuan/issues/11000) +* [超連結影響反向連結計算問題](https://github.com/siyuan-note/siyuan/issues/11001) +* [動態載入導致清單顯示不完整](https://github.com/siyuan-note/siyuan/issues/11004) +* [資料庫新增行時主鍵值意外更新](https://github.com/siyuan-note/siyuan/issues/11018) + +## 下載 + +* [B3log](https://b3log.org/siyuan/download.html) +* [GitHub](https://github.com/siyuan-note/siyuan/releases) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md new file mode 100644 index 0000000000..026e2b233e --- /dev/null +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md @@ -0,0 +1,51 @@ +## 概述 + +该版本改进了数据索引和数据库视图相关细节。 + +## 变更记录 + +以下是此版本中的详细变更。 + +### 改进功能 + +* [数据库光标焦点不再自动重置到标题输入框](https://github.com/siyuan-note/siyuan/issues/10732) +* [改进数据库资源字段编辑](https://github.com/siyuan-note/siyuan/issues/10768) +* [改进设置字体大小后数据库表格视图界面](https://github.com/siyuan-note/siyuan/issues/10885) +* [右键单击输入框提供复制菜单](https://github.com/siyuan-note/siyuan/issues/10896) +* [数据库中绑定的块支持 `添加到数据库`](https://github.com/siyuan-note/siyuan/issues/10929) +* [数据库过滤选项值支持搜索](https://github.com/siyuan-note/siyuan/issues/10932) +* [改进集市加载性能](https://github.com/siyuan-note/siyuan/issues/10973) +* [编辑文档时改进数据索引性能](https://github.com/siyuan-note/siyuan/issues/10976) +* [`Ctrl+Shift+F` 不再叠加关键字](https://github.com/siyuan-note/siyuan/issues/10980) +* [改进移动设备上的左右滑动](https://github.com/siyuan-note/siyuan/issues/10983) +* [改进在代码、标签和键盘之前 `Del`](https://github.com/siyuan-note/siyuan/issues/10984) +* [导入 .sy.zip 和 markdown 时改进数据索引性能](https://github.com/siyuan-note/siyuan/issues/10986) +* [改进导出行级代码 markdown 元素](https://github.com/siyuan-note/siyuan/issues/10988) +* [改进默认搜索类型过滤](https://github.com/siyuan-note/siyuan/issues/11003) +* [创建文档时改进数据索引性能](https://github.com/siyuan-note/siyuan/issues/11005) +* [移除链接、音频和其他 URL 的拼写检查](https://github.com/siyuan-note/siyuan/issues/11006) +* [添加数据库 `行号` 字段类型](https://github.com/siyuan-note/siyuan/pull/11008) +* [改进移动应用程序外观语言设置](https://github.com/siyuan-note/siyuan/issues/11009) +* [改进数据库模板字段计算](https://github.com/siyuan-note/siyuan/issues/11011) +* [改进数据库勾选框字段排序](https://github.com/siyuan-note/siyuan/issues/11016) +* [通过块图标菜单选择删除后,块图标菜单将不再显示](https://github.com/siyuan-note/siyuan/issues/11028) +* [改进数据库模板字段使用关联/汇总字段](https://github.com/siyuan-note/siyuan/issues/11029) +* [改进数据库引用锚文本](https://github.com/siyuan-note/siyuan/issues/11035) +* [改进标题拖拽转换文档子标题级别](https://github.com/siyuan-note/siyuan/issues/11037) +* [改进数据库字段排序](https://github.com/siyuan-note/siyuan/issues/11038) +* [改进数据库绑定文档块的更新时间](https://github.com/siyuan-note/siyuan/issues/11042) + +### 修复缺陷 + +* [数据库日期字段间过滤计算错误](https://github.com/siyuan-note/siyuan/issues/10979) +* [选中数据库行后粘贴文件报错](https://github.com/siyuan-note/siyuan/issues/10996) +* [打开大纲后布局异常](https://github.com/siyuan-note/siyuan/issues/10998) +* ["清除样式"后不应显示代码块行号](https://github.com/siyuan-note/siyuan/issues/11000) +* [超链接影响反向链接计算问题](https://github.com/siyuan-note/siyuan/issues/11001) +* [动态加载导致列表显示不完整](https://github.com/siyuan-note/siyuan/issues/11004) +* [数据库添加行时主键值意外更新](https://github.com/siyuan-note/siyuan/issues/11018) + +## 下载 + +* [B3log](https://b3log.org/siyuan/download.html) +* [GitHub](https://github.com/siyuan-note/siyuan/releases) From 0c1325fbc5a96e053d0a5bcd315e087f15191d91 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 22:12:56 +0800 Subject: [PATCH 38/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10958 --- app/src/boot/globalEvent/keydown.ts | 2 ++ app/src/protyle/gutter/index.ts | 6 ++++-- app/src/protyle/header/openTitleMenu.ts | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index 690957c36e..f8d4df7e63 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -328,6 +328,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { srcIDs: sourceIds, avID, }]); + focusByRange(range) }); } else { const selectElement: Element[] = []; @@ -362,6 +363,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { srcIDs: sourceIds, avID, }]); + focusByRange(range) }); } event.preventDefault(); diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 84f368bdfd..b0c3e22f89 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -811,6 +811,7 @@ export class Gutter { }); } }).element); + const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.addToDatabase, accelerator: window.siyuan.config.keymap.general.addToDatabase.custom, @@ -838,7 +839,7 @@ export class Gutter { srcIDs: sourceIds, avID, }]); - focusBlock(selectsElement[0]); + focusByRange(range); }); } }).element); @@ -1278,6 +1279,7 @@ export class Gutter { }); } }).element); + const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.addToDatabase, accelerator: window.siyuan.config.keymap.general.addToDatabase.custom, @@ -1302,7 +1304,7 @@ export class Gutter { srcIDs: sourceIds, avID, }]); - focusBlock(nodeElement); + focusByRange(range); }); } }).element); diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts index e366d1f44d..8b16b5edfe 100644 --- a/app/src/protyle/header/openTitleMenu.ts +++ b/app/src/protyle/header/openTitleMenu.ts @@ -23,6 +23,7 @@ import {genImportMenu} from "../../menus/navigation"; import {transferBlockRef} from "../../menus/block"; import {openSearchAV} from "../render/av/relation"; import {transaction} from "../wysiwyg/transaction"; +import {focusByRange} from "../util/selection"; export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { hideTooltip(); @@ -44,6 +45,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { }).element); if (!protyle.disabled) { window.siyuan.menus.menu.append(movePathToMenu([protyle.path])); + const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.addToDatabase, accelerator: window.siyuan.config.keymap.general.addToDatabase.custom, @@ -68,6 +70,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { srcIDs: sourceIds, avID, }]); + focusByRange(range); }); } }).element); From 7b702c8b11d755784129d7566766a1a1d140eadf Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 22:57:04 +0800 Subject: [PATCH 39/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10844 --- app/src/assets/scss/business/_av.scss | 5 +++++ app/src/protyle/render/av/render.ts | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss index 60fa2e0d11..4d81631f46 100644 --- a/app/src/assets/scss/business/_av.scss +++ b/app/src/assets/scss/business/_av.scss @@ -182,6 +182,11 @@ white-space: nowrap; cursor: pointer; + &:first-child { + padding-left: 1.625em; + box-sizing: initial; + } + &.av__calc--ashow { opacity: 1; } diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 4d6dbe36da..9287ed6913 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -132,11 +132,10 @@ style="width: ${column.width || "200px"};"> // lineNumber type 不参与计算操作 if (column.type === "lineNumber") { - calcHTML += `
 
`; + calcHTML += `
 
`; } else { - calcHTML += `
${getCalcValue(column) || '' + window.siyuan.languages.calc}
`; + calcHTML += `
${getCalcValue(column) || '' + window.siyuan.languages.calc}
`; } if (pinIndex === index) { From 781183e4340689a91b209df42473cee86e0f04f8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 15 Apr 2024 23:28:06 +0800 Subject: [PATCH 40/51] :art: fix https://github.com/siyuan-note/siyuan/issues/11034 --- app/src/assets/scss/protyle/_wysiwyg.scss | 3 ++- app/src/block/Panel.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/assets/scss/protyle/_wysiwyg.scss b/app/src/assets/scss/protyle/_wysiwyg.scss index 0472d1bae7..9758317514 100644 --- a/app/src/assets/scss/protyle/_wysiwyg.scss +++ b/app/src/assets/scss/protyle/_wysiwyg.scss @@ -635,7 +635,8 @@ } .protyle-wysiwyg:not([contenteditable]), -.protyle-wysiwyg[data-readonly="true"] { +.protyle-wysiwyg[data-readonly="true"], +.protyle-wysiwyg__embed { .img:hover .protyle-icons { display: none; } diff --git a/app/src/block/Panel.ts b/app/src/block/Panel.ts index 6ce2c81af5..bd57c0b17c 100644 --- a/app/src/block/Panel.ts +++ b/app/src/block/Panel.ts @@ -265,6 +265,9 @@ export class BlockPanel { this.element.querySelectorAll(".block__edit").forEach((item: HTMLElement, index) => { if (index < 5) { this.initProtyle(item, index === 0 ? () => { + if (!document.contains(this.element)) { + return; + } let targetRect; if (this.targetElement && this.targetElement.classList.contains("protyle-wysiwyg__embed")) { targetRect = this.targetElement.getBoundingClientRect(); From f0892d11c6962d82efd37724742a784bd105e2a0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 16 Apr 2024 00:14:01 +0800 Subject: [PATCH 41/51] :memo: Update changelogs --- app/changelogs/v3.0.10/v3.0.10.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CHT.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/app/changelogs/v3.0.10/v3.0.10.md b/app/changelogs/v3.0.10/v3.0.10.md index 4bb5aba440..615cf4688b 100644 --- a/app/changelogs/v3.0.10/v3.0.10.md +++ b/app/changelogs/v3.0.10/v3.0.10.md @@ -21,6 +21,7 @@ Below are the detailed changes in this version. * [Improve `Del` before code, tags and kbd](https://github.com/siyuan-note/siyuan/issues/10984) * [Improve data indexing performance when importing .sy.zip and markdown](https://github.com/siyuan-note/siyuan/issues/10986) * [Improve exporting inline code markdown element](https://github.com/siyuan-note/siyuan/issues/10988) +* [Prevent frontend request pending](https://github.com/siyuan-note/siyuan/issues/10992) * [Improve default search type filtering](https://github.com/siyuan-note/siyuan/issues/11003) * [Improve data indexing performance for creating documents](https://github.com/siyuan-note/siyuan/issues/11005) * [Remove spell check for links, audio and other URLs](https://github.com/siyuan-note/siyuan/issues/11006) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md index 6bc380b416..aaa73b8433 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md @@ -21,6 +21,7 @@ * [改進在程式碼、標籤和鍵盤之前 `Del`](https://github.com/siyuan-note/siyuan/issues/10984) * [導入 .sy.zip 與 markdown 時改善資料索引效能](https://github.com/siyuan-note/siyuan/issues/10986) * [改進匯出行級程式碼 markdown 元素](https://github.com/siyuan-note/siyuan/issues/10988) +* [避免前端要求等待處理](https://github.com/siyuan-note/siyuan/issues/10992) * [改進預設搜尋類型過濾](https://github.com/siyuan-note/siyuan/issues/11003) * [建立文件時改進資料索引效能](https://github.com/siyuan-note/siyuan/issues/11005) * [移除連結、音訊和其他 URL 的拼字檢查](https://github.com/siyuan-note/siyuan/issues/11006) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md index 026e2b233e..afc071f22c 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md @@ -21,6 +21,7 @@ * [改进在代码、标签和键盘之前 `Del`](https://github.com/siyuan-note/siyuan/issues/10984) * [导入 .sy.zip 和 markdown 时改进数据索引性能](https://github.com/siyuan-note/siyuan/issues/10986) * [改进导出行级代码 markdown 元素](https://github.com/siyuan-note/siyuan/issues/10988) +* [避免前端请求等待处理](https://github.com/siyuan-note/siyuan/issues/10992) * [改进默认搜索类型过滤](https://github.com/siyuan-note/siyuan/issues/11003) * [创建文档时改进数据索引性能](https://github.com/siyuan-note/siyuan/issues/11005) * [移除链接、音频和其他 URL 的拼写检查](https://github.com/siyuan-note/siyuan/issues/11006) From ffbb1423b36e94a0ec7b253637ee177f750a9294 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 16 Apr 2024 00:18:04 +0800 Subject: [PATCH 42/51] :art: fix https://github.com/siyuan-note/siyuan/issues/11013 --- app/src/protyle/render/av/cell.ts | 33 ++++++++++++++++++++---------- app/src/protyle/util/insertHTML.ts | 6 ++++-- app/src/types/index.d.ts | 1 + 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 18e1f53179..8d5a38e24e 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -552,7 +552,6 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va if (["created", "updated", "template", "rollup"].includes(type)) { return; } - const rowID = rowElement.getAttribute("data-id"); const cellId = item.dataset.id; // 刚创建时无 id,更新需和 oldValue 保持一致 const colId = item.dataset.colId; @@ -589,14 +588,25 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va if (objEquals(cellValue, oldValue)) { return; } - doOperations.push({ - action: "updateAttrViewCell", - id: cellId, - avID, - keyID: colId, - rowID, - data: cellValue - }); + if (type === "block" && !item.dataset.detached) { + const newId = Lute.NewNodeID() + doOperations.push({ + action: "unbindAttrViewBlock", + id: rowID, + nextID: newId + }); + rowElement.dataset.id = newId; + item.dataset.blockId = newId; + } else { + doOperations.push({ + action: "updateAttrViewCell", + id: cellId, + avID, + keyID: colId, + rowID, + data: cellValue + }); + } undoOperations.push({ action: "updateAttrViewCell", id: cellId, @@ -718,7 +728,7 @@ export const renderCell = (cellValue: IAVCellValue, rowIndex = 0) => { } if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated", "lineNumber"].includes(cellValue.type) && - ( cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) { + (cellValue.type === "lineNumber" || (cellValue && cellValue[cellValue.type as "url"].content))) { text += ``; } return text; @@ -840,7 +850,8 @@ export const dragFillCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, const originKeys = Object.keys(originData); Object.keys(newData).forEach((rowID, index) => { newData[rowID].forEach((item, cellIndex) => { - if (["rollup", "template", "created", "updated"].includes(item.type)) { + if (["rollup", "template", "created", "updated"].includes(item.type) || + (item.type === "block" && item.element.getAttribute("data-detached") !== "true")) { return; } // https://ld246.com/article/1707975507571 数据库下拉填充数据后异常 diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts index 8fb342f47f..e17c052d8f 100644 --- a/app/src/protyle/util/insertHTML.ts +++ b/app/src/protyle/util/insertHTML.ts @@ -71,7 +71,8 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: return true; } const type = getTypeByCellElement(cellElement) || cellElement.dataset.type as TAVCol; - if (["created", "updated", "template", "rollup"].includes(type)) { + if (["created", "updated", "template", "rollup"].includes(type) || + (type === "block" && !cellElement.dataset.detached)) { return; } const rowID = currentRowElement.getAttribute("data-id"); @@ -89,7 +90,8 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement: return; } cellValue = genCellValue(type, cellValue[cellValue.type as "text"].content.toString()); - } else if (cellValue.type === "block") { + } + if (cellValue.type === "block") { cellValue.isDetached = true; delete cellValue.block.id; } diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index b06ba0815f..cb505f9260 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -50,6 +50,7 @@ type TOperation = | "updateAttrViewColRollup" | "hideAttrViewName" | "setAttrViewColDate" + | "unbindAttrViewBlock" type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins" type TCardType = "doc" | "notebook" | "all" type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" | From 3a76a1118cf49f83f3594dd6fc8c4a07fe6196cc Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 16 Apr 2024 00:30:39 +0800 Subject: [PATCH 43/51] =?UTF-8?q?:art:=20no=20=E6=8D=A2=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/render/av/col.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 2dd6e6b9d6..9655a1927d 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -522,7 +522,7 @@ export const getColIconByType = (type: TAVCol) => { case "checkbox": return "iconCheck"; case "lineNumber": - return "iconSpreadOdd"; + return "iconOrderedList"; } }; @@ -1440,7 +1440,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st }); // 在创建时间前插入 lineNumber menu.addItem({ - icon: "iconSpreadOdd", + icon: "iconOrderedList", label: window.siyuan.languages.lineNumber, click() { const id = Lute.NewNodeID(); From 69371f5a7243464c194c595baf1ea90c4ea1691f Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 16 Apr 2024 08:55:33 +0800 Subject: [PATCH 44/51] :art: --- app/src/protyle/render/av/cell.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 8d5a38e24e..5644196077 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -593,7 +593,8 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va doOperations.push({ action: "unbindAttrViewBlock", id: rowID, - nextID: newId + nextID: newId, + avID, }); rowElement.dataset.id = newId; item.dataset.blockId = newId; From e4986f421b7470387dfbdcb8f6f32bfcf5f40a6d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 16 Apr 2024 00:16:44 +0800 Subject: [PATCH 45/51] :memo: Update changelogs --- app/changelogs/v3.0.10/v3.0.10.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CHT.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/app/changelogs/v3.0.10/v3.0.10.md b/app/changelogs/v3.0.10/v3.0.10.md index 615cf4688b..c734754774 100644 --- a/app/changelogs/v3.0.10/v3.0.10.md +++ b/app/changelogs/v3.0.10/v3.0.10.md @@ -31,6 +31,7 @@ Below are the detailed changes in this version. * [Improve database checkbox field sorting](https://github.com/siyuan-note/siyuan/issues/11016) * [The block icon menu will no longer be displayed after selecting Delete through the block icon menu](https://github.com/siyuan-note/siyuan/issues/11028) * [Improve database template field to use relation/rollup field](https://github.com/siyuan-note/siyuan/issues/11029) +* [Disable edit of database table view in embed block](https://github.com/siyuan-note/siyuan/issues/11034) * [Improve database reference anchor text](https://github.com/siyuan-note/siyuan/issues/11035) * [Improve heading drag conversion doc subheading level](https://github.com/siyuan-note/siyuan/issues/11037) * [Improve database field sorting](https://github.com/siyuan-note/siyuan/issues/11038) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md index aaa73b8433..88fa808cee 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md @@ -31,6 +31,7 @@ * [改進資料庫勾選方塊欄位排序](https://github.com/siyuan-note/siyuan/issues/11016) * [透過區塊圖示選單選擇刪除後,區塊圖示選單將不再顯示](https://github.com/siyuan-note/siyuan/issues/11028) * [改進資料庫範本欄位使用關聯/匯總欄位](https://github.com/siyuan-note/siyuan/issues/11029) +* [禁止在嵌入區塊中編輯資料庫檢視](https://github.com/siyuan-note/siyuan/issues/11034) * [改進資料庫引用錨文本](https://github.com/siyuan-note/siyuan/issues/11035) * [改進標題拖曳轉換文件子標題等級](https://github.com/siyuan-note/siyuan/issues/11037) * [改進資料庫欄位排序](https://github.com/siyuan-note/siyuan/issues/11038) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md index afc071f22c..fa0e12d104 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md @@ -31,6 +31,7 @@ * [改进数据库勾选框字段排序](https://github.com/siyuan-note/siyuan/issues/11016) * [通过块图标菜单选择删除后,块图标菜单将不再显示](https://github.com/siyuan-note/siyuan/issues/11028) * [改进数据库模板字段使用关联/汇总字段](https://github.com/siyuan-note/siyuan/issues/11029) +* [禁止在嵌入块中编辑数据库视图](https://github.com/siyuan-note/siyuan/issues/11034) * [改进数据库引用锚文本](https://github.com/siyuan-note/siyuan/issues/11035) * [改进标题拖拽转换文档子标题级别](https://github.com/siyuan-note/siyuan/issues/11037) * [改进数据库字段排序](https://github.com/siyuan-note/siyuan/issues/11038) From c1bf8bf04f8cc6df8f885a1a746d94e5366a2c70 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 16 Apr 2024 09:27:35 +0800 Subject: [PATCH 46/51] :art: fix https://github.com/siyuan-note/siyuan/issues/11046 --- app/src/block/popover.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index a4f33634b7..6c3d250506 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -136,7 +136,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => { return false; } - const avPanelElement = hasClosestByClassName(target, "av__panel"); + const avPanelElement = hasClosestByClassName(target, "av__panel") || hasClosestByClassName(target, "av__mask"); if (avPanelElement) { // 浮窗上点击 av 操作,浮窗不能消失 const blockPanel = window.siyuan.blockPanels.find((item) => { From 26984f39df38195c1da49fd07cb2a544d90500e8 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 16 Apr 2024 09:01:08 +0800 Subject: [PATCH 47/51] :memo: Update changelogs --- app/changelogs/v3.0.10/v3.0.10.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CHT.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/app/changelogs/v3.0.10/v3.0.10.md b/app/changelogs/v3.0.10/v3.0.10.md index c734754774..f955cf5095 100644 --- a/app/changelogs/v3.0.10/v3.0.10.md +++ b/app/changelogs/v3.0.10/v3.0.10.md @@ -28,6 +28,7 @@ Below are the detailed changes in this version. * [Add database `lineNumber` field type](https://github.com/siyuan-note/siyuan/pull/11008) * [Improve mobile app appearance language setting](https://github.com/siyuan-note/siyuan/issues/11009) * [Improve database template field calc](https://github.com/siyuan-note/siyuan/issues/11011) +* [Improve database unbind block](https://github.com/siyuan-note/siyuan/issues/11013) * [Improve database checkbox field sorting](https://github.com/siyuan-note/siyuan/issues/11016) * [The block icon menu will no longer be displayed after selecting Delete through the block icon menu](https://github.com/siyuan-note/siyuan/issues/11028) * [Improve database template field to use relation/rollup field](https://github.com/siyuan-note/siyuan/issues/11029) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md index 88fa808cee..614665df74 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md @@ -28,6 +28,7 @@ * [新增資料庫 `行號` 欄位類型](https://github.com/siyuan-note/siyuan/pull/11008) * [改進行動應用程式外觀語言設定](https://github.com/siyuan-note/siyuan/issues/11009) * [改進資料庫範本欄位計算](https://github.com/siyuan-note/siyuan/issues/11011) +* [改進資料庫解綁區塊](https://github.com/siyuan-note/siyuan/issues/11013) * [改進資料庫勾選方塊欄位排序](https://github.com/siyuan-note/siyuan/issues/11016) * [透過區塊圖示選單選擇刪除後,區塊圖示選單將不再顯示](https://github.com/siyuan-note/siyuan/issues/11028) * [改進資料庫範本欄位使用關聯/匯總欄位](https://github.com/siyuan-note/siyuan/issues/11029) diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md index fa0e12d104..3240265425 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md @@ -28,6 +28,7 @@ * [添加数据库 `行号` 字段类型](https://github.com/siyuan-note/siyuan/pull/11008) * [改进移动应用程序外观语言设置](https://github.com/siyuan-note/siyuan/issues/11009) * [改进数据库模板字段计算](https://github.com/siyuan-note/siyuan/issues/11011) +* [改进数据库解绑块](https://github.com/siyuan-note/siyuan/issues/11013) * [改进数据库勾选框字段排序](https://github.com/siyuan-note/siyuan/issues/11016) * [通过块图标菜单选择删除后,块图标菜单将不再显示](https://github.com/siyuan-note/siyuan/issues/11028) * [改进数据库模板字段使用关联/汇总字段](https://github.com/siyuan-note/siyuan/issues/11029) From 94d3ccfa9f5cdd596f11b679fa6b93579704cda2 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 16 Apr 2024 09:01:56 +0800 Subject: [PATCH 48/51] :art: Clean code --- app/electron/main.js | 4 ++-- app/src/boot/globalEvent/keydown.ts | 4 ++-- app/src/layout/dock/util.ts | 2 +- app/src/layout/util.ts | 24 +++++++++++------------ app/src/protyle/gutter/index.ts | 4 ++-- app/src/protyle/header/openTitleMenu.ts | 2 +- app/src/protyle/render/av/cell.ts | 2 +- app/src/protyle/render/av/filter.ts | 18 ++++++++--------- app/src/protyle/render/highlightRender.ts | 2 +- app/src/protyle/upload/index.ts | 12 ++++++------ app/src/protyle/util/selection.ts | 2 +- app/src/protyle/wysiwyg/input.ts | 2 +- 12 files changed, 39 insertions(+), 39 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index c0407376d9..57a543a1dc 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -713,8 +713,8 @@ app.whenReady().then(() => { }), new MenuItem({ role: "selectAll", label: langs.selectAll })]; - const menu = Menu.buildFromTemplate(template) - menu.popup({window: BrowserWindow.fromWebContents(event.sender)}) + const menu = Menu.buildFromTemplate(template); + menu.popup({window: BrowserWindow.fromWebContents(event.sender)}); }); ipcMain.on("siyuan-open-folder", (event, filePath) => { shell.showItemInFolder(filePath); diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index f8d4df7e63..0821df3dba 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -328,7 +328,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { srcIDs: sourceIds, avID, }]); - focusByRange(range) + focusByRange(range); }); } else { const selectElement: Element[] = []; @@ -363,7 +363,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { srcIDs: sourceIds, avID, }]); - focusByRange(range) + focusByRange(range); }); } event.preventDefault(); diff --git a/app/src/layout/dock/util.ts b/app/src/layout/dock/util.ts index ef00f181fc..3f6298dbc7 100644 --- a/app/src/layout/dock/util.ts +++ b/app/src/layout/dock/util.ts @@ -160,7 +160,7 @@ export const openOutline = async (protyle: IProtyle) => { } }), false, false); newWnd.element.style.width = "200px"; - newWnd.element.classList.remove("fn__flex-1") + newWnd.element.classList.remove("fn__flex-1"); switchWnd(newWnd, wnd); fixWndFlex1(newWnd.parent); saveLayout(); diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 2401df7158..209d8cba19 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -910,7 +910,7 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout. export const fixWndFlex1 = (layout: Layout) => { if (layout.children.length < 2) { - return + return; } if (layout.children[layout.children.length - 2].element.classList.contains("fn__flex-1")) { return; @@ -919,27 +919,27 @@ export const fixWndFlex1 = (layout: Layout) => { if (index !== layout.children.length - 2) { if (layout.direction === "lr") { if (item.element.classList.contains("fn__flex-1")) { - item.element.style.width = item.element.clientWidth + "px" - item.element.classList.remove("fn__flex-1") + item.element.style.width = item.element.clientWidth + "px"; + item.element.classList.remove("fn__flex-1"); } } else { if (item.element.classList.contains("fn__flex-1")) { - item.element.style.height = item.element.clientHeight + "px" - item.element.classList.remove("fn__flex-1") + item.element.style.height = item.element.clientHeight + "px"; + item.element.classList.remove("fn__flex-1"); } } } - }) - const flex1Element = layout.children[layout.children.length - 2].element + }); + const flex1Element = layout.children[layout.children.length - 2].element; if (layout.direction === "lr") { if (flex1Element.style.width) { - flex1Element.style.width = "" - flex1Element.classList.add("fn__flex-1") + flex1Element.style.width = ""; + flex1Element.classList.add("fn__flex-1"); } } else { if (flex1Element.style.height) { - flex1Element.style.height = "" - flex1Element.classList.add("fn__flex-1") + flex1Element.style.height = ""; + flex1Element.classList.add("fn__flex-1"); } } -} +}; diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index b0c3e22f89..1d4f72a664 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -811,7 +811,7 @@ export class Gutter { }); } }).element); - const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined + const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined; window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.addToDatabase, accelerator: window.siyuan.config.keymap.general.addToDatabase.custom, @@ -1279,7 +1279,7 @@ export class Gutter { }); } }).element); - const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined + const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined; window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.addToDatabase, accelerator: window.siyuan.config.keymap.general.addToDatabase.custom, diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts index 8b16b5edfe..287e65448f 100644 --- a/app/src/protyle/header/openTitleMenu.ts +++ b/app/src/protyle/header/openTitleMenu.ts @@ -45,7 +45,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => { }).element); if (!protyle.disabled) { window.siyuan.menus.menu.append(movePathToMenu([protyle.path])); - const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined + const range = getSelection().rangeCount > 0 ? getSelection().getRangeAt(0) : undefined; window.siyuan.menus.menu.append(new MenuItem({ label: window.siyuan.languages.addToDatabase, accelerator: window.siyuan.config.keymap.general.addToDatabase.custom, diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 5644196077..1e681e9287 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -589,7 +589,7 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va return; } if (type === "block" && !item.dataset.detached) { - const newId = Lute.NewNodeID() + const newId = Lute.NewNodeID(); doOperations.push({ action: "unbindAttrViewBlock", id: rowID, diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index 520e04c047..2ba4c41578 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -57,17 +57,17 @@ const toggleEmpty = (element: HTMLElement, operator: string, type: TAVCol) => { const filterSelect = (key: string) => { window.siyuan.menus.menu.element.querySelectorAll(".b3-menu__item").forEach((item) => { - const nameElement = item.querySelector(".b3-chip.b3-chip--middle") as HTMLElement + const nameElement = item.querySelector(".b3-chip.b3-chip--middle") as HTMLElement; if (nameElement) { - const itemName = nameElement.dataset.name.toLowerCase() + const itemName = nameElement.dataset.name.toLowerCase(); if (!key || (key.indexOf(itemName) > -1 || itemName.indexOf(key) > -1)) { item.classList.remove("fn__none"); } else { item.classList.add("fn__none"); } } - }) -} + }); +}; export const setFilter = async (options: { filter: IAVFilter, @@ -332,7 +332,7 @@ export const setFilter = async (options: { type: "readonly", label: ``, bind(element) { - const selectSearchElement = element.querySelector("input") + const selectSearchElement = element.querySelector("input"); selectSearchElement.addEventListener("keydown", (event: KeyboardEvent) => { if (event.isComposing) { return; @@ -344,18 +344,18 @@ export const setFilter = async (options: { } currentElement.dispatchEvent(new CustomEvent("click")); } - }) + }); selectSearchElement.addEventListener("input", (event: InputEvent) => { if (event.isComposing) { return; } filterSelect(selectSearchElement.value.toLowerCase()); - }) + }); selectSearchElement.addEventListener("compositionend", () => { filterSelect(selectSearchElement.value.toLowerCase()); - }) + }); } - }) + }); } colData.options?.forEach((option) => { let icon = "iconUncheck"; diff --git a/app/src/protyle/render/highlightRender.ts b/app/src/protyle/render/highlightRender.ts index f7872e5938..80accfb7b9 100644 --- a/app/src/protyle/render/highlightRender.ts +++ b/app/src/protyle/render/highlightRender.ts @@ -125,7 +125,7 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) = }; export const lineNumberRender = (block: HTMLElement) => { - const lineNumber = block.parentElement.getAttribute("lineNumber") + const lineNumber = block.parentElement.getAttribute("lineNumber"); if (lineNumber === "false") { return; } diff --git a/app/src/protyle/upload/index.ts b/app/src/protyle/upload/index.ts index 6b41340d10..25a0c1b300 100644 --- a/app/src/protyle/upload/index.ts +++ b/app/src/protyle/upload/index.ts @@ -145,20 +145,20 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => { }); if ((nodeElement && nodeElement.classList.contains("av"))) { - const cellElements: HTMLElement[] = [] + const cellElements: HTMLElement[] = []; nodeElement.querySelectorAll(".av__row--select:not(.av__row--header)").forEach(item => { item.querySelectorAll(".av__cell").forEach((cellItem: HTMLElement) => { if (getTypeByCellElement(cellItem) === "mAsset") { cellElements.push(cellItem); } - }) - }) + }); + }); if (cellElements.length === 0) { protyle.wysiwyg.element.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => { if (getTypeByCellElement(item) === "mAsset") { cellElements.push(item); } - }) + }); } if (cellElements.length > 0) { updateCellsValue(protyle, nodeElement, avAssets, cellElements); @@ -170,12 +170,12 @@ const genUploadedLabel = (responseText: string, protyle: IProtyle) => { } if (document.querySelector(".av__panel")) { - const cellElements: HTMLElement[] = [] + const cellElements: HTMLElement[] = []; protyle.wysiwyg.element.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => { if (getTypeByCellElement(item) === "mAsset") { cellElements.push(item); } - }) + }); if (cellElements.length > 0) { const blockElement = hasClosestBlock(cellElements[0]); if (blockElement) { diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts index a5401a9011..7f0f280b9a 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -532,7 +532,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar range.collapse(true); setRange = true; } else if (type === "NodeAttributeView") { - const cursorElement = element.querySelector(".av__cursor") + const cursorElement = element.querySelector(".av__cursor"); if (cursorElement) { range.setStart(cursorElement.firstChild, 0); setRange = true; diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts index fbc2d5e618..a984c39b0a 100644 --- a/app/src/protyle/wysiwyg/input.ts +++ b/app/src/protyle/wysiwyg/input.ts @@ -20,7 +20,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range: return; } if (blockElement.classList.contains("av")) { - const avCursorElement = hasClosestByClassName(range.startContainer, "av__cursor") + const avCursorElement = hasClosestByClassName(range.startContainer, "av__cursor"); if (avCursorElement) { range.startContainer.textContent = Constants.ZWSP; } else { From 54ae0edc3398e61daeb73e8752d144a52c4eda17 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 16 Apr 2024 09:29:23 +0800 Subject: [PATCH 49/51] :memo: Update changelogs --- app/changelogs/v3.0.10/v3.0.10.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CHT.md | 1 + app/changelogs/v3.0.10/v3.0.10_zh_CN.md | 1 + 3 files changed, 3 insertions(+) diff --git a/app/changelogs/v3.0.10/v3.0.10.md b/app/changelogs/v3.0.10/v3.0.10.md index f955cf5095..b04f118780 100644 --- a/app/changelogs/v3.0.10/v3.0.10.md +++ b/app/changelogs/v3.0.10/v3.0.10.md @@ -47,6 +47,7 @@ Below are the detailed changes in this version. * [Hyperlinks affect backlink calculation issue](https://github.com/siyuan-note/siyuan/issues/11001) * [Dynamic loading results in incomplete list display](https://github.com/siyuan-note/siyuan/issues/11004) * [Primary key value unexpectedly updated when database adds row](https://github.com/siyuan-note/siyuan/issues/11018) +* [The floating window disappears when editing a new row in the database in the floating window](https://github.com/siyuan-note/siyuan/issues/11046) ## Download diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md index 614665df74..723ba06afd 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CHT.md @@ -47,6 +47,7 @@ * [超連結影響反向連結計算問題](https://github.com/siyuan-note/siyuan/issues/11001) * [動態載入導致清單顯示不完整](https://github.com/siyuan-note/siyuan/issues/11004) * [資料庫新增行時主鍵值意外更新](https://github.com/siyuan-note/siyuan/issues/11018) +* [在浮動浮窗中編輯資料庫新建一行時浮窗消失](https://github.com/siyuan-note/siyuan/issues/11046) ## 下載 diff --git a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md index 3240265425..1c6c70d27a 100644 --- a/app/changelogs/v3.0.10/v3.0.10_zh_CN.md +++ b/app/changelogs/v3.0.10/v3.0.10_zh_CN.md @@ -47,6 +47,7 @@ * [超链接影响反向链接计算问题](https://github.com/siyuan-note/siyuan/issues/11001) * [动态加载导致列表显示不完整](https://github.com/siyuan-note/siyuan/issues/11004) * [数据库添加行时主键值意外更新](https://github.com/siyuan-note/siyuan/issues/11018) +* [在浮动浮窗中编辑数据库新建一行时浮窗消失](https://github.com/siyuan-note/siyuan/issues/11046) ## 下载 From 9b64cf0079c6526d2c5a0a8ee99bc5559ae0a80d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 16 Apr 2024 09:31:28 +0800 Subject: [PATCH 50/51] :bookmark: Release v3.0.10 --- .github/workflows/dockerimage.yml | 2 +- app/appx/AppxManifest.xml | 2 +- app/package.json | 2 +- kernel/util/working.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 16e0b5fc47..bdb3c5fff1 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -49,4 +49,4 @@ jobs: - name: Build the Docker image run: | - docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v3.0.9 . \ No newline at end of file + docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v3.0.10 . \ No newline at end of file diff --git a/app/appx/AppxManifest.xml b/app/appx/AppxManifest.xml index e454070999..02f8311ab9 100644 --- a/app/appx/AppxManifest.xml +++ b/app/appx/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="3.0.10.0"/> SiYuan 云南链滴科技有限公司 diff --git a/app/package.json b/app/package.json index 37465016c9..ce7459b6e2 100644 --- a/app/package.json +++ b/app/package.json @@ -1,6 +1,6 @@ { "name": "SiYuan", - "version": "3.0.9", + "version": "3.0.10", "description": "Refactor your thinking", "homepage": "https://b3log.org/siyuan", "main": "./electron/main.js", diff --git a/kernel/util/working.go b/kernel/util/working.go index ef9fe20b34..552f5e7052 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -43,7 +43,7 @@ import ( var Mode = "prod" const ( - Ver = "3.0.9" + Ver = "3.0.10" IsInsider = false ) From a5e32d6575498e504df3544b76551603fe34e73e Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 16 Apr 2024 09:33:40 +0800 Subject: [PATCH 51/51] :art: fix https://github.com/siyuan-note/siyuan/issues/10766 --- app/src/mobile/editor.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.ts index f2d70e6611..73c12d580f 100644 --- a/app/src/mobile/editor.ts +++ b/app/src/mobile/editor.ts @@ -72,7 +72,12 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_ getDocByScroll({ protyle: window.siyuan.mobile.editor.protyle, scrollAttr: window.siyuan.storage[Constants.LOCAL_FILEPOSITION][data.data.rootID], - mergedOptions: protyleOptions + mergedOptions: protyleOptions, + cb() { + app.plugins.forEach(item => { + item.eventBus.emit("switch-protyle", {protyle: window.siyuan.mobile.editor.protyle}); + }); + } }); } else { fetchPost("/api/filetree/getDoc", { @@ -83,7 +88,12 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_ onGet({ data: getResponse, protyle: window.siyuan.mobile.editor.protyle, - action + action, + afterCB() { + app.plugins.forEach(item => { + item.eventBus.emit("switch-protyle", {protyle: window.siyuan.mobile.editor.protyle}); + }); + } }); }); } @@ -94,8 +104,5 @@ export const openMobileFileById = (app: App, id: string, action = [Constants.CB_ (document.getElementById("toolbarName") as HTMLInputElement).value = data.data.rootTitle === window.siyuan.languages.untitled ? "" : data.data.rootTitle; setEditor(); closePanel(); - app.plugins.forEach(item => { - item.eventBus.emit("switch-protyle", {protyle: window.siyuan.mobile.editor.protyle}); - }); }); };