Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
60777228
Commit
60777228
authored
Jan 17, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enterkey/tabkey
parent
b7b47ab0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
37 deletions
+12
-37
node.js
src/core/node.js
+3
-1
keyboard.js
src/module/keyboard.js
+3
-34
layout.js
src/module/layout.js
+6
-2
No files found.
src/core/node.js
View file @
60777228
...
...
@@ -11,7 +11,9 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this
.
rc
=
new
kity
.
Group
();
this
.
rc
.
minderNode
=
this
;
},
isRoot
:
function
(){
return
this
.
getParent
()
==
null
?
true
:
false
;
},
getParent
:
function
()
{
return
this
.
parent
;
},
...
...
src/module/keyboard.js
View file @
60777228
...
...
@@ -60,19 +60,6 @@ KityMinder.registerModule( "KeyboardModule", function () {
return
minDepthNode
;
}
var
KBCreateAndEditCommand
=
kity
.
createClass
(
{
base
:
Command
,
execute
:
function
(
km
,
type
,
referNode
)
{
var
node
=
this
.
createdNode
=
km
.
execCommand
(
'create'
+
type
+
'node'
,
referNode
);
km
.
selectSingle
(
node
);
km
.
execCommand
(
'editText'
,
node
);
this
.
setContentChanged
(
true
);
},
revert
:
function
(
km
)
{
km
.
execCommand
(
'removeNode'
,
this
.
createdNode
);
}
}
);
var
KBNavigateCommand
=
kity
.
createClass
(
{
base
:
Command
,
...
...
@@ -115,40 +102,22 @@ KityMinder.registerModule( "KeyboardModule", function () {
}
);
return
{
// private usage
"commands"
:
{
'kbCreateAndEdit'
:
KBCreateAndEditCommand
,
'kbNavigate'
:
KBNavigateCommand
,
'kbRemove'
:
KBRemoveCommand
},
"events"
:
{
contentchange
:
function
()
{
buildPositionNetwork
(
this
.
getRoot
()
);
},
keydown
:
function
(
e
)
{
var
sNodes
=
this
.
getSelectedNodes
(),
isSingleSelected
=
sNodes
.
length
===
1
,
isRootSelected
=
this
.
isNodeSelected
(
this
.
getRoot
()
);
switch
(
e
.
originEvent
.
keyCode
)
{
case
13
:
// Enter
if
(
isSingleSelected
)
{
if
(
isRootSelected
)
{
this
.
execCommand
(
'kbCreateAndEdit'
,
'child'
,
sNodes
[
0
]
);
}
else
{
this
.
execCommand
(
'kbCreateAndEdit'
,
'sibling'
,
sNodes
[
0
]
);
}
}
this
.
execCommand
(
'appendSiblingNode'
,
new
MinderNode
(
'Topic'
));
break
;
case
9
:
// Tab
if
(
isSingleSelected
)
{
this
.
execCommand
(
'kbCreateAndEdit'
,
'child'
,
sNodes
[
0
]
);
}
this
.
execCommand
(
'appendChildNode'
,
new
MinderNode
(
'Topic'
));
break
;
case
8
:
...
...
src/module/layout.js
View file @
60777228
...
...
@@ -39,8 +39,12 @@ KityMinder.registerModule( "LayoutModule", function () {
base
:
Command
,
execute
:
function
(
km
,
node
)
{
//km.select( node );
var
sibling
=
km
.
getSelectedNode
();
km
.
appendSiblingNode
(
sibling
,
node
);
var
selectedNode
=
km
.
getSelectedNode
();
if
(
selectedNode
.
isRoot
()){
km
.
appendChildNode
(
selectedNode
,
node
);
}
else
{
km
.
appendSiblingNode
(
selectedNode
,
node
);
}
km
.
select
(
node
);
return
node
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment