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
effcf515
Commit
effcf515
authored
Mar 18, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
370f2f2e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
54 deletions
+47
-54
minder.js
src/core/minder.js
+45
-44
layout.default.js
src/module/layout.default.js
+2
-10
No files found.
src/core/minder.js
View file @
effcf515
...
@@ -28,7 +28,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -28,7 +28,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_paper
.
getNode
().
ondragstart
=
function
(
e
)
{
this
.
_paper
.
getNode
().
ondragstart
=
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
};
};
...
@@ -64,47 +64,48 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -64,47 +64,48 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_shortcutkeys
=
{};
this
.
_shortcutkeys
=
{};
this
.
_bindshortcutKeys
();
this
.
_bindshortcutKeys
();
},
},
isTextEditStatus
:
function
()
{
isTextEditStatus
:
function
()
{
return
false
;
return
false
;
},
},
addShortcutKeys
:
function
(
cmd
,
keys
)
{
addShortcutKeys
:
function
(
cmd
,
keys
)
{
var
obj
=
{},
km
=
this
;
var
obj
=
{},
km
=
this
;
if
(
keys
)
{
if
(
keys
)
{
obj
[
cmd
]
=
keys
obj
[
cmd
]
=
keys
}
else
{
}
else
{
obj
=
cmd
;
obj
=
cmd
;
}
}
utils
.
each
(
obj
,
function
(
k
,
v
)
{
utils
.
each
(
obj
,
function
(
k
,
v
)
{
km
.
_shortcutkeys
[
k
.
toLowerCase
()
]
=
v
;
km
.
_shortcutkeys
[
k
.
toLowerCase
()
]
=
v
;
});
}
);
},
},
getShortcutKey
:
function
(
cmdName
)
{
getShortcutKey
:
function
(
cmdName
)
{
return
this
.
_shortcutkeys
[
cmdName
]
return
this
.
_shortcutkeys
[
cmdName
]
},
},
_bindshortcutKeys
:
function
()
{
_bindshortcutKeys
:
function
()
{
var
me
=
this
,
var
me
=
this
,
shortcutkeys
=
this
.
_shortcutkeys
;
shortcutkeys
=
this
.
_shortcutkeys
;
function
checkkey
(
key
,
keyCode
,
e
){
switch
(
key
){
function
checkkey
(
key
,
keyCode
,
e
)
{
switch
(
key
)
{
case
'ctrl'
:
case
'ctrl'
:
case
'cmd'
:
case
'cmd'
:
if
(
e
.
ctrlKey
||
e
.
metaKey
)
{
if
(
e
.
ctrlKey
||
e
.
metaKey
)
{
return
true
;
return
true
;
}
}
break
;
break
;
case
'alt'
:
case
'alt'
:
if
(
e
.
altKey
)
{
if
(
e
.
altKey
)
{
return
true
return
true
}
}
break
;
break
;
case
'shift'
:
case
'shift'
:
if
(
e
.
shiftKey
)
{
if
(
e
.
shiftKey
)
{
return
true
;
return
true
;
}
}
}
}
if
(
keyCode
==
keymap
[
key
])
{
if
(
keyCode
==
keymap
[
key
]
)
{
return
true
;
return
true
;
}
}
return
false
return
false
...
@@ -114,15 +115,15 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -114,15 +115,15 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
var
originEvent
=
e
.
originEvent
;
var
originEvent
=
e
.
originEvent
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
for
(
var
i
in
shortcutkeys
)
{
for
(
var
i
in
shortcutkeys
)
{
var
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
var
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
var
current
=
0
;
var
current
=
0
;
utils
.
each
(
keys
,
function
(
i
,
k
)
{
utils
.
each
(
keys
,
function
(
i
,
k
)
{
if
(
checkkey
(
k
,
keyCode
,
originEvent
))
{
if
(
checkkey
(
k
,
keyCode
,
originEvent
)
)
{
current
++
;
current
++
;
}
}
});
}
);
if
(
current
==
keys
.
length
)
{
if
(
current
==
keys
.
length
)
{
if
(
me
.
queryCommandState
(
i
)
!=
-
1
)
if
(
me
.
queryCommandState
(
i
)
!=
-
1
)
me
.
execCommand
(
i
);
me
.
execCommand
(
i
);
originEvent
.
preventDefault
();
originEvent
.
preventDefault
();
...
@@ -132,38 +133,38 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -132,38 +133,38 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
}
}
}
);
}
);
},
},
_initContextmenu
:
function
()
{
_initContextmenu
:
function
()
{
this
.
contextmenus
=
[];
this
.
contextmenus
=
[];
},
},
addContextmenu
:
function
(
item
)
{
addContextmenu
:
function
(
item
)
{
if
(
utils
.
isArray
(
item
))
{
if
(
utils
.
isArray
(
item
)
)
{
this
.
contextmenus
=
this
.
contextmenus
.
concat
(
item
);
this
.
contextmenus
=
this
.
contextmenus
.
concat
(
item
);
}
else
{
}
else
{
this
.
contextmenus
.
push
(
item
);
this
.
contextmenus
.
push
(
item
);
}
}
return
this
;
return
this
;
},
},
getContextmenu
:
function
()
{
getContextmenu
:
function
()
{
return
this
.
contextmenus
;
return
this
.
contextmenus
;
},
},
_initStatus
:
function
()
{
_initStatus
:
function
()
{
this
.
_status
=
"normal"
;
this
.
_status
=
"normal"
;
this
.
_rollbackStatus
=
"normal"
;
this
.
_rollbackStatus
=
"normal"
;
},
},
setStatus
:
function
(
status
)
{
setStatus
:
function
(
status
)
{
if
(
status
)
{
if
(
status
)
{
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_status
=
status
;
this
.
_status
=
status
;
}
else
{
}
else
{
this
.
_status
=
''
;
this
.
_status
=
''
;
}
}
return
this
;
return
this
;
},
},
rollbackStatus
:
function
()
{
rollbackStatus
:
function
()
{
this
.
_status
=
this
.
_rollbackStatus
;
this
.
_status
=
this
.
_rollbackStatus
;
},
},
getStatus
:
function
()
{
getStatus
:
function
()
{
return
this
.
_status
;
return
this
.
_status
;
}
}
}
);
}
);
...
...
src/module/layout.default.js
View file @
effcf515
...
@@ -551,14 +551,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -551,14 +551,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
node
.
setType
(
"main"
);
node
.
setType
(
"main"
);
}
else
{
}
else
{
node
.
setType
(
"sub"
);
node
.
setType
(
"sub"
);
var
isExpand
=
parent
.
getData
(
"expand"
);
if
(
isExpand
===
undefined
)
{
isExpand
=
true
;
parent
.
setData
(
"expand"
,
isExpand
);
}
// if ( !isExpand ) {
// return false;
// }
}
}
//计算位置等流程
//计算位置等流程
updateBg
(
node
);
updateBg
(
node
);
...
@@ -654,13 +646,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -654,13 +646,13 @@ KityMinder.registerModule( "LayoutDefault", function () {
if
(
Layout
.
shicon
)
Layout
.
shicon
.
remove
();
if
(
Layout
.
shicon
)
Layout
.
shicon
.
remove
();
}
catch
(
error
)
{}
}
catch
(
error
)
{}
}
}
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
if
(
_buffer
[
0
].
getData
(
"expand"
)
!==
false
)
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
.
shift
();
_buffer
.
shift
();
}
}
if
(
isExpand
)
{
if
(
isExpand
)
{
node
.
clearChildren
();
node
.
clearChildren
();
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
for
(
var
j
=
0
;
j
<
_cleanbuffer
.
length
;
j
++
)
{
_cleanbuffer
[
j
].
clearChildren
();
if
(
_cleanbuffer
[
j
].
getData
(
"expand"
)
!==
false
)
_cleanbuffer
[
j
].
clearChildren
();
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
getLayout
().
parent
,
_cleanbuffer
[
j
]
);
minder
.
appendChildNode
(
_cleanbuffer
[
j
].
getLayout
().
parent
,
_cleanbuffer
[
j
]
);
}
}
}
}
...
...
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