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
7dc71dce
Commit
7dc71dce
authored
Jul 07, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:fex-team/kityminder into dev
parents
d18c5145
cc241e11
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
23 deletions
+29
-23
editor.js
src/module/editor.js
+1
-1
editor.receiver.js
src/module/editor.receiver.js
+18
-5
editor.selection.js
src/module/editor.selection.js
+10
-17
No files found.
src/module/editor.js
View file @
7dc71dce
...
...
@@ -95,7 +95,7 @@ KityMinder.registerModule('TextEditModule', function() {
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
sel
.
collapse
();
sel
.
collapse
(
true
);
sel
.
setColor
(
node
.
getStyle
(
'text-selection-color'
));
receiver
.
setMinderNode
(
node
)
...
...
src/module/editor.receiver.js
View file @
7dc71dce
...
...
@@ -200,6 +200,10 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
km
.
setStatus
(
'normal'
);
return
;
}
if
(
!
orgEvt
.
shiftKey
){
this
.
selection
.
baseOffset
=
this
.
selection
.
currentEndOffset
=
null
;
}
break
;
// case keymap.Shift:
case
keymap
.
Control
:
...
...
@@ -215,9 +219,7 @@ Minder.Receiver = kity.createClass('Receiver', {
}
//针对按住shift+方向键进行处理
if
(
orgEvt
.
shiftKey
&&
keymap
.
direction
[
keyCode
]
&&
this
.
selection
.
isShow
()){
if
(
this
.
selection
.
baseOffset
===
null
){
this
.
selection
.
baseOffset
=
this
.
selection
.
startOffset
;
this
.
selection
.
currentEndOffset
=
this
.
selection
.
endOffset
;
}
...
...
@@ -292,9 +294,21 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
Enter
:
case
keymap
.
Tab
:
case
keymap
.
F2
:
if
(
browser
.
ipad
){
if
(
this
.
selection
.
isShow
()){
this
.
clear
();
this
.
km
.
setStatus
(
'inputready'
);
clearTimeout
(
me
.
inputTextTimer
);
e
.
preventDefault
();
}
else
{
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
fire
(
'contentchange'
);
}
restoreTextContent
();
return
;
}
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
setTextToContainer
();
}
if
(
this
.
keydownNode
===
this
.
minderNode
)
{
this
.
rollbackStatus
();
...
...
@@ -305,7 +319,6 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
Del
:
case
keymap
.
Backspace
:
case
keymap
.
Spacebar
:
setTextToContainer
();
return
;
}
...
...
@@ -450,7 +463,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
selection
.
setStartOffset
(
i
);
}
if
(
offset
.
x
<=
v
.
x
+
v
.
width
/
2
)
{
me
.
selection
.
collapse
();
me
.
selection
.
collapse
(
true
);
}
else
{
me
.
selection
.
setEndOffset
(
i
+
((
me
.
selection
.
endOffset
>
i
||
dir
==
1
)
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
));
...
...
src/module/editor.selection.js
View file @
7dc71dce
...
...
@@ -19,25 +19,22 @@ Minder.Selection = kity.createClass( 'Selection', {
setColor
:
function
(
color
){
this
.
fill
(
color
);
},
collapse
:
function
(
to
End
){
collapse
:
function
(
to
Start
){
this
.
setOpacity
(
1
);
this
.
width
=
2
;
this
.
collapsed
=
true
;
if
(
toEnd
){
this
.
startOffset
=
this
.
endOffset
;
}
else
{
if
(
toStart
){
this
.
endOffset
=
this
.
startOffset
;
}
else
{
this
.
startOffset
=
this
.
endOffset
;
}
return
this
;
},
setStartOffset
:
function
(
offset
){
this
.
startOffset
=
offset
;
var
tmpOffset
=
this
.
startOffset
;
if
(
this
.
startOffset
>
this
.
endOffset
){
this
.
startOffset
=
this
.
endOffset
;
this
.
endOffset
=
tmpOffset
;
}
else
if
(
this
.
startOffset
==
this
.
endOffset
){
this
.
collapse
();
if
(
this
.
startOffset
>=
this
.
endOffset
){
this
.
collapse
(
true
);
return
this
;
}
this
.
collapsed
=
false
;
...
...
@@ -46,16 +43,12 @@ Minder.Selection = kity.createClass( 'Selection', {
},
setEndOffset
:
function
(
offset
){
this
.
endOffset
=
offset
;
var
tmpOffset
=
this
.
endOffset
;
if
(
this
.
endOffset
<
this
.
startOffset
){
this
.
endOffset
=
this
.
startOffset
;
this
.
startOffset
=
tmpOffset
;
}
else
if
(
this
.
startOffset
==
this
.
endOffset
){
this
.
collapse
();
if
(
this
.
endOffset
<=
this
.
startOffset
){
this
.
startOffset
=
offset
;
this
.
collapse
(
true
);
return
this
;
}
this
.
collapsed
=
false
;
// this.stroke('none',0);
this
.
setOpacity
(
0.5
);
return
this
;
},
...
...
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