diff --git a/src/public/app/widgets/type_widgets/options/other/revisions_snapshot_interval.ts b/src/public/app/widgets/type_widgets/options/other/revisions_snapshot_interval.ts index 751f70653..13c86fc88 100644 --- a/src/public/app/widgets/type_widgets/options/other/revisions_snapshot_interval.ts +++ b/src/public/app/widgets/type_widgets/options/other/revisions_snapshot_interval.ts @@ -1,30 +1,31 @@ -import OptionsWidget from "../options_widget.js"; import { t } from "../../../../services/i18n.js"; -import type { OptionMap } from "../../../../../../services/options_interface.js"; +import TimeSelector from "../time_selector.js"; const TPL = `

${t("revisions_snapshot_interval.note_revisions_snapshot_interval_title")}

- -
- - -
+
`; -export default class RevisionsSnapshotIntervalOptions extends OptionsWidget { +export default class RevisionsSnapshotIntervalOptions extends TimeSelector { - private $revisionsTimeInterval!: JQuery; + constructor() { + super({ + widgetId: "revision-snapshot-time-interval", + widgetLabelId: "revisions_snapshot_interval.snapshot_time_interval_label", + optionValueId: "revisionSnapshotTimeInterval", + optionTimeScaleId: "revisionSnapshotTimeIntervalTimeScale", + minimumSeconds: 10 + }); + super.doRender(); + } doRender() { + const $timeSelector = this.$widget; + // inject TimeSelector widget template this.$widget = $(TPL); - this.$revisionsTimeInterval = this.$widget.find(".revision-snapshot-time-interval-in-seconds"); - this.$revisionsTimeInterval.on("change", () => this.updateOption("revisionSnapshotTimeInterval", this.$revisionsTimeInterval.val())); - } - - async optionsLoaded(options: OptionMap) { - this.$revisionsTimeInterval.val(options.revisionSnapshotTimeInterval); + this.$widget.find("#time-selector-placeholder").replaceWith($timeSelector) } } diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json index f100c7003..61bccbe77 100644 --- a/src/public/translations/cn/translation.json +++ b/src/public/translations/cn/translation.json @@ -1138,9 +1138,9 @@ "deleted_notes_erased": "已删除的笔记已被清理。" }, "revisions_snapshot_interval": { - "note_revisions_snapshot_interval_title": "笔记修改快照间隔", - "note_revisions_snapshot_description": "笔记修改快照时间间隔是指经过多少秒后会为笔记创建新的修改历史。更多信息请参见wiki。", - "snapshot_time_interval_label": "笔记修改快照时间间隔(单位:秒)" + "note_revisions_snapshot_interval_title": "", + "note_revisions_snapshot_description": "", + "snapshot_time_interval_label": "" }, "revisions_snapshot_limit": { "note_revisions_snapshot_limit_title": "笔记历史快照限制", diff --git a/src/public/translations/de/translation.json b/src/public/translations/de/translation.json index 0339cde85..daf823696 100644 --- a/src/public/translations/de/translation.json +++ b/src/public/translations/de/translation.json @@ -1166,8 +1166,8 @@ }, "revisions_snapshot_interval": { "note_revisions_snapshot_interval_title": "Snapshot-Intervall für Notizrevisionen", - "note_revisions_snapshot_description": "Das Snapshot-Zeitintervall für Notizrevisionen ist die Zeit in Sekunden, nach der eine neue Notizrevision erstellt wird. Weitere Informationen findest du im Wiki.", - "snapshot_time_interval_label": "Zeitintervall für Notiz-Revisions-Snapshot (in Sekunden)" + "note_revisions_snapshot_description": "Das Snapshot-Zeitintervall für Notizrevisionen ist die Zeit, nach der eine neue Notizrevision erstellt wird. Weitere Informationen findest du im Wiki.", + "snapshot_time_interval_label": "Zeitintervall für Notiz-Revisions-Snapshot:" }, "revisions_snapshot_limit": { "note_revisions_snapshot_limit_title": "Limit für Notizrevision-Snapshots", diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 18826376c..9d60673eb 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1166,8 +1166,8 @@ }, "revisions_snapshot_interval": { "note_revisions_snapshot_interval_title": "Note Revision Snapshot Interval", - "note_revisions_snapshot_description": "The Note revision snapshot interval is the time in seconds after which a new note revision will be created for the note. See wiki for more info.", - "snapshot_time_interval_label": "Note revision snapshot time interval (in seconds):" + "note_revisions_snapshot_description": "The Note revision snapshot interval is the time after which a new note revision will be created for the note. See wiki for more info.", + "snapshot_time_interval_label": "Note revision snapshot time interval:" }, "revisions_snapshot_limit": { "note_revisions_snapshot_limit_title": "Note Revision Snapshot Limit", diff --git a/src/public/translations/es/translation.json b/src/public/translations/es/translation.json index 65c15ad88..f8327f774 100644 --- a/src/public/translations/es/translation.json +++ b/src/public/translations/es/translation.json @@ -1163,8 +1163,8 @@ }, "revisions_snapshot_interval": { "note_revisions_snapshot_interval_title": "Intervalo de instantáneas de revisiones de notas", - "note_revisions_snapshot_description": "El intervalo de tiempo de la instantánea de revisión de nota es el tiempo en segundos después de lo cual se creará una nueva revisión para la nota. Ver wiki para obtener más información.", - "snapshot_time_interval_label": "Intervalo de tiempo de la instantánea de revisión de notas (en segundos)" + "note_revisions_snapshot_description": "El intervalo de tiempo de la instantánea de revisión de nota es el tiempo después de lo cual se creará una nueva revisión para la nota. Ver wiki para obtener más información.", + "snapshot_time_interval_label": "Intervalo de tiempo de la instantánea de revisión de notas:" }, "revisions_snapshot_limit": { "note_revisions_snapshot_limit_title": "Límite de respaldos de revisiones de nota", diff --git a/src/public/translations/fr/translation.json b/src/public/translations/fr/translation.json index 8e136200a..0811c336b 100644 --- a/src/public/translations/fr/translation.json +++ b/src/public/translations/fr/translation.json @@ -1108,8 +1108,8 @@ }, "revisions_snapshot_interval": { "note_revisions_snapshot_interval_title": "Intervalle d'enregistrement automatique des versions des notes", - "note_revisions_snapshot_description": "L'intervalle d'enregistrement automatique des versions de note est le temps en secondes après lequel une nouvelle version de note est créée pour une note. Consultez le wiki pour plus d'informations.", - "snapshot_time_interval_label": "Intervalle de temps entre deux enregistrements de version de note (en secondes) :" + "note_revisions_snapshot_description": "L'intervalle d'enregistrement automatique des versions de note est le temps après lequel une nouvelle version de note est créée pour une note. Consultez le wiki pour plus d'informations.", + "snapshot_time_interval_label": "Intervalle de temps entre deux enregistrements de version de note :" }, "revisions_snapshot_limit": { "note_revisions_snapshot_limit_title": "Limite des enregistrements de version de note", diff --git a/src/public/translations/ro/translation.json b/src/public/translations/ro/translation.json index 442507833..10fffdb76 100644 --- a/src/public/translations/ro/translation.json +++ b/src/public/translations/ro/translation.json @@ -1068,9 +1068,9 @@ "note_revisions": "Revizii ale notiței" }, "revisions_snapshot_interval": { - "note_revisions_snapshot_description": "Intervalul de salvare a reviziilor este timpul în secunde după care se crează o nouă revizie a unei notițe. Vedeți wiki-ul pentru mai multe informații.", + "note_revisions_snapshot_description": "Intervalul de salvare a reviziilor este timpul după care se crează o nouă revizie a unei notițe. Vedeți wiki-ul pentru mai multe informații.", "note_revisions_snapshot_interval_title": "Intervalul de salvare a reviziilor", - "snapshot_time_interval_label": "Intervalul de salvare a reviziilor (în secunde)" + "snapshot_time_interval_label": "Intervalul de salvare a reviziilor:" }, "ribbon": { "edited_notes_message": "Tab-ul panglicii „Notițe editate” se va deschide automat pentru notițele zilnice", diff --git a/src/public/translations/tw/translation.json b/src/public/translations/tw/translation.json index 173ef6b5e..ae8381b5b 100644 --- a/src/public/translations/tw/translation.json +++ b/src/public/translations/tw/translation.json @@ -1116,9 +1116,9 @@ "deleted_notes_erased": "已刪除的筆記已被清理。" }, "revisions_snapshot_interval": { - "note_revisions_snapshot_interval_title": "筆記修改快照間隔", - "note_revisions_snapshot_description": "筆記修改快照時間間隔是指經過多少秒後會為筆記新增新的修改歷史。更多資訊請參見wiki。", - "snapshot_time_interval_label": "筆記修改快照時間間隔(單位:秒)" + "note_revisions_snapshot_interval_title": "", + "note_revisions_snapshot_description": "", + "snapshot_time_interval_label": "" }, "revisions_snapshot_limit": { "note_revisions_snapshot_limit_title": "筆記歷史快照限制", diff --git a/src/routes/api/options.ts b/src/routes/api/options.ts index d2cf695fd..6d9d9c613 100644 --- a/src/routes/api/options.ts +++ b/src/routes/api/options.ts @@ -16,6 +16,7 @@ const ALLOWED_OPTIONS = new Set([ "protectedSessionTimeout", "protectedSessionTimeoutTimeScale", "revisionSnapshotTimeInterval", + "revisionSnapshotTimeIntervalTimeScale", "revisionSnapshotNumberLimit", "zoomFactor", "theme", diff --git a/src/services/options_init.ts b/src/services/options_init.ts index 394808c99..339327808 100644 --- a/src/services/options_init.ts +++ b/src/services/options_init.ts @@ -75,6 +75,7 @@ async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts = */ const defaultOptions: DefaultOption[] = [ { name: "revisionSnapshotTimeInterval", value: "600", isSynced: true }, + { name: "revisionSnapshotTimeIntervalTimeScale", value: "60", isSynced: true }, // default to Minutes { name: "revisionSnapshotNumberLimit", value: "-1", isSynced: true }, { name: "protectedSessionTimeout", value: "600", isSynced: true }, { name: "protectedSessionTimeoutTimeScale", value: "60", isSynced: true }, diff --git a/src/services/options_interface.ts b/src/services/options_interface.ts index c2da7e1b5..072bf6b6f 100644 --- a/src/services/options_interface.ts +++ b/src/services/options_interface.ts @@ -49,6 +49,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions