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
c9c91572
Commit
c9c91572
authored
Feb 14, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
import
parent
1566b267
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
25 deletions
+32
-25
node.js
src/core/node.js
+28
-17
dropfile.js
src/module/dropfile.js
+4
-8
No files found.
src/core/node.js
View file @
c9c91572
...
@@ -70,7 +70,18 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -70,7 +70,18 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
this
.
setData
(
'type'
,
type
);
this
.
setData
(
'type'
,
type
);
},
},
getType
:
function
(
type
)
{
getType
:
function
(
type
)
{
return
this
.
getData
(
'type'
);
var
cached
=
this
.
getData
(
'type'
);
if
(
cached
)
{
return
cached
;
}
var
level
=
0
;
while
(
this
.
parent
)
{
level
++
;
if
(
level
>
1
)
break
;
}
cached
=
[
'root'
,
'main'
,
'sub'
][
level
];
this
.
setData
(
'type'
,
cached
);
return
cached
;
},
},
setText
:
function
(
text
)
{
setText
:
function
(
text
)
{
this
.
setData
(
'text'
,
text
);
this
.
setData
(
'text'
,
text
);
...
@@ -231,7 +242,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -231,7 +242,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
var
_tmp
=
new
KM
.
MinderNode
(
isClonedNode
.
getText
()
);
var
_tmp
=
new
KM
.
MinderNode
(
isClonedNode
.
getText
()
);
_tmp
.
data
=
Utils
.
clonePlainObject
(
isClonedNode
.
getData
()
);
_tmp
.
data
=
Utils
.
clonePlainObject
(
isClonedNode
.
getData
()
);
_tmp
.
tmpData
=
Utils
.
clonePlainObject
(
isClonedNode
.
getTmpData
()
)
_tmp
.
tmpData
=
Utils
.
clonePlainObject
(
isClonedNode
.
getTmpData
()
)
_tmp
.
parent
=
parent
;
_tmp
.
parent
=
parent
;
if
(
parent
)
{
if
(
parent
)
{
parent
.
children
.
push
(
_tmp
);
parent
.
children
.
push
(
_tmp
);
...
@@ -257,8 +268,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -257,8 +268,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return
false
;
return
false
;
}
}
for
(
var
i
=
0
,
ci
;
for
(
var
i
=
0
,
ci
;
(
ci
=
this
.
children
[
i
]
);
i
++
)
{
(
ci
=
this
.
children
[
i
]
);
i
++
)
{
if
(
ci
.
equals
(
node
.
children
[
i
]
)
===
false
)
{
if
(
ci
.
equals
(
node
.
children
[
i
]
)
===
false
)
{
return
false
;
return
false
;
}
}
}
}
...
@@ -274,26 +285,26 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
...
@@ -274,26 +285,26 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
clearChildren
:
function
()
{
clearChildren
:
function
()
{
this
.
children
=
[];
this
.
children
=
[];
},
},
isHighlight
:
function
()
{
isHighlight
:
function
()
{
return
this
.
getTmpData
(
'highlight'
)
return
this
.
getTmpData
(
'highlight'
)
},
},
setTmpData
:
function
(
a
,
v
)
{
setTmpData
:
function
(
a
,
v
)
{
var
me
=
this
;
var
me
=
this
;
if
(
utils
.
isObject
(
a
))
{
if
(
utils
.
isObject
(
a
)
)
{
utils
.
each
(
a
,
function
(
val
,
key
)
{
utils
.
each
(
a
,
function
(
val
,
key
)
{
me
.
setTmpData
(
key
,
val
)
me
.
setTmpData
(
key
,
val
)
})
}
)
}
}
if
(
v
===
undefined
||
v
===
null
||
v
===
''
)
{
if
(
v
===
undefined
||
v
===
null
||
v
===
''
)
{
delete
this
.
tmpData
[
a
];
delete
this
.
tmpData
[
a
];
}
else
{
}
else
{
this
.
tmpData
[
a
]
=
v
;
this
.
tmpData
[
a
]
=
v
;
}
}
},
},
getTmpData
:
function
(
a
)
{
getTmpData
:
function
(
a
)
{
if
(
a
===
undefined
)
{
if
(
a
===
undefined
)
{
return
this
.
tmpData
;
return
this
.
tmpData
;
}
}
return
this
.
tmpData
[
a
]
return
this
.
tmpData
[
a
]
}
}
}
);
}
);
\ No newline at end of file
src/module/dropfile.js
View file @
c9c91572
...
@@ -18,17 +18,13 @@ KityMinder.registerModule( "DropFile", function () {
...
@@ -18,17 +18,13 @@ KityMinder.registerModule( "DropFile", function () {
var
minder
=
this
;
var
minder
=
this
;
if
(
e
.
dataTransfer
.
files
)
{
if
(
e
.
dataTransfer
.
files
)
{
var
reader
=
new
FileReader
();
var
reader
=
new
FileReader
();
reader
.
onload
=
function
()
{};
reader
.
onload
=
function
(
e
)
{
var
data
=
readFile
(
e
.
dataTransfer
.
files
[
0
]
);
minder
.
importData
(
e
.
target
.
result
);
minder
.
importData
(
data
);
};
reader
.
readAsText
(
e
.
dataTransfer
.
files
[
0
]
);
}
}
}
}
function
readFile
(
e
)
{
var
reader
=
new
FileReader
();
return
reader
.
readAsText
();
}
return
{
return
{
events
:
{
events
:
{
ready
:
init
ready
:
init
...
...
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