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
29d682a7
Commit
29d682a7
authored
Feb 21, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/kitygraph/kityminder
into dev
parents
e02ca71e
f76a3351
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
88 additions
and
47 deletions
+88
-47
configure.js
configure.js
+15
-15
dev.php
dist/dev.php
+1
-0
zh-cn.js
lang/zh-cn/zh-cn.js
+7
-6
layout.js
src/adapter/layout.js
+31
-0
node.js
src/adapter/node.js
+15
-17
saveto.js
src/adapter/saveto.js
+9
-3
layout.js
src/module/layout.js
+6
-2
select.js
src/module/select.js
+4
-4
No files found.
configure.js
View file @
29d682a7
(
function
()
{
function
getKMBasePath
(
docUrl
,
confUrl
)
{
(
function
()
{
function
getKMBasePath
(
docUrl
,
confUrl
)
{
return
getBasePath
(
docUrl
||
self
.
document
.
URL
||
self
.
location
.
href
,
confUrl
||
getConfigFilePath
()
);
}
function
getConfigFilePath
()
{
function
getConfigFilePath
()
{
var
configPath
=
document
.
getElementsByTagName
(
'script'
);
var
configPath
=
document
.
getElementsByTagName
(
'script'
);
return
configPath
[
configPath
.
length
-
1
].
src
;
return
configPath
[
configPath
.
length
-
1
].
src
;
}
function
getBasePath
(
docUrl
,
confUrl
)
{
function
getBasePath
(
docUrl
,
confUrl
)
{
var
basePath
=
confUrl
;
if
(
/^
(\/
|
\\\\)
/
.
test
(
confUrl
))
{
if
(
/^
(\/
|
\\\\)
/
.
test
(
confUrl
)
)
{
basePath
=
/^.+
?\w(\/
|
\\\\)
/
.
exec
(
docUrl
)[
0
]
+
confUrl
.
replace
(
/^
(\/
|
\\\\)
/
,
''
);
basePath
=
/^.+
?\w(\/
|
\\\\)
/
.
exec
(
docUrl
)[
0
]
+
confUrl
.
replace
(
/^
(\/
|
\\\\)
/
,
''
);
}
else
if
(
!
/^
[
a-z
]
+:/i
.
test
(
confUrl
)
)
{
}
else
if
(
!
/^
[
a-z
]
+:/i
.
test
(
confUrl
)
)
{
docUrl
=
docUrl
.
split
(
"#"
)[
0
].
split
(
"?"
)[
0
].
replace
(
/
[^\\\/]
+$/
,
''
);
docUrl
=
docUrl
.
split
(
"#"
)[
0
].
split
(
"?"
)[
0
].
replace
(
/
[^\\\/]
+$/
,
''
);
basePath
=
docUrl
+
""
+
confUrl
;
...
...
@@ -34,15 +34,15 @@
}
function
optimizationPath
(
path
)
{
function
optimizationPath
(
path
)
{
var
protocol
=
/^
[
a-z
]
+:
\/\/
/
.
exec
(
path
)[
0
],
tmp
=
null
,
res
=
[];
path
=
path
.
replace
(
protocol
,
""
).
split
(
"?"
)[
0
].
split
(
"#"
)[
0
];
path
=
path
.
replace
(
protocol
,
""
).
split
(
"?"
)[
0
].
split
(
"#"
)[
0
];
path
=
path
.
replace
(
/
\\
/g
,
'/'
).
split
(
/
\/
/
);
path
=
path
.
replace
(
/
\\
/g
,
'/'
).
split
(
/
\/
/
);
path
[
path
.
length
-
1
]
=
""
;
...
...
@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
//定义工具栏
toolbars
:
[
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node'
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node
| layout
'
]
//设置主题
...
...
@@ -79,4 +79,4 @@
//设置km整体的z-index大小
//,zIndex : 1000
};
})()
}
)()
\ No newline at end of file
dist/dev.php
View file @
29d682a7
...
...
@@ -62,6 +62,7 @@ $dependency = Array(
,
'src/adapter/view.js'
,
'src/adapter/dialog.js'
,
'src/adapter/tooltips.js'
,
'src/adapter/layout.js'
,
'src/adapter/node.js'
,
'src/protocal/plain.js'
,
'src/protocal/json.js'
...
...
lang/zh-cn/zh-cn.js
View file @
29d682a7
...
...
@@ -10,12 +10,13 @@ KityMinder.LANG[ 'zh-cn' ] = {
'fontfamily'
:
'字体'
,
'fontsize'
:
'字号'
,
'layoutstyle'
:
'主题'
,
'node'
:
'节点操作'
,
'node'
:
'节点操作'
,
'saveto'
:
'导出'
,
'hand'
:
'允许拖拽'
,
'zoom-in'
:
'放大'
,
'zoom-out'
:
'缩小'
,
'markers'
:
'添加标签'
'markers'
:
'添加标签'
,
'layout'
:
'切换主题'
},
'popupcolor'
:
{
'clearColor'
:
'清空颜色'
,
...
...
@@ -40,10 +41,10 @@ KityMinder.LANG[ 'zh-cn' ] = {
}
}
},
'node'
:{
'appendsiblingnode'
:
'插入兄弟节点'
,
'appendchildnode'
:
'插入孩子节点'
,
'removenode'
:
'删除节点'
'node'
:
{
'appendsiblingnode'
:
'插入兄弟节点'
,
'appendchildnode'
:
'插入孩子节点'
,
'removenode'
:
'删除节点'
}
};
\ No newline at end of file
src/adapter/layout.js
0 → 100644
View file @
29d682a7
KM
.
registerToolbarUI
(
'layout'
,
function
(
name
)
{
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
title
:
label
,
comboboxName
:
name
,
items
:
me
.
getLayoutStyleItems
()
||
[],
itemStyles
:
[],
value
:
me
.
getLayoutStyleItems
(),
autowidthitem
:
[]
},
$combox
=
null
;
if
(
options
.
items
.
length
==
0
)
{
return
null
;
}
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
me
.
execCommand
(
"switchlayout"
,
res
.
value
);
}
).
on
(
"beforeshow"
,
function
()
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
}
);
\ No newline at end of file
src/adapter/node.js
View file @
29d682a7
KM
.
registerToolbarUI
(
'node'
,
function
(
name
)
{
var
shortcutKeys
=
{
var
shortcutKeys
=
{
"appendsiblingnode"
:
"enter"
,
"appendchildnode"
:
"tab"
,
"removenode"
:
"del|backspace"
"removenode"
:
"del|backspace"
};
var
me
=
this
,
msg
=
me
.
getLang
(
'node'
),
msg
=
me
.
getLang
(
'node'
),
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
...
...
@@ -16,10 +16,9 @@ KM.registerToolbarUI( 'node', function ( name ) {
itemStyles
:
[],
value
:
[],
autowidthitem
:
[],
enabledRecord
:
false
enabledRecord
:
false
},
$combox
=
null
;
if
(
options
.
items
.
length
==
0
)
{
return
null
;
}
...
...
@@ -29,21 +28,21 @@ KM.registerToolbarUI( 'node', function ( name ) {
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
me
.
execCommand
(
res
.
value
,
new
MinderNode
(
me
.
getLang
().
topic
)
);
}).
on
(
"beforeshow"
,
function
()
{
me
.
execCommand
(
res
.
value
,
new
MinderNode
(
me
.
getLang
().
topic
)
);
}
).
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
)
combox
.
traverseItems
(
function
(
label
,
value
)
{
if
(
me
.
queryCommandState
(
value
)
==
-
1
)
{
combox
.
disableItemByLabel
(
label
)
}
else
{
combox
.
enableItemByLabel
(
label
)
}
})
});
}
)
}
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
...
...
@@ -56,7 +55,7 @@ KM.registerToolbarUI( 'node', function ( name ) {
utils
.
each
(
options
.
items
,
function
(
k
,
v
)
{
options
.
value
.
push
(
v
);
tempItems
.
push
(
(
msg
[
k
]
||
k
)
+
'('
+
shortcutKeys
[
v
].
toUpperCase
()
+
')'
);
tempItems
.
push
(
(
msg
[
k
]
||
k
)
+
'('
+
shortcutKeys
[
v
].
toUpperCase
()
+
')'
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
tempItems
[
tempItems
.
length
-
1
]
)
);
}
);
...
...
@@ -65,5 +64,4 @@ KM.registerToolbarUI( 'node', function ( name ) {
}
});
}
);
\ No newline at end of file
src/adapter/saveto.js
View file @
29d682a7
...
...
@@ -24,7 +24,6 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
text
),
true
);
}
);
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
...
...
@@ -40,8 +39,15 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}
).
on
(
'aftercomboboxselect'
,
function
()
{
this
.
setLabelWithDefaultValue
();
var
combox
=
$combox
.
kmui
();
combox
.
traverseItems
(
function
(
label
,
value
)
{
if
(
me
.
queryCommandState
(
value
)
==
-
1
)
{
combox
.
disableItemByLabel
(
label
)
}
else
{
combox
.
enableItemByLabel
(
label
)
}
}
)
}
);
...
...
src/module/layout.js
View file @
29d682a7
...
...
@@ -8,7 +8,11 @@ KityMinder.registerModule( "LayoutModule", function () {
return
this
.
_layoutStyles
[
name
];
},
getLayoutStyleItems
:
function
()
{
return
this
.
_layoutStyles
;
var
items
=
[];
for
(
var
key
in
this
.
_layoutStyles
)
{
items
.
push
(
key
);
}
return
items
;
},
getCurrentStyle
:
function
()
{
var
_root
=
this
.
getRoot
();
...
...
@@ -196,7 +200,7 @@ KityMinder.registerModule( "LayoutModule", function () {
}
},
"defaultOptions"
:
{
"defaultlayoutstyle"
:
"
bottom
"
,
"defaultlayoutstyle"
:
"
default
"
,
"node"
:
{
'appendsiblingnode'
:
'appendsiblingnode'
,
'appendchildnode'
:
'appendchildnode'
,
...
...
src/module/select.js
View file @
29d682a7
...
...
@@ -29,11 +29,11 @@ KityMinder.registerModule( "Select", function () {
startPosition
=
g
.
snapToSharp
(
e
.
getPosition
()
);
},
selectMove
:
function
(
e
)
{
if
(
minder
.
isTextEditStatus
())
{
if
(
minder
.
isTextEditStatus
()
)
{
return
;
}
if
(
!
startPosition
)
return
;
var
p1
=
startPosition
,
p2
=
e
.
getPosition
();
...
...
@@ -67,7 +67,7 @@ KityMinder.registerModule( "Select", function () {
// 计算选中范围
minder
.
getRoot
().
traverse
(
function
(
node
)
{
var
renderBox
=
node
.
getRenderContainer
().
getRenderBox
();
var
renderBox
=
node
.
getRenderContainer
().
getRenderBox
(
"top"
);
if
(
g
.
isBoxIntersect
(
renderBox
,
marquee
)
)
{
selectedNodes
.
push
(
node
);
}
...
...
@@ -82,7 +82,7 @@ KityMinder.registerModule( "Select", function () {
}
if
(
marqueeMode
)
{
marqueeShape
.
fadeOut
(
200
,
'ease'
,
0
,
function
()
{
if
(
marqueeShape
.
remove
)
marqueeShape
.
remove
();
if
(
marqueeShape
.
remove
)
marqueeShape
.
remove
();
}
);
marqueeMode
=
false
;
}
...
...
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