mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-11 01:43:23 +01:00
Fix missing method error
This commit is contained in:
parent
8dbd6a92b7
commit
c58f434509
@ -354,6 +354,20 @@ class Designer extends Events {
|
||||
}
|
||||
}
|
||||
|
||||
shrinkSelectedBranch() {
|
||||
const nodes = this.getModel().filterSelectedTopics();
|
||||
if (nodes.length <= 0 || nodes.length !== 1) {
|
||||
// If there are more than one node selected,
|
||||
$notify($msg('ONLY_ONE_TOPIC_MUST_BE_SELECTED_COLLAPSE'));
|
||||
return;
|
||||
}
|
||||
// Execute event ...
|
||||
const topic = nodes[0];
|
||||
if (topic.getType() !== 'CentralTopic') {
|
||||
this._actionDispatcher.shrinkBranch([topic.getId()], !topic.areChildrenShrunken());
|
||||
}
|
||||
}
|
||||
|
||||
copyToClipboard(): void {
|
||||
let topics = this.getModel().filterSelectedTopics();
|
||||
if (topics.length <= 0) {
|
||||
|
@ -18,15 +18,19 @@
|
||||
import $ from 'jquery';
|
||||
import { $assert } from '@wisemapping/core-js';
|
||||
import Keyboard from './Keyboard';
|
||||
import { Designer } from '..';
|
||||
import Topic from './Topic';
|
||||
|
||||
class DesignerKeyboard extends Keyboard {
|
||||
constructor(designer) {
|
||||
super(designer);
|
||||
static _instance: any;
|
||||
|
||||
constructor(designer: Designer) {
|
||||
super();
|
||||
$assert(designer, 'designer can not be null');
|
||||
this._registerEvents(designer);
|
||||
}
|
||||
|
||||
_registerEvents(designer) {
|
||||
private _registerEvents(designer: Designer) {
|
||||
// Try with the keyboard ..
|
||||
const model = designer.getModel();
|
||||
this.addShortcut(
|
||||
@ -250,8 +254,9 @@ class DesignerKeyboard extends Keyboard {
|
||||
keyCode = event.keyCode;
|
||||
}
|
||||
|
||||
const specialKey = $.hotkeys.specialKeys[keyCode];
|
||||
if (['enter', 'capslock'].indexOf(specialKey) === -1 && !$.hotkeys.shiftNums[keyCode]) {
|
||||
const jq: any = $;
|
||||
const specialKey = jq.hotkeys.specialKeys[keyCode];
|
||||
if (['enter', 'capslock'].indexOf(specialKey) === -1 && !jq.hotkeys.shiftNums[keyCode]) {
|
||||
const nodes = designer.getModel().filterSelectedTopics();
|
||||
if (nodes.length > 0) {
|
||||
// If a modifier is press, the key selected must be ignored.
|
||||
@ -266,7 +271,7 @@ class DesignerKeyboard extends Keyboard {
|
||||
});
|
||||
}
|
||||
|
||||
_goToBrother(designer, node, direction) {
|
||||
private _goToBrother(designer: Designer, node: Topic, direction) {
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
const brothers = parent.getChildren();
|
||||
@ -305,7 +310,7 @@ class DesignerKeyboard extends Keyboard {
|
||||
}
|
||||
}
|
||||
|
||||
_goToSideChild(designer, node, side) {
|
||||
private _goToSideChild(designer: Designer, node: Topic, side: 'LEFT' | 'RIGHT') {
|
||||
const children = node.getChildren();
|
||||
if (children.length > 0) {
|
||||
let target = children[0];
|
||||
@ -331,14 +336,14 @@ class DesignerKeyboard extends Keyboard {
|
||||
}
|
||||
}
|
||||
|
||||
_goToParent(designer, node) {
|
||||
private _goToParent(designer: Designer, node: Topic) {
|
||||
const parent = node.getParent();
|
||||
if (parent) {
|
||||
this._goToNode(designer, parent);
|
||||
}
|
||||
}
|
||||
|
||||
_goToChild(designer, node) {
|
||||
private _goToChild(designer, node) {
|
||||
const children = node.getChildren();
|
||||
if (children.length > 0) {
|
||||
let target = children[0];
|
||||
@ -354,16 +359,19 @@ class DesignerKeyboard extends Keyboard {
|
||||
}
|
||||
}
|
||||
|
||||
_goToNode(designer, node) {
|
||||
private _goToNode(designer: Designer, node: Topic) {
|
||||
// First deselect all the nodes ...
|
||||
designer.deselectAll();
|
||||
|
||||
// Give focus to the selected node....
|
||||
node.setOnFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
DesignerKeyboard.specialKeys = {
|
||||
static register = function register(designer: Designer) {
|
||||
this._instance = new DesignerKeyboard(designer);
|
||||
};
|
||||
|
||||
static specialKeys = {
|
||||
8: 'backspace',
|
||||
9: 'tab',
|
||||
10: 'return',
|
||||
@ -419,14 +427,11 @@ DesignerKeyboard.specialKeys = {
|
||||
220: '\\',
|
||||
222: "'",
|
||||
224: 'meta',
|
||||
};
|
||||
};
|
||||
|
||||
DesignerKeyboard.register = function register(designer) {
|
||||
this._instance = new DesignerKeyboard(designer);
|
||||
};
|
||||
|
||||
DesignerKeyboard.getInstance = function getInstance() {
|
||||
static getInstance() {
|
||||
return this._instance;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default DesignerKeyboard;
|
Loading…
Reference in New Issue
Block a user