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", {
this
.
setData
(
'type'
,
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
)
{
this
.
setData
(
'text'
,
text
);
...
...
@@ -231,7 +242,7 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
var
_tmp
=
new
KM
.
MinderNode
(
isClonedNode
.
getText
()
);
_tmp
.
data
=
Utils
.
clonePlainObject
(
isClonedNode
.
getData
()
);
_tmp
.
tmpData
=
Utils
.
clonePlainObject
(
isClonedNode
.
getTmpData
()
)
_tmp
.
tmpData
=
Utils
.
clonePlainObject
(
isClonedNode
.
getTmpData
()
)
_tmp
.
parent
=
parent
;
if
(
parent
)
{
parent
.
children
.
push
(
_tmp
);
...
...
@@ -257,8 +268,8 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
return
false
;
}
for
(
var
i
=
0
,
ci
;
(
ci
=
this
.
children
[
i
]
);
i
++
)
{
if
(
ci
.
equals
(
node
.
children
[
i
]
)
===
false
)
{
(
ci
=
this
.
children
[
i
]
);
i
++
)
{
if
(
ci
.
equals
(
node
.
children
[
i
]
)
===
false
)
{
return
false
;
}
}
...
...
@@ -274,26 +285,26 @@ var MinderNode = KityMinder.MinderNode = kity.createClass( "MinderNode", {
clearChildren
:
function
()
{
this
.
children
=
[];
},
isHighlight
:
function
()
{
return
this
.
getTmpData
(
'highlight'
)
isHighlight
:
function
()
{
return
this
.
getTmpData
(
'highlight'
)
},
setTmpData
:
function
(
a
,
v
)
{
setTmpData
:
function
(
a
,
v
)
{
var
me
=
this
;
if
(
utils
.
isObject
(
a
))
{
utils
.
each
(
a
,
function
(
val
,
key
)
{
me
.
setTmpData
(
key
,
val
)
})
if
(
utils
.
isObject
(
a
)
)
{
utils
.
each
(
a
,
function
(
val
,
key
)
{
me
.
setTmpData
(
key
,
val
)
}
)
}
if
(
v
===
undefined
||
v
===
null
||
v
===
''
)
{
delete
this
.
tmpData
[
a
];
}
else
{
this
.
tmpData
[
a
]
=
v
;
if
(
v
===
undefined
||
v
===
null
||
v
===
''
)
{
delete
this
.
tmpData
[
a
];
}
else
{
this
.
tmpData
[
a
]
=
v
;
}
},
getTmpData
:
function
(
a
)
{
getTmpData
:
function
(
a
)
{
if
(
a
===
undefined
)
{
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 () {
var
minder
=
this
;
if
(
e
.
dataTransfer
.
files
)
{
var
reader
=
new
FileReader
();
reader
.
onload
=
function
()
{};
var
data
=
readFile
(
e
.
dataTransfer
.
files
[
0
]
);
minder
.
importData
(
data
);
reader
.
onload
=
function
(
e
)
{
minder
.
importData
(
e
.
target
.
result
);
};
reader
.
readAsText
(
e
.
dataTransfer
.
files
[
0
]
);
}
}
function
readFile
(
e
)
{
var
reader
=
new
FileReader
();
return
reader
.
readAsText
();
}
return
{
events
:
{
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