diff --git a/src/public/app/widgets/type_widgets/content_widget.js b/src/public/app/widgets/type_widgets/content_widget.js index 29a06cf55..2143eb2ef 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 = `
`; 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.js index 7d1fd01e7..b12fc911a 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 = ` - -
+ +

Images

@@ -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.js deleted file mode 100644 index 982b91c64..000000000 --- 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 = ` -
-

Tray

- -
- - -
-
- -
-

Note erasure timeout

- -

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.

- -
- - -
- -

You can also trigger erasing manually:

- - -
- -
-

Note revisions snapshot interval

- -

Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See wiki for more info.

- -
- - -
-
- -
-

Network connections

- -
- - -
-
`; - -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.js new file mode 100644 index 000000000..59106322b --- /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 = ` +
+

Network connections

+ +
+ + +
+
`; + +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.js new file mode 100644 index 000000000..1b455788a --- /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 = ` +
+

Note erasure timeout

+ +

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.

+ +
+ + +
+ +

You can also trigger erasing manually:

+ + +
`; + +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.js new file mode 100644 index 000000000..5e02991f8 --- /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 = ` +
+

Note revisions snapshot interval

+ +

Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See wiki for more info.

+ +
+ + +
+
`; + +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.js new file mode 100644 index 000000000..555d2f7aa --- /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 = ` +
+

Tray

+ +
+ + +
+
`; + +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.js index 821a1bf3b..98838a264 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 = `
`; 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.js index 819a2230d..bb45b1901 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 = `
`; 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.js index a98b35d05..e7ac9b8cc 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 = `
`; export default class SyncOptions extends OptionsWidget { - get tabTitle() { return "Sync" } - - lazyRender() { + doRender() { this.$widget = $(TPL); this.$form = this.$widget.find(".sync-setup-form");