From b990239219c6e81e3bda3869ecf125ff1d4fa499 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 16 Oct 2020 19:43:20 +0200 Subject: [PATCH 1/6] allow sender to save labels --- src/routes/api/sender.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/routes/api/sender.js b/src/routes/api/sender.js index dac2116d8..4d26407ae 100644 --- a/src/routes/api/sender.js +++ b/src/routes/api/sender.js @@ -35,6 +35,12 @@ function saveNote(req) { mime: 'text/html' }); + if (req.body.labels) { + for (const {name, value} of req.body.labels) { + note.setLabel(name, value); + } + } + return { noteId: note.noteId, branchId: branch.branchId From fd2d49de4f491268255697a714e17169c027732c Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 19 Oct 2020 20:22:30 +0200 Subject: [PATCH 2/6] fix display of checkboxes in promoted attributes, closes #1313 --- src/public/app/widgets/promoted_attributes.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/public/app/widgets/promoted_attributes.js b/src/public/app/widgets/promoted_attributes.js index 255554585..e7c29090e 100644 --- a/src/public/app/widgets/promoted_attributes.js +++ b/src/public/app/widgets/promoted_attributes.js @@ -173,6 +173,9 @@ export default class PromotedAttributesWidget extends TabAwareWidget { } else if (definition.labelType === 'boolean') { $input.prop("type", "checkbox"); + // hack, without this the checkbox is invisible + // we should be using a different bootstrap structure for checkboxes + $input.css('width', '80px'); if (valueAttr.value === "true") { $input.prop("checked", "checked"); From 991b335c3e0046ff159578eb1a85448367a6e0a2 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 19 Oct 2020 20:29:56 +0200 Subject: [PATCH 3/6] allow exporting code notes from note actions, closes #1315 --- src/public/app/widgets/note_actions.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/public/app/widgets/note_actions.js b/src/public/app/widgets/note_actions.js index 60eba0229..77b2a5f19 100644 --- a/src/public/app/widgets/note_actions.js +++ b/src/public/app/widgets/note_actions.js @@ -126,13 +126,6 @@ export default class NoteActionsWidget extends TabAwareWidget { this.$showSourceButton.attr('disabled', 'disabled'); } - if (note.type === 'text') { - this.$exportNoteButton.removeAttr('disabled'); - } - else { - this.$exportNoteButton.attr('disabled', 'disabled'); - } - this.$protectButton.toggle(!note.isProtected); this.$unprotectButton.toggle(!!note.isProtected); } From c2b64bad804e0c70b76b7551af9786b8c161b7b7 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 19 Oct 2020 22:10:25 +0200 Subject: [PATCH 4/6] hoisting bugfixes --- src/public/app/services/tab_context.js | 10 ++++++++++ src/public/app/services/tree.js | 4 +--- src/public/app/widgets/similar_notes.js | 5 +++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/public/app/services/tab_context.js b/src/public/app/services/tab_context.js index 196a52cfe..937b0a075 100644 --- a/src/public/app/services/tab_context.js +++ b/src/public/app/services/tab_context.js @@ -47,6 +47,9 @@ class TabContext extends Component { if (await hoistedNoteService.checkNoteAccess(resolvedNotePath) === false) { return; // note is outside of hoisted subtree and user chose not to unhoist } + + // if user choise to unhoist, cache was reloaded, but might not contain this note (since it's on unexpanded path) + await treeCache.getNote(noteId); } await this.triggerEvent('beforeNoteSwitch', {tabContext: this}); @@ -78,10 +81,17 @@ class TabContext extends Component { notePath: this.notePath }); } + + // close dangling autocompletes after closing the tab + $(".aa-input").autocomplete("close"); } /** @property {NoteShort} */ get note() { + if (this.noteId && !(this.noteId in treeCache.notes)) { + logError(`Cannot find tabContext's note id='${this.noteId}'`); + } + return treeCache.notes[this.noteId]; } diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.js index 8e285c5e6..d3718249f 100644 --- a/src/public/app/services/tree.js +++ b/src/public/app/services/tree.js @@ -62,7 +62,7 @@ async function resolveNotePathToSegments(notePath, logErrors = true) { if (!parents.length) { if (logErrors) { - ws.logError(`No parents found for ${childNoteId} (${child.title})`); + ws.logError(`No parents found for ${childNoteId} (${child.title}) for path ${notePath}`); } return; @@ -83,8 +83,6 @@ async function resolveNotePathToSegments(notePath, logErrors = true) { for (const noteId of pathToRoot) { effectivePath.push(noteId); } - - effectivePath.push('root'); } break; diff --git a/src/public/app/widgets/similar_notes.js b/src/public/app/widgets/similar_notes.js index 019c21aa1..4f281162f 100644 --- a/src/public/app/widgets/similar_notes.js +++ b/src/public/app/widgets/similar_notes.js @@ -122,6 +122,11 @@ export default class SimilarNotesWidget extends TabAwareWidget { const similarNotes = await server.get('similar-notes/' + this.noteId); + if (!similarNotes) { + this.toggleInt(false); + return; + } + this.toggleInt(similarNotes.length > 0); if (similarNotes.length === 0) { From 0cb46f8f9b3aa67b21a6cbda9f048ca4976b7730 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 19 Oct 2020 22:14:29 +0200 Subject: [PATCH 5/6] don't strip evernote links during import, #1319 --- src/services/html_sanitizer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/html_sanitizer.js b/src/services/html_sanitizer.js index 81f5000df..89727ba1e 100644 --- a/src/services/html_sanitizer.js +++ b/src/services/html_sanitizer.js @@ -21,7 +21,7 @@ function sanitize(dirtyHtml) { 'input': [ 'class', 'type', 'disabled' ], 'code': [ 'class' ] }, - allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'data'] + allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'data', 'evernote'] }); } From 7bd73230973db2ab1a5199a90b904ad036340d50 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 19 Oct 2020 22:25:35 +0200 Subject: [PATCH 6/6] limit max width of zen mode to improve readability, closes #1320 --- src/public/stylesheets/style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index fac5636a7..ccf2c2541 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -111,6 +111,10 @@ span.fancytree-node.muted { opacity: 0.6; } .zen-mode #center-pane { width: 100% !important; + /* limit max width to improve readability */ + max-width: 1000px; + margin-left: auto; + margin-right: auto; } .ui-autocomplete {