You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
Desktop: Fix issue that was preventing editor context menu from being refreshed (#4303)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useEffect } from 'react';
|
||||
import { FormNote, ScrollOptionTypes } from './types';
|
||||
import editorCommandDeclarations from '../commands/editorCommandDeclarations';
|
||||
import CommandService, { CommandDeclaration, CommandRuntime, CommandContext } from '@joplin/lib/services/CommandService';
|
||||
const time = require('@joplin/lib/time').default;
|
||||
const { reg } = require('@joplin/lib/registry.js');
|
||||
@@ -20,6 +19,7 @@ interface HookDependencies {
|
||||
titleInputRef: any;
|
||||
saveNoteAndWait: Function;
|
||||
setFormNote: Function;
|
||||
plugins: any;
|
||||
}
|
||||
|
||||
function editorCommandRuntime(declaration: CommandDeclaration, editorRef: any, setFormNote: Function): CommandRuntime {
|
||||
@@ -61,10 +61,10 @@ function editorCommandRuntime(declaration: CommandDeclaration, editorRef: any, s
|
||||
}
|
||||
|
||||
export default function useWindowCommandHandler(dependencies: HookDependencies) {
|
||||
const { setShowLocalSearch, noteSearchBarRef, editorRef, titleInputRef, setFormNote } = dependencies;
|
||||
const { setShowLocalSearch, noteSearchBarRef, editorRef, titleInputRef, setFormNote, plugins } = dependencies;
|
||||
|
||||
useEffect(() => {
|
||||
for (const declaration of editorCommandDeclarations) {
|
||||
for (const declaration of CommandService.instance().editorCommandDeclarations()) {
|
||||
CommandService.instance().registerRuntime(declaration.name, editorCommandRuntime(declaration, editorRef, setFormNote));
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function useWindowCommandHandler(dependencies: HookDependencies)
|
||||
}
|
||||
|
||||
return () => {
|
||||
for (const declaration of editorCommandDeclarations) {
|
||||
for (const declaration of CommandService.instance().editorCommandDeclarations()) {
|
||||
CommandService.instance().unregisterRuntime(declaration.name);
|
||||
}
|
||||
|
||||
@@ -88,5 +88,5 @@ export default function useWindowCommandHandler(dependencies: HookDependencies)
|
||||
CommandService.instance().unregisterRuntime(command.declaration.name);
|
||||
}
|
||||
};
|
||||
}, [editorRef, setShowLocalSearch, noteSearchBarRef, titleInputRef]);
|
||||
}, [editorRef, setShowLocalSearch, noteSearchBarRef, titleInputRef, plugins]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user