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 000000000..4bb5aba44 --- /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 000000000..6bc380b41 --- /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 000000000..026e2b233 --- /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) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 4db2283f8..ce4046071 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) { @@ -1282,6 +1287,63 @@ 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 + } + + for _, keyValues := range attrView.KeyValues { + for _, value := range keyValues.Values { + if value.BlockID != operation.ID { + continue + } + + if av.KeyTypeBlock == value.Type { + unbindBlockAv(tx, operation.AvID, value.BlockID) + } + value.BlockID = operation.NextID + if nil != value.Block { + value.Block.ID = operation.NextID + } + } + } + + 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 { @@ -2901,25 +2963,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) - } + if value.BlockID != operation.PreviousID { + continue + } - 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 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) + } } } @@ -3171,11 +3235,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]) diff --git a/kernel/model/blockinfo.go b/kernel/model/blockinfo.go index a2a0a7976..44fba8752 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 } diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index cf7fb0293..51dc1eec9 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 { @@ -1243,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)) } }