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
ee0677b8
Commit
ee0677b8
authored
Jul 03, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复光标的方向键问题
parent
97b7b458
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
19 deletions
+10
-19
editor.js
src/module/editor.js
+7
-3
editor.receiver.js
src/module/editor.receiver.js
+3
-16
No files found.
src/module/editor.js
View file @
ee0677b8
...
@@ -48,7 +48,7 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -48,7 +48,7 @@ KityMinder.registerModule('TextEditModule', function() {
return
{
return
{
'events'
:
{
'events'
:
{
'ready'
:
function
()
{
'ready'
:
function
()
{
this
.
_renderTarget
.
appendChild
(
receiver
.
container
);
document
.
body
.
appendChild
(
receiver
.
container
);
},
},
'normal.beforemousedown textedit.beforemousedown inputready.beforemousedown'
:
function
(
e
)
{
'normal.beforemousedown textedit.beforemousedown inputready.beforemousedown'
:
function
(
e
)
{
...
@@ -83,7 +83,6 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -83,7 +83,6 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
sel
.
collapse
();
sel
.
collapse
();
sel
.
setColor
(
node
.
getStyle
(
'text-selection-color'
));
sel
.
setColor
(
node
.
getStyle
(
'text-selection-color'
));
receiver
receiver
.
setMinderNode
(
node
)
.
setMinderNode
(
node
)
.
setCurrentIndex
(
e
.
getPosition
(
this
.
getRenderContainer
()))
.
setCurrentIndex
(
e
.
getPosition
(
this
.
getRenderContainer
()))
...
@@ -133,6 +132,7 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -133,6 +132,7 @@ KityMinder.registerModule('TextEditModule', function() {
}
}
},
},
'normal.mouseup textedit.mouseup inputready.mouseup'
:
function
(
e
)
{
'normal.mouseup textedit.mouseup inputready.mouseup'
:
function
(
e
)
{
mouseDownStatus
=
false
;
mouseDownStatus
=
false
;
var
node
=
e
.
getTargetNode
();
var
node
=
e
.
getTargetNode
();
...
@@ -160,7 +160,11 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -160,7 +160,11 @@ KityMinder.registerModule('TextEditModule', function() {
inputStatusReady
(
e
.
getTargetNode
());
inputStatusReady
(
e
.
getTargetNode
());
}
else
{
}
else
{
//当有光标时,要同步选区
//当有光标时,要同步选区
receiver
.
updateContainerRangeBySel
();
if
(
!
sel
.
collapsed
){
receiver
.
updateContainerRangeBySel
();
}
}
}
...
...
src/module/editor.receiver.js
View file @
ee0677b8
...
@@ -40,6 +40,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -40,6 +40,7 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
range
=
range
;
this
.
range
=
range
;
range
.
setStart
(
text
||
this
.
container
,
this
.
index
).
collapse
(
true
);
range
.
setStart
(
text
||
this
.
container
,
this
.
index
).
collapse
(
true
);
var
me
=
this
;
var
me
=
this
;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
me
.
container
.
focus
();
me
.
container
.
focus
();
range
.
select
();
range
.
select
();
...
@@ -327,25 +328,11 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -327,25 +328,11 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
return
this
;
},
},
setContainerStyle
:
function
()
{
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'
paper
'
);
var
textShapeBox
=
this
.
getBaseOffset
(
'
screen
'
);
this
.
container
.
style
.
cssText
=
';left:'
+
(
browser
.
ipad
?
'-'
:
''
)
+
this
.
container
.
style
.
cssText
=
';left:'
+
(
browser
.
ipad
?
'-'
:
''
)
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
+
textShapeBox
.
height
*
0.1
)
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
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
);
this
.
setContainerStyle
();
}
else
if
(
height
<
this
.
container
.
offsetTop
+
this
.
container
.
offsetHeight
)
{
this
.
km
.
getRenderContainer
().
translate
(
0
,
height
/
-
3
);
this
.
setContainerStyle
();
}
}
return
this
;
return
this
;
},
},
getTextOffsetData
:
function
()
{
getTextOffsetData
:
function
()
{
...
...
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