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
9e0d0b69
Commit
9e0d0b69
authored
Feb 14, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save to
parent
d66345b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
22 deletions
+32
-22
saveto.js
src/adapter/saveto.js
+28
-22
json.js
src/protocal/json.js
+2
-0
plain.js
src/protocal/plain.js
+2
-0
No files found.
src/adapter/saveto.js
View file @
9e0d0b69
KM
.
registerUI
(
'saveto'
,
function
(
name
)
{
KM
.
registerUI
(
'saveto'
,
function
(
name
)
{
var
me
=
this
,
label
=
me
.
getLang
(
'tooltips.'
+
name
),
label
=
me
.
getLang
(
'tooltips.'
+
name
),
options
=
{
label
:
label
,
title
:
label
,
...
...
@@ -14,32 +14,38 @@ KM.registerUI('saveto', function( name ) {
$combox
=
null
,
comboboxWidget
=
null
;
var
downloadLink
=
document
.
createElement
(
'a'
);
utils
.
each
(
KityMinder
.
getAllRegisteredProtocals
(),
function
(
k
){
options
.
value
.
push
(
k
);
options
.
items
.
push
(
k
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
k
)
);
});
utils
.
each
(
KityMinder
.
getAllRegisteredProtocals
(),
function
(
k
)
{
var
p
=
KityMinder
.
findProtocal
(
k
);
var
text
=
p
.
fileDescription
+
'('
+
p
.
fileExtension
+
')'
;
options
.
value
.
push
(
k
);
options
.
items
.
push
(
text
);
options
.
autowidthitem
.
push
(
$
.
wordCountAdaptive
(
text
),
true
);
}
);
//实例化
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
){
alert
(
me
.
exportData
(
res
.
value
));
}).
on
(
"beforeshow"
,
function
(){
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
$combox
=
$
.
kmuibuttoncombobox
(
options
).
css
(
'zIndex'
,
me
.
getOptions
(
'zIndex'
)
+
1
);
comboboxWidget
=
$combox
.
kmui
();
comboboxWidget
.
on
(
'comboboxselect'
,
function
(
evt
,
res
)
{
var
data
=
me
.
exportData
(
res
.
value
);
var
p
=
KityMinder
.
findProtocal
(
res
.
value
);
var
a
=
downloadLink
;
a
.
setAttribute
(
'download'
,
'MyMind'
+
p
.
fileExtension
);
a
.
setAttribute
(
'href'
,
'data:text/plain; utf-8,'
+
encodeURI
(
data
)
);
a
.
dispatchEvent
(
new
MouseEvent
(
'click'
)
);
}
).
on
(
"beforeshow"
,
function
()
{
if
(
$combox
.
parent
().
length
===
0
)
{
$combox
.
appendTo
(
me
.
$container
.
find
(
'.kmui-dialog-container'
)
);
}
}).
on
(
'aftercomboboxselect'
,
function
(){
this
.
setLabelWithDefaultValue
()
});
}
).
on
(
'aftercomboboxselect'
,
function
()
{
this
.
setLabelWithDefaultValue
();
}
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
}
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
}
);
\ No newline at end of file
src/protocal/json.js
View file @
9e0d0b69
...
...
@@ -6,6 +6,8 @@ KityMinder.registerProtocal( 'json', function () {
return
value
;
}
return
{
fileDescription
:
'KityMinder'
,
fileExtension
:
'.km'
,
encode
:
function
(
json
)
{
return
JSON
.
stringify
(
json
,
filter
);
},
...
...
src/protocal/plain.js
View file @
9e0d0b69
...
...
@@ -85,6 +85,8 @@ KityMinder.registerProtocal( "plain", function () {
return
!!
lastResult
;
}
return
{
fileDescription
:
'大纲文本'
,
fileExtension
:
'.txt'
,
encode
:
function
(
json
)
{
return
encode
(
json
,
0
);
},
...
...
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