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
20c7f489
Commit
20c7f489
authored
May 08, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/fex-team/kityminder
into dev
parents
b038022f
5071ea9f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
7 deletions
+84
-7
import.js
import.js
+1
-0
kityminder.config.js
kityminder.config.js
+3
-1
zh-cn.js
lang/zh-cn/zh-cn.js
+1
-2
zoom.js
src/adapter/zoom.js
+59
-0
utils.js
src/core/utils.js
+15
-0
editor.receiver.js
src/module/editor.receiver.js
+2
-4
zoom.js
src/module/zoom.js
+3
-0
No files found.
import.js
View file @
20c7f489
...
...
@@ -72,6 +72,7 @@
,
'adapter/contextmenu.js'
,
'adapter/dialog.js'
,
'adapter/hyperlink.js'
,
'adapter/zoom.js'
,
'protocal/xmind.js'
,
'protocal/freemind.js'
,
'protocal/mindmanager.js'
...
...
kityminder.config.js
View file @
20c7f489
...
...
@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
//定义工具栏
toolbars
:
[
'hand zoom
-in zoom-out
collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | hyperlink unhyperlink | markers | node | help'
'hand zoom
|
collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | hyperlink unhyperlink | markers | node | help'
]
//只读模式,默认是false
//readOnly: true
...
...
@@ -87,5 +87,7 @@
// defaultLayer: 2,
// defaultSubShow: 5
// }
//配置放大缩小的比例
//,zoom:[50,80,100,120,150,200]
};
}
)();
\ No newline at end of file
lang/zh-cn/zh-cn.js
View file @
20c7f489
...
...
@@ -13,8 +13,7 @@ KityMinder.LANG[ 'zh-cn' ] = {
'node'
:
'节点操作'
,
'saveto'
:
'导出'
,
'hand'
:
'允许拖拽'
,
'zoom-in'
:
'放大'
,
'zoom-out'
:
'缩小'
,
'zoom'
:
'放大缩小'
,
'markers'
:
'添加标签'
,
'switchlayout'
:
'切换主题'
,
'help'
:
'帮助'
,
...
...
src/adapter/zoom.js
0 → 100644
View file @
20c7f489
KM
.
registerToolbarUI
(
'zoom'
,
function
(
name
)
{
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
title
:
label
,
comboboxName
:
name
,
items
:
me
.
getOptions
(
name
)
||
[],
itemStyles
:
[],
value
:
me
.
getOptions
(
name
),
autowidthitem
:
[],
enabledRecord
:
false
,
enabledSelected
:
false
},
$combox
=
null
;
if
(
options
.
items
.
length
==
0
)
{
return
null
;
}
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
transForInserttopic
(
options
)
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
var
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
me
.
execCommand
(
'zoom'
,
res
.
value
);
}
).
on
(
"beforeshow"
,
function
()
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}
);
//状态反射
me
.
on
(
'interactchange'
,
function
()
{
var
state
=
0
;
//设置按钮状态
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
}
);
//comboboxWidget.button().kmui().disabled(-1);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
function
transForInserttopic
(
options
)
{
var
tempItems
=
[];
utils
.
each
(
options
.
items
,
function
(
k
,
v
)
{
options
.
value
.
push
(
v
);
tempItems
.
push
(
v
+
'%'
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
tempItems
[
tempItems
.
length
-
1
]
)
);
}
);
options
.
items
=
tempItems
;
return
options
;
}
}
);
\ No newline at end of file
src/core/utils.js
View file @
20c7f489
...
...
@@ -268,6 +268,21 @@ var utils = Utils = KityMinder.Utils = {
}
return
target
;
},
unhtml
:
function
(
str
,
reg
)
{
return
str
?
str
.
replace
(
reg
||
/
[
&<">'
](?:(
amp|lt|quot|gt|#39|nbsp
)
;
)?
/g
,
function
(
a
,
b
)
{
if
(
b
)
{
return
a
;
}
else
{
return
{
'<'
:
'<'
,
'&'
:
'&'
,
'"'
:
'"'
,
'>'
:
'>'
,
"'"
:
'''
}[
a
]
}
})
:
''
;
}
};
...
...
src/module/editor.receiver.js
View file @
20c7f489
...
...
@@ -46,7 +46,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape
=
new
kity
.
Text
();
}
this
.
textShape
=
textShape
;
this
.
container
.
innerHTML
=
textShape
.
getContent
(
);
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
()
);
return
this
;
},
setTextShapeSize
:
function
(
size
)
{
...
...
@@ -90,9 +90,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me
.
setContainerStyle
();
me
.
minderNode
.
setText
(
text
);
if
(
text
.
length
==
0
)
{
me
.
minderNode
.
setText
(
'a'
);
}
me
.
km
.
updateLayout
(
me
.
minderNode
);
...
...
@@ -142,7 +140,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout
(
function
()
{
me
.
range
.
updateNativeRange
().
insertNode
(
$
(
'<span>$$_kityminder_bookmark_$$</span>'
)[
0
]
);
me
.
container
.
innerHTML
=
me
.
container
.
textContent
.
replace
(
/
[\u
200b
\t\r\n]
/g
,
''
);
me
.
container
.
innerHTML
=
utils
.
unhtml
(
me
.
container
.
textContent
.
replace
(
/
[\u
200b
\t\r\n]
/g
,
''
)
);
var
index
=
me
.
container
.
textContent
.
indexOf
(
'$$_kityminder_bookmark_$$'
);
me
.
container
.
textContent
=
me
.
container
.
textContent
.
replace
(
'$$_kityminder_bookmark_$$'
,
''
);
me
.
range
.
setStart
(
me
.
container
.
firstChild
,
index
).
collapse
(
true
).
select
();
...
...
src/module/zoom.js
View file @
20c7f489
KityMinder
.
registerModule
(
'Zoom'
,
function
()
{
var
me
=
this
;
me
.
setOptions
(
'zoom'
,[
50
,
80
,
100
,
120
,
150
,
200
]);
var
MAX_ZOOM
=
2
,
MIN_ZOOM
=
kity
.
Browser
.
chrome
?
1
:
0.5
,
ZOOM_STEP
=
Math
.
sqrt
(
2
);
...
...
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