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

This commit is contained in:
Vanessa 2024-11-05 10:48:24 +08:00
commit 6d58e55e63
20 changed files with 56 additions and 90 deletions

View file

@ -1470,7 +1470,7 @@
"153": "Heruntergeladene Dateien %d, Chunks %d, empfangene Bytes %s",
"154": "Die Cloud kann nur bis zu 12 Momentaufnahmen unterstützen",
"155": "Das Cloud-Synchronisationsverzeichnis wurde auf [main] zurückgesetzt",
"156": "Zugriffsautorisierung fehlgeschlagen, bitte aktualisieren oder erneut öffnen",
"156": "Authentifizierung fehlgeschlagen, bitte <button onclick=\"window.location.reload()\">aktualisieren</button> oder erneut öffnen",
"157": "Der Schlüssel wird nicht erkannt, bitte bestätigen Sie, dass die kopierte Schlüsselzeichenfolge korrekt ist",
"158": "Indizierung des Daten-Repositories, gehn die Daten %s",
"159": "Indizierung des Daten-Repositorys, die neueste Datei abrufen %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "Downloaded files %d, chunks %d, received bytes %s",
"154": "The cloud can only support backup up to 12 snapshots",
"155": "Cloud sync directory has been reset to [main]",
"156": "Access authentication failed, please refresh or reopen it",
"156": "Authentication failed, please <button onclick=\"window.location.reload()\">refresh</button> or reopen",
"157": "The key is not recognized, please confirm that the copied key string is correct",
"158": "Indexing data repo, walking data %s",
"159": "Indexing data repo, getting the latest file %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "Archivos descargados %d, fragmentos %d, bytes recibidos %s",
"154": "La nube solo admite copias de seguridad de hasta 12 instantáneas",
"155": "El directorio de sincronización de la nube se ha restablecido a [main]",
"156": "Error de autenticación de acceso; actualice o vuelva a abrir",
"156": "Error de autenticación, por favor <button onclick=\"window.location.reload()\">actualiza</button> o vuelve a abrir",
"157": "No se reconoce la clave, confirme que la cadena de clave copiada es correcta",
"158": "Indexando repositorio de datos, datos para caminar %s",
"159": "Indexando repositorio de datos, obteniendo el último archivo %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "Fichiers chargés %d, morceaux %d, octets reçus %s",
"154": "Le cloud ne peut prendre en charge que la sauvegarde jusqu'à 12 instantanés",
"155": "Le répertoire de synchronisation du cloud a été réinitialisé sur [main]",
"156": "Échec de l'authentification d'accès, veuillez actualiser ou rouvrir",
"156": "Échec de l'authentification, veuillez <button onclick=\"window.location.reload()\">actualiser</button> ou rouvrir",
"157": "La clé n'est pas reconnue, veuillez confirmer que la chaîne de clé copiée est correcte",
"158": "Indexation du référentiel de données, données de marche %s",
"159": "Indexation du référentiel de données, obtention du dernier fichier %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "הורדו קבצים %d, חלקים %d, בתים שהתקבלו %s",
"154": "הענן תומך אך ורק בגיבוי עד 12 צילומים",
"155": "תיקיית הסנכרון בענן הושבה ל[ראשית]",
"156": "אישור הגישה נכשל, אנא רענן או פתח מחדש",
"156": "אימות נכשל, אנא <button onclick=\"window.location.reload()\">רענן</button> או פתח מחדש",
"157": "המפתח אינו מזוהה, אנא וודא שהמפתח שהועתק נכון",
"158": "מאנדקס את מאגר הנתונים, עובר על הנתונים %s",
"159": "מאנדקס את מאגר הנתונים, מקבל את הקובץ העדכני %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "File scaricati %d, blocchi %d, byte ricevuti %s",
"154": "Il cloud può supportare solo il backup fino a 12 snapshot",
"155": "La directory di sincronizzazione cloud è stata ripristinata a [principale]",
"156": "Autenticazione accesso fallita, si prega di aggiornare o riaprire",
"156": "Autenticazione fallita, per favore <button onclick=\"window.location.reload()\">aggiorna</button> o riapri",
"157": "La chiave non è riconosciuta, si prega di confermare che la stringa della chiave copiata sia corretta",
"158": "Indicizzazione del repository dati, elaborando dati %s",
"159": "Indicizzazione del repository dati, ottenendo il file più recente %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "ダウンロードされたファイル %d、チャンク %d、受信バイト %s",
"154": "クラウドでサポートされるスナップショットのバックアップ数は最大12個です",
"155": "クラウド同期ディレクトリが [main] にリセットされました",
"156": "アクセス認証に失敗しました。更新するか再起動してください",
"156": "認証に失敗しました。<button onclick=\"window.location.reload()\">リロード</button>するか、再度開いてください",
"157": "キーが認識されません。キーが間違っていないか確認してください",
"158": "データリポジトリのインデックス作成: データを走査中 %s",
"159": "データリポジトリのインデックス作成: 最新ファイルを取得中 %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "Pobrane pliki %d, fragmenty %d, odebrane bajty %s",
"154": "Chmura może obsługiwać tylko kopię zapasową do 12 zrzutów",
"155": "Katalog synchronizacji w chmurze został zresetowany na [główny]",
"156": "Autoryzacja dostępu nie powiodła się, proszę odświeżyć lub ponownie otworzyć",
"156": "Błąd uwierzytelniania, proszę <button onclick=\"window.location.reload()\">odśwież</button> lub otwórz ponownie",
"157": "Klucz nie jest rozpoznawany, proszę potwierdzić, że skopiowany ciąg klucza jest poprawny",
"158": "Indeksowanie repozytorium danych, przetwarzanie danych %s",
"159": "Indeksowanie repozytorium danych, pobieranie najnowszego pliku %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "Скачанные файлы %d, части %d, полученные байты %s",
"154": "Облако может поддерживать резервное копирование только до 12 снимков",
"155": "Директория облачной синхронизации была сброшена до [главной]",
"156": "Аутентификация доступа не удалась, пожалуйста, обновите или переоткройте её",
"156": "Аутентификация доступа не удалась, пожалуйста, <button onclick=\"window.location.reload()\">обновите</button> или переоткройте её",
"157": "Ключ не распознается, пожалуйста, подтвердите, что скопированная строка ключа правильная",
"158": "Индексирование репозитория данных, прогулка по данным %s",
"159": "Индексирование репозитория данных, получение последнего файла %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "下載文件數 %d 下載分塊數 %d 接收位元組數 %s",
"154": "雲端最多只能支持備份 12 個快照",
"155": "雲端同步目錄已經重置為 [main]",
"156": "訪問鑑權失敗,請刷新或重新打開",
"156": "訪問鑑權失敗,請 <button onclick=\"window.location.reload()\">刷新</button> 或者重新打開",
"157": "無法識別密鑰,請確認複製的密鑰字串是否正確",
"158": "正在索引資料倉庫,遍歷資料 %s",
"159": "正在索引資料倉庫,獲取最新文件 %v/%v",

View file

@ -1470,7 +1470,7 @@
"153": "下载文件数 %d 下载分块数 %d 接收字节数 %s",
"154": "云端最多只能支持备份 12 个快照",
"155": "云端同步目录已经重置为 [main]",
"156": "访问鉴权失败,请刷新或者重新打开",
"156": "访问鉴权失败,请 <button onclick=\"window.location.reload()\">刷新</button> 或者重新打开",
"157": "无法识别密钥,请确认复制的密钥字符串是否正确",
"158": "正在索引数据仓库,遍历数据 %s",
"159": "正在索引数据仓库,获取最新文件 %v/%v",

View file

@ -97,6 +97,9 @@ export const pasteEscaped = async (protyle: IProtyle, nodeElement: Element) => {
try {
// * _ [ ] ! \ ` < > & ~ { } ( ) = # $ ^ | .
let clipText = await readText();
// 删掉 <span data-type\="text".*>text</span> 标签,只保留文本
clipText = clipText.replace(/<span data-type="text".*?>(.*?)<\/span>/g, "$1");
// https://github.com/siyuan-note/siyuan/issues/5446
// A\B\C\D\
// E
@ -175,6 +178,9 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
textPlain = textPlain.replace(/<kbd>/g, "__@kbd@__").replace(/<\/kbd>/g, "__@/kbd@__");
textPlain = textPlain.replace(/<u>/g, "__@u@__").replace(/<\/u>/g, "__@/u@__");
// 删掉 <span data-type\="text".*>text</span> 标签,只保留文本
textPlain = textPlain.replace(/<span data-type="text".*?>(.*?)<\/span>/g, "$1");
// 对 HTML 标签进行内部转义,避免被 Lute 解析以后变为小写 https://github.com/siyuan-note/siyuan/issues/10620
textPlain = textPlain.replace(/</g, ";;;lt;;;").replace(/>/g, ";;;gt;;;");
@ -184,7 +190,22 @@ export const pasteAsPlainText = async (protyle: IProtyle) => {
textPlain = textPlain.replace(/__@kbd@__/g, "<kbd>").replace(/__@\/kbd@__/g, "</kbd>");
textPlain = textPlain.replace(/__@u@__/g, "<u>").replace(/__@\/u@__/g, "</u>");
protyle.lute.SetInlineAsterisk(true);
protyle.lute.SetGFMStrikethrough(true);
protyle.lute.SetInlineMath(true);
protyle.lute.SetSub(true);
protyle.lute.SetSup(true);
protyle.lute.SetTag(true);
protyle.lute.SetInlineUnderscore(true);
const content = protyle.lute.BlockDOM2EscapeMarkerContent(protyle.lute.Md2BlockDOM(textPlain));
protyle.lute.SetInlineAsterisk(window.siyuan.config.editor.markdown.inlineAsterisk);
protyle.lute.SetGFMStrikethrough(window.siyuan.config.editor.markdown.inlineStrikethrough);
protyle.lute.SetInlineMath(window.siyuan.config.editor.markdown.inlineMath);
protyle.lute.SetSub(window.siyuan.config.editor.markdown.inlineSub);
protyle.lute.SetSup(window.siyuan.config.editor.markdown.inlineSup);
protyle.lute.SetTag(window.siyuan.config.editor.markdown.inlineTag);
protyle.lute.SetInlineUnderscore(window.siyuan.config.editor.markdown.inlineUnderscore);
// insertHTML 会进行内部反转义
insertHTML(content, protyle, false, false, true);
filterClipboardHint(protyle, textPlain);

File diff suppressed because one or more lines are too long

View file

@ -10,7 +10,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.20240612035750-c9cf5f7a4d02
github.com/88250/lute v1.7.7-0.20241104041903-6639d831bb56
github.com/88250/lute v1.7.7-0.20241104160608-6885b1ea84cd
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

@ -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.20240612035750-c9cf5f7a4d02 h1:3e5+yobj655pTeKOYMbJrnc1mE51ZkbXIxquTYZuYCY=
github.com/88250/gulu v1.2.3-0.20240612035750-c9cf5f7a4d02/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
github.com/88250/lute v1.7.7-0.20241104041903-6639d831bb56 h1:AbOT5NYZZwsREshKGfj5/cTOn82aMqe42eXuH6mLrMk=
github.com/88250/lute v1.7.7-0.20241104041903-6639d831bb56/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
github.com/88250/lute v1.7.7-0.20241104160608-6885b1ea84cd h1:pBo4pZnyed6hnab8LmT/AYHl9mUI2k5xkGWHdedr9FI=
github.com/88250/lute v1.7.7-0.20241104160608-6885b1ea84cd/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
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

@ -1715,16 +1715,16 @@ func getAvNames(avIDs string) (ret string) {
return
}
func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees []*parse.Tree, nodes []*ast.Node) {
func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees map[string]*parse.Tree, nodes []*ast.Node) {
blockKeyValues := attrView.GetBlockKeyValues()
treeCache := map[string]*parse.Tree{}
trees = map[string]*parse.Tree{}
for _, blockKeyValue := range blockKeyValues.Values {
if blockKeyValue.IsDetached {
continue
}
var tree *parse.Tree
tree = treeCache[blockKeyValue.BlockID]
tree = trees[blockKeyValue.BlockID]
if nil == tree {
if nil == tx {
tree, _ = LoadTreeByBlockID(blockKeyValue.BlockID)
@ -1735,7 +1735,7 @@ func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees
if nil == tree {
continue
}
treeCache[blockKeyValue.BlockID] = tree
trees[blockKeyValue.BlockID] = tree
node := treenode.GetNodeInTree(tree, blockKeyValue.BlockID)
if nil == node {
@ -1744,9 +1744,6 @@ func (tx *Transaction) getAttrViewBoundNodes(attrView *av.AttributeView) (trees
nodes = append(nodes, node)
}
for _, tree := range treeCache {
trees = append(trees, tree)
}
return
}

View file

@ -109,7 +109,6 @@ func GetBackmentionDoc(defID, refTreeID, keyword string, containChildren bool) (
if 0 < len(trees) {
sortBacklinks(ret, refTree)
ret = mergeNeighborBacklinks(ret)
filterBlockPaths(ret)
}
return
@ -153,58 +152,10 @@ func GetBacklinkDoc(defID, refTreeID, keyword string, containChildren bool) (ret
}
sortBacklinks(ret, refTree)
ret = mergeNeighborBacklinks(ret)
filterBlockPaths(ret)
for i := len(ret) - 1; 0 < i; i-- {
curPaths := ret[i].BlockPaths
prevPaths := ret[i-1].BlockPaths
// 如果当前反链的面包屑和前一个反链的面包屑一致,则清空当前反链的面包屑以简化显示
if blockPathsEqual(curPaths, prevPaths) {
ret[i].BlockPaths = []*BlockPath{}
}
}
return
}
func mergeNeighborBacklinks(blockLinks []*Backlink) (ret []*Backlink) {
// 如果反链中的节点是相邻的,则合并
for i := len(blockLinks) - 1; 0 < i; i-- {
if isPrevious(blockLinks[i].node, blockLinks[i-1].node) {
blockLinks[i-1].DOM += blockLinks[i].DOM
blockLinks[i] = nil
continue
}
}
for _, b := range blockLinks {
if nil != b {
ret = append(ret, b)
}
}
return
}
func isPrevious(cur, prev *ast.Node) bool {
if nil == cur || nil == prev {
return false
}
if cur.Previous == prev {
return true
}
for prevParent := prev.Parent; nil != prevParent; prevParent = prevParent.Parent {
if prev.Next == cur {
return true
}
}
for curParent := cur.Parent; nil != curParent; curParent = curParent.Parent {
if prev.Next == curParent {
return true
}
}
return false
}
func filterBlockPaths(blockLinks []*Backlink) {
for _, b := range blockLinks {
if 2 == len(b.BlockPaths) {
@ -215,23 +166,6 @@ func filterBlockPaths(blockLinks []*Backlink) {
return
}
func blockPathsEqual(paths1, paths2 []*BlockPath) bool {
if len(paths1) != len(paths2) {
return false
}
if 2 < len(paths1) {
paths1 = paths1[:len(paths1)-1]
paths2 = paths2[:len(paths2)-1]
}
for i := range paths1 {
if paths1[i].ID != paths2[i].ID {
return false
}
}
return true
}
func sortBacklinks(backlinks []*Backlink, tree *parse.Tree) {
contentSorts := map[string]int{}
sortVal := 0

View file

@ -1181,6 +1181,8 @@ func reassignIDUpdated(tree *parse.Tree, rootID, updated string) {
n.SetIALAttr("id", n.ID)
if "" != updated {
n.SetIALAttr("updated", updated)
n.ID = updated + "-" + gulu.Rand.String(7)
n.SetIALAttr("id", n.ID)
} else {
n.SetIALAttr("updated", util.TimeFromID(n.ID))
}

View file

@ -1100,6 +1100,19 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
ReloadAttrView(avID)
}
// 插入数据库块时需要重新绑定其中已经存在的块
// 比如剪切操作时,会先进行 delete 数据库解绑块,这里需要重新绑定 https://github.com/siyuan-note/siyuan/issues/13031
if ast.NodeAttributeView == insertedNode.Type {
attrView, parseErr := av.ParseAttributeView(insertedNode.AttributeViewID)
if nil == parseErr {
trees, toBindNodes := tx.getAttrViewBoundNodes(attrView)
for _, toBindNode := range toBindNodes {
t := trees[toBindNode.ID]
bindBlockAv0(tx, insertedNode.AttributeViewID, toBindNode, t)
}
}
}
operation.ID = insertedNode.ID
operation.ParentID = insertedNode.Parent.ID

View file

@ -168,7 +168,6 @@ func GetAssetText(asset string) (ret string) {
assetsTextsLock.Lock()
ret = assetsTexts[asset]
assetsTextsLock.Unlock()
assetsTextsChanged.Store(true)
return
}