mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Refresh virtual block ref when closing box https://github.com/siyuan-note/siyuan/issues/11149#issuecomment-2106254491
This commit is contained in:
parent
84819beaf7
commit
b959cc2beb
9 changed files with 27 additions and 7 deletions
|
|
@ -1236,7 +1236,8 @@
|
||||||
"task.database.index.embedBlock": "Execute database index embed block",
|
"task.database.index.embedBlock": "Execute database index embed block",
|
||||||
"task.reload.ui": "Execute reload UI",
|
"task.reload.ui": "Execute reload UI",
|
||||||
"task.asset.database.index.full": "Execute asset database rebuild index",
|
"task.asset.database.index.full": "Execute asset database rebuild index",
|
||||||
"task.asset.database.index.commit": "Execute asset database index commit"
|
"task.asset.database.index.commit": "Execute asset database index commit",
|
||||||
|
"task.cache.virtualBlockRef": "Execute cache virtual reference"
|
||||||
},
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "Show Window",
|
"showWindow": "Show Window",
|
||||||
|
|
|
||||||
|
|
@ -1236,7 +1236,8 @@
|
||||||
"task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos",
|
"task.database.index.embedBlock": "Ejecutar bloque de incrustación de índice de base de datos",
|
||||||
"task.reload.ui": "IU de recarga de tareas",
|
"task.reload.ui": "IU de recarga de tareas",
|
||||||
"task.asset.database.index.full": "Ejecutar índice de reconstrucción de base de datos de activos",
|
"task.asset.database.index.full": "Ejecutar índice de reconstrucción de base de datos de activos",
|
||||||
"task.asset.database.index.commit": "Ejecutar confirmación del índice de la base de datos de activos"
|
"task.asset.database.index.commit": "Ejecutar confirmación del índice de la base de datos de activos",
|
||||||
|
"task.cache.virtualBlockRef": "Ejecutar referencia virtual de caché"
|
||||||
},
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "Mostrar ventana",
|
"showWindow": "Mostrar ventana",
|
||||||
|
|
|
||||||
|
|
@ -1236,7 +1236,8 @@
|
||||||
"task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données",
|
"task.database.index.embedBlock": "Exécuter le bloc d'intégration d'index de base de données",
|
||||||
"task.reload.ui": "Interface utilisateur de rechargement de tâche",
|
"task.reload.ui": "Interface utilisateur de rechargement de tâche",
|
||||||
"task.asset.database.index.full": "Exécuter l'index de reconstruction de la base de données d'actifs",
|
"task.asset.database.index.full": "Exécuter l'index de reconstruction de la base de données d'actifs",
|
||||||
"task.asset.database.index.commit": "Exécuter la validation de l'index de la base de données des actifs"
|
"task.asset.database.index.commit": "Exécuter la validation de l'index de la base de données des actifs",
|
||||||
|
"task.cache.virtualBlockRef": "Effectuer une référence virtuelle du cache"
|
||||||
},
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "Afficher la fenêtre principale",
|
"showWindow": "Afficher la fenêtre principale",
|
||||||
|
|
|
||||||
|
|
@ -1236,7 +1236,8 @@
|
||||||
"task.database.index.embedBlock": "データベースのインデックスを埋め込みブロック中",
|
"task.database.index.embedBlock": "データベースのインデックスを埋め込みブロック中",
|
||||||
"task.reload.ui": "UI の再読み込み中",
|
"task.reload.ui": "UI の再読み込み中",
|
||||||
"task.asset.database.index.full": "アセットデータベースのインデックスを再構築中",
|
"task.asset.database.index.full": "アセットデータベースのインデックスを再構築中",
|
||||||
"task.asset.database.index.commit": "アセットデータベースのインデックスをコミット中"
|
"task.asset.database.index.commit": "アセットデータベースのインデックスをコミット中",
|
||||||
|
"task.cache.virtualBlockRef": "キャッシュ仮想参照を実行"
|
||||||
},
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "ウィンドウを表示",
|
"showWindow": "ウィンドウを表示",
|
||||||
|
|
|
||||||
|
|
@ -1236,7 +1236,8 @@
|
||||||
"task.database.index.embedBlock": "執行資料庫索引嵌入塊",
|
"task.database.index.embedBlock": "執行資料庫索引嵌入塊",
|
||||||
"task.reload.ui": "執行重載界面",
|
"task.reload.ui": "執行重載界面",
|
||||||
"task.asset.database.index.full": "執行資源文件數據庫重建索引",
|
"task.asset.database.index.full": "執行資源文件數據庫重建索引",
|
||||||
"task.asset.database.index.commit": "執行資源文件數據庫索引提交"
|
"task.asset.database.index.commit": "執行資源文件數據庫索引提交",
|
||||||
|
"task.cache.virtualBlockRef": "執行快取虛擬引用"
|
||||||
},
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "顯示主窗口",
|
"showWindow": "顯示主窗口",
|
||||||
|
|
|
||||||
|
|
@ -1236,7 +1236,8 @@
|
||||||
"task.database.index.embedBlock": "执行数据库索引嵌入块",
|
"task.database.index.embedBlock": "执行数据库索引嵌入块",
|
||||||
"task.reload.ui": "执行重载界面",
|
"task.reload.ui": "执行重载界面",
|
||||||
"task.asset.database.index.full": "执行资源文件数据库重建索引",
|
"task.asset.database.index.full": "执行资源文件数据库重建索引",
|
||||||
"task.asset.database.index.commit": "执行资源文件数据库索引提交"
|
"task.asset.database.index.commit": "执行资源文件数据库索引提交",
|
||||||
|
"task.cache.virtualBlockRef": "执行缓存虚拟引用"
|
||||||
},
|
},
|
||||||
"_trayMenu": {
|
"_trayMenu": {
|
||||||
"showWindow": "显示主窗口",
|
"showWindow": "显示主窗口",
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,11 @@ func unindex(boxID string) {
|
||||||
ids := treenode.RemoveBlockTreesByBoxID(boxID)
|
ids := treenode.RemoveBlockTreesByBoxID(boxID)
|
||||||
RemoveRecentDoc(ids)
|
RemoveRecentDoc(ids)
|
||||||
sql.DeleteBoxQueue(boxID)
|
sql.DeleteBoxQueue(boxID)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
sql.WaitForWritingDatabase()
|
||||||
|
ResetVirtualBlockRefCache()
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (box *Box) Index() {
|
func (box *Box) Index() {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import (
|
||||||
"github.com/dgraph-io/ristretto"
|
"github.com/dgraph-io/ristretto"
|
||||||
"github.com/siyuan-note/siyuan/kernel/search"
|
"github.com/siyuan-note/siyuan/kernel/search"
|
||||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||||
|
"github.com/siyuan-note/siyuan/kernel/task"
|
||||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -99,6 +100,13 @@ func putBlockVirtualRefKeywords(blockContent string, root *ast.Node) (ret []stri
|
||||||
}
|
}
|
||||||
|
|
||||||
func CacheVirtualBlockRefJob() {
|
func CacheVirtualBlockRefJob() {
|
||||||
|
if !Conf.Editor.VirtualBlockRef {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
task.AppendTask(task.CacheVirtualBlockRef, ResetVirtualBlockRefCache)
|
||||||
|
}
|
||||||
|
|
||||||
|
func cacheVirtualBlockRef() {
|
||||||
virtualBlockRefCache.Del("virtual_ref")
|
virtualBlockRefCache.Del("virtual_ref")
|
||||||
if !Conf.Editor.VirtualBlockRef {
|
if !Conf.Editor.VirtualBlockRef {
|
||||||
return
|
return
|
||||||
|
|
@ -110,7 +118,7 @@ func CacheVirtualBlockRefJob() {
|
||||||
|
|
||||||
func ResetVirtualBlockRefCache() {
|
func ResetVirtualBlockRefCache() {
|
||||||
virtualBlockRefCache.Clear()
|
virtualBlockRefCache.Clear()
|
||||||
CacheVirtualBlockRefJob()
|
cacheVirtualBlockRef()
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddVirtualBlockRefInclude(keyword []string) {
|
func AddVirtualBlockRefInclude(keyword []string) {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ const (
|
||||||
ReloadUI = "task.reload.ui" // 重载 UI
|
ReloadUI = "task.reload.ui" // 重载 UI
|
||||||
AssetContentDatabaseIndexFull = "task.asset.database.index.full" // 资源文件数据库重建索引
|
AssetContentDatabaseIndexFull = "task.asset.database.index.full" // 资源文件数据库重建索引
|
||||||
AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交
|
AssetContentDatabaseIndexCommit = "task.asset.database.index.commit" // 资源文件数据库索引提交
|
||||||
|
CacheVirtualBlockRef = "task.cache.virtualBlockRef" // 缓存虚拟块引用
|
||||||
)
|
)
|
||||||
|
|
||||||
// uniqueActions 描述了唯一的任务,即队列中只能存在一个在执行的任务。
|
// uniqueActions 描述了唯一的任务,即队列中只能存在一个在执行的任务。
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue