mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5c5dc16954
5 changed files with 74 additions and 4 deletions
2
app/stage/protyle/js/lute/lute.min.js
vendored
2
app/stage/protyle/js/lute/lute.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
|
||||
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
|
||||
github.com/88250/gulu v1.2.3-0.20251119142510-7b1583ab4aa0
|
||||
github.com/88250/lute v1.7.7-0.20251122104311-8bc4c75a8f91
|
||||
github.com/88250/lute v1.7.7-0.20251122133654-ca7d12c867b3
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
|
||||
github.com/ConradIrwin/font v0.2.1
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
|
|||
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/88250/gulu v1.2.3-0.20251119142510-7b1583ab4aa0 h1:ip0IQCJCLtJEDHil+2XSnh3NP39i98SYV5qhWoUeMnA=
|
||||
github.com/88250/gulu v1.2.3-0.20251119142510-7b1583ab4aa0/go.mod h1:IQ5dXW9CjVmx6B7OfK1Y4ZBKTPMe9q1AkVoLGGzRbS8=
|
||||
github.com/88250/lute v1.7.7-0.20251122104311-8bc4c75a8f91 h1:uGTZqI/HYFrkr7M+ZH78QYDCsOrFYOwr7MXfL3t06ww=
|
||||
github.com/88250/lute v1.7.7-0.20251122104311-8bc4c75a8f91/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
|
||||
github.com/88250/lute v1.7.7-0.20251122133654-ca7d12c867b3 h1:JFcpHDdfVv7zY5FcIo0lo0HcFBlv9VTiCTfWjTCm3rg=
|
||||
github.com/88250/lute v1.7.7-0.20251122133654-ca7d12c867b3/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46 h1:Bq1JsDfVbHKUxNL/B2JXd8cC/1h6aFjrlXpGycnh0Hk=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20250424122812-f10e8d9d8d46/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
|
|
|
|||
|
|
@ -761,6 +761,14 @@ func ChangeBoxSort(boxIDs []string) {
|
|||
boxConf.Sort = i + 1
|
||||
box.SaveConf(boxConf)
|
||||
}
|
||||
|
||||
var notebookIDs []string
|
||||
for _, box := range Conf.GetOpenedBoxes() {
|
||||
notebookIDs = append(notebookIDs, box.ID)
|
||||
}
|
||||
util.BroadcastByType("main", "notebookSortChanged", 0, "", map[string]any{
|
||||
"notebookIDs": notebookIDs,
|
||||
})
|
||||
}
|
||||
|
||||
func SetBoxIcon(boxID, icon string) {
|
||||
|
|
|
|||
|
|
@ -1849,6 +1849,24 @@ func moveSorts(rootID, fromBox, toBox string) {
|
|||
logging.LogErrorf("write sort conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
sortIDs := map[string]int{}
|
||||
bt := treenode.GetBlockTree(rootID)
|
||||
if nil != bt {
|
||||
parentPath := path.Dir(bt.Path)
|
||||
docs, _, listErr := ListDocTree(toBox, parentPath, util.SortModeUnassigned, false, false, 102400)
|
||||
if listErr != nil {
|
||||
logging.LogErrorf("list doc tree failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, doc := range docs {
|
||||
sortIDs[doc.ID] = doc.Sort
|
||||
}
|
||||
|
||||
pushFiletreeSortChanged(sortIDs)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func ChangeFileTreeSort(boxID string, paths []string) {
|
||||
|
|
@ -1926,6 +1944,8 @@ func ChangeFileTreeSort(boxID string, paths []string) {
|
|||
}
|
||||
|
||||
IncSync()
|
||||
|
||||
pushFiletreeSortChanged(sortFolderIDs)
|
||||
}
|
||||
|
||||
func (box *Box) fillSort(files *[]*File) {
|
||||
|
|
@ -2006,6 +2026,13 @@ func (box *Box) addMaxSort(parentPath, id string) {
|
|||
}
|
||||
|
||||
box.setSortVal(id, sortVal)
|
||||
|
||||
sortIDs := map[string]int{}
|
||||
for _, doc := range docs {
|
||||
sortIDs[doc.ID] = doc.Sort
|
||||
}
|
||||
sortIDs[id] = sortVal
|
||||
pushFiletreeSortChanged(sortIDs)
|
||||
}
|
||||
|
||||
func (box *Box) addMinSort(parentPath, id string) {
|
||||
|
|
@ -2021,6 +2048,13 @@ func (box *Box) addMinSort(parentPath, id string) {
|
|||
}
|
||||
|
||||
box.setSortVal(id, sortVal)
|
||||
|
||||
sortIDs := map[string]int{}
|
||||
for _, doc := range docs {
|
||||
sortIDs[doc.ID] = doc.Sort
|
||||
}
|
||||
sortIDs[id] = sortVal
|
||||
pushFiletreeSortChanged(sortIDs)
|
||||
}
|
||||
|
||||
func (box *Box) setSortVal(id string, sortVal int) {
|
||||
|
|
@ -2086,6 +2120,7 @@ func (box *Box) addSort(previousPath, id string) {
|
|||
return
|
||||
}
|
||||
|
||||
sortIDs := map[string]int{}
|
||||
previousID := util.GetTreeID(previousPath)
|
||||
sortVal := 0
|
||||
for _, doc := range docs {
|
||||
|
|
@ -2095,6 +2130,7 @@ func (box *Box) addSort(previousPath, id string) {
|
|||
fullSortIDs[id] = sortVal
|
||||
}
|
||||
sortVal++
|
||||
sortIDs[doc.ID] = sortVal
|
||||
}
|
||||
|
||||
data, err = gulu.JSON.MarshalJSON(fullSortIDs)
|
||||
|
|
@ -2106,6 +2142,8 @@ func (box *Box) addSort(previousPath, id string) {
|
|||
logging.LogErrorf("write sort conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
pushFiletreeSortChanged(sortIDs)
|
||||
}
|
||||
|
||||
func (box *Box) setSort(sortIDVals map[string]int) {
|
||||
|
|
@ -2139,4 +2177,28 @@ func (box *Box) setSort(sortIDVals map[string]int) {
|
|||
logging.LogErrorf("write sort conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
pushFiletreeSortChanged(sortIDVals)
|
||||
}
|
||||
|
||||
func pushFiletreeSortChanged(sortIDs map[string]int) {
|
||||
var childIDs []string
|
||||
for sortID := range sortIDs {
|
||||
childIDs = append(childIDs, sortID)
|
||||
}
|
||||
sort.Slice(childIDs, func(i, j int) bool {
|
||||
return sortIDs[childIDs[i]] < sortIDs[childIDs[j]]
|
||||
})
|
||||
|
||||
firstID := childIDs[0]
|
||||
bt := treenode.GetBlockTree(firstID)
|
||||
if nil == bt {
|
||||
return
|
||||
}
|
||||
|
||||
parentPath := path.Dir(bt.Path)
|
||||
util.BroadcastByType("main", "filetreeSortChanged", 0, "", map[string]any{
|
||||
"parentPath": parentPath,
|
||||
"childIDs": childIDs,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue