diff --git a/src/public/javascripts/services/note_detail.js b/src/public/javascripts/services/note_detail.js index 2963c99ed..14d41e1b9 100644 --- a/src/public/javascripts/services/note_detail.js +++ b/src/public/javascripts/services/note_detail.js @@ -109,6 +109,10 @@ function onNoteChange(func) { async function saveNote() { const note = getCurrentNote(); + if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) { + return; + } + note.title = $noteTitle.val(); note.content = getCurrentNoteContent(note); @@ -223,6 +227,8 @@ async function loadNoteDetail(noteId) { return; } + $noteTitle.removeAttr("readonly"); // this can be set by protected session service + await getComponent(currentNote.type).show(); } finally { diff --git a/src/public/javascripts/services/protected_session.js b/src/public/javascripts/services/protected_session.js index ba71556c5..809841dfb 100644 --- a/src/public/javascripts/services/protected_session.js +++ b/src/public/javascripts/services/protected_session.js @@ -15,6 +15,7 @@ const $protectButton = $("#protect-button"); const $unprotectButton = $("#unprotect-button"); const $enterProtectedSessionButton = $("#enter-protected-session-button"); const $leaveProtectedSessionButton = $("#leave-protected-session-button"); +const $noteTitle = $("#note-title"); let protectedSessionDeferred = null; @@ -38,6 +39,9 @@ function ensureProtectedSession(requireProtectedSession, modal) { // using deferred instead of promise because it allows resolving from outside protectedSessionDeferred = dfd; + // user shouldn't be able to edit note title + $noteTitle.prop("readonly", true); + if (modal) { if (treeService.getCurrentNode().data.isProtected) { $noteDetailWrapper.hide(); diff --git a/src/public/stylesheets/mobile.css b/src/public/stylesheets/mobile.css index dbd97c9ee..ebe3212da 100644 --- a/src/public/stylesheets/mobile.css +++ b/src/public/stylesheets/mobile.css @@ -83,4 +83,8 @@ html, body { .fancytree-node.fancytree-expanded .fancytree-expander:before { content: "\e9ba"; +} + +kbd { + display: none; } \ No newline at end of file diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index ede0b9221..8c675e1d2 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -57,6 +57,18 @@ body { grid-area: title; } +#note-title { + margin-left: 15px; + font-size: x-large; + border: 0; + width: 5em; + flex-grow: 100; +} + +#note-title[readonly] { + background: inherit; +} + .tdialog { display: none; } diff --git a/src/views/index.ejs b/src/views/index.ejs index 0bac7bfc9..12fdf631e 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -112,7 +112,7 @@ - +