mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 16:28:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
03b2c3d949
10 changed files with 314 additions and 27 deletions
79
app/changelogs/v3.1.25/v3.1.25.md
Normal file
79
app/changelogs/v3.1.25/v3.1.25.md
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
## Overview
|
||||
|
||||
This version improves some details.
|
||||
|
||||
## Changelogs
|
||||
|
||||
Below are the detailed changes in this version.
|
||||
|
||||
### Enhancement
|
||||
|
||||
* [Remove zero-width spaces from empty paragraph blocks](https://github.com/siyuan-note/siyuan/issues/12273)
|
||||
* [Improve preview style](https://github.com/siyuan-note/siyuan/issues/13451)
|
||||
* [Improve marketplace package loading](https://github.com/siyuan-note/siyuan/issues/13950)
|
||||
* [Multiple selection cells in the table support copying plain text](https://github.com/siyuan-note/siyuan/issues/14144)
|
||||
* [Use html-to-image to replace html2canvs](https://github.com/siyuan-note/siyuan/issues/14161)
|
||||
* [Improve width submenu in block menu](https://github.com/siyuan-note/siyuan/issues/14163)
|
||||
* [Improve the rendering of the block icon position of the list block](https://github.com/siyuan-note/siyuan/issues/14211)
|
||||
* [Font size supports relative settings](https://github.com/siyuan-note/siyuan/issues/14231)
|
||||
* [Merge the same elements after find-replace](https://github.com/siyuan-note/siyuan/issues/14236)
|
||||
* [Improve outline jump positioning](https://github.com/siyuan-note/siyuan/issues/14245)
|
||||
* [Text with appearance after input keeps its appearance](https://github.com/siyuan-note/siyuan/issues/14267)
|
||||
* [Pin the floating window after scaling](https://github.com/siyuan-note/siyuan/issues/14278)
|
||||
* [Improve reconnection prompt after switching apps on iOS](https://github.com/siyuan-note/siyuan/issues/14279)
|
||||
* [The `Export` in the asset menu on the mobile is changed to calling the browser to download](https://github.com/siyuan-note/siyuan/issues/14280)
|
||||
* [Improve element menu on mobile](https://github.com/siyuan-note/siyuan/issues/14283)
|
||||
* [Improve chart edit rendering](https://github.com/siyuan-note/siyuan/issues/14288)
|
||||
* [Improve anchor text escaping when creating a subdoc by reference](https://github.com/siyuan-note/siyuan/issues/14289)
|
||||
* [Marketplace search for multiple keywords uses AND logic](https://github.com/siyuan-note/siyuan/issues/14293)
|
||||
* [Improve block ref dynamic anchor text to add inline level style](https://github.com/siyuan-note/siyuan/issues/14299)
|
||||
* [Block icon are not displayed in certain cases](https://github.com/siyuan-note/siyuan/issues/14304)
|
||||
* [The database supports creating new entries after pressing `Tab` at the end of the cell](https://github.com/siyuan-note/siyuan/issues/14305)
|
||||
* [Copying a database cell and pasting it into the doc title only pastes plain text](https://github.com/siyuan-note/siyuan/issues/14306)
|
||||
* [Improve database multiple selection and relation field cell pop-up editing](https://github.com/siyuan-note/siyuan/issues/14308)
|
||||
* [Improve switching of database cells or pop-up options via arrow keys](https://github.com/siyuan-note/siyuan/issues/14309)
|
||||
* [Improve browser clipping extension](https://github.com/siyuan-note/siyuan/issues/14316)
|
||||
* [Improve database field sorting for content containing emojis](https://github.com/siyuan-note/siyuan/issues/14323)
|
||||
* [Improve floating editor content synchronization](https://github.com/siyuan-note/siyuan/issues/14326)
|
||||
* [Improve `Move` auto fill search keyword](https://github.com/siyuan-note/siyuan/issues/14337)
|
||||
* [Improve Ctrl+X of inline elements](https://github.com/siyuan-note/siyuan/issues/14339)
|
||||
* [Support entering the sub-menu by pressing Enter](https://github.com/siyuan-note/siyuan/issues/14343)
|
||||
* [Improve `Optimize typography` for inline math](https://github.com/siyuan-note/siyuan/issues/14344)
|
||||
* [Supports displaying serving IP on Harmony NEXT](https://github.com/siyuan-note/siyuan/issues/14353)
|
||||
* [Improve rollback doc to avoid ID duplication](https://github.com/siyuan-note/siyuan/issues/14358)
|
||||
* [Generate file history before converting doc to heading/moving blocks](https://github.com/siyuan-note/siyuan/issues/14359)
|
||||
* [Improve pasting formulas from Claude](https://github.com/siyuan-note/siyuan/issues/14360)
|
||||
* [Database asset field support keyboard operation](https://github.com/siyuan-note/siyuan/issues/14365)
|
||||
* [Improve query embed block auto refresh](https://github.com/siyuan-note/siyuan/issues/14370)
|
||||
|
||||
### Abolishment
|
||||
|
||||
* [No longer support Android 7](https://github.com/siyuan-note/siyuan/issues/11010)
|
||||
* [No longer support iOS 14](https://github.com/siyuan-note/siyuan/issues/14264)
|
||||
|
||||
### Bugfix
|
||||
|
||||
* [Delete exception at the end of inline element](https://github.com/siyuan-note/siyuan/issues/13881)
|
||||
* [Flashcard management will be incorrectly highlighted after global search](https://github.com/siyuan-note/siyuan/issues/13898)
|
||||
* [Exception after pasting embed block](https://github.com/siyuan-note/siyuan/issues/14255)
|
||||
* [Cannot long press to paste on mobile devices](https://github.com/siyuan-note/siyuan/issues/14277)
|
||||
* [Unable to paste specific text copied from WPS](https://github.com/siyuan-note/siyuan/issues/14301)
|
||||
* [The URL link customized by the plugin does not work](https://github.com/siyuan-note/siyuan/issues/14314)
|
||||
* [Formula blocks in super blocks are not displayed completely when exporting to PDF](https://github.com/siyuan-note/siyuan/issues/14318)
|
||||
|
||||
### Refactor
|
||||
|
||||
* [Refactor setCurrentById of Outline func scroll policy](https://github.com/siyuan-note/siyuan/pull/14312)
|
||||
* [Upgrade to Electron v34.3.3](https://github.com/siyuan-note/siyuan/issues/14322)
|
||||
|
||||
### Development
|
||||
|
||||
* [Improve kernel API `/api/filetree/getPathByID`](https://github.com/siyuan-note/siyuan/issues/14275)
|
||||
* [Plugin API supports opening block attribute panel by block id](https://github.com/siyuan-note/siyuan/issues/14276)
|
||||
* [Missing `switch-protyle` or `loaded-protyle-static` Event on Mobile Back Navigation](https://github.com/siyuan-note/siyuan/issues/14296)
|
||||
* [Add a kernel API `/api/block/batchUpdateBlock`](https://github.com/siyuan-note/siyuan/issues/14335)
|
||||
|
||||
## Download
|
||||
|
||||
* [B3log](https://b3log.org/siyuan/en/download.html)
|
||||
* [GitHub](https://github.com/siyuan-note/siyuan/releases)
|
||||
79
app/changelogs/v3.1.25/v3.1.25_zh_CHT.md
Normal file
79
app/changelogs/v3.1.25/v3.1.25_zh_CHT.md
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
## 概述
|
||||
|
||||
該版本改進了一些細節。
|
||||
|
||||
## 變更記錄
|
||||
|
||||
以下是此版本中的詳細變更。
|
||||
|
||||
### 改進功能
|
||||
|
||||
* [從空白段落區塊中刪除零寬空格](https://github.com/siyuan-note/siyuan/issues/12273)
|
||||
* [改良預覽樣式](https://github.com/siyuan-note/siyuan/issues/13451)
|
||||
* [改進市集包載入](https://github.com/siyuan-note/siyuan/issues/13950)
|
||||
* [支援表格多選儲存格複製純文字](https://github.com/siyuan-note/siyuan/issues/14144)
|
||||
* [使用 html-to-image 替換 html2canvas](https://github.com/siyuan-note/siyuan/issues/14161)
|
||||
* [改進區塊選單中的寬度子選單](https://github.com/siyuan-note/siyuan/issues/14163)
|
||||
* [改進清單區塊的區塊標渲染位置](https://github.com/siyuan-note/siyuan/issues/14211)
|
||||
* [字體大小支援相對設定](https://github.com/siyuan-note/siyuan/issues/14231)
|
||||
* [尋找替換後合併相同元素](https://github.com/siyuan-note/siyuan/issues/14236)
|
||||
* [改進大綱跳轉定位](https://github.com/siyuan-note/siyuan/issues/14245)
|
||||
* [輸入後有外觀的文字保持其外觀](https://github.com/siyuan-note/siyuan/issues/14267)
|
||||
* [縮放後固定浮動視窗](https://github.com/siyuan-note/siyuan/issues/14278)
|
||||
* [在 iOS 上切換應用程式後改進重新連線提示](https://github.com/siyuan-note/siyuan/issues/14279)
|
||||
* [行動端資源選單中的「匯出」改為呼叫瀏覽器下載](https://github.com/siyuan-note/siyuan/issues/14280)
|
||||
* [改進行動端的元素選單](https://github.com/siyuan-note/siyuan/issues/14283)
|
||||
* [改進圖表編輯渲染](https://github.com/siyuan-note/siyuan/issues/14288)
|
||||
* [改進建立引用子文件時錨文本轉義](https://github.com/siyuan-note/siyuan/issues/14289)
|
||||
* [市集搜尋多個關鍵字使用 AND 邏輯](https://github.com/siyuan-note/siyuan/issues/14293)
|
||||
* [改進區塊引用動態錨文本新增行級樣式](https://github.com/siyuan-note/siyuan/issues/14299)
|
||||
* [某些情況下不顯示塊標](https://github.com/siyuan-note/siyuan/issues/14304)
|
||||
* [資料庫支援在儲存格結尾按 `Tab` 建立新條目](https://github.com/siyuan-note/siyuan/issues/14305)
|
||||
* [複製資料庫儲存格並貼上到文件標題中僅貼上純文字](https://github.com/siyuan-note/siyuan/issues/14306)
|
||||
* [改進資料庫多重選取和關聯欄位儲存格彈出編輯](https://github.com/siyuan-note/siyuan/issues/14308)
|
||||
* [透過箭頭鍵改進資料庫儲存格或彈出選項的切換](https://github.com/siyuan-note/siyuan/issues/14309)
|
||||
* [改進瀏覽器剪藏擴充功能](https://github.com/siyuan-note/siyuan/issues/14316)
|
||||
* [改進包含表情符號的內容的資料庫欄位排序](https://github.com/siyuan-note/siyuan/issues/14323)
|
||||
* [改進浮窗編輯內容同步](https://github.com/siyuan-note/siyuan/issues/14326)
|
||||
* [改進「移動」自動填入搜尋關鍵字](https://github.com/siyuan-note/siyuan/issues/14337)
|
||||
* [改進行級元素的 Ctrl+X](https://github.com/siyuan-note/siyuan/issues/14339)
|
||||
* [支援按回車鍵進入子選單](https://github.com/siyuan-note/siyuan/issues/14343)
|
||||
* [改進行級公式的「最佳化排版」](https://github.com/siyuan-note/siyuan/issues/14344)
|
||||
* [支援在 Harmony NEXT 上顯示伺服 IP](https://github.com/siyuan-note/siyuan/issues/14353)
|
||||
* [改進回溯文件以避免 ID 重複](https://github.com/siyuan-note/siyuan/issues/14358)
|
||||
* [在將文件轉換為標題/移動區塊之前產生文件歷史記錄](https://github.com/siyuan-note/siyuan/issues/14359)
|
||||
* [改進從 Claude 貼上公式](https://github.com/siyuan-note/siyuan/issues/14360)
|
||||
* [資料庫資源欄位支援鍵盤操作](https://github.com/siyuan-note/siyuan/issues/14365)
|
||||
* [改進查詢嵌入區塊自動刷新](https://github.com/siyuan-note/siyuan/issues/14370)
|
||||
|
||||
### 移除功能
|
||||
|
||||
* [不再支援 Android 7](https://github.com/siyuan-note/siyuan/issues/11010)
|
||||
* [不再支援 iOS 14](https://github.com/siyuan-note/siyuan/issues/14264)
|
||||
|
||||
### 修復缺陷
|
||||
|
||||
* [刪除行級元素結尾異常](https://github.com/siyuan-note/siyuan/issues/13881)
|
||||
* [全域搜尋後閃卡管理會被錯誤亮起來](https://github.com/siyuan-note/siyuan/issues/13898)
|
||||
* [貼上嵌入塊後出現異常](https://github.com/siyuan-note/siyuan/issues/14255)
|
||||
* [行動端裝置上無法長按貼上](https://github.com/siyuan-note/siyuan/issues/14277)
|
||||
* [無法貼上從 WPS 複製的特定文字](https://github.com/siyuan-note/siyuan/issues/14301)
|
||||
* [插件自訂的 URL 連結不起作用](https://github.com/siyuan-note/siyuan/issues/14314)
|
||||
* [匯出為 PDF 時超級區塊中的公式區塊未完全顯示](https://github.com/siyuan-note/siyuan/issues/14318)
|
||||
|
||||
### 開發重構
|
||||
|
||||
* [重構大綱函數 setCurrentById 的滾動策略](https://github.com/siyuan-note/siyuan/pull/14312)
|
||||
* [升級至 Electron v34.3.3](https://github.com/siyuan-note/siyuan/issues/14322)
|
||||
|
||||
### 開發者
|
||||
|
||||
* [改進內核 API `/api/filetree/getPathByID`](https://github.com/siyuan-note/siyuan/issues/14275)
|
||||
* [插件 API 支援透過區塊 ID 開啟區塊屬性面板](https://github.com/siyuan-note/siyuan/issues/14276)
|
||||
* [行動端返回導覽時缺少 `switch-protyle` 或 `loaded-protyle-static` 事件](https://github.com/siyuan-note/siyuan/issues/14296)
|
||||
* [新增內核 API `/api/block/batchUpdateBlock`](https://github.com/siyuan-note/siyuan/issues/14335)
|
||||
|
||||
## 下載
|
||||
|
||||
* [B3log](https://b3log.org/siyuan/download.html)
|
||||
* [GitHub](https://github.com/siyuan-note/siyuan/releases)
|
||||
79
app/changelogs/v3.1.25/v3.1.25_zh_CN.md
Normal file
79
app/changelogs/v3.1.25/v3.1.25_zh_CN.md
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
## 概述
|
||||
|
||||
该版本改进了一些细节。
|
||||
|
||||
## 变更记录
|
||||
|
||||
以下是此版本中的详细变更。
|
||||
|
||||
### 改进功能
|
||||
|
||||
* [从空段落块中删除零宽空格](https://github.com/siyuan-note/siyuan/issues/12273)
|
||||
* [改进预览样式](https://github.com/siyuan-note/siyuan/issues/13451)
|
||||
* [改进集市包加载](https://github.com/siyuan-note/siyuan/issues/13950)
|
||||
* [支持表格多选单元格复制纯文本](https://github.com/siyuan-note/siyuan/issues/14144)
|
||||
* [使用 html-to-image 替换 html2canvas](https://github.com/siyuan-note/siyuan/issues/14161)
|
||||
* [改进块菜单中的宽度子菜单](https://github.com/siyuan-note/siyuan/issues/14163)
|
||||
* [改进列表块的块标渲染位置](https://github.com/siyuan-note/siyuan/issues/14211)
|
||||
* [字体大小支持相对设置](https://github.com/siyuan-note/siyuan/issues/14231)
|
||||
* [查找替换后合并相同元素](https://github.com/siyuan-note/siyuan/issues/14236)
|
||||
* [改进大纲跳转定位](https://github.com/siyuan-note/siyuan/issues/14245)
|
||||
* [输入后带有外观的文本保持其外观](https://github.com/siyuan-note/siyuan/issues/14267)
|
||||
* [缩放后固定浮动窗口](https://github.com/siyuan-note/siyuan/issues/14278)
|
||||
* [在 iOS 上切换应用后改进重新连接提示](https://github.com/siyuan-note/siyuan/issues/14279)
|
||||
* [移动端资源菜单中的“导出”改为调用浏览器下载](https://github.com/siyuan-note/siyuan/issues/14280)
|
||||
* [改进移动端的元素菜单](https://github.com/siyuan-note/siyuan/issues/14283)
|
||||
* [改进图表编辑渲染](https://github.com/siyuan-note/siyuan/issues/14288)
|
||||
* [改进创建引用子文档时锚文本转义](https://github.com/siyuan-note/siyuan/issues/14289)
|
||||
* [集市搜索多个关键字使用 AND 逻辑](https://github.com/siyuan-note/siyuan/issues/14293)
|
||||
* [改进块引用动态锚文本添加行级样式](https://github.com/siyuan-note/siyuan/issues/14299)
|
||||
* [某些情况下不显示块标](https://github.com/siyuan-note/siyuan/issues/14304)
|
||||
* [数据库支持在单元格末尾按 `Tab` 创建新条目](https://github.com/siyuan-note/siyuan/issues/14305)
|
||||
* [复制数据库单元格并粘贴到文档标题中仅粘贴纯文本](https://github.com/siyuan-note/siyuan/issues/14306)
|
||||
* [改进数据库多选和关联字段单元格弹出编辑](https://github.com/siyuan-note/siyuan/issues/14308)
|
||||
* [通过箭头键改进数据库单元格或弹出选项的切换](https://github.com/siyuan-note/siyuan/issues/14309)
|
||||
* [改进浏览器剪藏扩展](https://github.com/siyuan-note/siyuan/issues/14316)
|
||||
* [改进包含表情符号的内容的数据库字段排序](https://github.com/siyuan-note/siyuan/issues/14323)
|
||||
* [改进浮窗编辑器内容同步](https://github.com/siyuan-note/siyuan/issues/14326)
|
||||
* [改进“移动”自动填充搜索关键字](https://github.com/siyuan-note/siyuan/issues/14337)
|
||||
* [改进行级元素的 Ctrl+X](https://github.com/siyuan-note/siyuan/issues/14339)
|
||||
* [支持按回车键进入子菜单](https://github.com/siyuan-note/siyuan/issues/14343)
|
||||
* [改进行级公式的“优化排版”](https://github.com/siyuan-note/siyuan/issues/14344)
|
||||
* [支持在 Harmony NEXT 上显示伺服 IP](https://github.com/siyuan-note/siyuan/issues/14353)
|
||||
* [改进回滚文档以避免 ID 重复](https://github.com/siyuan-note/siyuan/issues/14358)
|
||||
* [在将文档转换为标题/移动块之前生成文件历史记录](https://github.com/siyuan-note/siyuan/issues/14359)
|
||||
* [改进从 Claude 粘贴公式](https://github.com/siyuan-note/siyuan/issues/14360)
|
||||
* [数据库资源字段支持键盘操作](https://github.com/siyuan-note/siyuan/issues/14365)
|
||||
* [改进查询嵌入块自动刷新](https://github.com/siyuan-note/siyuan/issues/14370)
|
||||
|
||||
### 移除功能
|
||||
|
||||
* [不再支持 Android 7](https://github.com/siyuan-note/siyuan/issues/11010)
|
||||
* [不再支持 iOS 14](https://github.com/siyuan-note/siyuan/issues/14264)
|
||||
|
||||
### 修复缺陷
|
||||
|
||||
* [删除行级元素末尾异常](https://github.com/siyuan-note/siyuan/issues/13881)
|
||||
* [全局搜索后闪卡管理会被错误高亮](https://github.com/siyuan-note/siyuan/issues/13898)
|
||||
* [粘贴嵌入块后出现异常](https://github.com/siyuan-note/siyuan/issues/14255)
|
||||
* [移动端设备上无法长按粘贴](https://github.com/siyuan-note/siyuan/issues/14277)
|
||||
* [无法粘贴从 WPS 复制的特定文本](https://github.com/siyuan-note/siyuan/issues/14301)
|
||||
* [插件自定义的 URL 链接不起作用](https://github.com/siyuan-note/siyuan/issues/14314)
|
||||
* [导出为 PDF 时超级块中的公式块未完全显示](https://github.com/siyuan-note/siyuan/issues/14318)
|
||||
|
||||
### 开发重构
|
||||
|
||||
* [重构大纲函数 setCurrentById 的滚动策略](https://github.com/siyuan-note/siyuan/pull/14312)
|
||||
* [升级到 Electron v34.3.3](https://github.com/siyuan-note/siyuan/issues/14322)
|
||||
|
||||
### 开发者
|
||||
|
||||
* [改进内核 API `/api/filetree/getPathByID`](https://github.com/siyuan-note/siyuan/issues/14275)
|
||||
* [插件 API 支持通过块 ID 打开块属性面板](https://github.com/siyuan-note/siyuan/issues/14276)
|
||||
* [移动端返回导航时缺少 `switch-protyle` 或 `loaded-protyle-static` 事件](https://github.com/siyuan-note/siyuan/issues/14296)
|
||||
* [添加内核 API `/api/block/batchUpdateBlock`](https://github.com/siyuan-note/siyuan/issues/14335)
|
||||
|
||||
## 下载
|
||||
|
||||
* [B3log](https://b3log.org/siyuan/download.html)
|
||||
* [GitHub](https://github.com/siyuan-note/siyuan/releases)
|
||||
|
|
@ -31,6 +31,25 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func checkBlockRef(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
idsArg := arg["ids"].([]interface{})
|
||||
var ids []string
|
||||
for _, id := range idsArg {
|
||||
ids = append(ids, id.(string))
|
||||
}
|
||||
ids = gulu.Str.RemoveDuplicatedElem(ids)
|
||||
|
||||
ret.Data = model.CheckBlockRef(ids)
|
||||
}
|
||||
|
||||
func getBlockTreeInfos(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/block/transferBlockRef", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, transferBlockRef)
|
||||
ginServer.Handle("POST", "/api/block/getBlockSiblingID", model.CheckAuth, getBlockSiblingID)
|
||||
ginServer.Handle("POST", "/api/block/getBlockTreeInfos", model.CheckAuth, getBlockTreeInfos)
|
||||
ginServer.Handle("POST", "/api/block/checkBlockRef", model.CheckAuth, checkBlockRef)
|
||||
|
||||
ginServer.Handle("POST", "/api/file/getFile", model.CheckAuth, getFile)
|
||||
ginServer.Handle("POST", "/api/file/putFile", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, putFile)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/88250/lute/render"
|
||||
|
|
@ -76,21 +77,6 @@ type RiffCard struct {
|
|||
LastReview time.Time `json:"lastReview"`
|
||||
}
|
||||
|
||||
func getRiffCard(card *fsrs.Card) *RiffCard {
|
||||
due := card.Due
|
||||
if due.IsZero() {
|
||||
due = time.Now()
|
||||
}
|
||||
|
||||
return &RiffCard{
|
||||
Due: due,
|
||||
Reps: card.Reps,
|
||||
Lapses: card.Lapses,
|
||||
State: card.State,
|
||||
LastReview: card.LastReview,
|
||||
}
|
||||
}
|
||||
|
||||
func (block *Block) IsContainerBlock() bool {
|
||||
switch block.Type {
|
||||
case "NodeDocument", "NodeBlockquote", "NodeList", "NodeListItem", "NodeSuperBlock":
|
||||
|
|
@ -120,6 +106,46 @@ type Path struct {
|
|||
Created string `json:"created"` // 创建时间
|
||||
}
|
||||
|
||||
func CheckBlockRef(ids []string) bool {
|
||||
bts := treenode.GetBlockTrees(ids)
|
||||
|
||||
var rootIDs, blockIDs []string
|
||||
for _, bt := range bts {
|
||||
if "d" == bt.Type {
|
||||
rootIDs = append(rootIDs, bt.ID)
|
||||
} else {
|
||||
blockIDs = append(blockIDs, bt.ID)
|
||||
}
|
||||
}
|
||||
rootIDs = gulu.Str.RemoveDuplicatedElem(rootIDs)
|
||||
blockIDs = gulu.Str.RemoveDuplicatedElem(blockIDs)
|
||||
|
||||
existRef := func(refCounts map[string]int) bool {
|
||||
for _, refCount := range refCounts {
|
||||
if 0 < refCount {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
for _, rootID := range rootIDs {
|
||||
refCounts := sql.QueryRootChildrenRefCount(rootID)
|
||||
if existRef(refCounts) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
refCounts := sql.QueryRefCount(blockIDs)
|
||||
if existRef(refCounts) {
|
||||
return true
|
||||
}
|
||||
|
||||
// TODO 还需要考虑容器块的子块引用计数 https://github.com/siyuan-note/siyuan/issues/13396
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
type BlockTreeInfo struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import (
|
|||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
"github.com/88250/lute/parse"
|
||||
"github.com/open-spaced-repetition/go-fsrs/v3"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/riff"
|
||||
|
|
@ -434,6 +435,21 @@ func getCardsBlocks(cards []riff.Card, page, pageSize int) (blocks []*Block, tot
|
|||
return
|
||||
}
|
||||
|
||||
func getRiffCard(card *fsrs.Card) *RiffCard {
|
||||
due := card.Due
|
||||
if due.IsZero() {
|
||||
due = time.Now()
|
||||
}
|
||||
|
||||
return &RiffCard{
|
||||
Due: due,
|
||||
Reps: card.Reps,
|
||||
Lapses: card.Lapses,
|
||||
State: card.State,
|
||||
LastReview: card.LastReview,
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
// reviewCardCache <cardID, card> 用于复习时缓存卡片,以便支持撤销。
|
||||
reviewCardCache = map[string]riff.Card{}
|
||||
|
|
|
|||
|
|
@ -236,12 +236,6 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
|
|||
switch defNode.refType {
|
||||
case "ref-d":
|
||||
task.AppendAsyncTaskWithDelay(task.SetRefDynamicText, 200*time.Millisecond, util.PushSetRefDynamicText, refTreeID, n.ID, defNode.id, defNode.refText)
|
||||
case "embed":
|
||||
go func() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
sql.FlushQueue()
|
||||
task.AppendAsyncTaskWithDelay(task.ReloadEmbedBlock, 200*time.Millisecond, util.PushReloadEmbedBlock, refTreeID, n.ID)
|
||||
}()
|
||||
}
|
||||
}
|
||||
return ast.WalkContinue
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ const (
|
|||
ReloadProtyle = "task.reload.protyle" // 重新加载编辑器
|
||||
SetRefDynamicText = "task.ref.setDynamicText" // 设置引用的动态锚文本
|
||||
SetDefRefCount = "task.def.setRefCount" // 设置定义的引用计数
|
||||
ReloadEmbedBlock = "task.ref.reloadEmbedBlock" // 重新加载嵌入块
|
||||
UpdateIDs = "task.update.ids" // 更新 ID
|
||||
PushMsg = "task.push.msg" // 推送消息
|
||||
)
|
||||
|
|
@ -159,7 +158,6 @@ var uniqueActions = []string{
|
|||
ReloadProtyle,
|
||||
SetRefDynamicText,
|
||||
SetDefRefCount,
|
||||
ReloadEmbedBlock,
|
||||
UpdateIDs,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -275,10 +275,6 @@ func PushSetDefRefCount(rootID, blockID string, defIDs []string, refCount, rootR
|
|||
BroadcastByType("main", "setDefRefCount", 0, "", map[string]interface{}{"rootID": rootID, "blockID": blockID, "refCount": refCount, "rootRefCount": rootRefCount, "defIDs": defIDs})
|
||||
}
|
||||
|
||||
func PushReloadEmbedBlock(rootID, embedBlockID string) {
|
||||
BroadcastByType("main", "reloadEmbedBlock", 0, "", map[string]interface{}{"rootID": rootID, "embedBlockID": embedBlockID})
|
||||
}
|
||||
|
||||
func PushProtyleLoading(rootID, msg string) {
|
||||
BroadcastByType("protyle", "addLoading", 0, msg, rootID)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue