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
c0f3895f
Commit
c0f3895f
authored
Jul 02, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加粘贴剪贴节点功能
parent
50d3aa4b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
8 deletions
+81
-8
import.js
import.js
+1
-0
keymap.js
src/core/keymap.js
+3
-1
minder.node.js
src/core/minder.node.js
+1
-1
minder.select.js
src/core/minder.select.js
+2
-2
utils.js
src/core/utils.js
+3
-0
history.js
src/module/history.js
+4
-2
paste.js
src/module/paste.js
+67
-2
No files found.
import.js
View file @
c0f3895f
...
...
@@ -59,6 +59,7 @@
'module/zoom.js'
,
'module/hyperlink.js'
,
'module/arrange.js'
,
'module/paste.js'
,
'ui/jquery-ui-1.10.4.custom.min.js'
,
'ui/widget.js'
,
'ui/button.js'
,
...
...
src/core/keymap.js
View file @
c0f3895f
...
...
@@ -51,9 +51,11 @@ var keymap = KityMinder.keymap = (function(origin) {
//回退
'z'
:
90
,
'y'
:
89
,
//粘贴
//复制粘贴
'v'
:
86
,
'x'
:
88
,
'c'
:
67
,
's'
:
83
,
...
...
src/core/minder.node.js
View file @
c0f3895f
...
...
@@ -60,6 +60,6 @@ kity.extendClass(Minder, {
kity
.
extendClass
(
MinderNode
,
{
getMinder
:
function
()
{
return
this
.
root
.
minder
;
return
this
.
getRoot
()
.
minder
;
}
});
\ No newline at end of file
src/core/minder.select.js
View file @
c0f3895f
...
...
@@ -81,14 +81,14 @@ kity.extendClass(Minder, {
return
this
.
_selectedNodes
.
length
==
1
;
},
getSelectedAncestors
:
function
()
{
getSelectedAncestors
:
function
(
includeRoot
)
{
var
nodes
=
this
.
getSelectedNodes
().
slice
(
0
),
ancestors
=
[],
judge
;
// 根节点不参与计算
var
rootIndex
=
nodes
.
indexOf
(
this
.
getRoot
());
if
(
~
rootIndex
)
{
if
(
~
rootIndex
&&
!
includeRoot
)
{
nodes
.
splice
(
rootIndex
,
1
);
}
...
...
src/core/utils.js
View file @
c0f3895f
...
...
@@ -268,6 +268,9 @@ var utils = Utils = KityMinder.Utils = {
}[
a
]
}
})
:
''
;
},
cloneArr
:
function
(
arr
){
return
[].
concat
(
arr
);
}
};
...
...
src/module/history.js
View file @
c0f3895f
...
...
@@ -91,7 +91,9 @@ KityMinder.registerModule("HistoryModule", function() {
}
km
.
appendNode
(
child
,
parent
);
child
.
render
();
for
(
var
i
=
0
,
ci
;
ci
=
child
.
children
[
i
++
];)
{
var
children
=
utils
.
cloneArr
(
child
.
children
);
for
(
var
i
=
0
,
ci
;
ci
=
children
[
i
++
];)
{
appendChildNode
(
child
,
ci
);
}
}
...
...
@@ -122,7 +124,7 @@ KityMinder.registerModule("HistoryModule", function() {
traverseNode
(
km
.
getRoot
(),
target
);
km
.
layout
();
km
.
select
(
selectedNodes
,
true
);
selectedNodes
=
[];
},
restore
:
function
(
index
)
{
...
...
src/module/paste.js
View file @
c0f3895f
KityMinder
.
registerModule
(
"pasteModule"
,
function
()
{
var
km
=
this
;
//getSelectedTopNodes
var
km
=
this
,
_cacheNodes
=
[],
_selectedNodes
=
[],
_copystatus
=
false
,
_curstatus
=
false
;
function
appendChildNode
(
parent
,
child
)
{
_selectedNodes
.
push
(
child
);
km
.
appendNode
(
child
,
parent
);
child
.
render
();
child
.
setLayoutOffset
(
null
);
var
children
=
utils
.
cloneArr
(
child
.
children
);
for
(
var
i
=
0
,
ci
;
ci
=
children
[
i
++
];
)
{
appendChildNode
(
child
,
ci
);
}
}
function
getNodes
(
arr
,
isCut
){
_cacheNodes
=
[];
for
(
var
i
=
0
,
ni
;
ni
=
arr
[
i
++
];){
_cacheNodes
.
push
(
ni
.
clone
());
if
(
isCut
&&
!
ni
.
isRoot
()){
km
.
removeNode
(
ni
);
}
}
}
return
{
'events'
:
{
'normal.keydown'
:
function
(
e
)
{
var
keys
=
KityMinder
.
keymap
;
var
keyEvent
=
e
.
originEvent
;
if
(
keyEvent
.
ctrlKey
||
keyEvent
.
metaKey
)
{
switch
(
keyEvent
.
keyCode
)
{
case
keys
.
c
:
getNodes
(
km
.
getSelectedAncestors
(
true
));
_copystatus
=
true
;
break
;
case
keys
.
x
:
getNodes
(
km
.
getSelectedAncestors
(),
true
);
_curstatus
=
true
;
break
;
case
keys
.
v
:
if
(
_cacheNodes
.
length
){
var
node
=
km
.
getSelectedNode
();
if
(
node
){
km
.
fire
(
'saveScene'
);
for
(
var
i
=
0
,
ni
;
ni
=
_cacheNodes
[
i
++
];){
appendChildNode
(
node
,
ni
);
}
km
.
layout
(
300
);
km
.
select
(
_selectedNodes
,
true
);
_selectedNodes
=
[];
km
.
fire
(
'saveScene'
);
}
}
}
}
}
}
};
}
);
\ No newline at end of file
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