mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Add more shortcuts :)
This commit is contained in:
parent
d1a3ba470e
commit
0e854c8942
@ -36,10 +36,8 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'space' : function() {
|
'space' : function() {
|
||||||
var nodes = designer.getSelectedNodes();
|
var node = this._getSelectedNode(designer);
|
||||||
if (nodes.length > 0) {
|
if (node) {
|
||||||
var topic = nodes[0];
|
|
||||||
|
|
||||||
var model = topic.getModel();
|
var model = topic.getModel();
|
||||||
var isShrink = !model.areChildrenShrinked();
|
var isShrink = !model.areChildrenShrinked();
|
||||||
topic.setChildrenShrinked(isShrink);
|
topic.setChildrenShrinked(isShrink);
|
||||||
@ -47,12 +45,11 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'f2' : function() {
|
'f2' : function() {
|
||||||
var nodes = designer.getSelectedNodes();
|
var node = this._getSelectedNode(designer);
|
||||||
if (nodes.length > 0) {
|
if (node) {
|
||||||
var topic = nodes[0];
|
var topic = nodes[0];
|
||||||
topic.showTextEditor();
|
topic.showTextEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'delete' : function() {
|
'delete' : function() {
|
||||||
@ -87,7 +84,22 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
'ctrl+a' : function(event) {
|
'ctrl+a' : function(event) {
|
||||||
designer.selectAll();
|
designer.selectAll();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
},
|
||||||
|
|
||||||
|
'ctrl+b' : function() {
|
||||||
|
designer.changeFontWeight();
|
||||||
|
},
|
||||||
|
|
||||||
|
'meta+b' : function() {
|
||||||
|
designer.changeFontWeight();
|
||||||
|
},
|
||||||
|
|
||||||
|
'ctrl+i' : function() {
|
||||||
|
designer.changeFontStyle();
|
||||||
|
},
|
||||||
|
|
||||||
|
'meta+i' : function() {
|
||||||
|
designer.changeFontStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
'meta+shift+a' : function(event) {
|
'meta+shift+a' : function(event) {
|
||||||
@ -107,9 +119,8 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
'right' : function() {
|
'right' : function() {
|
||||||
var nodes = designer.getSelectedNodes();
|
var node = this._getSelectedNode(designer);
|
||||||
if (nodes.length > 0) {
|
if (node) {
|
||||||
var node = nodes[0];
|
|
||||||
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
this._goToSideChild(designer, node, 'RIGHT');
|
this._goToSideChild(designer, node, 'RIGHT');
|
||||||
}
|
}
|
||||||
@ -128,9 +139,8 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'left' : function() {
|
'left' : function() {
|
||||||
var nodes = designer.getSelectedNodes();
|
var node = this._getSelectedNode(designer);
|
||||||
if (nodes.length > 0) {
|
if (node) {
|
||||||
var node = nodes[0];
|
|
||||||
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
if (node.getTopicType() == mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
this._goToSideChild(designer, node, 'LEFT');
|
this._goToSideChild(designer, node, 'LEFT');
|
||||||
}
|
}
|
||||||
@ -149,9 +159,8 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'up' : function() {
|
'up' : function() {
|
||||||
var nodes = designer.getSelectedNodes();
|
var node = this._getSelectedNode(designer);
|
||||||
if (nodes.length > 0) {
|
if (node) {
|
||||||
var node = nodes[0];
|
|
||||||
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
this._goToBrother(designer, node, 'UP');
|
this._goToBrother(designer, node, 'UP');
|
||||||
}
|
}
|
||||||
@ -162,9 +171,8 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}.bind(this),
|
}.bind(this),
|
||||||
|
|
||||||
'down' : function() {
|
'down' : function() {
|
||||||
var nodes = designer.getSelectedNodes();
|
var node = this._getSelectedNode(designer);
|
||||||
if (nodes.length > 0) {
|
if (node) {
|
||||||
var node = nodes[0];
|
|
||||||
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
if (node.getTopicType() != mindplot.model.NodeModel.CENTRAL_TOPIC_TYPE) {
|
||||||
this._goToBrother(designer, node, 'DOWN');
|
this._goToBrother(designer, node, 'DOWN');
|
||||||
}
|
}
|
||||||
@ -201,7 +209,7 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If it's not registered, let's
|
// If it's not registered, let's
|
||||||
if (!isRegistered && !excludes.contains(key) && !modifiers.contains(key) && !key.contains('meta') && !key.contains('ctrl') && !key.contains('control')) {
|
if (!isRegistered && !excludes.contains(key) && !modifiers.contains(key) && !key.contains('meta') && !key.contains('ctrl') && !key.contains('control')) {
|
||||||
var nodes = designer.getSelectedNodes();
|
var nodes = designer.getSelectedNodes();
|
||||||
if (nodes.length > 0) {
|
if (nodes.length > 0) {
|
||||||
nodes[0].showTextEditor(event.key);
|
nodes[0].showTextEditor(event.key);
|
||||||
@ -302,10 +310,15 @@ mindplot.DesignerKeyboard = new Class({
|
|||||||
|
|
||||||
// Give focus to the selected node....
|
// Give focus to the selected node....
|
||||||
node.setOnFocus(true);
|
node.setOnFocus(true);
|
||||||
|
},
|
||||||
|
|
||||||
|
_getSelectedNode : function(designer) {
|
||||||
|
var nodes = designer.getSelectedNodes();
|
||||||
|
return (nodes.length > 0) ? nodes[0] : null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mindplot.DesignerKeyboard.register = function(designer) {
|
mindplot.DesignerKeyboard.register = function(designer) {
|
||||||
this._instance = new mindplot.DesignerKeyboard(designer);
|
this._instance = new mindplot.DesignerKeyboard(designer);
|
||||||
this._instance.activate();
|
this._instance.activate();
|
||||||
}
|
};
|
@ -81,6 +81,7 @@ mindplot.LocalActionDispatcher = new Class({
|
|||||||
var command = new mindplot.commands.RemoveNoteFromTopicCommand(topicId);
|
var command = new mindplot.commands.RemoveNoteFromTopicCommand(topicId);
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
changeFontStyleToTopic: function(topicsIds) {
|
changeFontStyleToTopic: function(topicsIds) {
|
||||||
|
|
||||||
var commandFunc = function(topic) {
|
var commandFunc = function(topic) {
|
||||||
|
@ -633,7 +633,7 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setStyle2SelectedNode : function() {
|
changeFontStyle : function() {
|
||||||
var validSelectedObjects = this._getValidSelectedObjectsIds();
|
var validSelectedObjects = this._getValidSelectedObjectsIds();
|
||||||
var topicsIds = validSelectedObjects.nodes;
|
var topicsIds = validSelectedObjects.nodes;
|
||||||
if (topicsIds.length > 0) {
|
if (topicsIds.length > 0) {
|
||||||
@ -735,7 +735,7 @@ mindplot.MindmapDesigner = new Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setWeight2SelectedNode : function() {
|
changeFontWeight : function() {
|
||||||
var validSelectedObjects = this._getValidSelectedObjectsIds();
|
var validSelectedObjects = this._getValidSelectedObjectsIds();
|
||||||
var topicsIds = validSelectedObjects.nodes;
|
var topicsIds = validSelectedObjects.nodes;
|
||||||
if (topicsIds.length > 0) {
|
if (topicsIds.length > 0) {
|
||||||
|
@ -228,11 +228,11 @@ mindplot.widget.Menu = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('fontBold').addEvent('click', function(event) {
|
$('fontBold').addEvent('click', function(event) {
|
||||||
designer.setWeight2SelectedNode();
|
designer.changeFontWeight();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('fontItalic').addEvent('click', function(event) {
|
$('fontItalic').addEvent('click', function(event) {
|
||||||
designer.setStyle2SelectedNode();
|
designer.changeFontStyle();
|
||||||
});
|
});
|
||||||
|
|
||||||
designer.addEventListener("modelUpdate", function(event) {
|
designer.addEventListener("modelUpdate", function(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user