diff --git a/src/public/app/widgets/dialogs/options.js b/src/public/app/widgets/dialogs/options.js
index 288bae91d..5d7ff1a90 100644
--- a/src/public/app/widgets/dialogs/options.js
+++ b/src/public/app/widgets/dialogs/options.js
@@ -40,6 +40,12 @@ const TPL = `
+
Images
+
+
+
+
+
+ Enable image compression
+
+
+
+
+`;
+
+export default class ImageOptions {
+ constructor() {
+ $("#options-images").html(TPL);
+
+ 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 changed have been saved."));
+
+ return false;
+ });
+
+ this.$imageJpegQuality.on('change', () => {
+ const opts = { 'imageJpegQuality': this.$imageJpegQuality.val() };
+ server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+
+ return false;
+ });
+
+ this.$downloadImagesAutomatically = $("#download-images-automatically");
+
+ this.$downloadImagesAutomatically.on("change", () => {
+ const isChecked = this.$downloadImagesAutomatically.prop("checked");
+ const opts = { 'downloadImagesAutomatically': isChecked ? 'true' : 'false' };
+
+ server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ });
+
+ this.$enableImageCompression = $("#image-compresion-enabled");
+ this.$imageCompressionWrapper = $("#image-compression-enabled-wraper");
+
+ this.setImageCompression = (isChecked) => {
+ if (isChecked) {
+ this.$imageCompressionWrapper.removeClass("disabled-field");
+ } else {
+ this.$imageCompressionWrapper.addClass("disabled-field");
+ }
+ };
+
+ this.$enableImageCompression.on("change", () => {
+ const isChecked = this.$enableImageCompression.prop("checked");
+ const opts = { 'compressImages': isChecked ? 'true' : 'false' };
+
+ server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+
+ this.setImageCompression(isChecked);
+ });
+ }
+
+ optionsLoaded(options) {
+ this.$imageMaxWidthHeight.val(options['imageMaxWidthHeight']);
+ this.$imageJpegQuality.val(options['imageJpegQuality']);
+
+ const downloadImagesAutomatically = options['downloadImagesAutomatically'] === 'true';
+ this.$downloadImagesAutomatically.prop('checked', downloadImagesAutomatically);
+
+ const compressImages = options['compressImages'] === 'true';
+ this.$enableImageCompression.prop('checked', compressImages);
+ this.setImageCompression(compressImages);
+ }
+}
diff --git a/src/public/app/widgets/dialogs/options/other.js b/src/public/app/widgets/dialogs/options/other.js
index a7452543b..6f4a8919d 100644
--- a/src/public/app/widgets/dialogs/options/other.js
+++ b/src/public/app/widgets/dialogs/options/other.js
@@ -3,62 +3,6 @@ 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.
-
-
-
- Enable spellcheck
-
-
-
-
-
- Language code(s)
-
-
-
-
Multiple languages can be separated by comma, e.g. en-US, de-DE, cs
. Changes to the spell check options will take effect after application restart.
-
-
Available language codes:
-
-
-
-
Images
-
-
-
-
-
- Enable image compression
-
-
-
-
-
Note revisions snapshot interval
@@ -117,31 +49,6 @@ export default class OtherOptions {
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 changed have been saved."));
-
- return false;
- });
-
- this.$spellCheckLanguageCode.on('change', () => {
- const opts = { 'spellCheckLanguageCode': this.$spellCheckLanguageCode.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
-
- return false;
- });
-
- this.$availableLanguageCodes = $("#available-language-codes");
-
- if (utils.isElectron()) {
- const { webContents } = utils.dynamicRequire('@electron/remote').getCurrentWindow();
-
- this.$availableLanguageCodes.text(webContents.session.availableSpellCheckerLanguages.join(', '));
- }
-
this.$eraseEntitiesAfterTimeInSeconds = $("#erase-entities-after-time-in-seconds");
this.$eraseEntitiesAfterTimeInSeconds.on('change', () => {
@@ -161,18 +68,6 @@ export default class OtherOptions {
});
});
- this.$protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
-
- this.$protectedSessionTimeout.on('change', () => {
- const protectedSessionTimeout = this.$protectedSessionTimeout.val();
-
- server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => {
- toastService.showMessage("Options changed have been saved.");
- });
-
- return false;
- });
-
this.$noteRevisionsTimeInterval = $("#note-revision-snapshot-time-interval-in-seconds");
this.$noteRevisionsTimeInterval.on('change', () => {
@@ -182,52 +77,6 @@ export default class OtherOptions {
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 changed have been saved."));
-
- return false;
- });
-
- this.$imageJpegQuality.on('change', () => {
- const opts = { 'imageJpegQuality': this.$imageJpegQuality.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
-
- return false;
- });
-
- this.$downloadImagesAutomatically = $("#download-images-automatically");
-
- this.$downloadImagesAutomatically.on("change", () => {
- const isChecked = this.$downloadImagesAutomatically.prop("checked");
- const opts = { 'downloadImagesAutomatically': isChecked ? 'true' : 'false' };
-
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
- });
-
- this.$enableImageCompression = $("#image-compresion-enabled");
- this.$imageCompressionWrapper = $("#image-compression-enabled-wraper");
-
- this.setImageCompression = (isChecked) => {
- if (isChecked) {
- this.$imageCompressionWrapper.removeClass("disabled-field");
- } else {
- this.$imageCompressionWrapper.addClass("disabled-field");
- }
- };
-
- this.$enableImageCompression.on("change", () => {
- const isChecked = this.$enableImageCompression.prop("checked");
- const opts = { 'compressImages': isChecked ? 'true' : 'false' };
-
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
-
- this.setImageCompression(isChecked);
- });
-
this.$checkForUpdates = $("#check-for-updates");
this.$checkForUpdates.on("change", () => {
const isChecked = this.$checkForUpdates.prop("checked");
@@ -238,26 +87,10 @@ export default class OtherOptions {
}
optionsLoaded(options) {
- this.$spellCheckEnabled.prop("checked", options['spellCheckEnabled'] === 'true');
- this.$spellCheckLanguageCode.val(options['spellCheckLanguageCode']);
-
this.$eraseEntitiesAfterTimeInSeconds.val(options['eraseEntitiesAfterTimeInSeconds']);
- this.$protectedSessionTimeout.val(options['protectedSessionTimeout']);
this.$noteRevisionsTimeInterval.val(options['noteRevisionSnapshotTimeInterval']);
- this.$imageMaxWidthHeight.val(options['imageMaxWidthHeight']);
- this.$imageJpegQuality.val(options['imageJpegQuality']);
-
- const downloadImagesAutomatically = options['downloadImagesAutomatically'] === 'true';
- this.$downloadImagesAutomatically.prop('checked', downloadImagesAutomatically);
-
- const compressImages = options['compressImages'] === 'true';
- this.$enableImageCompression.prop('checked', compressImages);
- this.setImageCompression(compressImages);
-
-
const checkForUpdates = options['checkForUpdates'] === 'true';
this.$checkForUpdates.prop('checked', checkForUpdates);
-
}
}
diff --git a/src/public/app/widgets/dialogs/options/password.js b/src/public/app/widgets/dialogs/options/password.js
index 708e04d9f..31816344b 100644
--- a/src/public/app/widgets/dialogs/options/password.js
+++ b/src/public/app/widgets/dialogs/options/password.js
@@ -3,39 +3,55 @@ import protectedSessionHolder from "../../../services/protected_session_holder.j
import toastService from "../../../services/toast.js";
const TPL = `
-
-
-
- Please take care to remember your new password. Password is used for logging into the web interface and
- to encrypt protected notes. If you forget your password, then all your protected notes are forever lost.
- In case you did forget your password,
click here to reset it .
+
+
+
+
+ Please take care to remember your new password. Password is used for logging into the web interface and
+ to encrypt protected notes. If you forget your password, then all your protected notes are forever lost.
+ In case you did forget your password,
click here to reset it .
+
+
+
-
`;
-
-export default class ChangePasswordOptions {
+export default class PasswordOptions {
constructor() {
$("#options-password").html(TPL);
this.$passwordHeading = $("#password-heading");
- this.$form = $("#change-password-form");
+ this.$changePasswordForm = $("#change-password-form");
this.$oldPassword = $("#old-password");
this.$newPassword1 = $("#new-password1");
this.$newPassword2 = $("#new-password2");
@@ -53,7 +69,19 @@ export default class ChangePasswordOptions {
}
});
- this.$form.on('submit', () => this.save());
+ this.$changePasswordForm.on('submit', () => this.save());
+
+ this.$protectedSessionTimeout = $("#protected-session-timeout-in-seconds");
+
+ this.$protectedSessionTimeout.on('change', () => {
+ const protectedSessionTimeout = this.$protectedSessionTimeout.val();
+
+ server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => {
+ toastService.showMessage("Options changed have been saved.");
+ });
+
+ return false;
+ });
}
optionsLoaded(options) {
@@ -62,6 +90,7 @@ export default class ChangePasswordOptions {
$("#old-password-form-group").toggle(isPasswordSet);
this.$passwordHeading.text(isPasswordSet ? 'Change password' : 'Set password');
this.$savePasswordButton.text(isPasswordSet ? 'Change password' : 'Set password');
+ this.$protectedSessionTimeout.val(options['protectedSessionTimeout']);
}
save() {
diff --git a/src/public/app/widgets/dialogs/options/spellcheck.js b/src/public/app/widgets/dialogs/options/spellcheck.js
new file mode 100644
index 000000000..cba354f5a
--- /dev/null
+++ b/src/public/app/widgets/dialogs/options/spellcheck.js
@@ -0,0 +1,69 @@
+import utils from "../../../services/utils.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.
+
+
+
+ Enable spellcheck
+
+
+
+
+
+ Language code(s)
+
+
+
+
Multiple languages can be separated by comma, e.g. en-US, de-DE, cs
. Changes to the spell check options will take effect after application restart.
+
+
Available language codes:
+
`;
+
+export default class SpellcheckOptions {
+ constructor() {
+ $("#options-spellcheck").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 changed have been saved."));
+
+ return false;
+ });
+
+ this.$spellCheckLanguageCode.on('change', () => {
+ const opts = { 'spellCheckLanguageCode': this.$spellCheckLanguageCode.val() };
+ server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+
+ return false;
+ });
+
+ this.$availableLanguageCodes = $("#available-language-codes");
+
+ if (utils.isElectron()) {
+ const { webContents } = utils.dynamicRequire('@electron/remote').getCurrentWindow();
+
+ this.$availableLanguageCodes.text(webContents.session.availableSpellCheckerLanguages.join(', '));
+ }
+ }
+
+ optionsLoaded(options) {
+ this.$spellCheckEnabled.prop("checked", options['spellCheckEnabled'] === 'true');
+ this.$spellCheckLanguageCode.val(options['spellCheckLanguageCode']);
+ }
+}