diff --git a/app/appearance/langs/ar_SA.json b/app/appearance/langs/ar_SA.json index bdefc8dab..b32209648 100644 --- a/app/appearance/langs/ar_SA.json +++ b/app/appearance/langs/ar_SA.json @@ -128,6 +128,7 @@ "unbindBlock": "فك ربط الكتلة", "showTitle": "عرض عنوان قاعدة البيانات", "fillCreated": "ملء وقت الإنشاء افتراضياً", + "fillSpecificTime": "ملء الوقت المحدد افتراضيًا", "removeCard": "إزالة بطاقة تعليمية", "updateLayout": "تحديث التصميم", "dndFolderTip": "‫يرجى ملاحظة أن ${x} يقوم فقط بإدراج رابط file:// ولا يقوم بنسخ الملف‬", diff --git a/app/appearance/langs/de_DE.json b/app/appearance/langs/de_DE.json index 819056bc2..651680e08 100644 --- a/app/appearance/langs/de_DE.json +++ b/app/appearance/langs/de_DE.json @@ -128,6 +128,7 @@ "unbindBlock": "Block entkoppeln", "showTitle": "Datenbanktitel anzeigen", "fillCreated": "Standardfüllzeit erstellen", + "fillSpecificTime": "Standardmäßig bestimmte Zeit ausfüllen", "removeCard": "Karte entfernen", "updateLayout": "Layout aktualisieren", "dndFolderTip": "Bitte beachten Sie, dass ${x} nur den file:// Hyperlink einfügt und die Datei nicht kopiert.", diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 7947ab32b..920124605 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -128,6 +128,7 @@ "unbindBlock": "Unbind block", "showTitle": "Show database title", "fillCreated": "Default fill created time", + "fillSpecificTime": "Default fill specific time", "removeCard": "Remove flashcard", "updateLayout": "Update layout", "dndFolderTip": "Please note that ${x} only inserts the file:// hyperlink and does not copy the file", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 632da1e4a..85eb31afd 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -128,6 +128,7 @@ "unbindBlock": "Desvincular bloque", "showTitle": "Mostrar título de la base de datos", "fillCreated": "Hora de creación del relleno predeterminado", + "fillSpecificTime": "Rellenar hora específica por defecto", "removeCard": "Eliminar tarjeta flash", "updateLayout": "Actualizar diseño", "dndFolderTip": "Tenga en cuenta que ${x} solo inserta el hipervínculo file:// y no copia el archivo", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index fbfdefecb..9ea6ee2ce 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -128,6 +128,7 @@ "unbindBlock": "Dissocier le bloc", "showTitle": "Afficher le titre de la base de données", "fillCreated": "Heure de création de remplissage par défaut", + "fillSpecificTime": "Remplir l'heure spécifique par défaut", "removeCard": "Supprimer la flashcard", "updateLayout": "Mettre à jour la mise en page", "dndFolderTip": "Veuillez noter que ${x} insère uniquement le lien hypertexte file:// et ne copie pas le fichier", diff --git a/app/appearance/langs/he_IL.json b/app/appearance/langs/he_IL.json index 27aa75cf4..e729e1d5f 100644 --- a/app/appearance/langs/he_IL.json +++ b/app/appearance/langs/he_IL.json @@ -128,6 +128,7 @@ "unbindBlock": "שחרר בלוק", "showTitle": "הצג כותרת מסד נתונים", "fillCreated": "מלא את זמן היצירה ברירת מחדל", + "fillSpecificTime": "מילוי זמן מסוים כברירת מחדל", "removeCard": "הסר כרטיסון", "updateLayout": "עדכן עימוד", "dndFolderTip": "שים לב כי ${x} ניחש את ה-hyperlink file:// ואינו מעתיק את הקובץ", diff --git a/app/appearance/langs/it_IT.json b/app/appearance/langs/it_IT.json index 8ed125a4b..b81d9ff95 100644 --- a/app/appearance/langs/it_IT.json +++ b/app/appearance/langs/it_IT.json @@ -128,6 +128,7 @@ "unbindBlock": "Scollega blocco", "showTitle": "Mostra titolo del database", "fillCreated": "Compilazione automatica del tempo di creazione", + "fillSpecificTime": "Compila l'orario specifico di default", "removeCard": "Rimuovi flashcard", "updateLayout": "Aggiorna layout", "dndFolderTip": "Nota che ${x} inserisce solo il collegamento file:// e non copia il file", diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.json index b0e1faa0a..88d23a14f 100644 --- a/app/appearance/langs/ja_JP.json +++ b/app/appearance/langs/ja_JP.json @@ -128,6 +128,7 @@ "unbindBlock": "ブロックのバインドを解除", "showTitle": "データベースのタイトルを表示", "fillCreated": "デフォルトで作成時間を入力", + "fillSpecificTime": "デフォルトで具体的な時間を入力", "removeCard": "フラッシュカードを削除", "updateLayout": "レイアウトを更新", "dndFolderTip": "${x} は file:// 形式のハイパーリンクを挿入するだけでファイルはコピーされないので注意してください", diff --git a/app/appearance/langs/pl_PL.json b/app/appearance/langs/pl_PL.json index ee2e55f0e..a816a7987 100644 --- a/app/appearance/langs/pl_PL.json +++ b/app/appearance/langs/pl_PL.json @@ -128,6 +128,7 @@ "unbindBlock": "Odłącz blok", "showTitle": "Pokaż tytuł bazy danych", "fillCreated": "Domyślnie wypełnij czas utworzenia", + "fillSpecificTime": "Domyślnie wypełnij konkretny czas", "removeCard": "Usuń fiszkę", "updateLayout": "Zaktualizuj układ", "dndFolderTip": "Proszę pamiętać, że ${x} tylko wstawia link file:// i nie kopiuje pliku", diff --git a/app/appearance/langs/pt_BR.json b/app/appearance/langs/pt_BR.json index b684bdb9a..e39490f6b 100644 --- a/app/appearance/langs/pt_BR.json +++ b/app/appearance/langs/pt_BR.json @@ -128,6 +128,7 @@ "unbindBlock": "Desvincular bloco", "showTitle": "Mostrar título do banco de dados", "fillCreated": "Preencher automaticamente a hora de criação", + "fillSpecificTime": "Preencher horário específico por padrão", "removeCard": "Remover cartão de memorização", "updateLayout": "Atualizar layout", "dndFolderTip": "Observe que ${x} apenas insere o hiperlink file:// e não copia o arquivo", diff --git a/app/appearance/langs/ru_RU.json b/app/appearance/langs/ru_RU.json index 9f0c2e67a..bb7077507 100644 --- a/app/appearance/langs/ru_RU.json +++ b/app/appearance/langs/ru_RU.json @@ -128,6 +128,7 @@ "unbindBlock": "Отвязать блок", "showTitle": "Показать заголовок базы данных", "fillCreated": "Заполнить время создания по умолчанию", + "fillSpecificTime": "Заполнить конкретное время по умолчанию", "removeCard": "Удалить карточку", "updateLayout": "Обновить макет", "dndFolderTip": "Пожалуйста, обратите внимание, что ${x} только вставляет файл:// гиперссылку и не копирует файл", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 06fd737de..fccf54bae 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -128,6 +128,7 @@ "unbindBlock": "取消綁定塊", "showTitle": "顯示資料庫標題", "fillCreated": "預設填滿創建時間", + "fillSpecificTime": "預設填入具體時間", "removeCard": "移除閃卡", "updateLayout": "更新版面配置", "dndFolderTip": "請注意 ${x} 僅插入 file:// 超鏈接,不複製檔案", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 292a763bd..f26fa27e2 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -128,6 +128,7 @@ "unbindBlock": "取消绑定块", "showTitle": "显示数据库标题", "fillCreated": "默认填充创建时间", + "fillSpecificTime": "默认填充具体时间", "removeCard": "移除闪卡", "updateLayout": "更新布局", "dndFolderTip": "请注意 ${x} 仅插入 file:// 超链接,不复制文件", diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 17bce4717..a27e17ca1 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -182,6 +182,11 @@ export const getEditHTML = (options: { ${window.siyuan.languages.fillCreated} + +`; } html += ` @@ -439,18 +444,35 @@ export const bindEditEvent = (options: { fillCreatedElement.addEventListener("change", () => { transaction(options.protyle, [{ avID, - action: "setAttrViewColDate", + action: "setAttrViewColDateFillCreated", id: colId, data: fillCreatedElement.checked }], [{ avID, - action: "setAttrViewColDate", + action: "setAttrViewColDateFillCreated", id: colId, data: !fillCreatedElement.checked }]); }); } + const fillSpecificTimeElement = options.menuElement.querySelector('[data-type="fillSpecificTime"]') as HTMLInputElement; + if (fillSpecificTimeElement) { + fillSpecificTimeElement.addEventListener("change", () => { + transaction(options.protyle, [{ + avID, + action: "setAttrViewColDateFillSpecificTime", + id: colId, + data: fillSpecificTimeElement.checked + }], [{ + avID, + action: "setAttrViewColDateFillSpecificTime", + id: colId, + data: !fillSpecificTimeElement.checked + }]); + }); + } + const backRelationElement = options.menuElement.querySelector('[data-type="backRelation"]') as HTMLInputElement; if (backRelationElement) { backRelationElement.addEventListener("change", () => { diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 52a587c76..b900f46df 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -58,7 +58,8 @@ type TOperation = | "setAttrViewFitImage" | "setAttrViewShowIcon" | "setAttrViewWrapField" - | "setAttrViewColDate" + | "setAttrViewColDateFillCreated" + | "setAttrViewColDateFillSpecificTime" | "setAttrViewViewDesc" | "setAttrViewColDesc" | "setAttrViewBlockView" @@ -942,6 +943,7 @@ interface IAVColumn { calc: IAVCalc, date?: { autoFillNow: boolean, + fillSpecificTime: boolean, } // 选项列表 options?: { diff --git a/kernel/av/av.go b/kernel/av/av.go index 3cbe0752f..195aa1886 100644 --- a/kernel/av/av.go +++ b/kernel/av/av.go @@ -168,7 +168,8 @@ func (k *Key) GetOption(name string) (ret *SelectOption) { } type Date struct { - AutoFillNow bool `json:"autoFillNow"` // 是否自动填充当前时间 The database date field supports filling the current time by default https://github.com/siyuan-note/siyuan/issues/10823 + AutoFillNow bool `json:"autoFillNow"` // 是否自动填充当前时间 The database date field supports filling the current time by default https://github.com/siyuan-note/siyuan/issues/10823 + FillSpecificTime bool `json:"fillSpecificTime"` // 是否填充具体时间 Add `Default fill specific time` switch to database date field https://github.com/siyuan-note/siyuan/issues/12089 } type Rollup struct { diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 64c308232..71e3738f7 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -2147,15 +2147,15 @@ func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, er return } -func (tx *Transaction) doSetAttrViewColDate(operation *Operation) (ret *TxErr) { - err := setAttributeViewColDate(operation) +func (tx *Transaction) doSetAttrViewColDateFillCreated(operation *Operation) (ret *TxErr) { + err := setAttributeViewColDateFillCreated(operation) if err != nil { return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()} } return } -func setAttributeViewColDate(operation *Operation) (err error) { +func setAttributeViewColDateFillCreated(operation *Operation) (err error) { attrView, err := av.ParseAttributeView(operation.AvID) if err != nil { return @@ -2172,7 +2172,35 @@ func setAttributeViewColDate(operation *Operation) (err error) { } key.Date.AutoFillNow = operation.Data.(bool) + err = av.SaveAttributeView(attrView) + return +} +func (tx *Transaction) doSetAttrViewColDateFillSpecificTime(operation *Operation) (ret *TxErr) { + err := setAttrViewColDateFillSpecificTime(operation) + if err != nil { + return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()} + } + return +} + +func setAttrViewColDateFillSpecificTime(operation *Operation) (err error) { + attrView, err := av.ParseAttributeView(operation.AvID) + if err != nil { + return + } + + keyID := operation.ID + key, _ := attrView.GetKey(keyID) + if nil == key || av.KeyTypeDate != key.Type { + return + } + + if nil == key.Date { + key.Date = &av.Date{} + } + + key.Date.FillSpecificTime = operation.Data.(bool) err = av.SaveAttributeView(attrView) return } diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 97f19b859..201c808fd 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -275,8 +275,10 @@ func performTx(tx *Transaction) (ret *TxErr) { ret = tx.doUpdateAttrViewColRollup(op) case "hideAttrViewName": ret = tx.doHideAttrViewName(op) - case "setAttrViewColDate": - ret = tx.doSetAttrViewColDate(op) + case "setAttrViewColDateFillCreated": + ret = tx.doSetAttrViewColDateFillCreated(op) + case "setAttrViewColDateFillSpecificTime": + ret = tx.doSetAttrViewColDateFillSpecificTime(op) case "duplicateAttrViewKey": ret = tx.doDuplicateAttrViewKey(op) case "setAttrViewCoverFrom":