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
d2d0c27e
Commit
d2d0c27e
authored
May 09, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format
parent
f0cb4ee8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
55 deletions
+55
-55
index.html
dist/index.html
+11
-11
kityminder.all.js
dist/kityminder.all.js
+22
-22
editor.receiver.js
src/module/editor.receiver.js
+22
-22
No files found.
dist/index.html
View file @
d2d0c27e
...
...
@@ -7,26 +7,26 @@
<meta
name=
"description"
content=
"百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"
>
<script
src=
"lib/jquery-2.1.0.min.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lib/ZeroClipboard.min.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lib/jquery-2.1.0.min.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"lib/ZeroClipboard.min.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
type=
"text/javascript"
>
ZeroClipboard
.
setDefaults
(
{
moviePath
:
'lib/ZeroClipboard.swf'
}
);
</script>
<script
src=
"lib/kitygraph.all.min.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"kityminder.all.min.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"kityminder.config.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lang/zh-cn/zh-cn.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lib/kitygraph.all.min.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"kityminder.all.min.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"kityminder.config.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"lang/zh-cn/zh-cn.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"lib/zip.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lib/zip.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script>
zip
.
inflateJSPath
=
'lib/inflate.js'
;
</script>
<script
src=
"lib/jquery.xml2json.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lib/baidu-frontia-js-full-1.0.0.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"social/draftmanager.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"social/social.js?_=13996
27592968
"
charset=
"utf-8"
></script>
<script
src=
"lib/jquery.xml2json.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"lib/baidu-frontia-js-full-1.0.0.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"social/draftmanager.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<script
src=
"social/social.js?_=13996
30445671
"
charset=
"utf-8"
></script>
<link
href=
"social/social.css"
rel=
"stylesheet"
>
<link
href=
"themes/default/css/import.css"
type=
"text/css"
rel=
"stylesheet"
/>
...
...
dist/kityminder.all.js
View file @
d2d0c27e
...
...
@@ -5406,10 +5406,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div
.
setAttribute
(
'contenteditable'
,
true
);
_div
.
className
=
'km_receiver'
;
this
.
container
=
document
.
body
.
insertBefore
(
_div
,
document
.
body
.
firstChild
);
if
(
browser
.
ie
&&
browser
.
version
==
11
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
"beforekeyup"
:
e
.
type
,
e
)
)
})
if
(
browser
.
ie
&&
browser
.
version
==
11
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
"beforekeyup"
:
e
.
type
,
e
)
)
}
)
}
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}'
);
//
this
.
km
.
on
(
'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
)
);
...
...
@@ -5435,7 +5435,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape
=
new
kity
.
Text
();
}
this
.
textShape
=
textShape
;
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
()
);
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
()
);
return
this
;
},
setTextShapeSize
:
function
(
size
)
{
...
...
@@ -5530,7 +5530,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout
(
function
()
{
me
.
range
.
updateNativeRange
().
insertNode
(
$
(
'<span>$$_kityminder_bookmark_$$</span>'
)[
0
]
);
me
.
container
.
innerHTML
=
utils
.
unhtml
(
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
();
...
...
@@ -5619,10 +5619,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
getBaseOffset
:
function
(
refer
)
{
var
rb
=
this
.
textShape
.
getRenderBox
(
refer
||
this
.
km
.
getRenderContainer
()
);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return
rb
;
},
setBaseOffset
:
function
()
{
...
...
@@ -5630,18 +5630,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return
this
;
},
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
this
.
container
.
style
.
cssText
=
";left:"
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
-
35
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
if
(
!
this
.
selection
.
isShow
())
{
if
(
!
this
.
selection
.
isShow
()
)
{
var
paperContainer
=
this
.
km
.
getPaper
();
var
width
=
paperContainer
.
node
.
parentNode
.
clientWidth
;
var
height
=
paperContainer
.
node
.
parentNode
.
clientHeight
;
if
(
width
<
this
.
container
.
offsetWidth
+
this
.
container
.
offsetLeft
)
{
this
.
km
.
getRenderContainer
().
translate
(
width
/-
3
,
0
);
if
(
width
<
this
.
container
.
offsetWidth
+
this
.
container
.
offsetLeft
)
{
this
.
km
.
getRenderContainer
().
translate
(
width
/
-
3
,
0
);
this
.
setContainerStyle
();
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
)
{
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/-
3
);
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
)
{
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/
-
3
);
this
.
setContainerStyle
()
}
}
...
...
@@ -5657,7 +5657,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
try
{
var
box
=
this
.
textShape
.
getExtentOfChar
(
i
);
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
}
this
.
textData
.
push
(
{
...
...
@@ -5735,7 +5735,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me
.
selection
.
setEndOffset
(
i
+
1
)
}
else
{
if
(
dir
==
1
)
{
me
.
selection
.
setStartOffset
(
i
+
(
offset
.
x
>=
v
.
x
+
v
.
width
/
2
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
)
);
me
.
selection
.
setStartOffset
(
i
+
(
offset
.
x
>=
v
.
x
+
v
.
width
/
2
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
)
);
}
else
{
me
.
selection
.
setStartOffset
(
i
);
}
...
...
@@ -5753,15 +5753,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset
=
this
.
textData
[
this
.
selection
.
endOffset
],
width
=
0
;
if
(
this
.
selection
.
collapsed
)
{
this
.
selection
.
updateShow
(
startOffset
||
this
.
textData
[
this
.
textData
.
length
-
1
],
1
);
this
.
selection
.
updateShow
(
startOffset
||
this
.
textData
[
this
.
textData
.
length
-
1
],
1
);
return
this
;
}
if
(
!
endOffset
)
{
try
{
try
{
var
lastOffset
=
this
.
textData
[
this
.
textData
.
length
-
1
];
width
=
lastOffset
.
x
-
startOffset
.
x
+
lastOffset
.
width
;
}
catch
(
e
)
{
console
.
log
(
'e'
)
}
catch
(
e
)
{
console
.
log
(
'e'
)
}
}
else
{
...
...
src/module/editor.receiver.js
View file @
d2d0c27e
...
...
@@ -23,10 +23,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div
.
setAttribute
(
'contenteditable'
,
true
);
_div
.
className
=
'km_receiver'
;
this
.
container
=
document
.
body
.
insertBefore
(
_div
,
document
.
body
.
firstChild
);
if
(
browser
.
ie
&&
browser
.
version
==
11
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
"beforekeyup"
:
e
.
type
,
e
)
)
})
if
(
browser
.
ie
&&
browser
.
version
==
11
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
"beforekeyup"
:
e
.
type
,
e
)
)
}
)
}
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}'
);
//
this
.
km
.
on
(
'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
)
);
...
...
@@ -52,7 +52,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape
=
new
kity
.
Text
();
}
this
.
textShape
=
textShape
;
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
()
);
this
.
container
.
innerHTML
=
utils
.
unhtml
(
textShape
.
getContent
()
);
return
this
;
},
setTextShapeSize
:
function
(
size
)
{
...
...
@@ -147,7 +147,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout
(
function
()
{
me
.
range
.
updateNativeRange
().
insertNode
(
$
(
'<span>$$_kityminder_bookmark_$$</span>'
)[
0
]
);
me
.
container
.
innerHTML
=
utils
.
unhtml
(
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
();
...
...
@@ -236,10 +236,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
getBaseOffset
:
function
(
refer
)
{
var
rb
=
this
.
textShape
.
getRenderBox
(
refer
||
this
.
km
.
getRenderContainer
()
);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return
rb
;
},
setBaseOffset
:
function
()
{
...
...
@@ -247,18 +247,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return
this
;
},
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
this
.
container
.
style
.
cssText
=
";left:"
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
-
35
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
if
(
!
this
.
selection
.
isShow
())
{
if
(
!
this
.
selection
.
isShow
()
)
{
var
paperContainer
=
this
.
km
.
getPaper
();
var
width
=
paperContainer
.
node
.
parentNode
.
clientWidth
;
var
height
=
paperContainer
.
node
.
parentNode
.
clientHeight
;
if
(
width
<
this
.
container
.
offsetWidth
+
this
.
container
.
offsetLeft
)
{
this
.
km
.
getRenderContainer
().
translate
(
width
/-
3
,
0
);
if
(
width
<
this
.
container
.
offsetWidth
+
this
.
container
.
offsetLeft
)
{
this
.
km
.
getRenderContainer
().
translate
(
width
/
-
3
,
0
);
this
.
setContainerStyle
();
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
)
{
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/-
3
);
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
)
{
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/
-
3
);
this
.
setContainerStyle
()
}
}
...
...
@@ -274,7 +274,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
try
{
var
box
=
this
.
textShape
.
getExtentOfChar
(
i
);
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
}
this
.
textData
.
push
(
{
...
...
@@ -352,7 +352,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me
.
selection
.
setEndOffset
(
i
+
1
)
}
else
{
if
(
dir
==
1
)
{
me
.
selection
.
setStartOffset
(
i
+
(
offset
.
x
>=
v
.
x
+
v
.
width
/
2
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
)
);
me
.
selection
.
setStartOffset
(
i
+
(
offset
.
x
>=
v
.
x
+
v
.
width
/
2
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
)
);
}
else
{
me
.
selection
.
setStartOffset
(
i
);
}
...
...
@@ -370,15 +370,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset
=
this
.
textData
[
this
.
selection
.
endOffset
],
width
=
0
;
if
(
this
.
selection
.
collapsed
)
{
this
.
selection
.
updateShow
(
startOffset
||
this
.
textData
[
this
.
textData
.
length
-
1
],
1
);
this
.
selection
.
updateShow
(
startOffset
||
this
.
textData
[
this
.
textData
.
length
-
1
],
1
);
return
this
;
}
if
(
!
endOffset
)
{
try
{
try
{
var
lastOffset
=
this
.
textData
[
this
.
textData
.
length
-
1
];
width
=
lastOffset
.
x
-
startOffset
.
x
+
lastOffset
.
width
;
}
catch
(
e
)
{
console
.
log
(
'e'
)
}
catch
(
e
)
{
console
.
log
(
'e'
)
}
}
else
{
...
...
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