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

This commit is contained in:
Vanessa 2024-05-17 17:50:12 +08:00
commit 9f792df41e
11 changed files with 93 additions and 31 deletions

View file

@ -1,5 +1,7 @@
{
"confirmDeleteTip": "Are you sure to delete <b>${x}</b>?<br>After deletion, it can be restored in [Data History], retained <code class= 'fn__code'>${y}</code> days according to [Settings - Editor - History Retention Days]",
"andSubFile": "Are you sure you want to delete <b>${x}</b> and its ${y} subdocs?",
"confirmDeleteTip": "Are you sure to delete <b>${x}</b>?",
"rollbackTip": "After deletion, it can be restored in [Data History], retained <code class= 'fn__code'>${x}</code> days according to [Settings - Editor - History Retention Days]",
"newView": "Add View",
"newCol": "Add column",
"newRow": "Add entry",
@ -686,7 +688,6 @@
"customEmoji": "Add custom emoji",
"customEmojiTip": "Open <a href=\"javascript:void(0)\" id=\"appearanceOpenEmoji\">Emoji folder</a>, put the picture in and click the refresh button",
"recentEmoji": "Common Emoticons",
"andSubFile": "and its <b>x</b> subdocs",
"changeIcon": "Change icon",
"addIcon": "Add icon",
"includeSubFile": "\nInclude x subdocs",

View file

@ -1,5 +1,7 @@
{
"confirmDeleteTip": "¿Está seguro de eliminar <b>${x}</b>?<br>Después de la eliminación, se puede restaurar en [Historial de datos] y se conserva <code class= 'fn__code'>${y }</code> días según [Configuración - Editor - Días de retención del historial]",
"andSubFile": "¿Está seguro de que desea eliminar <b>${x}</b> y sus subdocumentos ${y}?",
"confirmDeleteTip": "¿Está seguro de eliminar <b>${x}</b>?",
"rollbackTip": "Después de la eliminación, se puede restaurar en [Historial de datos] y se conserva <code class= 'fn__code'>${x}</code> días según [Configuración - Editor - Días de retención del historial]",
"newView": "Agregar vista",
"newCol": "Agregar columna",
"newRow": "Agregar entrada",
@ -235,7 +237,7 @@
"hideAll": "Ocultar todo",
"showAll": "Mostrar todo",
"showCol": "Mostrar columna",
"número": "Número",
"number": "Número",
"fecha": "Fecha",
"seleccionar": "Seleccionar",
"multiSelect": "Selección múltiple",
@ -686,7 +688,6 @@
"customEmoji": "Añadir un emoji personalizado",
"customEmojiTip": "Abrir <a href=\"javascript:void(0)\" id=\"appearanceOpenEmoji\">carpeta de emojis</a>, poner la imagen y hacer clic en el botón de actualización",
"recentEmoji": "Emoticonos comunes",
"andSubFile": "y sus <b>x</b> documentos secundarios",
"changeIcon": "Cambiar el icono",
"addIcon": "Agregar icono",
"includeSubFile": "\nIncluir x documentos secundarios",

View file

@ -1,5 +1,7 @@
{
"confirmDeleteTip": "Êtes-vous sûr de supprimer <b>${x}</b> ?<br>Après la suppression, il peut être restauré dans [Historique des données], conservé <code class= 'fn__code'>${y }</code> jours selon [Paramètres - Éditeur - Jours de rétention de l'historique]",
"andSubFile": "Êtes-vous sûr de vouloir supprimer <b>${x}</b> et ses sous-documents ${y} ?",
"confirmDeleteTip": "Êtes-vous sûr de supprimer <b>${x}</b> ?",
"rollbackTip": "Après la suppression, il peut être restauré dans [Historique des données], conservé <code class= 'fn__code'>${x}</code> jours selon [Paramètres - Éditeur - Jours de rétention de l'historique]",
"newView": "Ajouter une vue",
"newCol": "Ajouter une colonne",
"newRow": "Ajouter une entrée",
@ -235,7 +237,7 @@
"hideAll": "Masquer tout",
"showAll": "Afficher tout",
"showCol": "Afficher la colonne",
"numéro": "Numéro",
"number": "Numéro",
"date": "Date",
"select": "Sélectionner",
"multiSelect": "Multi-sélection",
@ -686,7 +688,6 @@
"customEmoji": "Ajouter un emoji personnalisé",
"customEmojiTip": "Ouvrir <a href=\"javascript:void(0)\" id=\"appearanceOpenEmoji\">Emoji folder</a>, insérez l'image et cliquez sur le bouton d'actualisation",
"recentEmoji": "Emoticônes courantes",
"andSubFile": "et son <b>x</b> sous-documents",
"changeIcon": "Changer l'icône",
"addIcon": "Ajouter une icône",
"includeSubFile": "\nInclure x sous-documents",

View file

@ -1,5 +1,7 @@
{
"confirmDeleteTip": "<b>${x}</b> を削除してもよろしいですか?<br>削除後は [データ履歴] で復元でき、<code class= 'fn__code'>${y}</code> は保持されます。 [設定 - エディター - 履歴の保存日数] による日数",
"andSubFile": "<b>${x}</b> とそのサブドキュメント ${y} を削除してもよろしいですか?",
"confirmDeleteTip": "<b>${x}</b> を削除してもよろしいですか?",
"rollbackTip": "削除後は [データ履歴] で復元でき、<code class= 'fn__code'>${x}</code> は保持されます。 [設定 - エディター - 履歴の保存日数] による日数",
"newView": "ビューを追加",
"newCol": "列を追加",
"newRow": "エントリを追加",
@ -686,7 +688,6 @@
"customEmoji": "絵文字を追加",
"customEmojiTip": "<a href=\"javascript:void(0)\" id=\"appearanceOpenEmoji\">絵文字フォルダ</a>に画像を入れて更新ボタンをクリックしてください",
"recentEmoji": "よく使う絵文字",
"andSubFile": "およびその <b>x</b> サブドキュメント",
"changeIcon": "アイコンを変更",
"addIcon": "アイコンを追加",
"includeSubFile": "\nx 個のサブドキュメントを含む",

View file

@ -1,5 +1,7 @@
{
"confirmDeleteTip": "確定刪除<b>${x}</b> 嗎?<br>刪除後可在 [資料歷史] 中恢復,按 [設定- 編輯器- 歷史保留天數] 保留<code class= 'fn__code'>${y}</code> 天",
"andSubFile": "決定刪除 <b>${x}</b> 及其 ${y} 個子文件嗎?",
"confirmDeleteTip": "確定刪除<b>${x}</b> 嗎?",
"rollbackTip": "刪除後可在 [資料歷史] 中恢復,按 [設定 - 編輯器 - 歷史保留天數] 保留 <code class= 'fn__code'>${x}</code> 天",
"newView": "新增視圖",
"newCol": "新增列",
"newRow": "新增項目",
@ -686,7 +688,6 @@
"customEmoji": "新增自訂表情",
"customEmojiTip": "打開 <a href=\"javascript:void(0)\" id=\"appearanceOpenEmoji\">Emoji 資料夾</a> 放入圖片後並點擊重新整理按鈕",
"recentEmoji": "常用表情",
"andSubFile": "及其 <b>x</b> 個子文檔",
"changeIcon": "修改圖示",
"addIcon": "新增圖示",
"includeSubFile": "\n包含 x 個子文檔",

View file

@ -1,5 +1,5 @@
{
"andSubFile": "确定删除 <b>${x}</b> 及其 <b>${y}</b> 个子文档吗?",
"andSubFile": "确定删除 <b>${x}</b> 及其 ${y} 个子文档吗?",
"confirmDeleteTip": "确定删除 <b>${x}</b> 吗?",
"rollbackTip": "删除后可在 [数据历史] 中恢复,按 [设置 - 编辑器 - 历史保留天数] 保留 <code class='fn__code'>${x}</code> 天",
"newView": "添加视图",

View file

@ -27,7 +27,7 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func getAttributeViewSelectOptions(c *gin.Context) {
func getAttributeViewKeysByAvID(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
@ -36,8 +36,7 @@ func getAttributeViewSelectOptions(c *gin.Context) {
return
}
avID := arg["avID"].(string)
keyID := arg["keyID"].(string)
ret.Data = model.GetAttributeViewSelectOptions(avID, keyID)
ret.Data = model.GetAttributeViewKeysByAvID(avID)
}
func getMirrorDatabaseBlocks(c *gin.Context) {

View file

@ -133,6 +133,59 @@ func appendDailyNoteBlock(c *gin.Context) {
broadcastTransactions(transactions)
}
func prependDailyNoteBlock(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
data := arg["data"].(string)
dataType := arg["dataType"].(string)
boxID := arg["notebook"].(string)
if util.InvalidIDPattern(boxID, ret) {
return
}
if "markdown" == dataType {
luteEngine := util.NewLute()
var err error
data, err = dataBlockDOM(data, luteEngine)
if nil != err {
ret.Code = -1
ret.Msg = "data block DOM failed: " + err.Error()
return
}
}
p, _, err := model.CreateDailyNote(boxID)
if nil != err {
ret.Code = -1
ret.Msg = "create daily note failed: " + err.Error()
return
}
parentID := strings.TrimSuffix(path.Base(p), ".sy")
transactions := []*model.Transaction{
{
DoOperations: []*model.Operation{
{
Action: "prependInsert",
Data: data,
ParentID: parentID,
},
},
},
}
model.PerformTransactions(&transactions)
model.WaitForWritingFiles()
ret.Data = transactions
broadcastTransactions(transactions)
}
func unfoldBlock(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -185,6 +185,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/block/prependBlock", model.CheckAuth, model.CheckReadonly, prependBlock)
ginServer.Handle("POST", "/api/block/appendBlock", model.CheckAuth, model.CheckReadonly, appendBlock)
ginServer.Handle("POST", "/api/block/appendDailyNoteBlock", model.CheckAuth, model.CheckReadonly, appendDailyNoteBlock)
ginServer.Handle("POST", "/api/block/prependDailyNoteBlock", model.CheckAuth, model.CheckReadonly, prependDailyNoteBlock)
ginServer.Handle("POST", "/api/block/updateBlock", model.CheckAuth, model.CheckReadonly, updateBlock)
ginServer.Handle("POST", "/api/block/deleteBlock", model.CheckAuth, model.CheckReadonly, deleteBlock)
ginServer.Handle("POST", "/api/block/moveBlock", model.CheckAuth, model.CheckReadonly, moveBlock)
@ -423,7 +424,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/av/getAttributeViewPrimaryKeyValues", model.CheckAuth, model.CheckReadonly, getAttributeViewPrimaryKeyValues)
ginServer.Handle("POST", "/api/av/setDatabaseBlockView", model.CheckAuth, model.CheckReadonly, setDatabaseBlockView)
ginServer.Handle("POST", "/api/av/getMirrorDatabaseBlocks", model.CheckAuth, model.CheckReadonly, getMirrorDatabaseBlocks)
ginServer.Handle("POST", "/api/av/getAttributeViewSelectOptions", model.CheckAuth, model.CheckReadonly, getAttributeViewSelectOptions)
ginServer.Handle("POST", "/api/av/getAttributeViewKeysByAvID", model.CheckAuth, model.CheckReadonly, getAttributeViewKeysByAvID)
ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, chatGPT)
ginServer.Handle("POST", "/api/ai/chatGPTWithAction", model.CheckAuth, chatGPTWithAction)

View file

@ -41,8 +41,8 @@ import (
"github.com/xrash/smetrics"
)
func GetAttributeViewSelectOptions(avID string, keyID string) (ret []*av.SelectOption) {
ret = []*av.SelectOption{}
func GetAttributeViewKeysByAvID(avID string) (ret []*av.Key) {
ret = []*av.Key{}
attrView, err := av.ParseAttributeView(avID)
if nil != err {
@ -50,17 +50,9 @@ func GetAttributeViewSelectOptions(avID string, keyID string) (ret []*av.SelectO
return
}
key, _ := attrView.GetKey(keyID)
if nil == key {
return
}
if av.KeyTypeSelect != key.Type && av.KeyTypeMSelect != key.Type {
return
}
if 0 < len(key.Options) {
ret = key.Options
for _, keyValues := range attrView.KeyValues {
key := keyValues.Key
ret = append(ret, key)
}
return ret
}

View file

@ -35,6 +35,7 @@ import (
"github.com/88250/gulu"
"github.com/88250/lute"
"github.com/88250/lute/ast"
"github.com/88250/lute/html"
"github.com/88250/lute/lex"
"github.com/88250/lute/parse"
"github.com/88250/vitess-sqlparser/sqlparser"
@ -1538,8 +1539,8 @@ func stringQuery(query string) string {
// markReplaceSpan 用于处理搜索高亮。
func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markSpanDataType string, luteEngine *lute.Lute) bool {
text := n.Content()
if ast.NodeText == n.Type {
text := n.Content()
escapedText := util.EscapeHTML(text)
escapedKeywords := make([]string, len(keywords))
for i, keyword := range keywords {
@ -1569,6 +1570,17 @@ func markReplaceSpan(n *ast.Node, unlinks *[]*ast.Node, keywords []string, markS
return false
}
var text string
if n.IsTextMarkType("code") {
// code 在前面的 n.
for i, k := range keywords {
keywords[i] = html.EscapeString(k)
}
text = n.TextMarkTextContent
} else {
text = n.Content()
}
startTag := search.GetMarkSpanStart(markSpanDataType)
text = search.EncloseHighlighting(text, keywords, startTag, search.GetMarkSpanEnd(), Conf.Search.CaseSensitive, false)
if strings.Contains(text, search.MarkDataType) {