From 5ecb881cec752919112493a1c7d80efecd143b09 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 3 Nov 2019 19:06:22 +0100 Subject: [PATCH] options template is handled directly in the option classes which fixes multiple binding of elements inside options dialog --- package-lock.json | 6 +- package.json | 2 +- .../javascripts/dialogs/options/advanced.js | 27 +++++ .../javascripts/dialogs/options/appearance.js | 100 ++++++++++++++++++ .../dialogs/options/change_password.js | 22 ++++ .../javascripts/dialogs/options/code_notes.js | 7 ++ .../javascripts/dialogs/options/other.js | 60 +++++++++++ .../javascripts/dialogs/options/sidebar.js | 54 ++++++++++ .../javascripts/dialogs/options/sync.js | 38 +++++++ src/views/dialogs/options.ejs | 14 +-- src/views/dialogs/options/advanced.ejs | 25 ----- src/views/dialogs/options/appearance.ejs | 98 ----------------- src/views/dialogs/options/change_password.ejs | 20 ---- src/views/dialogs/options/code_notes.ejs | 5 - src/views/dialogs/options/other.ejs | 58 ---------- src/views/dialogs/options/sidebar.ejs | 52 --------- src/views/dialogs/options/sync.ejs | 36 ------- 17 files changed, 319 insertions(+), 305 deletions(-) delete mode 100644 src/views/dialogs/options/advanced.ejs delete mode 100644 src/views/dialogs/options/appearance.ejs delete mode 100644 src/views/dialogs/options/change_password.ejs delete mode 100644 src/views/dialogs/options/code_notes.ejs delete mode 100644 src/views/dialogs/options/other.ejs delete mode 100644 src/views/dialogs/options/sidebar.ejs delete mode 100644 src/views/dialogs/options/sync.ejs diff --git a/package-lock.json b/package-lock.json index 0432bf7d8..87fd68a1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10922,9 +10922,9 @@ } }, "rcedit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/rcedit/-/rcedit-2.0.0.tgz", - "integrity": "sha512-XcFGyEBjhWSsud+R8elwQtGBbVkCf7tAiad+nXo5jc6l2rMf46NfGNwjnmBNneBIZDfq+Npf8lwP371JTONfrw==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/rcedit/-/rcedit-2.1.0.tgz", + "integrity": "sha512-Nrd/65LzMjFmKpS9d2fqIxVYdW0M8ovsN0PgZhCrPMQss2yznkp6/zjEQ1a9DzzoGv2uuN3yDJAeHybOD5ZNKA==" }, "read-all-stream": { "version": "3.1.0", diff --git a/package.json b/package.json index 2c9d330ea..cebd72f1a 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "pngjs": "3.4.0", "portscanner": "2.2.0", "rand-token": "0.4.0", - "rcedit": "2.0.0", + "rcedit": "2.1.0", "rimraf": "3.0.0", "sanitize-filename": "1.6.3", "sax": "1.2.4", diff --git a/src/public/javascripts/dialogs/options/advanced.js b/src/public/javascripts/dialogs/options/advanced.js index 1f773daa0..c1c7ba581 100644 --- a/src/public/javascripts/dialogs/options/advanced.js +++ b/src/public/javascripts/dialogs/options/advanced.js @@ -1,8 +1,35 @@ import server from "../../services/server.js"; import toastService from "../../services/toast.js"; +const TPL = ` +

Sync

+ + +
+
+ + + +
+
+ +

Debugging

+ +

+ +

This action will create a new copy of the database and anonymise it (remove all note content and leave only structure and metadata) + for sharing online for debugging purposes without fear of leaking your personal data.

+ +

Vacuum database

+ +

This will rebuild database which will typically result in smaller database file. No data will be actually changed.

+ +`; + export default class AdvancedOptions { constructor() { + $("#options-advanced").html(TPL); + this.$forceFullSyncButton = $("#force-full-sync-button"); this.$fillSyncRowsButton = $("#fill-sync-rows-button"); this.$anonymizeButton = $("#anonymize-button"); diff --git a/src/public/javascripts/dialogs/options/appearance.js b/src/public/javascripts/dialogs/options/appearance.js index d805bdf8d..8dfaf89cb 100644 --- a/src/public/javascripts/dialogs/options/appearance.js +++ b/src/public/javascripts/dialogs/options/appearance.js @@ -4,8 +4,108 @@ import cssLoader from "../../services/css_loader.js"; import zoomService from "../../services/zoom.js"; import optionsService from "../../services/options.js"; +const TPL = ` +

Settings on this options tab are saved automatically after each change.

+ +
+
+
+ + +
+ +
+ + + +
+ +
+ + +
+
+ +

Zooming can be controlled with CTRL-+ and CTRL-= shortcuts as well.

+ +

Font sizes

+ +
+
+ + +
+ +
+ % +
+
+
+ +
+ + +
+ +
+ % +
+
+
+ +
+ + +
+ +
+ % +
+
+
+
+ +

Note that tree and detail font sizing is relative to the main font size setting.

+ +

Left pane sizing

+ +
+
+ + +
+ + +
+ px +
+
+
+ +
+ + +
+ + +
+ % +
+
+
+
+ +

Left pane width is calculated from the percent of window size, if this is smaller than minimum width, then minimum width is used. If you want to have fixed width left pane, set minimum width to the desired width and set percent to 0.

+ +
`; + export default class ApperanceOptions { constructor() { + $("#options-appearance").html(TPL); + this.$themeSelect = $("#theme-select"); this.$zoomFactorSelect = $("#zoom-factor-select"); this.$oneTabDisplaySelect = $("#one-tab-display-select"); diff --git a/src/public/javascripts/dialogs/options/change_password.js b/src/public/javascripts/dialogs/options/change_password.js index a55a222bc..171893def 100644 --- a/src/public/javascripts/dialogs/options/change_password.js +++ b/src/public/javascripts/dialogs/options/change_password.js @@ -2,8 +2,30 @@ import server from "../../services/server.js"; import protectedSessionHolder from "../../services/protected_session_holder.js"; import toastService from "../../services/toast.js"; +const TPL = ` +
+
+ + +
+ +
+ + +
+ +
+ + +
+ + +
`; + export default class ChangePasswordOptions { constructor() { + $("#options-change-password").html(TPL); + this.$form = $("#change-password-form"); this.$oldPassword = $("#old-password"); this.$newPassword1 = $("#new-password1"); diff --git a/src/public/javascripts/dialogs/options/code_notes.js b/src/public/javascripts/dialogs/options/code_notes.js index 572e2b928..4e71368d2 100644 --- a/src/public/javascripts/dialogs/options/code_notes.js +++ b/src/public/javascripts/dialogs/options/code_notes.js @@ -2,8 +2,15 @@ import server from "../../services/server.js"; import mimeTypesService from "../../services/mime_types.js"; import optionsService from "../../services/options.js"; +const TPL = ` +

Available MIME types in the dropdown

+ +`; + export default class CodeNotesOptions { constructor() { + $("#options-code-notes").html(TPL); + this.$mimeTypes = $("#options-mime-types"); } diff --git a/src/public/javascripts/dialogs/options/other.js b/src/public/javascripts/dialogs/options/other.js index 8baff5c13..a1a764bb8 100644 --- a/src/public/javascripts/dialogs/options/other.js +++ b/src/public/javascripts/dialogs/options/other.js @@ -2,8 +2,68 @@ 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.

+ +
+ + +
+ +
+ +
+ + +
+ +

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

+
+ +
+

Image compression

+ +
+ + +
+ +
+ + +
+
+ +
+

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"); diff --git a/src/public/javascripts/dialogs/options/sidebar.js b/src/public/javascripts/dialogs/options/sidebar.js index 3aad194c1..f573c0f3e 100644 --- a/src/public/javascripts/dialogs/options/sidebar.js +++ b/src/public/javascripts/dialogs/options/sidebar.js @@ -2,8 +2,62 @@ import libraryLoader from "../../services/library_loader.js"; import server from "../../services/server.js"; import optionsService from "../../services/options.js"; +const TPL = ` +

Show sidebar in new tab

+ +
+ + +
+ +
+ +

Sidebar sizing

+ +
+
+ + +
+ + +
+ px +
+
+
+ +
+ + +
+ + +
+ % +
+
+
+
+ +

Sidebar width is calculated from the percent of the detail pane, if this is smaller than minimum width, then minimum width is used. If you want to have fixed width sidebar, set minimum width to the desired width and set percent to 0.

+ +

Widgets

+ +
+
Enabled widgets
+ +
Disabled widgets
+ +
+ +
+
`; + export default class SidebarOptions { constructor() { + $("#options-sidebar").html(TPL); + this.$sidebarMinWidth = $("#sidebar-min-width"); this.$sidebarWidthPercent = $("#sidebar-width-percent"); this.$showSidebarInNewTab = $("#show-sidebar-in-new-tab"); diff --git a/src/public/javascripts/dialogs/options/sync.js b/src/public/javascripts/dialogs/options/sync.js index d69b311be..c6f7ab43d 100644 --- a/src/public/javascripts/dialogs/options/sync.js +++ b/src/public/javascripts/dialogs/options/sync.js @@ -1,8 +1,46 @@ import server from "../../services/server.js"; import toastService from "../../services/toast.js"; +const TPL = ` +

Sync configuration

+ +
+
+ + +
+ +
+ + +
+ +
+ + + +

Note: If you leave proxy setting blank, system proxy will be used (applies to desktop/electron build only)

+
+ +
+ + + +
+
+ +
+ +

Sync test

+ +

This will test connection and handshake to the sync server. If sync server isn't initialized, this will set it up to sync with local document.

+ +`; + export default class SyncOptions { constructor() { + $("#options-sync-setup").html(TPL); + this.$form = $("#sync-setup-form"); this.$syncServerHost = $("#sync-server-host"); this.$syncServerTimeout = $("#sync-server-timeout"); diff --git a/src/views/dialogs/options.ejs b/src/views/dialogs/options.ejs index b551975b2..e8481a77d 100644 --- a/src/views/dialogs/options.ejs +++ b/src/views/dialogs/options.ejs @@ -34,13 +34,13 @@
- <% include options/appearance.ejs %> - <% include options/sidebar.ejs %> - <% include options/code_notes.ejs %> - <% include options/change_password.ejs %> - <% include options/other.ejs %> - <% include options/sync.ejs %> - <% include options/advanced.ejs %> +
+
+
+
+
+
+
diff --git a/src/views/dialogs/options/advanced.ejs b/src/views/dialogs/options/advanced.ejs deleted file mode 100644 index a3f9c79a9..000000000 --- a/src/views/dialogs/options/advanced.ejs +++ /dev/null @@ -1,25 +0,0 @@ -
-

Sync

- - -
-
- - - -
-
- -

Debugging

- -

- -

This action will create a new copy of the database and anonymise it (remove all note content and leave only structure and metadata) - for sharing online for debugging purposes without fear of leaking your personal data.

- -

Vacuum database

- -

This will rebuild database which will typically result in smaller database file. No data will be actually changed.

- - -
\ No newline at end of file diff --git a/src/views/dialogs/options/appearance.ejs b/src/views/dialogs/options/appearance.ejs deleted file mode 100644 index 1f981dca9..000000000 --- a/src/views/dialogs/options/appearance.ejs +++ /dev/null @@ -1,98 +0,0 @@ -
-

Settings on this options tab are saved automatically after each change.

- -
-
-
- - -
- -
- - - -
- -
- - -
-
- -

Zooming can be controlled with CTRL-+ and CTRL-= shortcuts as well.

- -

Font sizes

- -
-
- - -
- -
- % -
-
-
- -
- - -
- -
- % -
-
-
- -
- - -
- -
- % -
-
-
-
- -

Note that tree and detail font sizing is relative to the main font size setting.

- -

Left pane sizing

- -
-
- - -
- - -
- px -
-
-
- -
- - -
- - -
- % -
-
-
-
- -

Left pane width is calculated from the percent of window size, if this is smaller than minimum width, then minimum width is used. If you want to have fixed width left pane, set minimum width to the desired width and set percent to 0.

- -
-
\ No newline at end of file diff --git a/src/views/dialogs/options/change_password.ejs b/src/views/dialogs/options/change_password.ejs deleted file mode 100644 index a092a9ee5..000000000 --- a/src/views/dialogs/options/change_password.ejs +++ /dev/null @@ -1,20 +0,0 @@ -
-
-
- - -
- -
- - -
- -
- - -
- - -
-
\ No newline at end of file diff --git a/src/views/dialogs/options/code_notes.ejs b/src/views/dialogs/options/code_notes.ejs deleted file mode 100644 index 7067e2ad2..000000000 --- a/src/views/dialogs/options/code_notes.ejs +++ /dev/null @@ -1,5 +0,0 @@ -
-

Available MIME types in the dropdown

- - -
\ No newline at end of file diff --git a/src/views/dialogs/options/other.ejs b/src/views/dialogs/options/other.ejs deleted file mode 100644 index c76471599..000000000 --- a/src/views/dialogs/options/other.ejs +++ /dev/null @@ -1,58 +0,0 @@ -
-
-

Spell check

- -

These options apply only for desktop builds, browsers will use their own native spell check.

- -
- - -
- -
- -
- - -
- -

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

-
- -
-

Image compression

- -
- - -
- -
- - -
-
- -
-

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.

- -
- - -
-
-
\ No newline at end of file diff --git a/src/views/dialogs/options/sidebar.ejs b/src/views/dialogs/options/sidebar.ejs deleted file mode 100644 index 689596a15..000000000 --- a/src/views/dialogs/options/sidebar.ejs +++ /dev/null @@ -1,52 +0,0 @@ -
-

Show sidebar in new tab

- -
- - -
- -
- -

Sidebar sizing

- -
-
- - -
- - -
- px -
-
-
- -
- - -
- - -
- % -
-
-
-
- -

Sidebar width is calculated from the percent of the detail pane, if this is smaller than minimum width, then minimum width is used. If you want to have fixed width sidebar, set minimum width to the desired width and set percent to 0.

- -

Widgets

- -
-
Enabled widgets
- -
Disabled widgets
- -
- -
-
-
\ No newline at end of file diff --git a/src/views/dialogs/options/sync.ejs b/src/views/dialogs/options/sync.ejs deleted file mode 100644 index 89bdaeb49..000000000 --- a/src/views/dialogs/options/sync.ejs +++ /dev/null @@ -1,36 +0,0 @@ -
-

Sync configuration

- -
-
- - -
- -
- - -
- -
- - - -

Note: If you leave proxy setting blank, system proxy will be used (applies to desktop/electron build only)

-
- -
- - - -
-
- -
- -

Sync test

- -

This will test connection and handshake to the sync server. If sync server isn't initialized, this will set it up to sync with local document.

- - -
\ No newline at end of file