1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-05 22:57:29 +02:00

Desktop: Undo changes introduced in #4303 (#4406)

This commit is contained in:
Caleb John
2021-02-06 09:01:06 -07:00
committed by GitHub
parent 11c8bf7e6e
commit 33e1214ef6
18 changed files with 82 additions and 117 deletions

View File

@@ -1,5 +1,6 @@
import { useEffect } from 'react';
import { FormNote, ScrollOptionTypes } from './types';
import editorCommandDeclarations from '../commands/editorCommandDeclarations';
import CommandService, { CommandDeclaration, CommandRuntime, CommandContext } from '@joplin/lib/services/CommandService';
import time from '@joplin/lib/time';
import { reg } from '@joplin/lib/registry';
@@ -19,7 +20,6 @@ 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, plugins } = dependencies;
const { setShowLocalSearch, noteSearchBarRef, editorRef, titleInputRef, setFormNote } = dependencies;
useEffect(() => {
for (const declaration of CommandService.instance().editorCommandDeclarations()) {
for (const declaration of 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 CommandService.instance().editorCommandDeclarations()) {
for (const declaration of 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, plugins]);
}, [editorRef, setShowLocalSearch, noteSearchBarRef, titleInputRef]);
}