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
a7f18700
Commit
a7f18700
authored
May 09, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复ie11的光标
parent
0a733593
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
editor.range.js
src/module/editor.range.js
+6
-1
editor.receiver.js
src/module/editor.receiver.js
+9
-5
No files found.
src/module/editor.range.js
View file @
a7f18700
...
@@ -11,7 +11,12 @@ Minder.Range = kity.createClass('Range',{
...
@@ -11,7 +11,12 @@ Minder.Range = kity.createClass('Range',{
this
.
nativeRange
.
setStart
(
char
,
1
);
this
.
nativeRange
.
setStart
(
char
,
1
);
this
.
nativeRange
.
collapse
(
true
);
this
.
nativeRange
.
collapse
(
true
);
}
}
this
.
nativeSel
.
removeAllRanges
();
try
{
this
.
nativeSel
.
removeAllRanges
();
}
catch
(
e
){
}
this
.
nativeSel
.
addRange
(
this
.
nativeRange
);
this
.
nativeSel
.
addRange
(
this
.
nativeRange
);
return
this
;
return
this
;
},
},
...
...
src/module/editor.receiver.js
View file @
a7f18700
...
@@ -16,12 +16,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
...
@@ -16,12 +16,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return
this
.
textEditStatus
;
return
this
.
textEditStatus
;
},
},
constructor
:
function
(
km
)
{
constructor
:
function
(
km
)
{
var
me
=
this
;
this
.
setKityMinder
(
km
);
this
.
setKityMinder
(
km
);
this
.
textEditStatus
=
false
;
this
.
textEditStatus
=
false
;
var
_div
=
document
.
createElement
(
'div'
);
var
_div
=
document
.
createElement
(
'div'
);
_div
.
setAttribute
(
'contenteditable'
,
true
);
_div
.
setAttribute
(
'contenteditable'
,
true
);
_div
.
className
=
'km_receiver'
;
_div
.
className
=
'km_receiver'
;
this
.
container
=
document
.
body
.
insertBefore
(
_div
,
document
.
body
.
firstChild
);
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
))
})
}
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}'
);
//
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
)
);
this
.
km
.
on
(
'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
)
);
this
.
timer
=
null
;
this
.
timer
=
null
;
...
@@ -114,6 +120,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
...
@@ -114,6 +120,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
switch
(
e
.
type
)
{
switch
(
e
.
type
)
{
case
'keydown'
:
case
'keydown'
:
isTypeText
=
false
;
isTypeText
=
false
;
isKeypress
=
false
;
isKeypress
=
false
;
switch
(
e
.
originEvent
.
keyCode
)
{
switch
(
e
.
originEvent
.
keyCode
)
{
...
@@ -162,6 +169,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
...
@@ -162,6 +169,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
case
'keypress'
:
case
'keypress'
:
if
(
isTypeText
)
if
(
isTypeText
)
setTextToContainer
();
setTextToContainer
();
isKeypress
=
true
;
isKeypress
=
true
;
...
@@ -169,7 +177,6 @@ Minder.Receiver = kity.createClass( 'Receiver', {
...
@@ -169,7 +177,6 @@ Minder.Receiver = kity.createClass( 'Receiver', {
case
'beforekeyup'
:
case
'beforekeyup'
:
switch
(
keyCode
)
{
switch
(
keyCode
)
{
case
keymap
.
Enter
:
case
keymap
.
Enter
:
case
keymap
.
Tab
:
case
keymap
.
Tab
:
...
@@ -241,18 +248,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
...
@@ -241,18 +248,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
},
setContainerStyle
:
function
()
{
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
this
.
container
.
style
.
cssText
=
";left:"
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
-
5
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
this
.
container
.
style
.
cssText
=
";left:"
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
-
3
5
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
if
(
!
this
.
selection
.
isShow
()){
if
(
!
this
.
selection
.
isShow
()){
var
paperContainer
=
this
.
km
.
getPaper
();
var
paperContainer
=
this
.
km
.
getPaper
();
var
width
=
paperContainer
.
node
.
parentNode
.
clientWidth
;
var
width
=
paperContainer
.
node
.
parentNode
.
clientWidth
;
var
height
=
paperContainer
.
node
.
parentNode
.
clientHeight
;
var
height
=
paperContainer
.
node
.
parentNode
.
clientHeight
;
if
(
width
<
this
.
container
.
offsetWidth
+
this
.
container
.
offsetLeft
){
if
(
width
<
this
.
container
.
offsetWidth
+
this
.
container
.
offsetLeft
){
this
.
km
.
getRenderContainer
().
translate
(
width
/-
3
,
0
);
this
.
km
.
getRenderContainer
().
translate
(
width
/-
3
,
0
);
this
.
setContainerStyle
();
this
.
setContainerStyle
();
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
){
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
){
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/-
3
);
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/-
3
);
this
.
setContainerStyle
()
this
.
setContainerStyle
()
...
...
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