mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 20:21:43 +08:00
fixes
This commit is contained in:
parent
e06f3ef97e
commit
2c3f07521d
4 changed files with 9 additions and 8 deletions
|
@ -98,7 +98,7 @@ class AppContext {
|
|||
this.trigger('treeCacheReloaded');
|
||||
}
|
||||
|
||||
async triggerCommand(name, data) {
|
||||
async triggerCommand(name, data = {}) {
|
||||
for (const executor of this.executors) {
|
||||
const fun = executor[name + 'Command'];
|
||||
|
||||
|
|
|
@ -35,9 +35,8 @@ async function setupActionsForElement(scope, $el, component) {
|
|||
|
||||
getActionsForScope("window").then(actions => {
|
||||
for (const action of actions) {
|
||||
for (const shortcut of action.effectiveShortcuts) {
|
||||
// empty object param so that destructuring with optional params work
|
||||
utils.bindGlobalShortcut(shortcut, () => appContext.trigger(action.actionName, {}));
|
||||
for (const shortcut of action.effectiveShortcuts) {console.log(`Binding ${shortcut} for ${action.actionName}`);
|
||||
utils.bindGlobalShortcut(shortcut, () => appContext.triggerCommand(action.actionName));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -227,9 +227,11 @@ function focusSavedElement() {
|
|||
if ($lastFocusedElement.hasClass("ck")) {
|
||||
// must handle CKEditor separately because of this bug: https://github.com/ckeditor/ckeditor5/issues/607
|
||||
|
||||
import("./note_detail.js").then(noteDetail => {
|
||||
noteDetail.default.getActiveEditor().editing.view.focus();
|
||||
});
|
||||
const editor = $lastFocusedElement
|
||||
.closest('.ck-editor__editable')
|
||||
.prop('ckeditorInstance');
|
||||
|
||||
editor.editing.view.focus();
|
||||
} else {
|
||||
$lastFocusedElement.focus();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ export default class Component {
|
|||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
async triggerCommand(name, data) {
|
||||
async triggerCommand(name, data = {}) {
|
||||
const fun = this[name + 'Command'];
|
||||
|
||||
const called = await this.callMethod(fun, data);
|
||||
|
|
Loading…
Reference in a new issue