Clean up code.

This commit is contained in:
Paulo Gustavo Veiga 2022-04-05 15:11:32 -03:00
parent 7163a07696
commit b84f0b6142
2 changed files with 6 additions and 5 deletions

View File

@ -16,9 +16,13 @@
* limitations under the License. * limitations under the License.
*/ */
import $ from 'jquery'; import $ from 'jquery';
import initHotKeyPluggin from '../../../../libraries/jquery.hotkeys';
// Provides dispatcher of keyevents by key...
initHotKeyPluggin($);
class Keyboard { class Keyboard {
addShortcut(shortcuts: string[] | string, callback, stopPropagation?: true) { addShortcut(shortcuts: string[] | string, callback: () => void, stopPropagation?: true) {
const shortcutsArray = Array.isArray(shortcuts) ? shortcuts : [shortcuts]; const shortcutsArray = Array.isArray(shortcuts) ? shortcuts : [shortcuts];
shortcutsArray.forEach((shortcut) => { shortcutsArray.forEach((shortcut) => {
$(document).bind('keydown', shortcut, $(document).bind('keydown', shortcut,
@ -27,7 +31,7 @@ class Keyboard {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
} }
callback(e); callback();
}); });
}); });
} }

View File

@ -18,13 +18,10 @@
import { $defined } from '@wisemapping/core-js'; import { $defined } from '@wisemapping/core-js';
import $ from 'jquery'; import $ from 'jquery';
import initHotKeyPluggin from '../../../../libraries/jquery.hotkeys';
import Events from './Events'; import Events from './Events';
import ActionDispatcher from './ActionDispatcher'; import ActionDispatcher from './ActionDispatcher';
import Topic from './Topic'; import Topic from './Topic';
initHotKeyPluggin($);
class MultilineTextEditor extends Events { class MultilineTextEditor extends Events {
private _topic: Topic; private _topic: Topic;