mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
feat(react/settings): port note revision snapshot interval
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Trans } from "react-i18next";
|
||||
import { t } from "../../../services/i18n";
|
||||
import server from "../../../services/server";
|
||||
import toast from "../../../services/toast";
|
||||
@@ -11,6 +12,7 @@ export default function OtherSettings() {
|
||||
<>
|
||||
<NoteErasureTimeout />
|
||||
<AttachmentErasureTimeout />
|
||||
<RevisionSnapshotInterval />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -59,4 +61,23 @@ function AttachmentErasureTimeout() {
|
||||
/>
|
||||
</OptionsSection>
|
||||
)
|
||||
}
|
||||
|
||||
function RevisionSnapshotInterval() {
|
||||
return (
|
||||
<OptionsSection title={t("revisions_snapshot_interval.note_revisions_snapshot_interval_title")}>
|
||||
<FormText>
|
||||
<Trans
|
||||
i18nKey="revisions_snapshot_interval.note_revisions_snapshot_description"
|
||||
components={{ doc: <a href="https://triliumnext.github.io/Docs/Wiki/note-revisions.html" class="external" />}}
|
||||
/>
|
||||
</FormText>
|
||||
<TimeSelector
|
||||
name="revision-snapshot-time-interval"
|
||||
label={t("revisions_snapshot_interval.snapshot_time_interval_label")}
|
||||
optionValueId="revisionSnapshotTimeInterval" optionTimeScaleId="revisionSnapshotTimeIntervalTimeScale"
|
||||
minimumSeconds={10}
|
||||
/>
|
||||
</OptionsSection>
|
||||
)
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
import TimeSelector from "../time_selector.js";
|
||||
|
||||
const TPL = /*html*/`
|
||||
<div class="options-section">
|
||||
<h4>${t("revisions_snapshot_interval.note_revisions_snapshot_interval_title")}</h4>
|
||||
|
||||
<p class="form-text use-tn-links">${t("revisions_snapshot_interval.note_revisions_snapshot_description")}</p>
|
||||
<div id="time-selector-placeholder"></div>
|
||||
</div>`;
|
||||
|
||||
export default class RevisionsSnapshotIntervalOptions extends TimeSelector {
|
||||
|
||||
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.$widget.find("#time-selector-placeholder").replaceWith($timeSelector);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user