diff --git a/electron.js b/electron.js
index 5f76269c4..f32f992ab 100644
--- a/electron.js
+++ b/electron.js
@@ -57,4 +57,3 @@ app.on('will-quit', () => {
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
require('./src/www');
-const options = require("./src/public/app/services/options.js");
diff --git a/src/public/app/widgets/dialogs/options/code_notes.js b/src/public/app/widgets/dialogs/options/code_notes.js
index a5bee4180..335c8b922 100644
--- a/src/public/app/widgets/dialogs/options/code_notes.js
+++ b/src/public/app/widgets/dialogs/options/code_notes.js
@@ -4,23 +4,40 @@ import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
const TPL = `
-
Use vim keybindings in code notes (no ex mode)
-
-
-
+
+
Use vim keybindings in code notes (no ex mode)
+
+
+
+
+
-
-
Wrap lines in code notes
-
-
-
+
+
Wrap lines in code notes
+
+
+
+
+
-
-
Available MIME types in the dropdown
+
+
Automatic readonly size
-
`;
+
Automatic readonly note size is the size after which notes will be displayed in a readonly mode (for performance reasons).
+
+
+
+
+
+
+
+
+
Available MIME types in the dropdown
+
+
+
`;
export default class CodeNotesOptions {
constructor() {
@@ -32,6 +49,7 @@ export default class CodeNotesOptions {
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
+
this.$codeLineWrapEnabled = $("#line-wrap-enabled");
this.$codeLineWrapEnabled.on('change', () => {
const opts = { 'codeLineWrapEnabled': this.$codeLineWrapEnabled.is(":checked") ? "true" : "false" };
@@ -39,12 +57,22 @@ export default class CodeNotesOptions {
return false;
});
this.$mimeTypes = $("#options-mime-types");
+
+ this.$autoReadonlySizeCode = $("#auto-readonly-size-code");
+ this.$autoReadonlySizeCode.on('change', () => {
+ const opts = { 'autoReadonlySizeCode': this.$autoReadonlySizeCode.val() };
+ server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+
+ return false;
+ });
}
async optionsLoaded(options) {
this.$mimeTypes.empty();
this.$vimKeymapEnabled.prop("checked", options['vimKeymapEnabled'] === 'true');
this.$codeLineWrapEnabled.prop("checked", options['codeLineWrapEnabled'] === 'true');
+ this.$autoReadonlySizeCode.val(options['autoReadonlySizeCode']);
+
let idCtr = 1;
for (const mimeType of await mimeTypesService.getMimeTypes()) {
diff --git a/src/public/app/widgets/dialogs/options/other.js b/src/public/app/widgets/dialogs/options/other.js
index 9d47035a7..a7452543b 100644
--- a/src/public/app/widgets/dialogs/options/other.js
+++ b/src/public/app/widgets/dialogs/options/other.js
@@ -102,21 +102,6 @@ const TPL = `
-
-
Automatic readonly size
-
-
Automatic readonly note size is the size after which notes will be displayed in a readonly mode (for performance reasons).
-
-
-
-
-
-
-
-
-
-
-
Network connections
@@ -128,7 +113,7 @@ const TPL = `
`;
-export default class ProtectedSessionOptions {
+export default class OtherOptions {
constructor() {
$("#options-other").html(TPL);
@@ -214,24 +199,6 @@ export default class ProtectedSessionOptions {
return false;
});
- this.$autoReadonlySizeText = $("#auto-readonly-size-text");
-
- this.$autoReadonlySizeText.on('change', () => {
- const opts = { 'autoReadonlySizeText': this.$autoReadonlySizeText.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
-
- return false;
- });
-
- this.$autoReadonlySizeCode = $("#auto-readonly-size-code");
-
- this.$autoReadonlySizeCode.on('change', () => {
- const opts = { 'autoReadonlySizeCode': this.$autoReadonlySizeText.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
-
- return false;
- });
-
this.$downloadImagesAutomatically = $("#download-images-automatically");
this.$downloadImagesAutomatically.on("change", () => {
@@ -281,9 +248,6 @@ export default class ProtectedSessionOptions {
this.$imageMaxWidthHeight.val(options['imageMaxWidthHeight']);
this.$imageJpegQuality.val(options['imageJpegQuality']);
- this.$autoReadonlySizeText.val(options['autoReadonlySizeText']);
- this.$autoReadonlySizeCode.val(options['autoReadonlySizeCode']);
-
const downloadImagesAutomatically = options['downloadImagesAutomatically'] === 'true';
this.$downloadImagesAutomatically.prop('checked', downloadImagesAutomatically);
diff --git a/src/public/app/widgets/dialogs/options/text_notes.js b/src/public/app/widgets/dialogs/options/text_notes.js
index 86510a47a..524208ab2 100644
--- a/src/public/app/widgets/dialogs/options/text_notes.js
+++ b/src/public/app/widgets/dialogs/options/text_notes.js
@@ -1,4 +1,5 @@
import server from "../../../services/server.js";
+import toastService from "../../../services/toast.js";
const TPL = `
Settings on this options tab are saved automatically after each change.
@@ -22,6 +23,17 @@ const TPL = `
You can also use this option to effectively disable TOC by setting a very high number.
+
+
+
Automatic readonly size
+
+
Automatic readonly note size is the size after which notes will be displayed in a readonly mode (for performance reasons).
+
+
+
+
+
+
`;
export default class TextNotesOptions {
@@ -45,6 +57,15 @@ export default class TextNotesOptions {
server.put('options/minTocHeadings/' + minTocHeadings);
});
+
+ this.$autoReadonlySizeText = $("#auto-readonly-size-text");
+
+ this.$autoReadonlySizeText.on('change', () => {
+ const opts = { 'autoReadonlySizeText': this.$autoReadonlySizeText.val() };
+ server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+
+ return false;
+ });
}
toggleBodyClass(prefix, value) {
@@ -60,5 +81,6 @@ export default class TextNotesOptions {
async optionsLoaded(options) {
this.$headingStyle.val(options.headingStyle);
this.$minTocHeadings.val(options.minTocHeadings);
+ this.$autoReadonlySizeText.val(options.autoReadonlySizeText);
}
}
diff --git a/src/services/tray.js b/src/services/tray.js
index 10f2be279..667d613bf 100644
--- a/src/services/tray.js
+++ b/src/services/tray.js
@@ -2,7 +2,6 @@ const { Menu, Tray } = require('electron');
const path = require('path');
const windowService = require("./window");
const optionService = require("./options");
-const options = require("../public/app/services/options.js");
const UPDATE_TRAY_EVENTS = [
'minimize', 'maximize', 'show', 'hide'