Vanessa 2025-11-10 18:37:07 +08:00
parent 6c6f7d8ce2
commit 8e853fe66f
3 changed files with 14 additions and 5 deletions

View file

@ -193,7 +193,7 @@ export const getEditHTML = (options: {
<label class="b3-menu__item">
<span class="fn__flex-center">${window.siyuan.languages.includeTime}</span>
<span class="fn__space fn__flex-1"></span>
<input data-type="includeTime" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.includeTime ? "checked" : ""}>
<input data-type="includeTime" type="checkbox" class="b3-switch b3-switch--menu" ${colData[colData.type as "updated"].includeTime ? "checked" : ""}>
</label>`;
}
html += `<button class="b3-menu__separator" data-id="separator_3"></button>
@ -376,17 +376,17 @@ export const bindEditEvent = (options: {
if (includeTimeElement) {
includeTimeElement.addEventListener("change", () => {
transaction(options.protyle, [{
action: "setAttrViewUpdatedIncludeTime",
action: colData.type === "updated" ? "setAttrViewUpdatedIncludeTime" : "setAttrViewCreatedIncludeTime",
id: colId,
avID,
data: includeTimeElement.checked,
}], [{
action: "setAttrViewUpdatedIncludeTime",
action: colData.type === "updated" ? "setAttrViewUpdatedIncludeTime" : "setAttrViewCreatedIncludeTime",
id: colId,
avID,
data: !includeTimeElement.checked,
}]);
colData.includeTime = includeTimeElement.checked;
colData[colData.type as "updated"].includeTime = includeTimeElement.checked;
});
}

View file

@ -878,7 +878,8 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
"setAttrViewBlockView", "setAttrViewCardSize", "setAttrViewCardAspectRatio", "hideAttrViewName", "setAttrViewShowIcon",
"setAttrViewWrapField", "setAttrViewGroup", "removeAttrViewGroup", "hideAttrViewGroup", "sortAttrViewGroup",
"foldAttrViewGroup", "hideAttrViewAllGroups", "setAttrViewFitImage", "setAttrViewDisplayFieldName",
"insertAttrViewBlock", "setAttrViewColDateFillSpecificTime", "setAttrViewFillColBackgroundColor"].includes(operation.action)) {
"insertAttrViewBlock", "setAttrViewColDateFillSpecificTime", "setAttrViewFillColBackgroundColor", "setAttrViewUpdatedIncludeTime",
"setAttrViewCreatedIncludeTime"].includes(operation.action)) {
// 撤销 transaction 会进行推送,需使用推送来进行刷新最新数据 https://github.com/siyuan-note/siyuan/issues/13607
if (!isUndo) {
refreshAV(protyle, operation);

View file

@ -72,6 +72,8 @@ type TOperation =
| "foldAttrViewGroup"
| "setAttrViewDisplayFieldName"
| "setAttrViewFillColBackgroundColor"
| "setAttrViewUpdatedIncludeTime"
| "setAttrViewCreatedIncludeTime"
type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
type TCardType = "doc" | "notebook" | "all"
type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
@ -969,6 +971,12 @@ interface IAVColumn {
numberFormat: string,
template: string,
calc: IAVCalc,
updated?: {
includeTime: boolean
}
created?: {
includeTime: boolean
}
date?: {
autoFillNow: boolean,
fillSpecificTime: boolean,