mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Clean up code.
This commit is contained in:
parent
7163a07696
commit
b84f0b6142
@ -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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user