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
6b28eec0
Commit
6b28eec0
authored
Feb 20, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
fcd6b5aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
9 deletions
+30
-9
editor.js
src/module/editor.js
+10
-2
editor.range.js
src/module/editor.range.js
+6
-1
editor.receiver.js
src/module/editor.receiver.js
+8
-3
editor.selection.js
src/module/editor.selection.js
+3
-2
select.js
src/module/select.js
+3
-1
No files found.
src/module/editor.js
View file @
6b28eec0
...
@@ -59,12 +59,20 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -59,12 +59,20 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousemove'
:
function
(
e
){
'beforemousemove'
:
function
(
e
){
if
(
mouseDownStatus
){
if
(
mouseDownStatus
){
e
.
stopPropagationImmediately
();
e
.
stopPropagationImmediately
();
var
offset
=
e
.
getPosition
();
var
offset
=
e
.
getPosition
();
if
(
Math
.
abs
(
offset
.
y
-
lastEvtPosition
.
y
)
>
2
){
sel
.
setHide
();
mouseDownStatus
=
false
;
return
;
}
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
dir
=
offset
.
x
>
lastEvtPosition
.
x
?
1
:
(
offset
.
x
<
lastEvtPosition
.
x
?
-
1
:
dir
);
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
receiver
.
updateSelectionByMousePosition
(
offset
,
dir
)
.
updateSelectionShow
(
dir
);
.
updateSelectionShow
(
dir
);
sel
.
stroke
(
'none'
,
0
);
sel
.
stroke
(
'none'
,
0
);
lastEvtPosition
=
e
.
getPosition
();
lastEvtPosition
=
e
.
getPosition
();
}
}
},
},
'dblclick'
:
function
(
e
){
'dblclick'
:
function
(
e
){
...
@@ -75,8 +83,8 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -75,8 +83,8 @@ KityMinder.registerModule( "TextEditModule", function () {
sel
.
setStartOffset
(
0
);
sel
.
setStartOffset
(
0
);
sel
.
setEndOffset
(
text
.
getContent
().
length
);
sel
.
setEndOffset
(
text
.
getContent
().
length
);
sel
.
setShow
();
sel
.
setShow
();
receiver
.
updateSelectionShow
(
1
)
receiver
.
setContainerTxt
(
text
.
getContent
()).
updateSelectionShow
(
1
)
.
updateRange
(
range
)
;
.
updateRange
(
range
)
.
setTextEditStatus
(
true
)
}
}
},
},
...
...
src/module/editor.range.js
View file @
6b28eec0
...
@@ -16,7 +16,12 @@ Minder.Range = kity.createClass('Range',{
...
@@ -16,7 +16,12 @@ Minder.Range = kity.createClass('Range',{
return
this
;
return
this
;
},
},
setStart
:
function
(
node
,
index
){
setStart
:
function
(
node
,
index
){
this
.
nativeRange
.
setStart
(
node
,
index
);
try
{
this
.
nativeRange
.
setStart
(
node
,
index
);
}
catch
(
e
){
console
.
log
(
e
)
}
return
this
;
return
this
;
},
},
setEnd
:
function
(
node
,
index
){
setEnd
:
function
(
node
,
index
){
...
...
src/module/editor.receiver.js
View file @
6b28eec0
...
@@ -223,16 +223,17 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -223,16 +223,17 @@ Minder.Receiver = kity.createClass('Receiver',{
return
false
;
return
false
;
}
}
if
(
offset
.
x
>=
v
.
x
&&
offset
.
x
<=
v
.
x
+
v
.
width
){
if
(
offset
.
x
>=
v
.
x
&&
offset
.
x
<=
v
.
x
+
v
.
width
){
if
(
me
.
index
==
i
){
if
(
me
.
index
==
i
){
if
(
i
==
0
){
if
(
i
==
0
){
me
.
selection
.
setStartOffset
(
i
)
me
.
selection
.
setStartOffset
(
i
)
}
}
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
}
else
if
(
i
>
me
.
index
){
}
else
if
(
i
>
me
.
index
){
me
.
selection
.
setStartOffset
(
me
.
index
);
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
me
.
selection
.
setEndOffset
(
i
+
(
dir
==
1
?
1
:
0
))
}
else
{
}
else
{
me
.
selection
.
setStartOffset
(
i
+
(
dir
==
1
?
1
:
0
))
me
.
selection
.
setStartOffset
(
i
+
(
dir
==
1
?
1
:
0
));
me
.
selection
.
setEndOffset
(
me
.
index
)
}
}
return
false
;
return
false
;
...
@@ -246,7 +247,7 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -246,7 +247,7 @@ Minder.Receiver = kity.createClass('Receiver',{
width
=
0
;
width
=
0
;
if
(
this
.
selection
.
collapsed
){
if
(
this
.
selection
.
collapsed
){
this
.
selection
.
updateShow
(
startOffset
,
0
);
this
.
selection
.
updateShow
(
startOffset
||
this
.
textData
[
this
.
textData
.
length
-
1
]
,
0
);
return
this
;
return
this
;
}
}
if
(
!
endOffset
){
if
(
!
endOffset
){
...
@@ -269,5 +270,9 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -269,5 +270,9 @@ Minder.Receiver = kity.createClass('Receiver',{
setIndex
:
function
(
index
){
setIndex
:
function
(
index
){
this
.
index
=
index
;
this
.
index
=
index
;
return
this
return
this
},
setContainerTxt
:
function
(
txt
){
this
.
container
.
textContent
=
txt
;
return
this
;
}
}
});
});
\ No newline at end of file
src/module/editor.selection.js
View file @
6b28eec0
...
@@ -12,7 +12,8 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -12,7 +12,8 @@ Minder.Selection = kity.createClass( 'Selection', {
this
.
timer
=
null
;
this
.
timer
=
null
;
this
.
collapsed
=
true
;
this
.
collapsed
=
true
;
this
.
startOffset
=
this
.
endOffset
=
0
;
this
.
startOffset
=
this
.
endOffset
=
0
;
this
.
setOpacity
(
0.5
)
this
.
setOpacity
(
0.5
);
this
.
setStyle
(
'cursor'
,
'text'
);
},
},
collapse
:
function
(
toEnd
){
collapse
:
function
(
toEnd
){
...
@@ -64,7 +65,7 @@ Minder.Selection = kity.createClass( 'Selection', {
...
@@ -64,7 +65,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this
.
y
=
offset
.
y
;
this
.
y
=
offset
.
y
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
debugger
}
}
return
this
.
update
();
return
this
.
update
();
...
...
src/module/select.js
View file @
6b28eec0
...
@@ -29,7 +29,9 @@ KityMinder.registerModule( "Select", function () {
...
@@ -29,7 +29,9 @@ KityMinder.registerModule( "Select", function () {
startPosition
=
g
.
snapToSharp
(
e
.
getPosition
()
);
startPosition
=
g
.
snapToSharp
(
e
.
getPosition
()
);
},
},
selectMove
:
function
(
e
)
{
selectMove
:
function
(
e
)
{
if
(
minder
.
isTextEditStatus
()){
return
;
}
if
(
!
startPosition
)
return
;
if
(
!
startPosition
)
return
;
var
p1
=
startPosition
,
var
p1
=
startPosition
,
...
...
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