Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-12-14 11:36:20 +08:00
commit 0f1f911b58
4 changed files with 34 additions and 26 deletions

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c
github.com/88250/lute v1.7.6-0.20231213141834-39c4b6c267f0
github.com/88250/lute v1.7.6-0.20231213154422-cae466b8b3a7
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

View file

@ -10,8 +10,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c h1:Fas3hxqP33xA9KKDV50jUmppiiOukk5bdV00Hk5VSSk=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
github.com/88250/lute v1.7.6-0.20231213141834-39c4b6c267f0 h1:RxGaYX1FqZv+Vunwg/qBzqnDUzb90TapifOJ0qj0QsQ=
github.com/88250/lute v1.7.6-0.20231213141834-39c4b6c267f0/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/lute v1.7.6-0.20231213154422-cae466b8b3a7 h1:Hav/8eI6gIQBu8qHt+tA1PZUtoTQg6UGR3QP+ZjcxKM=
github.com/88250/lute v1.7.6-0.20231213154422-cae466b8b3a7/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -1089,11 +1089,6 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
return
}
view, err := attrView.GetCurrentView()
if nil != err {
return
}
// 不允许重复添加相同的块到属性视图中
blockValues := attrView.GetBlockKeyValues()
for _, blockValue := range blockValues.Values {
@ -1127,17 +1122,24 @@ func addAttributeViewBlock(blockID string, operation *Operation, tree *parse.Tre
}
}
switch view.LayoutType {
case av.LayoutTypeTable:
if "" != operation.PreviousID {
for i, id := range view.Table.RowIDs {
if id == operation.PreviousID {
view.Table.RowIDs = append(view.Table.RowIDs[:i+1], append([]string{blockID}, view.Table.RowIDs[i+1:]...)...)
break
for _, view := range attrView.Views {
switch view.LayoutType {
case av.LayoutTypeTable:
if "" != operation.PreviousID {
changed := false
for i, id := range view.Table.RowIDs {
if id == operation.PreviousID {
view.Table.RowIDs = append(view.Table.RowIDs[:i+1], append([]string{blockID}, view.Table.RowIDs[i+1:]...)...)
changed = true
break
}
}
if !changed {
view.Table.RowIDs = append(view.Table.RowIDs, blockID)
}
} else {
view.Table.RowIDs = append([]string{blockID}, view.Table.RowIDs...)
}
} else {
view.Table.RowIDs = append([]string{blockID}, view.Table.RowIDs...)
}
}
@ -1159,11 +1161,6 @@ func (tx *Transaction) removeAttributeViewBlock(operation *Operation) (err error
return
}
view, err := attrView.GetCurrentView()
if nil != err {
return
}
trees := map[string]*parse.Tree{}
for _, keyValues := range attrView.KeyValues {
tmp := keyValues.Values[:0]
@ -1210,8 +1207,10 @@ func (tx *Transaction) removeAttributeViewBlock(operation *Operation) (err error
keyValues.Values = tmp
}
for _, blockID := range operation.SrcIDs {
view.Table.RowIDs = gulu.Str.RemoveElem(view.Table.RowIDs, blockID)
for _, view := range attrView.Views {
for _, blockID := range operation.SrcIDs {
view.Table.RowIDs = gulu.Str.RemoveElem(view.Table.RowIDs, blockID)
}
}
err = av.SaveAttributeView(attrView)
@ -1404,7 +1403,9 @@ func sortAttributeViewRow(operation *Operation) (err error) {
}
}
if "" == rowID {
return
rowID = operation.ID
view.Table.RowIDs = append(view.Table.RowIDs, rowID)
index = len(view.Table.RowIDs) - 1
}
switch view.LayoutType {
@ -1670,6 +1671,7 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
}
}
replacedRowID := false
for _, v := range attrView.Views {
switch v.LayoutType {
case av.LayoutTypeTable:
@ -1682,8 +1684,14 @@ func replaceAttributeViewBlock(operation *Operation, tx *Transaction) (err error
for i, rowID := range v.Table.RowIDs {
if rowID == operation.PreviousID {
v.Table.RowIDs[i] = operation.NextID
replacedRowID = true
break
}
}
if !replacedRowID {
v.Table.RowIDs = append(v.Table.RowIDs, operation.NextID)
}
}
}