mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
added "re-render note" menu item & shortcut, closes #1766
This commit is contained in:
parent
6a70e0ab97
commit
7e2186721f
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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();
|
||||
|
@ -328,4 +328,10 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
async saveNoteDetailNowCommand() {
|
||||
await this.spacedUpdate.updateNowIfNecessary();
|
||||
}
|
||||
|
||||
renderActiveNoteEvent() {
|
||||
if (this.tabContext.isActive()) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -352,6 +352,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
||||
defaultShortcuts: [],
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "renderActiveNote",
|
||||
defaultShortcuts: [],
|
||||
description: "Render (re-render) active note",
|
||||
scope: "window"
|
||||
},
|
||||
{
|
||||
actionName: "runActiveNote",
|
||||
defaultShortcuts: ["CommandOrControl+Enter"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user