mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	Merge pull request #1220 from TriliumNext/feat_friendly-numbers-note-revision
feat: friendly numbers note revision
This commit is contained in:
		
						commit
						38dbf6efcd
					
				| @ -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 = ` | ||||
| <div class="options-section"> | ||||
|     <h4>${t("revisions_snapshot_interval.note_revisions_snapshot_interval_title")}</h4> | ||||
| 
 | ||||
|     <p class="use-tn-links">${t("revisions_snapshot_interval.note_revisions_snapshot_description")}</p> | ||||
| 
 | ||||
|     <div class="form-group"> | ||||
|         <label>${t("revisions_snapshot_interval.snapshot_time_interval_label")}</label> | ||||
|         <input class="revision-snapshot-time-interval-in-seconds form-control options-number-input" type="number" min="10"> | ||||
|     </div> | ||||
|     <div id="time-selector-placeholder"></div> | ||||
| </div>`;
 | ||||
| 
 | ||||
| export default class RevisionsSnapshotIntervalOptions extends OptionsWidget { | ||||
| export default class RevisionsSnapshotIntervalOptions extends TimeSelector { | ||||
| 
 | ||||
|     private $revisionsTimeInterval!: JQuery<HTMLElement>; | ||||
|     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) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1138,9 +1138,9 @@ | ||||
|     "deleted_notes_erased": "已删除的笔记已被清理。" | ||||
|   }, | ||||
|   "revisions_snapshot_interval": { | ||||
|     "note_revisions_snapshot_interval_title": "笔记修改快照间隔", | ||||
|     "note_revisions_snapshot_description": "笔记修改快照时间间隔是指经过多少秒后会为笔记创建新的修改历史。更多信息请参见<a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a>。", | ||||
|     "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": "笔记历史快照限制", | ||||
|  | ||||
| @ -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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">Wiki</a>.", | ||||
|     "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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">Wiki</a>.", | ||||
|     "snapshot_time_interval_label": "Zeitintervall für Notiz-Revisions-Snapshot:" | ||||
|   }, | ||||
|   "revisions_snapshot_limit": { | ||||
|     "note_revisions_snapshot_limit_title": "Limit für Notizrevision-Snapshots", | ||||
|  | ||||
| @ -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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a> 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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a> for more info.", | ||||
|     "snapshot_time_interval_label": "Note revision snapshot time interval:" | ||||
|   }, | ||||
|   "revisions_snapshot_limit": { | ||||
|     "note_revisions_snapshot_limit_title": "Note Revision Snapshot Limit", | ||||
|  | ||||
| @ -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 <a href=\"https://triliumnext.github.io/docs/wiki/note-revisions.html\" class=\"external\"> wiki </a> 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 <a href=\"https://triliumnext.github.io/docs/wiki/note-revisions.html\" class=\"external\"> wiki </a> 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", | ||||
|  | ||||
| @ -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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a> 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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a> 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", | ||||
|  | ||||
| @ -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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki-ul</a> 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 <a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki-ul</a> 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", | ||||
|  | ||||
| @ -1116,9 +1116,9 @@ | ||||
|     "deleted_notes_erased": "已刪除的筆記已被清理。" | ||||
|   }, | ||||
|   "revisions_snapshot_interval": { | ||||
|     "note_revisions_snapshot_interval_title": "筆記修改快照間隔", | ||||
|     "note_revisions_snapshot_description": "筆記修改快照時間間隔是指經過多少秒後會為筆記新增新的修改歷史。更多資訊請參見<a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a>。", | ||||
|     "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": "筆記歷史快照限制", | ||||
|  | ||||
| @ -16,6 +16,7 @@ const ALLOWED_OPTIONS = new Set([ | ||||
|     "protectedSessionTimeout", | ||||
|     "protectedSessionTimeoutTimeScale", | ||||
|     "revisionSnapshotTimeInterval", | ||||
|     "revisionSnapshotTimeIntervalTimeScale", | ||||
|     "revisionSnapshotNumberLimit", | ||||
|     "zoomFactor", | ||||
|     "theme", | ||||
|  | ||||
| @ -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 }, | ||||
|  | ||||
| @ -49,6 +49,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi | ||||
|     lastSyncedPull: number; | ||||
|     lastSyncedPush: number; | ||||
|     revisionSnapshotTimeInterval: number; | ||||
|     revisionSnapshotTimeIntervalTimeScale: number; | ||||
|     revisionSnapshotNumberLimit: number; | ||||
|     protectedSessionTimeout: number; | ||||
|     protectedSessionTimeoutTimeScale: number; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran