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
f3b162df
Commit
f3b162df
authored
Feb 20, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:kitygraph/kityminder into dev
parents
98e0d3cd
80d4ac10
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
368 additions
and
203 deletions
+368
-203
configure.js
configure.js
+1
-1
dev.php
dist/dev.php
+1
-0
zh-cn.js
lang/zh-cn/zh-cn.js
+7
-1
combobox.js
src/adapter/combobox.js
+12
-10
node.js
src/adapter/node.js
+68
-0
keymap.js
src/core/keymap.js
+10
-1
minder.js
src/core/minder.js
+35
-14
basestyle.js
src/module/basestyle.js
+2
-2
history.js
src/module/history.js
+2
-2
layout.bottom.js
src/module/layout.bottom.js
+102
-160
layout.default.js
src/module/layout.default.js
+0
-1
layout.js
src/module/layout.js
+30
-1
zoom.js
src/module/zoom.js
+1
-1
combobox.js
src/ui/combobox.js
+87
-9
comboboxmenu.css
themes/default/_css/comboboxmenu.css
+10
-0
No files found.
configure.js
View file @
f3b162df
...
...
@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
//定义工具栏
toolbars
:
[
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers'
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers
| node
'
]
//设置主题
...
...
dist/dev.php
View file @
f3b162df
...
...
@@ -62,6 +62,7 @@ $dependency = Array(
,
'src/adapter/view.js'
,
'src/adapter/dialog.js'
,
'src/adapter/tooltips.js'
,
'src/adapter/node.js'
,
'src/protocal/plain.js'
,
'src/protocal/json.js'
);
...
...
lang/zh-cn/zh-cn.js
View file @
f3b162df
...
...
@@ -10,6 +10,7 @@ KityMinder.LANG[ 'zh-cn' ] = {
'fontfamily'
:
'字体'
,
'fontsize'
:
'字号'
,
'layoutstyle'
:
'主题'
,
'node'
:
'节点操作'
,
'saveto'
:
'导出'
,
'hand'
:
'允许拖拽'
,
'zoom-in'
:
'放大'
,
...
...
@@ -35,9 +36,14 @@ KityMinder.LANG[ 'zh-cn' ] = {
'quarterdone'
:
'完成1/4'
,
'halfdone'
:
'完成1/2'
,
'threequartersdone'
:
'完成3/4'
,
'done'
:
'已完成'
,
'done'
:
'已完成'
}
}
},
'node'
:{
'appendsiblingnode'
:
'插入兄弟节点'
,
'appendchildnode'
:
'插入孩子节点'
,
'removenode'
:
'删除节点'
}
};
\ No newline at end of file
src/adapter/combobox.js
View file @
f3b162df
KM
.
registerToolbarUI
(
'layoutstyle fontfamily fontsize'
,
function
(
name
)
{
KM
.
registerToolbarUI
(
'layoutstyle fontfamily fontsize
inserttopic
'
,
function
(
name
)
{
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
...
...
@@ -31,6 +31,8 @@ KM.registerToolbarUI( 'layoutstyle fontfamily fontsize', function ( name ) {
options
=
transForFontsize
(
options
);
break
;
case
'inserttopic'
:
optons
}
//实例化
...
...
src/adapter/node.js
0 → 100644
View file @
f3b162df
KM
.
registerToolbarUI
(
'node'
,
function
(
name
)
{
var
shortcutKeys
=
{
"appendsiblingnode"
:
"enter"
,
"appendchildnode"
:
"tab"
,
"removenode"
:
"del|backspace"
};
var
me
=
this
,
msg
=
me
.
getLang
(
'node'
),
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
title
:
label
,
comboboxName
:
name
,
items
:
me
.
getOptions
(
name
)
||
[],
itemStyles
:
[],
value
:
[],
autowidthitem
:
[]
},
$combox
=
null
;
if
(
options
.
items
.
length
==
0
)
{
return
null
;
}
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
transForInserttopic
(
options
)
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
me
.
execCommand
(
res
.
value
);
}).
on
(
"beforeshow"
,
function
()
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
var
combox
=
$combox
.
kmui
();
combox
.
traverseItems
(
function
(
label
,
value
){
if
(
me
.
queryCommandState
(
value
)
==
-
1
){
combox
.
disableItemByLabel
(
label
)
}
else
{
combox
.
enableItemByLabel
(
label
)
}
})
});
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
function
transForInserttopic
(
options
)
{
var
tempItems
=
[];
utils
.
each
(
options
.
items
,
function
(
k
,
v
)
{
options
.
value
.
push
(
v
);
tempItems
.
push
(
(
msg
[
k
]
||
k
)
+
'('
+
shortcutKeys
[
v
].
toUpperCase
()
+
')'
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
tempItems
[
tempItems
.
length
-
1
]
)
);
}
);
options
.
items
=
tempItems
;
return
options
;
}
});
src/core/keymap.js
View file @
f3b162df
...
...
@@ -28,5 +28,14 @@ var keymap = KityMinder.keymap = {
'NumLock'
:
144
,
'Cmd'
:
91
'Cmd'
:
91
,
'='
:
187
,
'-'
:
189
,
"b"
:
66
,
'i'
:
73
,
'z'
:
90
,
'y'
:
89
};
\ No newline at end of file
src/core/minder.js
View file @
f3b162df
...
...
@@ -87,25 +87,46 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
_bindshortcutKeys
:
function
()
{
var
me
=
this
,
shortcutkeys
=
this
.
_shortcutkeys
;
me
.
on
(
'keydown'
,
function
(
e
)
{
function
checkkey
(
key
,
keyCode
,
e
){
switch
(
key
){
case
'ctrl'
:
case
'cmd'
:
if
(
e
.
ctrlKey
||
e
.
metaKey
){
return
true
;
}
break
;
case
'alt'
:
if
(
e
.
altKey
){
return
true
}
break
;
case
'shift'
:
if
(
e
.
shiftKey
){
return
true
;
}
}
if
(
keyCode
==
keymap
[
key
]){
return
true
;
}
return
false
}
me
.
on
(
'keydown'
,
function
(
e
)
{
var
originEvent
=
e
.
originEvent
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
for
(
var
i
in
shortcutkeys
)
{
var
tmp
=
shortcutkeys
[
i
].
split
(
','
);
for
(
var
t
=
0
,
ti
;
ti
=
tmp
[
t
++
];
)
{
ti
=
ti
.
split
(
':'
);
var
key
=
ti
[
0
],
param
=
ti
[
1
];
if
(
/^
(
ctrl
)(\+
shift
)?\+(\d
+
)
$/
.
test
(
key
.
toLowerCase
()
)
||
/^
(\d
+
)
$/
.
test
(
key
)
)
{
if
(
(
(
RegExp
.
$1
==
'ctrl'
?
(
originEvent
.
ctrlKey
||
originEvent
.
metaKey
)
:
0
)
&&
(
RegExp
.
$2
!=
""
?
originEvent
[
RegExp
.
$2
.
slice
(
1
)
+
"Key"
]
:
1
)
&&
keyCode
==
RegExp
.
$3
)
||
keyCode
==
RegExp
.
$1
)
{
if
(
me
.
queryCommandState
(
i
,
param
)
!=
-
1
)
me
.
execCommand
(
i
,
param
);
e
.
preventDefault
();
}
var
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
var
current
=
0
;
utils
.
each
(
keys
,
function
(
i
,
k
){
if
(
checkkey
(
k
,
keyCode
,
originEvent
)){
current
++
;
}
});
if
(
current
==
keys
.
length
){
if
(
me
.
queryCommandState
(
i
)
!=
-
1
)
me
.
execCommand
(
i
);
originEvent
.
preventDefault
();
break
;
}
}
...
...
src/module/basestyle.js
View file @
f3b162df
...
...
@@ -69,8 +69,8 @@ KityMinder.registerModule( "basestylemodule", function () {
}
)
},
addShortcutKeys
:
{
"bold"
:
"ctrl+
66
"
,
//bold
"italic"
:
"ctrl+
73
"
//italic
"bold"
:
"ctrl+
b
"
,
//bold
"italic"
:
"ctrl+
i
"
//italic
},
"events"
:
{
"beforeRenderNode"
:
function
(
e
)
{
...
...
src/module/history.js
View file @
f3b162df
...
...
@@ -138,8 +138,8 @@ KityMinder.registerModule( "HistoryModule", function () {
}
)
},
addShortcutKeys
:
{
"Undo"
:
"ctrl+
90
"
,
//undo
"Redo"
:
"ctrl+
89
"
//redo
"Undo"
:
"ctrl+
z
"
,
//undo
"Redo"
:
"ctrl+
y
"
//redo
},
"events"
:
{
"saveScene"
:
function
(
e
)
{
...
...
src/module/layout.bottom.js
View file @
f3b162df
This diff is collapsed.
Click to expand it.
src/module/layout.default.js
View file @
f3b162df
...
...
@@ -605,7 +605,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
var
parent
=
_buffer
[
0
].
getParent
();
Layout
.
parent
=
parent
;
_cleanbuffer
.
push
(
_buffer
[
0
]
);
//minder.appendChildNode( parent, _buffer[ 0 ] );
Layout
.
connect
=
null
;
Layout
.
shicon
=
null
;
}
else
{
...
...
src/module/layout.js
View file @
f3b162df
...
...
@@ -104,6 +104,14 @@ KityMinder.registerModule( "LayoutModule", function () {
km
.
appendChildNode
(
parent
,
node
);
km
.
select
(
node
,
true
);
return
node
;
},
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
return
-
1
;
}
else
{
return
0
;
}
}
};
}
)()
);
...
...
@@ -124,6 +132,14 @@ KityMinder.registerModule( "LayoutModule", function () {
}
km
.
select
(
node
,
true
);
return
node
;
},
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
||
selectedNode
===
km
.
getRoot
()
)
{
return
-
1
;
}
else
{
return
0
;
}
}
};
}
)()
);
...
...
@@ -148,6 +164,14 @@ KityMinder.registerModule( "LayoutModule", function () {
}
while
(
_buffer
.
length
>
1
);
km
.
removeNode
(
selectedNodes
);
km
.
select
(
_buffer
[
0
]
);
},
queryState
:
function
(
km
)
{
var
selectedNodes
=
km
.
getSelectedNodes
();
if
(
(
selectedNodes
.
length
===
1
&&
selectedNodes
[
0
]
===
km
.
getRoot
()
)
||
selectedNodes
.
length
===
0
)
{
return
-
1
;
}
else
{
return
0
;
}
}
};
}
)()
);
...
...
@@ -181,7 +205,12 @@ KityMinder.registerModule( "LayoutModule", function () {
}
},
"defaultOptions"
:
{
"defaultlayoutstyle"
:
"default"
"defaultlayoutstyle"
:
"default"
,
"node"
:
{
'appendsiblingnode'
:
'appendsiblingnode'
,
'appendchildnode'
:
'appendchildnode'
,
'removenode'
:
'removenode'
}
}
};
}
);
\ No newline at end of file
src/module/zoom.js
View file @
f3b162df
...
...
@@ -62,7 +62,7 @@ KityMinder.registerModule( 'Zoom', function () {
'zoom-out'
:
ZoomOutCommand
},
addShortcutKeys
:
{
"zoom-in"
:
"
+
"
,
//=
"zoom-in"
:
"
=
"
,
//=
"zoom-out"
:
"-"
//-
},
events
:
{
...
...
src/ui/combobox.js
View file @
f3b162df
...
...
@@ -21,7 +21,7 @@
"<%if(autoRecord) {%>"
+
"<%for( var i=0, len = recordStack.length; i<len; i++ ) {%>"
+
"<%var index = recordStack[i];%>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == index ) {%> kmui-combobox-checked<%}%>
\"
data-item-index=
\"
<%=index%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == index ) {%> kmui-combobox-checked<%}%>
<%if( disabled[ index ] === true ) {%> kmui-combobox-item-disabled<%}%>
\"
data-item-index=
\"
<%=index%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<span class=
\"
kmui-combobox-icon
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
></span>"
+
"<label class=
\"
<%=labelClassName%>
\"
style=
\"
<%=itemStyles[ index ]%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
><%=items[index]%></label>"
+
"</li>"
+
...
...
@@ -31,7 +31,7 @@
"<%}%>"
+
"<%}%>"
+
"<%for( var i=0, label; label = items[i]; i++ ) {%>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == i ) {%> kmui-combobox-checked<%}%> kmui-combobox-item-<%=i%>
\"
data-item-index=
\"
<%=i%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<li class=
\"
<%=itemClassName%><%if( selected == i ) {%> kmui-combobox-checked<%}%> kmui-combobox-item-<%=i%>
<%if( disabled[ i ] === true ) {%> kmui-combobox-item-disabled<%}%>
\"
data-item-index=
\"
<%=i%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
>"
+
"<span class=
\"
kmui-combobox-icon
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
></span>"
+
"<label class=
\"
<%=labelClassName%>
\"
style=
\"
<%=itemStyles[ i ]%>
\"
unselectable=
\"
on
\"
onmousedown=
\"
return false
\"
><%=label%></label>"
+
"</li>"
+
...
...
@@ -46,6 +46,8 @@
value
:
[],
comboboxName
:
''
,
selected
:
''
,
//初始禁用状态
disabled
:
{},
//自动记录
autoRecord
:
true
,
//最多记录条数
...
...
@@ -87,6 +89,7 @@
initSelectItem
:
function
(){
var
me
=
this
,
options
=
me
.
data
(
"options"
),
labelClass
=
"."
+
labelClassName
;
me
.
root
().
delegate
(
'.'
+
itemClassName
,
'click'
,
function
(){
...
...
@@ -94,6 +97,10 @@
var
$li
=
$
(
this
),
index
=
$li
.
attr
(
'data-item-index'
);
if
(
options
.
disabled
[
index
]
)
{
return
false
;
}
me
.
trigger
(
'comboboxselect'
,
{
index
:
index
,
label
:
$li
.
find
(
labelClass
).
text
(),
...
...
@@ -126,11 +133,17 @@
*/
select
:
function
(
index
){
var
itemCount
=
this
.
data
(
'options'
).
itemCount
,
items
=
this
.
data
(
'options'
).
autowidthitem
;
var
options
=
this
.
data
(
'options'
),
itemCount
=
options
.
itemCount
,
items
=
options
.
autowidthitem
;
if
(
items
&&
!
items
.
length
)
{
items
=
this
.
data
(
'options'
).
items
;
items
=
options
.
items
;
}
// 禁用
if
(
options
.
disabled
[
index
]
)
{
return
null
;
}
if
(
itemCount
==
0
)
{
...
...
@@ -178,6 +191,65 @@
}
);
},
getItems
:
function
()
{
return
this
.
data
(
"options"
).
items
;
},
traverseItems
:
function
(
fn
){
var
values
=
this
.
data
(
'options'
).
value
;
var
labels
=
this
.
data
(
'options'
).
items
;
$
.
each
(
labels
,
function
(
i
,
label
){
fn
(
label
,
values
[
i
])
});
return
this
;
},
getItemMapping
:
function
()
{
return
this
.
data
(
"options"
).
itemMapping
;
},
disableItemByIndex
:
function
(
index
)
{
var
options
=
this
.
data
(
"options"
);
options
.
disabled
[
index
]
=
true
;
this
.
_repaint
();
},
disableItemByLabel
:
function
(
label
)
{
var
itemMapping
=
this
.
data
(
'options'
).
itemMapping
,
index
=
itemMapping
[
label
];
if
(
typeof
index
===
"number"
)
{
return
this
.
disableItemByIndex
(
index
);
}
return
false
;
},
enableItemByIndex
:
function
(
index
)
{
var
options
=
this
.
data
(
"options"
);
delete
options
.
disabled
[
index
];
this
.
_repaint
();
},
enableItemByLabel
:
function
(
label
)
{
var
itemMapping
=
this
.
data
(
'options'
).
itemMapping
,
index
=
itemMapping
[
label
];
if
(
typeof
index
===
"number"
)
{
return
this
.
enableItemByIndex
(
index
);
}
return
false
;
},
/**
* 转换记录栈
*/
...
...
@@ -256,8 +328,7 @@
_update
:
function
(
index
)
{
var
options
=
this
.
data
(
"options"
),
newStack
=
[],
newChilds
=
null
;
newStack
=
[];
$
.
each
(
options
.
recordStack
,
function
(
i
,
item
){
...
...
@@ -277,13 +348,20 @@
options
.
recordStack
=
newStack
;
options
.
selected
=
index
;
newChilds
=
$
(
$
.
parseTmpl
(
this
.
tpl
,
options
)
);
this
.
_repaint
();
newStack
=
null
;
},
_repaint
:
function
()
{
var
newChilds
=
$
(
$
.
parseTmpl
(
this
.
tpl
,
this
.
data
(
"options"
)
)
);
//重新渲染
this
.
root
().
html
(
newChilds
.
html
()
);
newChilds
=
null
;
newStack
=
null
;
}
};
...
...
themes/default/_css/comboboxmenu.css
View file @
f3b162df
...
...
@@ -19,6 +19,7 @@
.kmui-combobox-menu
.kmui-combobox-item
{
display
:
block
;
border
:
1px
solid
white
;
white-space
:
nowrap
;
}
.kmui-combobox-menu
.kmui-combobox-item-label
{
...
...
@@ -185,3 +186,12 @@
.kmui-combobox-paragraph
.kmui-combobox-item-6
.kmui-combobox-item-label
{
font-size
:
12px
;
}
.kmui-combobox-menu
.kmui-combobox-item-disabled
{
opacity
:
0.3
;
}
.kmui-combobox-menu
.kmui-combobox-item-disabled
:HOVER
{
border-color
:
#fff
;
background-color
:
#fff
;
}
\ 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