Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
raw conversion of all options tabs
zadam2a68bdb6905e
diff --git a/src/public/app/widgets/type_widgets/content_widget.js b/src/public/app/widgets/type_widgets/content_widget.jsindex 29a06cf552..2143eb2ef8 100644--- a/src/public/app/widgets/type_widgets/content_widget.js+++ b/src/public/app/widgets/type_widgets/content_widget.js@@ -12,6 +12,21 @@ import VimKeyBindingsOptions from "./options/code_notes/vim_key_bindings.js";import WrapLinesOptions from "./options/code_notes/wrap_lines.js";import CodeAutoReadOnlySizeOptions from "./options/code_notes/code_auto_read_only_size.js";import CodeMimeTypesOptions from "./options/code_notes/code_mime_types.js";+import ImageOptions from "./options/images.js";+import SpellcheckOptions from "./options/spellcheck.js";+import PasswordOptions from "./options/password.js";+import EtapiOptions from "./options/etapi.js";+import BackupOptions from "./options/backup.js";+import SyncOptions from "./options/sync.js";+import TrayOptions from "./options/other/tray.js";+import NoteErasureTimeoutOptions from "./options/other/note_erasure_timeout.js";+import NoteRevisionsSnapshotIntervalOptions from "./options/other/note_revisions_snapshot_interval.js";+import NetworkConnectionsOptions from "./options/other/network_connections.js";+import AdvancedSyncOptions from "./options/advanced/sync.js";+import DatabaseIntegrityCheckOptions from "./options/advanced/database_integrity_check.js";+import ConsistencyChecksOptions from "./options/advanced/consistency_checks.js";+import VacuumDatabaseOptions from "./options/advanced/vacuum_database.js";+import DatabaseAnonymizationOptions from "./options/advanced/database_anonymization.js";const TPL = `<div class="note-detail-content-widget note-detail-printable"><style>@@ -42,6 +57,25 @@ const CONTENT_WIDGETS = {WrapLinesOptions,CodeAutoReadOnlySizeOptions,CodeMimeTypesOptions+ ],+ optionsImages: [ ImageOptions ],+ optionsSpellcheck: [ SpellcheckOptions ],+ optionsPassword: [ PasswordOptions ],+ optionsEtapi: [ EtapiOptions ],+ optionsBackup: [ BackupOptions ],+ optionsSync: [ SyncOptions ],+ optionsOther: [+ TrayOptions,+ NoteErasureTimeoutOptions,+ NoteRevisionsSnapshotIntervalOptions,+ NetworkConnectionsOptions+ ],+ optionsAdvanced: [+ DatabaseIntegrityCheckOptions,+ ConsistencyChecksOptions,+ DatabaseAnonymizationOptions,+ AdvancedSyncOptions,+ VacuumDatabaseOptions]};diff --git a/src/public/app/widgets/type_widgets/options/advanced.js b/src/public/app/widgets/type_widgets/options/advanced.jsdeleted file mode 100644index 3f1aaddfad..0000000000--- a/src/public/app/widgets/type_widgets/options/advanced.js+++ /dev/null@@ -1,137 +0,0 @@-import server from "../../../services/server.js";-import toastService from "../../../services/toast.js";-import OptionsWidget from "./options_widget.js";--const TPL = `-<div class="options-section">- <h4>Sync</h4>- <button class="force-full-sync-button btn">Force full sync</button>-- <button class="fill-entity-changes-button btn">Fill entity changes records</button>-</div>--<div class="options-section">- <h4>Database integrity check</h4>-- <p>This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.</p>-- <button class="check-integrity-button btn">Check database integrity</button>-</div>--<div class="options-section">- <h4>Consistency checks</h4>-- <button class="find-and-fix-consistency-issues-button btn">Find and fix consistency issues</button>-</div>--<div class="options-section">- <h4>Anonymize database</h4>-- <h5>Full anonymization</h5>-- <p>This action will create a new copy of the database and anonymize it (remove all note content and leave only structure and some non-sensitive metadata)- for sharing online for debugging purposes without fear of leaking your personal data.</p>-- <button class="anonymize-full-button btn">Save fully anonymized database</button>-- <h5>Light anonymization</h5>-- <p>This action will create a new copy of the database and do a light anonymization on it - specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>-- <p>You can decide yourself if you want to provide fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.</p>-- <button class="anonymize-light-button btn">Save lightly anonymized database</button>-</div>--<div class="options-section">- <h4>Vacuum database</h4>-- <p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>-- <button class="vacuum-database-button btn">Vacuum database</button>-</div>`;--export default class AdvancedOptions extends OptionsWidget {- get tabTitle() { return "Advanced" }-- lazyRender() {- this.$widget = $(TPL);-- this.$forceFullSyncButton = this.$widget.find(".force-full-sync-button");- this.$fillEntityChangesButton = this.$widget.find(".fill-entity-changes-button");- this.$anonymizeFullButton = this.$widget.find(".anonymize-full-button");- this.$anonymizeLightButton = this.$widget.find(".anonymize-light-button");- this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");- this.$findAndFixConsistencyIssuesButton = this.$widget.find(".find-and-fix-consistency-issues-button");- this.$checkIntegrityButton = this.$widget.find(".check-integrity-button");-- this.$forceFullSyncButton.on('click', async () => {- await server.post('sync/force-full-sync');-- toastService.showMessage("Full sync triggered");- });-- this.$fillEntityChangesButton.on('click', async () => {- toastService.showMessage("Filling entity changes rows...");-- await server.post('sync/fill-entity-changes');-- toastService.showMessage("Sync rows filled successfully");- });-- this.$anonymizeFullButton.on('click', async () => {- toastService.showMessage("Creating fully anonymized database...");-- const resp = await server.post('database/anonymize/full');-- if (!resp.success) {- toastService.showError("Could not create anonymized database, check backend logs for details");- }- else {- toastService.showMessage(`Created fully anonymized database in ${resp.anonymizedFilePath}`, 10000);- }- });-- this.$anonymizeLightButton.on('click', async () => {- toastService.showMessage("Creating lightly anonymized database...");-- const resp = await server.post('database/anonymize/light');-- if (!resp.success) {- toastService.showError("Could not create anonymized database, check backend logs for details");- }- else {- toastService.showMessage(`Created lightly anonymized database in ${resp.anonymizedFilePath}`, 10000);- }- });-- this.$vacuumDatabaseButton.on('click', async () => {- toastService.showMessage("Vacuuming database...");-- await server.post('database/vacuum-database');-- toastService.showMessage("Database has been vacuumed");- });-- this.$findAndFixConsistencyIssuesButton.on('click', async () => {- toastService.showMessage("Finding and fixing consistency issues...");-- await server.post('database/find-and-fix-consistency-issues');-- toastService.showMessage("Consistency issues should be fixed.");- });-- this.$checkIntegrityButton.on('click', async () => {- toastService.showMessage("Checking database integrity...");-- const {results} = await server.get('database/check-integrity');-- if (results.length === 1 && results[0].integrity_check === "ok") {- toastService.showMessage("Integrity check succeeded - no problems found.");- }- else {- toastService.showMessage("Integrity check failed: " + JSON.stringify(results, null, 2), 15000);- }- });- }-}diff --git a/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.js b/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.jsnew file mode 100644index 0000000000..e48746ab17--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/advanced/consistency_checks.js@@ -0,0 +1,24 @@+import OptionsWidget from "../options_widget.js";+import toastService from "../../../../services/toast.js";+import server from "../../../../services/server.js";++const TPL = `+<div class="options-section">+ <h4>Consistency checks</h4>++ <button class="find-and-fix-consistency-issues-button btn">Find and fix consistency issues</button>+</div>`;++export default class ConsistencyChecksOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$findAndFixConsistencyIssuesButton = this.$widget.find(".find-and-fix-consistency-issues-button");+ this.$findAndFixConsistencyIssuesButton.on('click', async () => {+ toastService.showMessage("Finding and fixing consistency issues...");++ await server.post('database/find-and-fix-consistency-issues');++ toastService.showMessage("Consistency issues should be fixed.");+ });+ }+}diff --git a/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.js b/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.jsnew file mode 100644index 0000000000..3a0c534e26--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/advanced/database_anonymization.js@@ -0,0 +1,56 @@+import OptionsWidget from "../options_widget.js";+import toastService from "../../../../services/toast.js";+import server from "../../../../services/server.js";++const TPL = `+<div class="options-section">+ <h4>Database anonymization</h4>++ <h5>Full anonymization</h5>++ <p>This action will create a new copy of the database and anonymize it (remove all note content and leave only structure and some non-sensitive metadata)+ for sharing online for debugging purposes without fear of leaking your personal data.</p>++ <button class="anonymize-full-button btn">Save fully anonymized database</button>++ <h5>Light anonymization</h5>++ <p>This action will create a new copy of the database and do a light anonymization on it - specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>++ <p>You can decide yourself if you want to provide fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.</p>++ <button class="anonymize-light-button btn">Save lightly anonymized database</button>+</div>`;++export default class DatabaseAnonymizationOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$anonymizeFullButton = this.$widget.find(".anonymize-full-button");+ this.$anonymizeLightButton = this.$widget.find(".anonymize-light-button");+ this.$anonymizeFullButton.on('click', async () => {+ toastService.showMessage("Creating fully anonymized database...");++ const resp = await server.post('database/anonymize/full');++ if (!resp.success) {+ toastService.showError("Could not create anonymized database, check backend logs for details");+ }+ else {+ toastService.showMessage(`Created fully anonymized database in ${resp.anonymizedFilePath}`, 10000);+ }+ });++ this.$anonymizeLightButton.on('click', async () => {+ toastService.showMessage("Creating lightly anonymized database...");++ const resp = await server.post('database/anonymize/light');++ if (!resp.success) {+ toastService.showError("Could not create anonymized database, check backend logs for details");+ }+ else {+ toastService.showMessage(`Created lightly anonymized database in ${resp.anonymizedFilePath}`, 10000);+ }+ });+ }+}diff --git a/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.js b/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.jsnew file mode 100644index 0000000000..5fc1264b96--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/advanced/database_integrity_check.js@@ -0,0 +1,31 @@+import OptionsWidget from "../options_widget.js";+import toastService from "../../../../services/toast.js";+import server from "../../../../services/server.js";++const TPL = `+<div class="options-section">+ <h4>Database integrity check</h4>++ <p>This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.</p>++ <button class="check-integrity-button btn">Check database integrity</button>+</div>`;++export default class DatabaseIntegrityCheckOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$checkIntegrityButton = this.$widget.find(".check-integrity-button");+ this.$checkIntegrityButton.on('click', async () => {+ toastService.showMessage("Checking database integrity...");++ const {results} = await server.get('database/check-integrity');++ if (results.length === 1 && results[0].integrity_check === "ok") {+ toastService.showMessage("Integrity check succeeded - no problems found.");+ }+ else {+ toastService.showMessage("Integrity check failed: " + JSON.stringify(results, null, 2), 15000);+ }+ });+ }+}diff --git a/src/public/app/widgets/type_widgets/options/advanced/sync.js b/src/public/app/widgets/type_widgets/options/advanced/sync.jsnew file mode 100644index 0000000000..457d7e34e7--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/advanced/sync.js@@ -0,0 +1,36 @@+import OptionsWidget from "../options_widget.js";+import server from "../../../../services/server.js";+import toastService from "../../../../services/toast.js";++const TPL = `+<div class="options-section">+ <h4>Sync</h4>+ <button class="force-full-sync-button btn">Force full sync</button>++ <button class="fill-entity-changes-button btn">Fill entity changes records</button>+</div>`;++export default class AdvancedSyncOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$forceFullSyncButton = this.$widget.find(".force-full-sync-button");+ this.$fillEntityChangesButton = this.$widget.find(".fill-entity-changes-button");+ this.$forceFullSyncButton.on('click', async () => {+ await server.post('sync/force-full-sync');++ toastService.showMessage("Full sync triggered");+ });++ this.$fillEntityChangesButton.on('click', async () => {+ toastService.showMessage("Filling entity changes rows...");++ await server.post('sync/fill-entity-changes');++ toastService.showMessage("Sync rows filled successfully");+ });+ }++ async optionsLoaded(options) {++ }+}diff --git a/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.js b/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.jsnew file mode 100644index 0000000000..4ac6adda0f--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/advanced/vacuum_database.js@@ -0,0 +1,26 @@+import OptionsWidget from "../options_widget.js";+import toastService from "../../../../services/toast.js";+import server from "../../../../services/server.js";++const TPL = `+<div class="options-section">+ <h4>Vacuum database</h4>++ <p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>++ <button class="vacuum-database-button btn">Vacuum database</button>+</div>`;++export default class VacuumDatabaseOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");+ this.$vacuumDatabaseButton.on('click', async () => {+ toastService.showMessage("Vacuuming database...");++ await server.post('database/vacuum-database');++ toastService.showMessage("Database has been vacuumed");+ });+ }+}diff --git a/src/public/app/widgets/type_widgets/options/backup.js b/src/public/app/widgets/type_widgets/options/backup.jsindex 9285e42882..8d099b1aea 100644--- a/src/public/app/widgets/type_widgets/options/backup.js+++ b/src/public/app/widgets/type_widgets/options/backup.js@@ -36,9 +36,7 @@ const TPL = ``;export default class BackupOptions extends OptionsWidget {- get tabTitle() { return "Backup" }-- lazyRender() {+ doRender() {this.$widget = $(TPL);this.$backupDatabaseButton = this.$widget.find(".backup-database-button");diff --git a/src/public/app/widgets/type_widgets/options/etapi.js b/src/public/app/widgets/type_widgets/options/etapi.jsindex 23c88cb913..e2b4f088ef 100644--- a/src/public/app/widgets/type_widgets/options/etapi.js+++ b/src/public/app/widgets/type_widgets/options/etapi.js@@ -47,9 +47,7 @@ const TPL = `</style>`;export default class EtapiOptions extends OptionsWidget {- get tabTitle() { return "ETAPI" }-- lazyRender() {+ doRender() {this.$widget = $(TPL);this.$widget.find(".create-etapi-token").on("click", async () => {diff --git a/src/public/app/widgets/type_widgets/options/images.js b/src/public/app/widgets/type_widgets/options/images.jsindex 7d1fd01e72..b12fc911a4 100644--- a/src/public/app/widgets/type_widgets/options/images.js+++ b/src/public/app/widgets/type_widgets/options/images.js@@ -1,14 +1,14 @@import OptionsWidget from "./options_widget.js";const TPL = `-<style>- .options-section .disabled-field {- opacity: 0.5;- pointer-events: none;- }-</style>-<div class="options-section">+ <style>+ .options-section .disabled-field {+ opacity: 0.5;+ pointer-events: none;+ }+ </style>+<h4>Images</h4><div class="form-group">@@ -37,9 +37,7 @@ const TPL = ``;export default class ImageOptions extends OptionsWidget {- get tabTitle() { return "Images" }-- lazyRender() {+ doRender() {this.$widget = $(TPL);this.$imageMaxWidthHeight = this.$widget.find(".image-max-width-height");diff --git a/src/public/app/widgets/type_widgets/options/other.js b/src/public/app/widgets/type_widgets/options/other.jsdeleted file mode 100644index 982b91c648..0000000000--- a/src/public/app/widgets/type_widgets/options/other.js+++ /dev/null@@ -1,91 +0,0 @@-import server from "../../../services/server.js";-import toastService from "../../../services/toast.js";-import OptionsWidget from "./options_widget.js";--const TPL = `-<div class="options-section">- <h4>Tray</h4>-- <div class="custom-control custom-checkbox">- <input type="checkbox" class="tray-enabled custom-control-input">- <label class="custom-control-label">Enable tray (Trilium needs to be restarted for this change to take effect)</label>- </div>-</div>--<div class="options-section">- <h4>Note erasure timeout</h4>-- <p>Deleted notes (and attributes, revisions...) are at first only marked as deleted and it is possible to recover them- from Recent Notes dialog. After a period of time, deleted notes are "erased" which means- their content is not recoverable anymore. This setting allows you to configure the length- of the period between deleting and erasing the note.</p>-- <div class="form-group">- <label>Erase notes after X seconds</label>- <input class="erase-entities-after-time-in-seconds form-control" type="number" min="0">- </div>-- <p>You can also trigger erasing manually:</p>-- <button class="erase-deleted-notes-now-button btn">Erase deleted notes now</button>-</div>--<div class="options-section">- <h4>Note revisions snapshot interval</h4>-- <p>Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See <a href="https://github.com/zadam/trilium/wiki/Note-revisions" class="external">wiki</a> for more info.</p>-- <div class="form-group">- <label>Note revision snapshot time interval (in seconds)</label>- <input class="note-revision-snapshot-time-interval-in-seconds form-control" type="number" min="10">- </div>-</div>--<div class="options-section">- <h4>Network connections</h4>-- <div class="form-group">- <input class="check-for-updates" type="checkbox" name="check-for-updates">- <label>Check for updates automatically</label>- </div>-</div>`;--export default class OtherOptions extends OptionsWidget {- get tabTitle() { return "Other" }-- lazyRender() {- this.$widget = $(TPL);-- this.$trayEnabled = this.$widget.find(".tray-enabled");- this.$trayEnabled.on('change', () =>- this.updateOption('disableTray', !this.$trayEnabled.is(":checked") ? "true" : "false"));-- this.$eraseEntitiesAfterTimeInSeconds = this.$widget.find(".erase-entities-after-time-in-seconds");- this.$eraseEntitiesAfterTimeInSeconds.on('change', () => this.updateOption('eraseEntitiesAfterTimeInSeconds', this.$eraseEntitiesAfterTimeInSeconds.val()));-- this.$eraseDeletedNotesButton = this.$widget.find(".erase-deleted-notes-now-button");- this.$eraseDeletedNotesButton.on('click', () => {- server.post('notes/erase-deleted-notes-now').then(() => {- toastService.showMessage("Deleted notes have been erased.");- });- });-- this.$noteRevisionsTimeInterval = this.$widget.find(".note-revision-snapshot-time-interval-in-seconds");-- this.$noteRevisionsTimeInterval.on('change', () =>- this.updateOption('noteRevisionSnapshotTimeInterval', this.$noteRevisionsTimeInterval.val()));-- this.$checkForUpdates = this.$widget.find(".check-for-updates");- this.$checkForUpdates.on("change", () =>- this.updateCheckboxOption('checkForUpdates', this.$checkForUpdates));- }-- optionsLoaded(options) {- this.$trayEnabled.prop("checked", options.disableTray !== 'true');-- this.$eraseEntitiesAfterTimeInSeconds.val(options.eraseEntitiesAfterTimeInSeconds);- this.$noteRevisionsTimeInterval.val(options.noteRevisionSnapshotTimeInterval);-- this.setCheckboxState(this.$checkForUpdates, options.checkForUpdates);- }-}diff --git a/src/public/app/widgets/type_widgets/options/other/network_connections.js b/src/public/app/widgets/type_widgets/options/other/network_connections.jsnew file mode 100644index 0000000000..59106322bb--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/other/network_connections.js@@ -0,0 +1,24 @@+import OptionsWidget from "../options_widget.js";++const TPL = `+<div class="options-section">+ <h4>Network connections</h4>++ <div class="form-group">+ <input class="check-for-updates" type="checkbox" name="check-for-updates">+ <label>Check for updates automatically</label>+ </div>+</div>`;++export default class NetworkConnectionsOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$checkForUpdates = this.$widget.find(".check-for-updates");+ this.$checkForUpdates.on("change", () =>+ this.updateCheckboxOption('checkForUpdates', this.$checkForUpdates));+ }++ async optionsLoaded(options) {+ this.setCheckboxState(this.$checkForUpdates, options.checkForUpdates);+ }+}diff --git a/src/public/app/widgets/type_widgets/options/other/note_erasure_timeout.js b/src/public/app/widgets/type_widgets/options/other/note_erasure_timeout.jsnew file mode 100644index 0000000000..1b455788aa--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/other/note_erasure_timeout.js@@ -0,0 +1,41 @@+import OptionsWidget from "../options_widget.js";+import server from "../../../../services/server.js";+import toastService from "../../../../services/toast.js";++const TPL = `+<div class="options-section">+ <h4>Note erasure timeout</h4>++ <p>Deleted notes (and attributes, revisions...) are at first only marked as deleted and it is possible to recover them+ from Recent Notes dialog. After a period of time, deleted notes are "erased" which means+ their content is not recoverable anymore. This setting allows you to configure the length+ of the period between deleting and erasing the note.</p>++ <div class="form-group">+ <label>Erase notes after X seconds</label>+ <input class="erase-entities-after-time-in-seconds form-control" type="number" min="0">+ </div>++ <p>You can also trigger erasing manually:</p>++ <button class="erase-deleted-notes-now-button btn">Erase deleted notes now</button>+</div>`;++export default class NoteErasureTimeoutOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$eraseEntitiesAfterTimeInSeconds = this.$widget.find(".erase-entities-after-time-in-seconds");+ this.$eraseEntitiesAfterTimeInSeconds.on('change', () => this.updateOption('eraseEntitiesAfterTimeInSeconds', this.$eraseEntitiesAfterTimeInSeconds.val()));++ this.$eraseDeletedNotesButton = this.$widget.find(".erase-deleted-notes-now-button");+ this.$eraseDeletedNotesButton.on('click', () => {+ server.post('notes/erase-deleted-notes-now').then(() => {+ toastService.showMessage("Deleted notes have been erased.");+ });+ });+ }++ async optionsLoaded(options) {+ this.$eraseEntitiesAfterTimeInSeconds.val(options.eraseEntitiesAfterTimeInSeconds);+ }+}diff --git a/src/public/app/widgets/type_widgets/options/other/note_revisions_snapshot_interval.js b/src/public/app/widgets/type_widgets/options/other/note_revisions_snapshot_interval.jsnew file mode 100644index 0000000000..5e02991f8e--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/other/note_revisions_snapshot_interval.js@@ -0,0 +1,26 @@+import OptionsWidget from "../options_widget.js";++const TPL = `+<div class="options-section">+ <h4>Note revisions snapshot interval</h4>++ <p>Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See <a href="https://github.com/zadam/trilium/wiki/Note-revisions" class="external">wiki</a> for more info.</p>++ <div class="form-group">+ <label>Note revision snapshot time interval (in seconds)</label>+ <input class="note-revision-snapshot-time-interval-in-seconds form-control" type="number" min="10">+ </div>+</div>`;++export default class NoteRevisionsSnapshotIntervalOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$noteRevisionsTimeInterval = this.$widget.find(".note-revision-snapshot-time-interval-in-seconds");+ this.$noteRevisionsTimeInterval.on('change', () =>+ this.updateOption('noteRevisionSnapshotTimeInterval', this.$noteRevisionsTimeInterval.val()));+ }++ async optionsLoaded(options) {+ this.$noteRevisionsTimeInterval.val(options.noteRevisionSnapshotTimeInterval);+ }+}diff --git a/src/public/app/widgets/type_widgets/options/other/tray.js b/src/public/app/widgets/type_widgets/options/other/tray.jsnew file mode 100644index 0000000000..555d2f7aa9--- /dev/null+++ b/src/public/app/widgets/type_widgets/options/other/tray.js@@ -0,0 +1,24 @@+import OptionsWidget from "../options_widget.js";++const TPL = `+<div class="options-section">+ <h4>Tray</h4>++ <div class="custom-control custom-checkbox">+ <input type="checkbox" class="tray-enabled custom-control-input">+ <label class="custom-control-label">Enable tray (Trilium needs to be restarted for this change to take effect)</label>+ </div>+</div>`;++export default class TrayOptions extends OptionsWidget {+ doRender() {+ this.$widget = $(TPL);+ this.$trayEnabled = this.$widget.find(".tray-enabled");+ this.$trayEnabled.on('change', () =>+ this.updateOption('disableTray', !this.$trayEnabled.is(":checked") ? "true" : "false"));+ }++ async optionsLoaded(options) {+ this.$trayEnabled.prop("checked", options.disableTray !== 'true');+ }+}diff --git a/src/public/app/widgets/type_widgets/options/password.js b/src/public/app/widgets/type_widgets/options/password.jsindex 821a1bf3bd..98838a2644 100644--- a/src/public/app/widgets/type_widgets/options/password.js+++ b/src/public/app/widgets/type_widgets/options/password.js@@ -46,9 +46,7 @@ const TPL = `</div>`;export default class PasswordOptions extends OptionsWidget {- get tabTitle() { return "Password" }-- lazyRender() {+ doRender() {this.$widget = $(TPL);this.$passwordHeading = this.$widget.find(".password-heading");diff --git a/src/public/app/widgets/type_widgets/options/spellcheck.js b/src/public/app/widgets/type_widgets/options/spellcheck.jsindex 819a2230d0..bb45b1901f 100644--- a/src/public/app/widgets/type_widgets/options/spellcheck.js+++ b/src/public/app/widgets/type_widgets/options/spellcheck.js@@ -25,9 +25,7 @@ const TPL = `</div>`;export default class SpellcheckOptions extends OptionsWidget {- get tabTitle() { return "Spellcheck" }-- lazyRender() {+ doRender() {this.$widget = $(TPL);this.$spellCheckEnabled = this.$widget.find(".spell-check-enabled");diff --git a/src/public/app/widgets/type_widgets/options/sync.js b/src/public/app/widgets/type_widgets/options/sync.jsindex a98b35d05a..e7ac9b8ccb 100644--- a/src/public/app/widgets/type_widgets/options/sync.js+++ b/src/public/app/widgets/type_widgets/options/sync.js@@ -41,9 +41,7 @@ const TPL = `</div>`;export default class SyncOptions extends OptionsWidget {- get tabTitle() { return "Sync" }-- lazyRender() {+ doRender() {this.$widget = $(TPL);this.$form = this.$widget.find(".sync-setup-form");