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
de0293e2
Commit
de0293e2
authored
Feb 22, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into gh-pages
parents
f18e3c89
b88ee449
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
236 additions
and
41 deletions
+236
-41
configure.js
configure.js
+1
-1
dev.php
dist/dev.php
+1
-0
zh-cn.js
lang/zh-cn/zh-cn.js
+1
-1
layout.js
src/adapter/layout.js
+18
-3
saveto.js
src/adapter/saveto.js
+50
-9
dragtree.js
src/module/dragtree.js
+1
-1
editor.js
src/module/editor.js
+26
-6
editor.selection.js
src/module/editor.selection.js
+12
-6
layout.bottom.js
src/module/layout.bottom.js
+5
-0
layout.js
src/module/layout.js
+4
-1
png.js
src/protocal/png.js
+102
-0
combobox.js
src/ui/combobox.js
+15
-13
No files found.
configure.js
View file @
de0293e2
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
'KITYMINDER_HOME_URL'
:
getKMBasePath
(),
//定义工具栏
//定义工具栏
toolbars
:
[
toolbars
:
[
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | layout'
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node |
switch
layout'
]
]
//设置主题
//设置主题
...
...
dist/dev.php
View file @
de0293e2
...
@@ -66,6 +66,7 @@ $dependency = Array(
...
@@ -66,6 +66,7 @@ $dependency = Array(
,
'src/adapter/node.js'
,
'src/adapter/node.js'
,
'src/protocal/plain.js'
,
'src/protocal/plain.js'
,
'src/protocal/json.js'
,
'src/protocal/json.js'
,
'src/protocal/png.js'
);
);
$content
=
""
;
$content
=
""
;
...
...
lang/zh-cn/zh-cn.js
View file @
de0293e2
...
@@ -16,7 +16,7 @@ KityMinder.LANG[ 'zh-cn' ] = {
...
@@ -16,7 +16,7 @@ KityMinder.LANG[ 'zh-cn' ] = {
'zoom-in'
:
'放大'
,
'zoom-in'
:
'放大'
,
'zoom-out'
:
'缩小'
,
'zoom-out'
:
'缩小'
,
'markers'
:
'添加标签'
,
'markers'
:
'添加标签'
,
'layout'
:
'切换主题'
'
switch
layout'
:
'切换主题'
},
},
'popupcolor'
:
{
'popupcolor'
:
{
'clearColor'
:
'清空颜色'
,
'clearColor'
:
'清空颜色'
,
...
...
src/adapter/layout.js
View file @
de0293e2
KM
.
registerToolbarUI
(
'layout'
,
function
(
name
)
{
KM
.
registerToolbarUI
(
'switchlayout'
,
function
(
name
)
{
var
me
=
this
,
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
options
=
{
...
@@ -8,7 +9,8 @@ KM.registerToolbarUI( 'layout', function ( name ) {
...
@@ -8,7 +9,8 @@ KM.registerToolbarUI( 'layout', function ( name ) {
items
:
me
.
getLayoutStyleItems
()
||
[],
items
:
me
.
getLayoutStyleItems
()
||
[],
itemStyles
:
[],
itemStyles
:
[],
value
:
me
.
getLayoutStyleItems
(),
value
:
me
.
getLayoutStyleItems
(),
autowidthitem
:
[]
autowidthitem
:
[],
enabledRecord
:
false
},
},
$combox
=
null
;
$combox
=
null
;
if
(
options
.
items
.
length
==
0
)
{
if
(
options
.
items
.
length
==
0
)
{
...
@@ -20,12 +22,25 @@ KM.registerToolbarUI( 'layout', function ( name ) {
...
@@ -20,12 +22,25 @@ KM.registerToolbarUI( 'layout', function ( name ) {
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
me
.
execCommand
(
"switchlayout"
,
res
.
value
);
me
.
execCommand
(
name
,
res
.
value
);
}
).
on
(
"beforeshow"
,
function
()
{
}
).
on
(
"beforeshow"
,
function
()
{
if
(
$combox
.
parent
().
length
===
0
)
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}
}
);
}
);
//状态反射
me
.
on
(
'interactchange'
,
function
()
{
var
state
=
this
.
queryCommandState
(
name
),
value
=
this
.
queryCommandValue
(
name
);
//设置按钮状态
comboboxWidget
.
button
().
kmui
().
disabled
(
state
==
-
1
).
active
(
state
==
1
);
if
(
value
)
{
//设置label
value
=
value
.
replace
(
/
[
'"
]
/g
,
''
).
toLowerCase
().
split
(
/
[
'|"
]?\s
*,
\s
*
[\1]?
/
);
comboboxWidget
.
selectItemByLabel
(
value
);
}
}
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
}
);
}
);
\ No newline at end of file
src/adapter/saveto.js
View file @
de0293e2
...
@@ -24,11 +24,59 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -24,11 +24,59 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
text
),
true
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
text
),
true
);
}
);
}
);
//实例化
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
if
(
res
.
value
===
"png"
)
{
var
svghtml
=
$
(
"#kityminder .kmui-editor-body"
).
html
();
var
rootBox
=
me
.
getRoot
().
getRenderContainer
().
getRenderBox
();
var
svg
=
$
(
svghtml
).
attr
(
{
width
:
rootBox
.
x
+
me
.
getRenderContainer
().
getWidth
()
+
20
,
height
:
rootBox
.
y
+
me
.
getRenderContainer
().
getHeight
()
+
20
,
viewBox
:
null
}
);
var
div
=
$
(
"<div></div>"
).
append
(
svg
);
svghtml
=
div
.
html
();
var
canvas
=
$
(
'<canvas style="border:2px solid black;" width="'
+
svg
.
attr
(
"width"
)
+
'" height="'
+
svg
.
attr
(
"height"
)
+
'"></canvas>'
);
var
ctx
=
canvas
[
0
].
getContext
(
"2d"
);
var
DOMURL
=
self
.
URL
||
self
.
webkitURL
||
self
;
var
img
=
new
Image
();
var
svg
=
new
Blob
(
[
svghtml
],
{
type
:
"image/svg+xml;charset=utf-8"
}
);
var
url
=
DOMURL
.
createObjectURL
(
svg
);
img
.
onload
=
function
()
{
ctx
.
drawImage
(
img
,
0
,
0
);
DOMURL
.
revokeObjectURL
(
url
);
var
type
=
'png'
;
var
imgData
=
canvas
[
0
].
toDataURL
(
type
);
var
_fixType
=
function
(
type
)
{
type
=
type
.
toLowerCase
().
replace
(
/jpg/i
,
'jpeg'
);
var
r
=
type
.
match
(
/png|jpeg|bmp|gif/
)[
0
];
return
'image/'
+
r
;
};
imgData
=
imgData
.
replace
(
_fixType
(
type
),
'image/octet-stream'
);
var
saveFile
=
function
(
data
,
filename
)
{
var
save_link
=
document
.
createElementNS
(
'http://www.w3.org/1999/xhtml'
,
'a'
);
save_link
.
href
=
data
;
save_link
.
download
=
filename
;
var
event
=
document
.
createEvent
(
'MouseEvents'
);
event
.
initMouseEvent
(
'click'
,
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
,
false
,
false
,
false
,
false
,
0
,
null
);
save_link
.
dispatchEvent
(
event
);
};
// 下载后的问题名
var
filename
=
'kityminder_'
+
(
new
Date
()
).
getTime
()
+
'.'
+
type
;
// download
saveFile
(
imgData
,
filename
);
};
img
.
src
=
url
;
return
"png"
;
}
var
data
=
me
.
exportData
(
res
.
value
);
var
data
=
me
.
exportData
(
res
.
value
);
var
p
=
KityMinder
.
findProtocal
(
res
.
value
);
var
p
=
KityMinder
.
findProtocal
(
res
.
value
);
var
a
=
downloadLink
;
var
a
=
downloadLink
;
...
@@ -39,15 +87,8 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
...
@@ -39,15 +87,8 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
if
(
$combox
.
parent
().
length
===
0
)
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}
var
combox
=
$combox
.
kmui
();
}
).
on
(
'aftercomboboxselect'
,
function
()
{
this
.
setLabelWithDefaultValue
();
combox
.
traverseItems
(
function
(
label
,
value
)
{
if
(
me
.
queryCommandState
(
value
)
==
-
1
)
{
combox
.
disableItemByLabel
(
label
)
}
else
{
combox
.
enableItemByLabel
(
label
)
}
}
)
}
);
}
);
...
...
src/module/dragtree.js
View file @
de0293e2
...
@@ -32,7 +32,7 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
...
@@ -32,7 +32,7 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
function
boxMapper
(
node
)
{
function
boxMapper
(
node
)
{
return
node
.
getRenderContainer
().
getRenderBox
();
return
node
.
getRenderContainer
().
getRenderBox
(
'top'
);
}
}
// 对拖动对象的一个替代盒子,控制整个拖放的逻辑,包括:
// 对拖动对象的一个替代盒子,控制整个拖放的逻辑,包括:
...
...
src/module/editor.js
View file @
de0293e2
...
@@ -12,9 +12,13 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -12,9 +12,13 @@ KityMinder.registerModule( "TextEditModule", function () {
var
lastEvtPosition
,
dir
=
1
;
var
lastEvtPosition
,
dir
=
1
;
km
.
isTextEditStatus
=
function
(){
km
.
isTextEditStatus
=
function
(){
return
km
.
receiver
.
isTextEditStatus
();
return
km
.
receiver
.
isTextEditStatus
();
}
};
var
selectionByClick
=
false
;
return
{
return
{
//插入光标
//插入光标
...
@@ -25,12 +29,19 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -25,12 +29,19 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousedown'
:
function
(
e
){
'beforemousedown'
:
function
(
e
){
sel
.
setHide
();
sel
.
setHide
();
var
node
=
e
.
getTargetNode
();
var
node
=
e
.
getTargetNode
();
if
(
!
node
){
var
selectionShape
=
e
.
kityEvent
.
targetShape
;
if
(
selectionShape
&&
selectionShape
.
getType
()
==
'Selection'
){
selectionByClick
=
true
;
node
=
selectionShape
.
getData
(
'relatedNode'
);
e
.
stopPropagationImmediately
();
}
}
if
(
node
){
if
(
node
){
var
textShape
=
node
.
getTextShape
();
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
// && e.kityEvent.targetShape.getType().toLowerCase()== 'text'
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
// && e.kityEvent.targetShape.getType().toLowerCase()== 'text'
sel
.
collapse
();
sel
.
collapse
();
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
receiver
.
setTextEditStatus
(
true
)
receiver
.
setTextEditStatus
(
true
)
...
@@ -44,15 +55,24 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -44,15 +55,24 @@ KityMinder.registerModule( "TextEditModule", function () {
.
setCurrentIndex
(
e
.
getPosition
())
.
setCurrentIndex
(
e
.
getPosition
())
.
updateSelection
()
.
updateSelection
()
.
setRange
(
range
);
.
setRange
(
range
);
sel
.
setData
(
'relatedNode'
,
node
);
mouseDownStatus
=
true
;
mouseDownStatus
=
true
;
lastEvtPosition
=
e
.
getPosition
();
lastEvtPosition
=
e
.
getPosition
();
if
(
selectionByClick
){
sel
.
setShow
();
selectionByClick
=
false
;
}
}
}
}
}
},
},
'mouseup'
:
function
(
e
){
'mouseup'
:
function
(
e
){
if
(
!
sel
.
collapsed
&&
mouseDownStatus
){
if
(
mouseDownStatus
){
if
(
!
sel
.
collapsed
){
receiver
.
updateRange
(
range
)
receiver
.
updateRange
(
range
)
}
else
sel
.
setShow
()
}
}
mouseDownStatus
=
false
;
mouseDownStatus
=
false
;
oneTime
=
0
;
oneTime
=
0
;
},
},
...
@@ -62,7 +82,7 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -62,7 +82,7 @@ KityMinder.registerModule( "TextEditModule", function () {
var
offset
=
e
.
getPosition
();
var
offset
=
e
.
getPosition
();
if
(
Math
.
abs
(
offset
.
y
-
lastEvtPosition
.
y
)
>
2
){
if
(
Math
.
abs
(
offset
.
y
-
lastEvtPosition
.
y
)
>
2
&&
Math
.
abs
(
lastEvtPosition
.
x
-
offset
.
x
)
<
1
){
sel
.
setHide
();
sel
.
setHide
();
mouseDownStatus
=
false
;
mouseDownStatus
=
false
;
return
;
return
;
...
@@ -70,7 +90,7 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -70,7 +90,7 @@ KityMinder.registerModule( "TextEditModule", function () {
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
.
updateSelectionShow
(
dir
);
.
updateSelectionShow
(
dir
);
sel
.
stroke
(
'none'
,
0
);
lastEvtPosition
=
e
.
getPosition
();
lastEvtPosition
=
e
.
getPosition
();
}
}
...
...
src/module/editor.selection.js
View file @
de0293e2
...
@@ -5,9 +5,9 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -5,9 +5,9 @@ Minder.Selection = kity.createClass( 'Selection', {
this
.
callBase
();
this
.
callBase
();
this
.
height
=
height
||
20
;
this
.
height
=
height
||
20
;
this
.
stroke
(
color
||
'
blue
'
,
width
||
1
);
this
.
stroke
(
color
||
'
rgb(27,171,255)
'
,
width
||
1
);
this
.
width
=
1
;
this
.
width
=
0
;
this
.
fill
(
'
#99C8FF
'
);
this
.
fill
(
'
rgb(27,171,255)
'
);
this
.
setHide
();
this
.
setHide
();
this
.
timer
=
null
;
this
.
timer
=
null
;
this
.
collapsed
=
true
;
this
.
collapsed
=
true
;
...
@@ -17,7 +17,8 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -17,7 +17,8 @@ Minder.Selection = kity.createClass( 'Selection', {
},
},
collapse
:
function
(
toEnd
){
collapse
:
function
(
toEnd
){
this
.
stroke
(
'blue'
,
1
);
this
.
stroke
(
'rgb(27,171,255)'
,
1
);
this
.
setOpacity
(
1
);
this
.
width
=
1
;
this
.
width
=
1
;
this
.
collapsed
=
true
;
this
.
collapsed
=
true
;
if
(
toEnd
){
if
(
toEnd
){
...
@@ -38,7 +39,8 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -38,7 +39,8 @@ Minder.Selection = kity.createClass( 'Selection', {
return
this
;
return
this
;
}
}
this
.
collapsed
=
false
;
this
.
collapsed
=
false
;
this
.
stroke
(
'none'
);
this
.
stroke
(
'none'
,
0
);
this
.
setOpacity
(
0.5
);
return
this
;
return
this
;
},
},
setEndOffset
:
function
(
offset
){
setEndOffset
:
function
(
offset
){
...
@@ -52,10 +54,14 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -52,10 +54,14 @@ Minder.Selection = kity.createClass( 'Selection', {
return
this
;
return
this
;
}
}
this
.
collapsed
=
false
;
this
.
collapsed
=
false
;
this
.
stroke
(
'none'
);
this
.
stroke
(
'none'
,
0
);
this
.
setOpacity
(
0.5
);
return
this
;
return
this
;
},
},
updateShow
:
function
(
offset
,
width
){
updateShow
:
function
(
offset
,
width
){
if
(
width
){
this
.
setShowHold
();
}
this
.
setPosition
(
offset
).
setWidth
(
width
);
this
.
setPosition
(
offset
).
setWidth
(
width
);
return
this
;
return
this
;
},
},
...
...
src/module/layout.bottom.js
View file @
de0293e2
...
@@ -464,6 +464,11 @@ KityMinder.registerModule( "LayoutBottom", function () {
...
@@ -464,6 +464,11 @@ KityMinder.registerModule( "LayoutBottom", function () {
translateNode
(
set
[
j
]
);
translateNode
(
set
[
j
]
);
updateConnectAndshIcon
(
set
[
j
]
);
updateConnectAndshIcon
(
set
[
j
]
);
}
}
var
set1
=
updateLayoutMain
();
for
(
var
k
=
0
;
k
<
set1
.
length
;
k
++
)
{
translateNode
(
set1
[
k
]
);
updateConnectAndshIcon
(
set1
[
k
]
);
}
var
_buffer
=
[
nodes
[
0
]
];
var
_buffer
=
[
nodes
[
0
]
];
while
(
_buffer
.
length
!==
0
)
{
while
(
_buffer
.
length
!==
0
)
{
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
_buffer
=
_buffer
.
concat
(
_buffer
[
0
].
getChildren
()
);
...
...
src/module/layout.js
View file @
de0293e2
...
@@ -94,7 +94,10 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -94,7 +94,10 @@ KityMinder.registerModule( "LayoutModule", function () {
var
SwitchLayoutCommand
=
kity
.
createClass
(
"SwitchLayoutCommand"
,
(
function
()
{
var
SwitchLayoutCommand
=
kity
.
createClass
(
"SwitchLayoutCommand"
,
(
function
()
{
return
{
return
{
base
:
Command
,
base
:
Command
,
execute
:
switchLayout
execute
:
switchLayout
,
queryValue
:
function
(
km
)
{
return
km
.
getCurrentStyle
();
}
};
};
}
)()
);
}
)()
);
var
AppendChildNodeCommand
=
kity
.
createClass
(
"AppendChildNodeCommand"
,
(
function
()
{
var
AppendChildNodeCommand
=
kity
.
createClass
(
"AppendChildNodeCommand"
,
(
function
()
{
...
...
src/protocal/png.js
0 → 100644
View file @
de0293e2
KityMinder
.
registerProtocal
(
"png"
,
function
()
{
var
LINE_ENDING
=
'
\
n'
,
TAB_CHAR
=
'
\
t'
;
function
repeat
(
s
,
n
)
{
var
result
=
""
;
while
(
n
--
)
result
+=
s
;
return
result
;
}
function
encode
(
json
,
level
)
{
var
local
=
""
;
level
=
level
||
0
;
local
+=
repeat
(
TAB_CHAR
,
level
);
local
+=
json
.
data
.
text
+
LINE_ENDING
;
if
(
json
.
children
)
{
json
.
children
.
forEach
(
function
(
child
)
{
local
+=
encode
(
child
,
level
+
1
);
}
);
}
return
local
;
}
function
isEmpty
(
line
)
{
return
!
/
\S
/
.
test
(
line
);
}
function
getLevel
(
line
)
{
var
level
=
0
;
while
(
line
.
charAt
(
level
)
===
TAB_CHAR
)
level
++
;
return
level
;
}
function
getNode
(
line
)
{
return
{
data
:
{
text
:
line
.
replace
(
new
RegExp
(
'^'
+
TAB_CHAR
+
'*'
),
''
)
}
};
}
function
decode
(
local
)
{
var
json
,
parentMap
=
{},
lines
=
local
.
split
(
LINE_ENDING
),
line
,
level
,
node
;
function
addChild
(
parent
,
child
)
{
var
children
=
parent
.
children
||
(
parent
.
children
=
[]
);
children
.
push
(
child
);
}
for
(
var
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
line
=
lines
[
i
];
if
(
isEmpty
(
line
)
)
continue
;
level
=
getLevel
(
line
);
node
=
getNode
(
line
);
if
(
level
===
0
)
{
if
(
json
)
{
throw
new
Error
(
'Invalid local format'
);
}
json
=
node
;
}
else
{
if
(
!
parentMap
[
level
-
1
]
)
{
throw
new
Error
(
'Invalid local format'
);
}
addChild
(
parentMap
[
level
-
1
],
node
);
}
parentMap
[
level
]
=
node
;
}
return
json
;
}
var
lastTry
,
lastResult
;
function
recognize
(
local
)
{
if
(
!
Utils
.
isString
(
local
)
)
return
false
;
lastTry
=
local
;
try
{
lastResult
=
decode
(
local
);
}
catch
(
e
)
{
lastResult
=
null
;
}
return
!!
lastResult
;
}
return
{
fileDescription
:
'png'
,
fileExtension
:
'.png'
,
encode
:
function
(
json
)
{
return
encode
(
json
,
0
);
},
decode
:
function
(
local
)
{
if
(
lastTry
==
local
&&
lastResult
)
{
return
lastResult
;
}
return
decode
(
local
);
},
recognize
:
recognize
,
recognizePriority
:
-
1
};
}
);
\ No newline at end of file
src/ui/combobox.js
View file @
de0293e2
...
@@ -134,9 +134,7 @@
...
@@ -134,9 +134,7 @@
*/
*/
select
:
function
(
index
){
select
:
function
(
index
){
if
(
!
this
.
data
(
'options'
).
enabledRecord
){
return
this
;
}
var
options
=
this
.
data
(
'options'
),
var
options
=
this
.
data
(
'options'
),
itemCount
=
options
.
itemCount
,
itemCount
=
options
.
itemCount
,
items
=
options
.
autowidthitem
;
items
=
options
.
autowidthitem
;
...
@@ -166,6 +164,7 @@
...
@@ -166,6 +164,7 @@
this
.
trigger
(
'changebefore'
,
items
[
index
]
);
this
.
trigger
(
'changebefore'
,
items
[
index
]
);
this
.
_update
(
index
);
this
.
_update
(
index
);
this
.
trigger
(
'changeafter'
,
items
[
index
]
);
this
.
trigger
(
'changeafter'
,
items
[
index
]
);
...
@@ -334,6 +333,7 @@
...
@@ -334,6 +333,7 @@
var
options
=
this
.
data
(
"options"
),
var
options
=
this
.
data
(
"options"
),
newStack
=
[];
newStack
=
[];
if
(
this
.
data
(
'options'
).
enabledRecord
){
$
.
each
(
options
.
recordStack
,
function
(
i
,
item
){
$
.
each
(
options
.
recordStack
,
function
(
i
,
item
){
if
(
item
!=
index
)
{
if
(
item
!=
index
)
{
...
@@ -350,6 +350,8 @@
...
@@ -350,6 +350,8 @@
}
}
options
.
recordStack
=
newStack
;
options
.
recordStack
=
newStack
;
}
options
.
selected
=
index
;
options
.
selected
=
index
;
this
.
_repaint
();
this
.
_repaint
();
...
...
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