mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Desktop: Handle case where a command is sent to an editor that is gone
This commit is contained in:
parent
df3e6a6219
commit
ccf5271584
@ -25,6 +25,11 @@ interface HookDependencies {
|
||||
function editorCommandRuntime(declaration: CommandDeclaration, editorRef: any, setFormNote: Function): CommandRuntime {
|
||||
return {
|
||||
execute: async (_context: CommandContext, ...args: any[]) => {
|
||||
if (!editorRef.current) {
|
||||
reg.logger().warn('Received command, but editor is gone', declaration.name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!editorRef.current.execCommand) {
|
||||
reg.logger().warn('Received command, but editor cannot execute commands', declaration.name);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user