From 0c3f06fa3ee5843a612f9d8a7b2d489285b2c9ef Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Jun 2025 10:39:04 +0800 Subject: [PATCH 1/6] :art: Database gallery view https://github.com/siyuan-note/siyuan/issues/10414 --- kernel/av/layout.go | 72 +++++++++++++++++++++++++++++++++++++ kernel/av/layout_gallery.go | 55 +++++----------------------- kernel/av/layout_table.go | 55 +++++----------------------- 3 files changed, 90 insertions(+), 92 deletions(-) diff --git a/kernel/av/layout.go b/kernel/av/layout.go index cd4fffd81..ca8e7e466 100644 --- a/kernel/av/layout.go +++ b/kernel/av/layout.go @@ -44,6 +44,10 @@ type BaseInstance struct { PageSize int `json:"pageSize"` // 每页项目 } +func (baseInstance *BaseInstance) GetFilters() []*ViewFilter { + return baseInstance.Filters +} + // BaseInstanceField 描述了实例字段的基础结构。 type BaseInstanceField struct { ID string `json:"id"` // ID @@ -63,6 +67,10 @@ type BaseInstanceField struct { Date *Date `json:"date,omitempty"` // 日期设置 } +func (baseInstanceField *BaseInstanceField) GetID() string { + return baseInstanceField.ID +} + // CollectionLayout 描述了集合布局的接口。 type CollectionLayout interface { @@ -79,6 +87,19 @@ type Collection interface { // SetItems 设置集合中的项目。 SetItems(items []Item) + + // GetFields 返回集合的所有字段。 + GetFields() []Field + + // GetFilters 返回集合的过滤规则。 + GetFilters() []*ViewFilter +} + +// Field 描述了一个字段的接口。 +type Field interface { + + // GetID 返回字段的 ID。 + GetID() string } // Item 描述了一个项目的接口。 @@ -97,3 +118,54 @@ type Item interface { // GetID 返回项目的 ID。 GetID() string } + +func filter(collection Collection, attrView *AttributeView) { + filters := collection.GetFilters() + if 1 > len(filters) { + return + } + + var colIndexes []int + for _, f := range filters { + for i, c := range collection.GetFields() { + if c.GetID() == f.Column { + colIndexes = append(colIndexes, i) + break + } + } + } + + items := []Item{} + attrViewCache := map[string]*AttributeView{} + attrViewCache[attrView.ID] = attrView + for _, row := range collection.GetItems() { + pass := true + values := row.GetValues() + for j, index := range colIndexes { + operator := filters[j].Operator + + if nil == values[index] { + if FilterOperatorIsNotEmpty == operator { + pass = false + } else if FilterOperatorIsEmpty == operator { + pass = true + break + } + + if KeyTypeText != values[index].Type { + pass = false + } + break + } + + if !values[index].Filter(filters[j], attrView, row.GetID(), &attrViewCache) { + pass = false + break + } + } + if pass { + items = append(items, row) + } + } + collection.SetItems(items) +} diff --git a/kernel/av/layout_gallery.go b/kernel/av/layout_gallery.go index 73e4cf160..bbcc55cec 100644 --- a/kernel/av/layout_gallery.go +++ b/kernel/av/layout_gallery.go @@ -163,6 +163,14 @@ func (gallery *Gallery) SetItems(items []Item) { } } +func (gallery *Gallery) GetFields() []Field { + fields := []Field{} + for _, field := range gallery.Fields { + fields = append(fields, field) + } + return fields +} + func (gallery *Gallery) GetType() LayoutType { return LayoutTypeGallery } @@ -285,50 +293,5 @@ func (gallery *Gallery) Sort(attrView *AttributeView) { } func (gallery *Gallery) Filter(attrView *AttributeView) { - if 1 > len(gallery.Filters) { - return - } - - var fieldIndexes []int - for _, f := range gallery.Filters { - for i, c := range gallery.Fields { - if c.ID == f.Column { - fieldIndexes = append(fieldIndexes, i) - break - } - } - } - - cards := []*GalleryCard{} - attrViewCache := map[string]*AttributeView{} - attrViewCache[attrView.ID] = attrView - for _, card := range gallery.Cards { - pass := true - for j, index := range fieldIndexes { - operator := gallery.Filters[j].Operator - - if nil == card.Values[index].Value { - if FilterOperatorIsNotEmpty == operator { - pass = false - } else if FilterOperatorIsEmpty == operator { - pass = true - break - } - - if KeyTypeText != card.Values[index].ValueType { - pass = false - } - break - } - - if !card.Values[index].Value.Filter(gallery.Filters[j], attrView, card.ID, &attrViewCache) { - pass = false - break - } - } - if pass { - cards = append(cards, card) - } - } - gallery.Cards = cards + filter(gallery, attrView) } diff --git a/kernel/av/layout_table.go b/kernel/av/layout_table.go index 46c68d059..0b303c3a2 100644 --- a/kernel/av/layout_table.go +++ b/kernel/av/layout_table.go @@ -151,6 +151,14 @@ func (table *Table) SetItems(items []Item) { } } +func (table *Table) GetFields() []Field { + fields := []Field{} + for _, column := range table.Columns { + fields = append(fields, column) + } + return fields +} + func (*Table) GetType() LayoutType { return LayoutTypeTable } @@ -273,50 +281,5 @@ func (table *Table) Sort(attrView *AttributeView) { } func (table *Table) Filter(attrView *AttributeView) { - if 1 > len(table.Filters) { - return - } - - var colIndexes []int - for _, f := range table.Filters { - for i, c := range table.Columns { - if c.ID == f.Column { - colIndexes = append(colIndexes, i) - break - } - } - } - - rows := []*TableRow{} - attrViewCache := map[string]*AttributeView{} - attrViewCache[attrView.ID] = attrView - for _, row := range table.Rows { - pass := true - for j, index := range colIndexes { - operator := table.Filters[j].Operator - - if nil == row.Cells[index].Value { - if FilterOperatorIsNotEmpty == operator { - pass = false - } else if FilterOperatorIsEmpty == operator { - pass = true - break - } - - if KeyTypeText != row.Cells[index].ValueType { - pass = false - } - break - } - - if !row.Cells[index].Value.Filter(table.Filters[j], attrView, row.ID, &attrViewCache) { - pass = false - break - } - } - if pass { - rows = append(rows, row) - } - } - table.Rows = rows + filter(table, attrView) } From 407ceb2e6d36356cf3142979c76d54ac08cddfcc Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Jun 2025 10:49:09 +0800 Subject: [PATCH 2/6] :art: Database gallery view https://github.com/siyuan-note/siyuan/issues/10414 --- kernel/av/layout.go | 136 ++++++++++++++++++++++++++++++++++-- kernel/av/layout_gallery.go | 123 ++------------------------------ kernel/av/layout_table.go | 123 ++------------------------------ 3 files changed, 142 insertions(+), 240 deletions(-) diff --git a/kernel/av/layout.go b/kernel/av/layout.go index ca8e7e466..5a3235100 100644 --- a/kernel/av/layout.go +++ b/kernel/av/layout.go @@ -16,6 +16,8 @@ package av +import "sort" + // BaseLayout 描述了布局的基础结构。 type BaseLayout struct { Spec int `json:"spec"` // 布局格式版本 @@ -44,6 +46,10 @@ type BaseInstance struct { PageSize int `json:"pageSize"` // 每页项目 } +func (baseInstance *BaseInstance) GetSorts() []*ViewSort { + return baseInstance.Sorts +} + func (baseInstance *BaseInstance) GetFilters() []*ViewFilter { return baseInstance.Filters } @@ -91,6 +97,9 @@ type Collection interface { // GetFields 返回集合的所有字段。 GetFields() []Field + // GetSorts 返回集合的排序规则。 + GetSorts() []*ViewSort + // GetFilters 返回集合的过滤规则。 GetFilters() []*ViewFilter } @@ -119,7 +128,122 @@ type Item interface { GetID() string } -func filter(collection Collection, attrView *AttributeView) { +func sort0(collection Collection, attrView *AttributeView) { + sorts := collection.GetSorts() + if 1 > len(sorts) { + return + } + + type FieldIndexSort struct { + Index int + Order SortOrder + } + + var fieldIndexSorts []*FieldIndexSort + for _, s := range sorts { + for i, c := range collection.GetFields() { + if c.GetID() == s.Column { + fieldIndexSorts = append(fieldIndexSorts, &FieldIndexSort{Index: i, Order: s.Order}) + break + } + } + } + + items := collection.GetItems() + editedValItems := map[string]bool{} + for i, item := range items { + for _, fieldIndexSort := range fieldIndexSorts { + val := items[i].GetValues()[fieldIndexSort.Index] + if KeyTypeCheckbox == val.Type { + if block := item.GetBlockValue(); nil != block && block.IsEdited() { + // 如果主键编辑过,则勾选框也算作编辑过,参与排序 https://github.com/siyuan-note/siyuan/issues/11016 + editedValItems[item.GetID()] = true + break + } + } + + if val.IsEdited() { + // 如果该卡片某字段的值已经编辑过,则该卡片可参与排序 + editedValItems[item.GetID()] = true + break + } + } + } + + // 将未编辑的卡片和已编辑的卡片分开排序 + var uneditedItems, editedItems []Item + for _, item := range items { + if _, ok := editedValItems[item.GetID()]; ok { + editedItems = append(editedItems, item) + } else { + uneditedItems = append(uneditedItems, item) + } + } + + sort.Slice(uneditedItems, func(i, j int) bool { + val1 := uneditedItems[i].GetBlockValue() + if nil == val1 { + return true + } + val2 := uneditedItems[j].GetBlockValue() + if nil == val2 { + return false + } + return val1.CreatedAt < val2.CreatedAt + }) + + sort.Slice(editedItems, func(i, j int) bool { + sorted := true + for _, fieldIndexSort := range fieldIndexSorts { + val1 := editedItems[i].GetValues()[fieldIndexSort.Index] + val2 := editedItems[j].GetValues()[fieldIndexSort.Index] + 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) + if 0 == result { + sorted = false + continue + } + sorted = true + + if fieldIndexSort.Order == SortOrderAsc { + return 0 > result + } + return 0 < result + } + + if !sorted { + key1 := editedItems[i].GetBlockValue() + if nil == key1 { + return false + } + key2 := editedItems[j].GetBlockValue() + if nil == key2 { + return false + } + return key1.CreatedAt < key2.CreatedAt + } + return false + }) + + // 将包含未编辑的卡片放在最后 + collection.SetItems(append(editedItems, uneditedItems...)) + if 1 > len(collection.GetItems()) { + collection.SetItems([]Item{}) + } +} + +func filter0(collection Collection, attrView *AttributeView) { filters := collection.GetFilters() if 1 > len(filters) { return @@ -135,12 +259,12 @@ func filter(collection Collection, attrView *AttributeView) { } } - items := []Item{} + var items []Item attrViewCache := map[string]*AttributeView{} attrViewCache[attrView.ID] = attrView - for _, row := range collection.GetItems() { + for _, item := range collection.GetItems() { pass := true - values := row.GetValues() + values := item.GetValues() for j, index := range colIndexes { operator := filters[j].Operator @@ -158,13 +282,13 @@ func filter(collection Collection, attrView *AttributeView) { break } - if !values[index].Filter(filters[j], attrView, row.GetID(), &attrViewCache) { + if !values[index].Filter(filters[j], attrView, item.GetID(), &attrViewCache) { pass = false break } } if pass { - items = append(items, row) + items = append(items, item) } } collection.SetItems(items) diff --git a/kernel/av/layout_gallery.go b/kernel/av/layout_gallery.go index bbcc55cec..39696ff08 100644 --- a/kernel/av/layout_gallery.go +++ b/kernel/av/layout_gallery.go @@ -17,8 +17,6 @@ package av import ( - "sort" - "github.com/88250/lute/ast" ) @@ -163,12 +161,12 @@ func (gallery *Gallery) SetItems(items []Item) { } } -func (gallery *Gallery) GetFields() []Field { - fields := []Field{} +func (gallery *Gallery) GetFields() (ret []Field) { + ret = []Field{} for _, field := range gallery.Fields { - fields = append(fields, field) + ret = append(ret, field) } - return fields + return ret } func (gallery *Gallery) GetType() LayoutType { @@ -180,118 +178,9 @@ func (gallery *Gallery) GetID() string { } func (gallery *Gallery) Sort(attrView *AttributeView) { - if 1 > len(gallery.Sorts) { - return - } - - type FieldIndexSort struct { - Index int - Order SortOrder - } - - var fieldIndexSorts []*FieldIndexSort - for _, s := range gallery.Sorts { - for i, c := range gallery.Fields { - if c.ID == s.Column { - fieldIndexSorts = append(fieldIndexSorts, &FieldIndexSort{Index: i, Order: s.Order}) - break - } - } - } - - editedValCards := map[string]bool{} - for i, card := range gallery.Cards { - for _, fieldIndexSort := range fieldIndexSorts { - val := gallery.Cards[i].Values[fieldIndexSort.Index].Value - if KeyTypeCheckbox == val.Type { - if block := card.GetBlockValue(); nil != block && block.IsEdited() { - // 如果主键编辑过,则勾选框也算作编辑过,参与排序 https://github.com/siyuan-note/siyuan/issues/11016 - editedValCards[card.ID] = true - break - } - } - - if val.IsEdited() { - // 如果该卡片某字段的值已经编辑过,则该卡片可参与排序 - editedValCards[card.ID] = true - break - } - } - } - - // 将未编辑的卡片和已编辑的卡片分开排序 - var uneditedCards, editedCards []*GalleryCard - for _, card := range gallery.Cards { - if _, ok := editedValCards[card.ID]; ok { - editedCards = append(editedCards, card) - } else { - uneditedCards = append(uneditedCards, card) - } - } - - sort.Slice(uneditedCards, func(i, j int) bool { - val1 := uneditedCards[i].GetBlockValue() - if nil == val1 { - return true - } - val2 := uneditedCards[j].GetBlockValue() - if nil == val2 { - return false - } - return val1.CreatedAt < val2.CreatedAt - }) - - sort.Slice(editedCards, func(i, j int) bool { - sorted := true - for _, fieldIndexSort := range fieldIndexSorts { - val1 := editedCards[i].Values[fieldIndexSort.Index].Value - val2 := editedCards[j].Values[fieldIndexSort.Index].Value - 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) - if 0 == result { - sorted = false - continue - } - sorted = true - - if fieldIndexSort.Order == SortOrderAsc { - return 0 > result - } - return 0 < result - } - - if !sorted { - key1 := editedCards[i].GetBlockValue() - if nil == key1 { - return false - } - key2 := editedCards[j].GetBlockValue() - if nil == key2 { - return false - } - return key1.CreatedAt < key2.CreatedAt - } - return false - }) - - // 将包含未编辑的卡片放在最后 - gallery.Cards = append(editedCards, uneditedCards...) - if 1 > len(gallery.Cards) { - gallery.Cards = []*GalleryCard{} - } + sort0(gallery, attrView) } func (gallery *Gallery) Filter(attrView *AttributeView) { - filter(gallery, attrView) + filter0(gallery, attrView) } diff --git a/kernel/av/layout_table.go b/kernel/av/layout_table.go index 0b303c3a2..9c2ee3515 100644 --- a/kernel/av/layout_table.go +++ b/kernel/av/layout_table.go @@ -17,8 +17,6 @@ package av import ( - "sort" - "github.com/88250/lute/ast" ) @@ -151,12 +149,12 @@ func (table *Table) SetItems(items []Item) { } } -func (table *Table) GetFields() []Field { - fields := []Field{} +func (table *Table) GetFields() (ret []Field) { + ret = []Field{} for _, column := range table.Columns { - fields = append(fields, column) + ret = append(ret, column) } - return fields + return ret } func (*Table) GetType() LayoutType { @@ -168,118 +166,9 @@ func (table *Table) GetID() string { } func (table *Table) Sort(attrView *AttributeView) { - if 1 > len(table.Sorts) { - return - } - - type ColIndexSort struct { - Index int - Order SortOrder - } - - var colIndexSorts []*ColIndexSort - for _, s := range table.Sorts { - for i, c := range table.Columns { - if c.ID == s.Column { - colIndexSorts = append(colIndexSorts, &ColIndexSort{Index: i, Order: s.Order}) - break - } - } - } - - editedValRows := map[string]bool{} - 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 - break - } - } - } - - // 将未编辑的行和已编辑的行分开排序 - var uneditedRows, editedRows []*TableRow - for _, row := range table.Rows { - if _, ok := editedValRows[row.ID]; ok { - editedRows = append(editedRows, row) - } else { - uneditedRows = append(uneditedRows, row) - } - } - - sort.Slice(uneditedRows, func(i, j int) bool { - val1 := uneditedRows[i].GetBlockValue() - if nil == val1 { - return true - } - val2 := uneditedRows[j].GetBlockValue() - if nil == val2 { - return false - } - return val1.CreatedAt < val2.CreatedAt - }) - - sort.Slice(editedRows, func(i, j int) bool { - sorted := true - for _, colIndexSort := range colIndexSorts { - val1 := editedRows[i].Cells[colIndexSort.Index].Value - val2 := editedRows[j].Cells[colIndexSort.Index].Value - 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) - if 0 == result { - sorted = false - continue - } - sorted = true - - if colIndexSort.Order == SortOrderAsc { - return 0 > result - } - return 0 < result - } - - if !sorted { - key1 := editedRows[i].GetBlockValue() - if nil == key1 { - return false - } - key2 := editedRows[j].GetBlockValue() - if nil == key2 { - return false - } - return key1.CreatedAt < key2.CreatedAt - } - return false - }) - - // 将包含未编辑的行放在最后 - table.Rows = append(editedRows, uneditedRows...) - if 1 > len(table.Rows) { - table.Rows = []*TableRow{} - } + sort0(table, attrView) } func (table *Table) Filter(attrView *AttributeView) { - filter(table, attrView) + filter0(table, attrView) } From e8a592e4e7f2d3d34c6ef08b8843ffdf6f36fab2 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Jun 2025 11:09:28 +0800 Subject: [PATCH 3/6] :art: Database gallery view https://github.com/siyuan-note/siyuan/issues/10414 --- kernel/model/attribute_view.go | 13 ++----------- kernel/sql/av.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 1a7263a3c..bdaf76fd2 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -1180,8 +1180,6 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page, } } view.Table.Sorts = tmpSorts - - viewable = sql.RenderAttributeViewTable(attrView, view, query) case av.LayoutTypeGallery: // 字段删除以后需要删除设置的过滤和排序 tmpFilters := []*av.ViewFilter{} @@ -1199,10 +1197,9 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page, } } view.Gallery.Sorts = tmpSorts - - viewable = sql.RenderAttributeViewGallery(attrView, view, query) } + viewable = sql.RenderView(view, attrView, query) if nil == viewable { err = av.ErrViewNotFound logging.LogErrorf("render attribute view [%s] failed", attrView.ID) @@ -2424,13 +2421,7 @@ func addAttributeViewBlock(now int64, avID, blockID, previousBlockID, addingBloc } if nil != view && 0 < len(filters) && !ignoreFillFilter { - var viewable av.Viewable - switch view.LayoutType { - case av.LayoutTypeTable: - viewable = sql.RenderAttributeViewTable(attrView, view, "") - case av.LayoutTypeGallery: - viewable = sql.RenderAttributeViewGallery(attrView, view, "") - } + viewable := sql.RenderView(view, attrView, "") viewable.Filter(attrView) viewable.Sort(attrView) diff --git a/kernel/sql/av.go b/kernel/sql/av.go index 6d66488d7..919605647 100644 --- a/kernel/sql/av.go +++ b/kernel/sql/av.go @@ -32,6 +32,16 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) +func RenderView(view *av.View, attrView *av.AttributeView, query string) (ret av.Viewable) { + switch view.LayoutType { + case av.LayoutTypeTable: + ret = RenderAttributeViewTable(attrView, view, query) + case av.LayoutTypeGallery: + ret = RenderAttributeViewGallery(attrView, view, query) + } + return +} + func RenderTemplateField(ial map[string]string, keyValues []*av.KeyValues, tplContent string) (ret string, err error) { if "" == ial["id"] { block := getBlockValue(keyValues) From b6828235be8aa273676fee8917587fc6f327f6e1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Jun 2025 11:41:07 +0800 Subject: [PATCH 4/6] :recycle: Upgrade to Electron v36.4.0 https://github.com/siyuan-note/siyuan/issues/15022 --- .github/CONTRIBUTING.md | 6 +++--- .github/CONTRIBUTING_zh_CN.md | 6 +++--- app/package.json | 2 +- app/pnpm-lock.yaml | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 569f524a4..1dffb64a5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -14,10 +14,10 @@ Install pnpm: `npm install -g pnpm@10.11.0` Set the Electron mirror environment variable and install Electron: -* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v35.5.0 -D` +* macOS/Linux: `ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v36.4.0 -D` * Windows: * `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/` - * `pnpm install electron@v35.5.0 -D` + * `pnpm install electron@v36.4.0 -D` NPM mirror: @@ -27,7 +27,7 @@ NPM mirror: Enter the app folder and execute: -* `pnpm install electron@v35.5.0 -D` +* `pnpm install electron@v36.4.0 -D` * `pnpm run dev` * `pnpm run start` diff --git a/.github/CONTRIBUTING_zh_CN.md b/.github/CONTRIBUTING_zh_CN.md index 96ca7fd52..9f54d149c 100644 --- a/.github/CONTRIBUTING_zh_CN.md +++ b/.github/CONTRIBUTING_zh_CN.md @@ -14,10 +14,10 @@ 设置 Electron 镜像环境变量并安装 Electron: -* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v35.5.0 -D` +* macOS/Linux:`ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ pnpm install electron@v36.4.0 -D` * Windows: * `SET ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/` - * `pnpm install electron@v35.5.0 -D` + * `pnpm install electron@v36.4.0 -D` NPM 镜像: @@ -27,7 +27,7 @@ NPM 镜像: 进入 app 文件夹执行: -* `pnpm install electron@v35.5.0 -D` +* `pnpm install electron@v36.4.0 -D` * `pnpm run dev` * `pnpm run start` diff --git a/app/package.json b/app/package.json index c9db9e3aa..43d73c394 100644 --- a/app/package.json +++ b/app/package.json @@ -58,7 +58,7 @@ "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.7.1", "dayjs": "^1.11.5", - "electron": "35.5.0", + "electron": "36.4.0", "electron-builder": "26.0.12", "encoding": "^0.1.13", "esbuild-loader": "^3.0.1", diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index e2328cdf7..8ba9f0a48 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: '@electron/remote': specifier: ^2.1.2 - version: 2.1.2(electron@35.5.0) + version: 2.1.2(electron@36.4.0) devDependencies: '@eslint/eslintrc': specifier: ^3.3.1 @@ -40,8 +40,8 @@ importers: specifier: ^1.11.5 version: 1.11.13 electron: - specifier: 35.5.0 - version: 35.5.0 + specifier: 36.4.0 + version: 36.4.0 electron-builder: specifier: 26.0.12 version: 26.0.12(electron-builder-squirrel-windows@26.0.11) @@ -1191,8 +1191,8 @@ packages: resolution: {integrity: sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==} engines: {node: '>=8.0.0'} - electron@35.5.0: - resolution: {integrity: sha512-16ScwDuKgnuL7tSrEgBvQe1Hm4CSK0vbOusPFrDs4oIs3QOdEFtrP9i8+4yKQGXpszj4f4F0MQjKv1tu9E4Gvg==} + electron@36.4.0: + resolution: {integrity: sha512-LLOOZEuW5oqvnjC7HBQhIqjIIJAZCIFjQxltQGLfEC7XFsBoZgQ3u3iFj+Kzw68Xj97u1n57Jdt7P98qLvUibQ==} engines: {node: '>= 12.20.55'} hasBin: true @@ -2858,9 +2858,9 @@ snapshots: - bluebird - supports-color - '@electron/remote@2.1.2(electron@35.5.0)': + '@electron/remote@2.1.2(electron@36.4.0)': dependencies: - electron: 35.5.0 + electron: 36.4.0 '@electron/universal@2.0.1': dependencies: @@ -4025,7 +4025,7 @@ snapshots: transitivePeerDependencies: - supports-color - electron@35.5.0: + electron@36.4.0: dependencies: '@electron/get': 2.0.3 '@types/node': 22.15.3 From 200634881908e0cce3738b91406003d64bacb491 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Jun 2025 11:41:52 +0800 Subject: [PATCH 5/6] :arrow_up: Upgrade pnpm --- .github/CONTRIBUTING.md | 2 +- .github/CONTRIBUTING_zh_CN.md | 2 +- app/package.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1dffb64a5..14e1ede3f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,7 +7,7 @@ ## NPM dependencies -Install pnpm: `npm install -g pnpm@10.11.0` +Install pnpm: `npm install -g pnpm@10.12.1`
For China mainland diff --git a/.github/CONTRIBUTING_zh_CN.md b/.github/CONTRIBUTING_zh_CN.md index 9f54d149c..940253da7 100644 --- a/.github/CONTRIBUTING_zh_CN.md +++ b/.github/CONTRIBUTING_zh_CN.md @@ -7,7 +7,7 @@ ## NPM 依赖 -安装 pnpm:`npm install -g pnpm@10.11.0` +安装 pnpm:`npm install -g pnpm@10.12.1`
适用于中国大陆 diff --git a/app/package.json b/app/package.json index 43d73c394..a0e9b1c41 100644 --- a/app/package.json +++ b/app/package.json @@ -4,7 +4,7 @@ "description": "Refactor your thinking", "homepage": "https://b3log.org/siyuan", "main": "./electron/main.js", - "packageManager": "pnpm@10.11.0", + "packageManager": "pnpm@10.12.1", "scripts": { "lint": "eslint . --fix --cache", "dev": "webpack --mode development", @@ -58,7 +58,7 @@ "clean-webpack-plugin": "^4.0.0", "css-loader": "^6.7.1", "dayjs": "^1.11.5", - "electron": "36.4.0", + "electron": "v36.4.0", "electron-builder": "26.0.12", "encoding": "^0.1.13", "esbuild-loader": "^3.0.1", From 15634bd7cee989343aaaf1da16981b12f3cb9f49 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Jun 2025 11:41:59 +0800 Subject: [PATCH 6/6] :recycle: Upgrade to Electron v36.4.0 https://github.com/siyuan-note/siyuan/issues/15022 --- app/pnpm-lock.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 8ba9f0a48..58ff6b8a8 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -40,7 +40,7 @@ importers: specifier: ^1.11.5 version: 1.11.13 electron: - specifier: 36.4.0 + specifier: v36.4.0 version: 36.4.0 electron-builder: specifier: 26.0.12 @@ -131,8 +131,8 @@ packages: resolution: {integrity: sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==} engines: {node: '>=12'} - '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2': - resolution: {tarball: https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2} + '@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2': + resolution: {commit: 06b29aafb7708acef8b3669835c8a7857ebc92d2, repo: https://github.com/electron/node-gyp.git, type: git} version: 10.2.0-electron.1 engines: {node: '>=12.13.0'} hasBin: true @@ -2803,7 +2803,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2': + '@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2': dependencies: env-paths: 2.2.1 exponential-backoff: 3.1.2 @@ -2840,7 +2840,7 @@ snapshots: '@electron/rebuild@3.7.0': dependencies: - '@electron/node-gyp': https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2 + '@electron/node-gyp': git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2 '@malept/cross-spawn-promise': 2.0.0 chalk: 4.1.2 debug: 4.4.0