import optionsService from "../../services/options.js"; import server from "../../services/server.js"; import toastService from "../../services/toast.js"; const TPL = `

Spell check

These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.


Changes to the spell check options will take effect after application restart.

Image compression

Note erasure timeout

Deleted notes are at first only marked as deleted and it is possible to recover them from Recent Notes dialog. After 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.

Protected session timeout

Protected session timeout is a time period after which the protected session is wiped out from browser's memory. This is measured from the last interaction with protected notes. See wiki for more info.

Note revisions snapshot interval

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

`; export default class ProtectedSessionOptions { constructor() { $("#options-other").html(TPL); this.$spellCheckEnabled = $("#spell-check-enabled"); this.$spellCheckLanguageCode = $("#spell-check-language-code"); this.$spellCheckEnabled.on('change', () => { const opts = { 'spellCheckEnabled': this.$spellCheckEnabled.is(":checked") ? "true" : "false" }; server.put('options', opts).then(() => toastService.showMessage("Options change have been saved.")); return false; }); this.$spellCheckLanguageCode.on('change', () => { const opts = { 'spellCheckLanguageCode': this.$spellCheckLanguageCode.val() }; server.put('options', opts).then(() => toastService.showMessage("Options change have been saved.")); return false; }); this.$eraseNotesAfterTimeInSeconds = $("#erase-notes-after-time-in-seconds"); this.$eraseNotesAfterTimeInSeconds.on('change', () => { const eraseNotesAfterTimeInSeconds = this.$eraseNotesAfterTimeInSeconds.val(); server.put('options', { 'eraseNotesAfterTimeInSeconds': eraseNotesAfterTimeInSeconds }).then(() => { optionsService.reloadOptions(); toastService.showMessage("Options change have been saved."); }); return false; }); this.$protectedSessionTimeout = $("#protected-session-timeout-in-seconds"); this.$protectedSessionTimeout.on('change', () => { const protectedSessionTimeout = this.$protectedSessionTimeout.val(); server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => { optionsService.reloadOptions(); toastService.showMessage("Options change have been saved."); }); return false; }); this.$noteRevisionsTimeInterval = $("#note-revision-snapshot-time-interval-in-seconds"); this.$noteRevisionsTimeInterval.on('change', () => { const opts = { 'noteRevisionSnapshotTimeInterval': this.$noteRevisionsTimeInterval.val() }; server.put('options', opts).then(() => toastService.showMessage("Options change have been saved.")); return false; }); this.$imageMaxWidthHeight = $("#image-max-width-height"); this.$imageJpegQuality = $("#image-jpeg-quality"); this.$imageMaxWidthHeight.on('change', () => { const opts = { 'imageMaxWidthHeight': this.$imageMaxWidthHeight.val() }; server.put('options', opts).then(() => toastService.showMessage("Options change have been saved.")); return false; }); this.$imageJpegQuality.on('change', () => { const opts = { 'imageJpegQuality': this.$imageJpegQuality.val() }; server.put('options', opts).then(() => toastService.showMessage("Options change have been saved.")); return false; }); } optionsLoaded(options) { this.$spellCheckEnabled.prop("checked", options['spellCheckEnabled'] === 'true'); this.$spellCheckLanguageCode.val(options['spellCheckLanguageCode']); this.$eraseNotesAfterTimeInSeconds.val(options['eraseNotesAfterTimeInSeconds']); this.$protectedSessionTimeout.val(options['protectedSessionTimeout']); this.$noteRevisionsTimeInterval.val(options['noteRevisionSnapshotTimeInterval']); this.$imageMaxWidthHeight.val(options['imageMaxWidthHeight']); this.$imageJpegQuality.val(options['imageJpegQuality']); } }