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
1711db1e
Commit
1711db1e
authored
Jan 04, 2015
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持归纳命令 && 移除旧代码
parent
67cb3b04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
37 deletions
+28
-37
node.js
src/module/node.js
+28
-37
No files found.
src/module/node.js
View file @
1711db1e
...
@@ -94,62 +94,53 @@ define(function(require, exports, module) {
...
@@ -94,62 +94,53 @@ define(function(require, exports, module) {
}
}
});
});
/**
var
AppendParentCommand
=
kity
.
createClass
(
'AppendParentCommand'
,
{
* @command EditNode
* @description 编辑选中的节点
* @state
* 0: 当前有选中的节点
* -1: 当前没有选中的节点
*/
var
EditNodeCommand
=
kity
.
createClass
(
'EditNodeCommand'
,
{
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
)
{
execute
:
function
(
km
,
text
)
{
var
selectedNode
=
km
.
getSelectedNode
();
var
nodes
=
km
.
getSelectedNodes
();
if
(
!
selectedNode
)
{
if
(
!
nodes
.
length
)
return
;
return
null
;
var
parent
=
nodes
[
0
].
parent
;
for
(
var
i
=
1
;
i
<
nodes
.
length
;
i
++
)
{
if
(
nodes
[
i
].
parent
!=
parent
)
return
-
1
;
}
}
km
.
select
(
selectedNode
,
true
);
nodes
.
sort
(
function
(
a
,
b
)
{
km
.
textEditNode
(
selectedNode
);
return
a
.
getIndex
()
-
b
.
getIndex
();
});
var
newParent
=
km
.
createNode
(
text
,
parent
,
nodes
[
0
].
getIndex
());
nodes
.
forEach
(
function
(
node
)
{
newParent
.
appendChild
(
node
);
});
newParent
.
setGlobalLayoutTransform
(
nodes
[
nodes
.
length
>>
1
].
getGlobalLayoutTransform
());
km
.
select
(
newParent
,
true
);
km
.
layout
(
600
);
},
},
queryState
:
function
(
km
)
{
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
var
nodes
=
km
.
getSelectedNodes
();
if
(
!
selectedNode
)
{
if
(
!
nodes
.
length
)
return
;
return
-
1
;
var
parent
=
nodes
[
0
].
parent
;
}
else
{
for
(
var
i
=
1
;
i
<
nodes
.
length
;
i
++
)
{
return
0
;
if
(
nodes
[
i
].
parent
!=
parent
)
return
-
1
;
}
}
},
return
0
;
isNeedUndo
:
function
()
{
return
false
;
}
}
});
});
Module
.
register
(
'NodeModule'
,
function
()
{
Module
.
register
(
'NodeModule'
,
function
()
{
return
{
return
{
commands
:
{
commands
:
{
'AppendChildNode'
:
AppendChildCommand
,
'AppendChildNode'
:
AppendChildCommand
,
'AppendSiblingNode'
:
AppendSiblingCommand
,
'AppendSiblingNode'
:
AppendSiblingCommand
,
'RemoveNode'
:
RemoveNodeCommand
,
'RemoveNode'
:
RemoveNodeCommand
,
'
EditNode'
:
EditNode
Command
'
AppendParentNode'
:
AppendParent
Command
},
},
'contextmenu'
:
[{
command
:
'appendsiblingnode'
},
{
command
:
'appendchildnode'
},
{
command
:
'editnode'
},
{
command
:
'removenode'
},
{
divider
:
1
}],
'commandShortcutKeys'
:
{
'commandShortcutKeys'
:
{
'appendsiblingnode'
:
'normal::Enter'
,
'appendsiblingnode'
:
'normal::Enter'
,
'appendchildnode'
:
'normal::Insert|Tab'
,
'appendchildnode'
:
'normal::Insert|Tab'
,
'
editnode'
:
'normal::F2
'
,
'
appendparentnode'
:
'normal::Shift+Tab|normal::Shift+Insert
'
,
'removenode'
:
'normal::Del|Backspace'
'removenode'
:
'normal::Del|Backspace'
}
}
};
};
...
...
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