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

This commit is contained in:
Vanessa 2024-10-19 16:56:05 +08:00
commit 88a2835d5d
15 changed files with 83 additions and 98 deletions

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "Sind Sie sicher, dass Sie das Feld, das mit <b>${x}</b> verknüpft ist, löschen möchten?",
"removeButKeepRelationField": "Entfernen, verknüpftes Feld behalten",
"removeButKeepRelationField": "Entfernen, aber verknüpftes Feld behalten",
"exportPDFLowMemory": "Nicht genügend verfügbarer Speicher, um dieses PDF zu exportieren, bitte reduzieren Sie den Inhalt oder erhöhen Sie den verfügbaren Speicher und versuchen Sie es erneut",
"exportConf": "Export-Einstellungen",
"exportConfTip": "Konto, Zugriffscode, Synchronisation, API-Token und Daten-Repo-Schlüssel werden nicht exportiert",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "Are you sure you want to delete the field associated with <b>${x}</b>?",
"removeButKeepRelationField": "Remove, keep related field",
"removeButKeepRelationField": "Remove, but keep related field",
"exportPDFLowMemory": "Insufficient available memory to export this PDF, please reduce the content or increase available memory and try exporting again",
"exportConf": "Export settings",
"exportConfTip": "Account, access authorization code, synchronization, API token and data repo key will not be exported",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "¿Está seguro de que desea eliminar el campo asociado a <b>${x}</b>?",
"removeButKeepRelationField": "Eliminar, mantener el campo relacionado",
"removeButKeepRelationField": "Eliminar, pero mantener el campo relacionado",
"exportPDFLowMemory": "Memoria disponible insuficiente para exportar este PDF, por favor reduzca el contenido o aumente la memoria disponible y vuelva a intentar exportar",
"exportConf": "Configuración de exportación",
"exportConfTip": "Las cuentas, los códigos de acceso, la sincronización, los tokens API y las claves del almacén de datos no se exportarán",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "Êtes-vous sûr de vouloir supprimer le champ associé à <b>${x}</b>?",
"removeButKeepRelationField": "Supprimer, conserver le champ associé",
"removeButKeepRelationField": "Supprimer, mais conserver le champ associé",
"exportPDFLowMemory": "Mémoire disponible insuffisante pour exporter ce PDF, veuillez réduire le contenu ou augmenter la mémoire disponible et réessayer d'exporter",
"exportConf": "Exporter les paramètres",
"exportConfTip": "Les comptes, codes d'accès, synchronisation, tokens API et clés d'entrepôt de données ne seront pas exportés",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "האם אתה בטוח שברצונך למחוק את השדה המשויך ל-<b>${x}</b>?",
"removeButKeepRelationField": "מחק, שמור על שדה הקשר",
"removeButKeepRelationField": "מחק, אך שמור על שדה הקשר",
"exportPDFLowMemory": "אין מספיק זיכרון זמין במערכת כדי לייצא את ה-PDF הזה, נא לצמצם את התוכן או להגדיל את הזיכרון הזמין ולנסות שוב לייצא",
"exportConf": "הגדרות ייצוא",
"exportConfTip": "פרטי חשבון, קוד אישור גישה, סנכרון, אסימון API ומפתח מאגר נתונים לא ייוצאו",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "Sei sicuro di voler eliminare il campo associato a <b>${x}</b>?",
"removeButKeepRelationField": "Rimuovi, mantieni il campo correlato",
"removeButKeepRelationField": "Rimuovi, ma mantieni il campo correlato",
"exportPDFLowMemory": "Memoria disponibile insufficiente per esportare questo PDF, riduci il contenuto o aumenta la memoria disponibile e riprova a esportare",
"exportConf": "Impostazioni di esportazione",
"exportConfTip": "Account, codici di accesso, sincronizzazione, token API e chiavi di data warehouse non verranno esportati",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "Czy na pewno chcesz usunąć pole powiązane z <b>${x}</b>?",
"removeButKeepRelationField": "Usuń, zachowaj powiązane pole",
"removeButKeepRelationField": "Usuń, ale zachowaj powiązane pole",
"exportPDFLowMemory": "Za mało dostępnej pamięci, aby wyeksportować ten PDF, proszę zmniejszyć zawartość lub zwiększyć dostępną pamięć i spróbować ponownie",
"exportConf": "Ustawienia eksportu",
"exportConfTip": "Konto, kod autoryzacji dostępu, synchronizacja, token API i klucz repozytorium danych nie będą eksportowane",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "Вы уверены, что хотите удалить поле, связанное с <b>${x}</b>?",
"removeButKeepRelationField": "Удалить, сохранить связанное поле",
"removeButKeepRelationField": "Удалить, но сохранить связанное поле",
"exportPDFLowMemory": "Недостаточно доступной памяти для экспорта этого PDF, пожалуйста, уменьшите содержимое или увеличьте доступную память и повторите попытку экспорта",
"exportConf": "Экспорт настроек",
"exportConfTip": "Учетная запись, код авторизации доступа, синхронизация, API токен и ключ репозитория данных не будут экспортированы",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "確定同時刪除關聯至 <b>${x}</b> 中的字段嗎?",
"removeButKeepRelationField": "刪除,保留關聯字段",
"removeButKeepRelationField": "刪除,保留關聯字段",
"exportPDFLowMemory": "系統可用記憶體不足,無法導出該 PDF請減少內容或者增加可用記憶體後再嘗試導出",
"exportConf": "匯出設定",
"exportConfTip": "帳號、存取授權碼、同步、API token 和資料倉儲金鑰不會被匯出",

View file

@ -1,6 +1,6 @@
{
"confirmRemoveRelationField": "确定同时删除关联至 <b>${x}</b> 中的字段吗?",
"removeButKeepRelationField": "删除,保留关联字段",
"removeButKeepRelationField": "删除,保留关联字段",
"exportPDFLowMemory": "系统可用内存不足,无法导出该 PDF请减少内容或者增加可用内存后再尝试导出",
"exportConf": "导出设置",
"exportConfTip": "账号、访问授权码、同步、API token 和数据仓库密钥不会被导出",

View file

@ -46,7 +46,7 @@ func NewExport() *Export {
return &Export{
ParagraphBeginningSpace: false,
AddTitle: true,
BlockRefMode: 3,
BlockRefMode: 4,
BlockEmbedMode: 1,
BlockRefTextLeft: "",
BlockRefTextRight: "",

View file

@ -209,28 +209,17 @@ func GetAttributeViewPrimaryKeyValues(avID, keyword string, page, pageSize int)
databaseBlockIDs = treenode.GetMirrorAttrViewBlockIDs(avID)
keyValues = attrView.GetBlockKeyValues()
// 过滤掉不在视图中的值
tmp := map[string]*av.Value{}
var values []*av.Value
for _, kv := range keyValues.Values {
for _, view := range attrView.Views {
switch view.LayoutType {
case av.LayoutTypeTable:
if !kv.IsDetached {
if !treenode.ExistBlockTree(kv.BlockID) {
break
}
}
if !kv.IsDetached && !treenode.ExistBlockTree(kv.BlockID) {
continue
}
tmp[kv.Block.ID] = kv
}
}
}
keyValues.Values = []*av.Value{}
for _, v := range tmp {
if strings.Contains(strings.ToLower(v.String(true)), strings.ToLower(keyword)) {
keyValues.Values = append(keyValues.Values, v)
if strings.Contains(strings.ToLower(kv.String(true)), strings.ToLower(keyword)) {
values = append(values, kv)
}
}
keyValues.Values = values
if 1 > pageSize {
pageSize = 16
@ -2796,27 +2785,35 @@ func RemoveAttributeViewKey(avID, keyID string, removeRelationDest bool) (err er
if nil != removedKey && av.KeyTypeRelation == removedKey.Type && nil != removedKey.Relation {
if removedKey.Relation.IsTwoWay {
if removeRelationDest { // 删除双向关联的目标列
var destAv *av.AttributeView
if avID == removedKey.Relation.AvID {
destAv = attrView
} else {
destAv, _ = av.ParseAttributeView(removedKey.Relation.AvID)
var destAv *av.AttributeView
if avID == removedKey.Relation.AvID {
destAv = attrView
} else {
destAv, _ = av.ParseAttributeView(removedKey.Relation.AvID)
}
if nil != destAv {
oldDestKey, _ := destAv.GetKey(removedKey.Relation.BackKeyID)
if nil != oldDestKey && nil != oldDestKey.Relation && oldDestKey.Relation.AvID == attrView.ID && oldDestKey.Relation.IsTwoWay {
oldDestKey.Relation.IsTwoWay = false
oldDestKey.Relation.BackKeyID = ""
}
if nil != destAv {
destAvRelSrcAv := false
for i, keyValues := range destAv.KeyValues {
if keyValues.Key.ID == removedKey.Relation.BackKeyID {
destAvRelSrcAv := false
for i, keyValues := range destAv.KeyValues {
if keyValues.Key.ID == removedKey.Relation.BackKeyID {
if removeRelationDest { // 删除双向关联的目标列
destAv.KeyValues = append(destAv.KeyValues[:i], destAv.KeyValues[i+1:]...)
continue
}
if av.KeyTypeRelation == keyValues.Key.Type && keyValues.Key.Relation.AvID == attrView.ID {
destAvRelSrcAv = true
}
continue
}
if av.KeyTypeRelation == keyValues.Key.Type && keyValues.Key.Relation.AvID == attrView.ID {
destAvRelSrcAv = true
}
}
if removeRelationDest {
for _, view := range destAv.Views {
switch view.LayoutType {
case av.LayoutTypeTable:
@ -2828,15 +2825,15 @@ func RemoveAttributeViewKey(avID, keyID string, removeRelationDest bool) (err er
}
}
}
}
if destAv != attrView {
av.SaveAttributeView(destAv)
ReloadAttrView(destAv.ID)
}
if destAv != attrView {
av.SaveAttributeView(destAv)
ReloadAttrView(destAv.ID)
}
if !destAvRelSrcAv {
av.RemoveAvRel(destAv.ID, attrView.ID)
}
if !destAvRelSrcAv {
av.RemoveAvRel(destAv.ID, attrView.ID)
}
}

View file

@ -130,26 +130,8 @@ type BlockTreeInfo struct {
func GetBlockTreeInfos(ids []string) (ret map[string]*BlockTreeInfo) {
ret = map[string]*BlockTreeInfo{}
luteEngine := util.NewLute()
treeCache := map[string]*parse.Tree{}
for _, id := range ids {
bt := treenode.GetBlockTree(id)
if nil == bt {
ret[id] = &BlockTreeInfo{ID: id}
continue
}
tree := treeCache[bt.RootID]
if nil == tree {
tree, _ = filesys.LoadTree(bt.BoxID, bt.Path, luteEngine)
if nil == tree {
ret[id] = &BlockTreeInfo{ID: id}
continue
}
treeCache[bt.RootID] = tree
}
trees := filesys.LoadTrees(ids)
for id, tree := range trees {
node := treenode.GetNodeInTree(tree, id)
if nil == node {
ret[id] = &BlockTreeInfo{ID: id}

View file

@ -255,8 +255,7 @@ func Export2Liandi(id string) (err error) {
case 404:
foundArticle = false
default:
msg := fmt.Sprintf("get liandi article info failed [sc=%d]", resp.StatusCode)
err = errors.New(msg)
err = errors.New(fmt.Sprintf("get liandi article info failed [sc=%d]", resp.StatusCode))
return
}
}
@ -315,8 +314,7 @@ func Export2Liandi(id string) (err error) {
}
}
msg := fmt.Sprintf(Conf.Language(181), util.GetCloudAccountServer()+"/article/"+articleId)
util.PushMsg(msg, 7000)
util.PushMsg(fmt.Sprintf(Conf.Language(181), util.GetCloudAccountServer()+"/article/"+articleId), 7000)
return
}
@ -505,8 +503,7 @@ func exportData(exportFolder string) (zipPath string, err error) {
}
zipCallback := func(filename string) {
msg := Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), filename)
util.PushEndlessProgress(msg)
util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), filename))
}
if err = zip.AddDirectory(baseFolderName, exportFolder, zipCallback); err != nil {
@ -619,8 +616,7 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (fullPath string,
if "" != docxTemplate {
if !gulu.File.IsExist(docxTemplate) {
logging.LogErrorf("docx template [%s] not found", docxTemplate)
msg := fmt.Sprintf(Conf.Language(197), docxTemplate)
err = errors.New(msg)
err = errors.New(fmt.Sprintf(Conf.Language(197), docxTemplate))
return
}
@ -633,8 +629,7 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (fullPath string,
output, err := pandoc.CombinedOutput()
if err != nil {
logging.LogErrorf("export docx failed: %s", gulu.Str.FromBytes(output))
msg := fmt.Sprintf(Conf.Language(14), gulu.Str.FromBytes(output))
err = errors.New(msg)
err = errors.New(fmt.Sprintf(Conf.Language(14), gulu.Str.FromBytes(output)))
return
}
@ -1540,23 +1535,22 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
trees := map[string]*parse.Tree{}
refTrees := map[string]*parse.Tree{}
treeCache := map[string]*parse.Tree{}
luteEngine := util.NewLute()
for i, p := range docPaths {
docIAL := box.docIAL(p)
if nil == docIAL {
continue
}
msg := Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), fmt.Sprintf("%d/%d %s", i+1, len(docPaths), docIAL["title"]))
util.PushEndlessProgress(msg)
id := docIAL["id"]
tree, err := LoadTreeByBlockID(id)
tree, err := filesys.LoadTree(boxID, p, luteEngine)
if err != nil {
continue
}
trees[tree.ID] = tree
util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), fmt.Sprintf("%d/%d %s", i+1, len(docPaths), tree.Root.IALAttr("title"))))
}
count := 1
treeCache := map[string]*parse.Tree{}
for _, tree := range trees {
util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), fmt.Sprintf("%d/%d %s", count, len(docPaths), tree.Root.IALAttr("title"))))
refs := map[string]*parse.Tree{}
exportRefTrees(tree, &refs, &treeCache)
for refTreeID, refTree := range refs {
@ -1567,9 +1561,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
}
util.PushEndlessProgress(Conf.Language(65))
count = 0
// 按文件夹结构复制选择的树
count := 0
total := len(trees) + len(refTrees)
for _, tree := range trees {
readPath := filepath.Join(util.DataDir, tree.Box, tree.Path)
@ -1592,7 +1586,7 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
}
count++
util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
}
// 引用树放在导出文件夹根路径下
@ -1612,7 +1606,7 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
}
count++
util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath))
}
// 将引用树合并到选择树中,以便后面一次性导出资源文件
@ -1798,8 +1792,7 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (
}
zipCallback := func(filename string) {
msg := Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), filename)
util.PushEndlessProgress(msg)
util.PushEndlessProgress(Conf.language(65) + " " + fmt.Sprintf(Conf.language(70), filename))
}
if err = zip.AddDirectory(baseFolderName, exportFolder, zipCallback); err != nil {
@ -2735,7 +2728,7 @@ type refAsFootnotes struct {
refAnchorText string
}
func exportRefTrees(tree *parse.Tree, retTrees *map[string]*parse.Tree, treeCache *map[string]*parse.Tree) {
func exportRefTrees(tree *parse.Tree, retTrees, treeCache *map[string]*parse.Tree) {
if nil != (*retTrees)[tree.ID] {
return
}

View file

@ -81,7 +81,16 @@ func renderOutline(heading *ast.Node, luteEngine *lute.Lute) (ret string) {
dom := luteEngine.RenderNodeBlockDOM(n)
buf.WriteString(dom)
return ast.WalkSkipChildren
case ast.NodeEmoji:
dom := luteEngine.RenderNodeBlockDOM(n)
buf.WriteString(dom)
return ast.WalkSkipChildren
case ast.NodeImage:
// 标题后直接跟图片时图片的提示文本不再渲染到大纲中 https://github.com/siyuan-note/siyuan/issues/6278
title := n.ChildByType(ast.NodeLinkTitle)
title.Unlink()
dom := luteEngine.RenderNodeBlockDOM(n)
buf.WriteString(dom)
return ast.WalkSkipChildren
}
return ast.WalkContinue
@ -215,6 +224,10 @@ func resolveEmbedR(n *ast.Node, blockEmbedMode int, luteEngine *lute.Lute, resol
}
subTree, _ := LoadTreeByBlockID(sqlBlock.ID)
if nil == subTree {
continue
}
var md string
if "d" == sqlBlock.Type {
if 0 == blockEmbedMode {