🎨 Add Default fill specific time switch to database date field https://github.com/siyuan-note/siyuan/issues/12089

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-09-24 17:14:39 +08:00
parent e6a9db0253
commit 0147a6573d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
18 changed files with 77 additions and 9 deletions

View file

@ -182,6 +182,11 @@ export const getEditHTML = (options: {
<span class="fn__flex-center">${window.siyuan.languages.fillCreated}</span>
<span class="fn__space fn__flex-1"></span>
<input data-type="fillCreated" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.autoFillNow ? "checked" : ""}>
</label>
<label class="b3-menu__item">
<span class="fn__flex-center">${window.siyuan.languages.fillSpecificTime}</span>
<span class="fn__space fn__flex-1"></span>
<input data-type="fillSpecificTime" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.fillSpecificTime ? "checked" : ""}>
</label>`;
}
html += `<button class="b3-menu__separator" data-id="separator_3"></button>
@ -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", () => {