mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-01 02:10:15 +01:00
🎨 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:
parent
e6a9db0253
commit
0147a6573d
18 changed files with 77 additions and 9 deletions
|
|
@ -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", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue