Merge remote-tracking branch 'origin/stable' into math2

This commit is contained in:
zadam 2020-10-19 23:04:12 +02:00
commit 32e3560dce
8 changed files with 30 additions and 11 deletions

View File

@ -47,6 +47,9 @@ class TabContext extends Component {
if (await hoistedNoteService.checkNoteAccess(resolvedNotePath) === false) { if (await hoistedNoteService.checkNoteAccess(resolvedNotePath) === false) {
return; // note is outside of hoisted subtree and user chose not to unhoist 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}); await this.triggerEvent('beforeNoteSwitch', {tabContext: this});
@ -78,10 +81,17 @@ class TabContext extends Component {
notePath: this.notePath notePath: this.notePath
}); });
} }
// close dangling autocompletes after closing the tab
$(".aa-input").autocomplete("close");
} }
/** @property {NoteShort} */ /** @property {NoteShort} */
get note() { get note() {
if (this.noteId && !(this.noteId in treeCache.notes)) {
logError(`Cannot find tabContext's note id='${this.noteId}'`);
}
return treeCache.notes[this.noteId]; return treeCache.notes[this.noteId];
} }

View File

@ -62,7 +62,7 @@ async function resolveNotePathToSegments(notePath, logErrors = true) {
if (!parents.length) { if (!parents.length) {
if (logErrors) { if (logErrors) {
ws.logError(`No parents found for ${childNoteId} (${child.title})`); ws.logError(`No parents found for ${childNoteId} (${child.title}) for path ${notePath}`);
} }
return; return;
@ -83,8 +83,6 @@ async function resolveNotePathToSegments(notePath, logErrors = true) {
for (const noteId of pathToRoot) { for (const noteId of pathToRoot) {
effectivePath.push(noteId); effectivePath.push(noteId);
} }
effectivePath.push('root');
} }
break; break;

View File

@ -126,13 +126,6 @@ export default class NoteActionsWidget extends TabAwareWidget {
this.$showSourceButton.attr('disabled', 'disabled'); 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.$protectButton.toggle(!note.isProtected);
this.$unprotectButton.toggle(!!note.isProtected); this.$unprotectButton.toggle(!!note.isProtected);
} }

View File

@ -173,6 +173,9 @@ export default class PromotedAttributesWidget extends TabAwareWidget {
} }
else if (definition.labelType === 'boolean') { else if (definition.labelType === 'boolean') {
$input.prop("type", "checkbox"); $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") { if (valueAttr.value === "true") {
$input.prop("checked", "checked"); $input.prop("checked", "checked");

View File

@ -122,6 +122,11 @@ export default class SimilarNotesWidget extends TabAwareWidget {
const similarNotes = await server.get('similar-notes/' + this.noteId); const similarNotes = await server.get('similar-notes/' + this.noteId);
if (!similarNotes) {
this.toggleInt(false);
return;
}
this.toggleInt(similarNotes.length > 0); this.toggleInt(similarNotes.length > 0);
if (similarNotes.length === 0) { if (similarNotes.length === 0) {

View File

@ -111,6 +111,10 @@ span.fancytree-node.muted { opacity: 0.6; }
.zen-mode #center-pane { .zen-mode #center-pane {
width: 100% !important; width: 100% !important;
/* limit max width to improve readability */
max-width: 1000px;
margin-left: auto;
margin-right: auto;
} }
.ui-autocomplete { .ui-autocomplete {

View File

@ -35,6 +35,12 @@ function saveNote(req) {
mime: 'text/html' mime: 'text/html'
}); });
if (req.body.labels) {
for (const {name, value} of req.body.labels) {
note.setLabel(name, value);
}
}
return { return {
noteId: note.noteId, noteId: note.noteId,
branchId: branch.branchId branchId: branch.branchId

View File

@ -21,7 +21,7 @@ function sanitize(dirtyHtml) {
'input': [ 'class', 'type', 'disabled' ], 'input': [ 'class', 'type', 'disabled' ],
'code': [ 'class' ] 'code': [ 'class' ]
}, },
allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'data'] allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'data', 'evernote']
}); });
} }