added "re-render note" menu item & shortcut, closes #1766

This commit is contained in:
zadam
2021-03-19 22:34:56 +01:00
parent 6a70e0ab97
commit 7e2186721f
5 changed files with 27 additions and 7 deletions

View File

@@ -63,6 +63,7 @@ const TPL = `
<span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right">
<a data-trigger-command="renderActiveNote" class="dropdown-item render-note-button">Re-render note</a>
<div class="dropdown-item protect-button">
Protect the note
@@ -96,6 +97,7 @@ export default class NoteActionsWidget extends TabAwareWidget {
this.overflowing();
this.$showSourceButton = this.$widget.find('.show-source-button');
this.$renderNoteButton = this.$widget.find('.render-note-button');
this.$exportNoteButton = this.$widget.find('.export-note-button');
this.$exportNoteButton.on("click", () => {
@@ -120,16 +122,22 @@ export default class NoteActionsWidget extends TabAwareWidget {
}
refreshWithNote(note) {
if (['text', 'relation-map', 'search', 'code'].includes(note.type)) {
this.$showSourceButton.removeAttr('disabled');
} else {
this.$showSourceButton.attr('disabled', 'disabled');
}
this.toggleDisabled(this.$showSourceButton, ['text', 'relation-map', 'search', 'code'].includes(note.type));
this.$renderNoteButton.toggle(note.type === 'render');
this.$protectButton.toggle(!note.isProtected);
this.$unprotectButton.toggle(!!note.isProtected);
}
toggleDisabled($el, enable) {
if (enable) {
$el.removeAttr('disabled');
} else {
$el.attr('disabled', 'disabled');
}
}
entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
this.refresh();