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
d6f01c94
Commit
d6f01c94
authored
Sep 09, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加换行机制
parent
e3d55a0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
editor.keyboard.js
src/module/editor.keyboard.js
+18
-6
editor.range.js
src/module/editor.range.js
+11
-0
No files found.
src/module/editor.keyboard.js
View file @
d6f01c94
...
@@ -83,7 +83,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -83,7 +83,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
// }
// }
//重新渲染节点
//重新渲染节点
me
.
minderNode
.
setText
(
text
);
me
.
minderNode
.
setText
(
text
);
me
.
re
.
setContainerStyle
();
me
.
re
.
setContainerStyle
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
...
@@ -109,10 +108,11 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -109,10 +108,11 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me
.
timer
=
setTimeout
(
function
()
{
me
.
timer
=
setTimeout
(
function
()
{
if
(
me
.
selection
.
isShow
()){
if
(
me
.
selection
.
isShow
()){
me
.
selection
.
setShow
();
me
.
selection
.
setShow
();
}
}
},
200
);
},
200
);
...
@@ -227,7 +227,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -227,7 +227,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
case
keymap
.
F2
:
case
keymap
.
F2
:
if
(
browser
.
ipad
){
if
(
browser
.
ipad
){
if
(
this
.
selection
.
isShow
()){
if
(
this
.
selection
.
isShow
()){
this
.
clear
();
this
.
re
.
clear
();
this
.
km
.
setStatus
(
'inputready'
);
this
.
km
.
setStatus
(
'inputready'
);
clearTimeout
(
me
.
inputTextTimer
);
clearTimeout
(
me
.
inputTextTimer
);
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -237,12 +237,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -237,12 +237,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
}
}
return
;
return
;
}
}
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
me
.
_setTextToContainer
(
keyCode
);
me
.
_setTextToContainer
(
keyCode
);
}
}
if
(
this
.
keydownNode
===
this
.
minderNode
)
{
if
(
this
.
re
.
keydownNode
===
this
.
re
.
minderNode
)
{
this
.
rollbackStatus
();
this
.
km
.
rollbackStatus
();
this
.
clear
();
this
.
re
.
clear
();
}
}
e
.
preventDefault
();
e
.
preventDefault
();
return
;
return
;
...
@@ -317,9 +318,20 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -317,9 +318,20 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
rng
.
insertNode
(
br
);
rng
.
insertNode
(
br
);
rng
.
setStartAfter
(
br
);
rng
.
setStartAfter
(
br
);
rng
.
collapse
(
true
);
rng
.
collapse
(
true
);
var
start
=
rng
.
startContainer
.
childNodes
[
rng
.
startOffset
];
if
(
start
&&
start
.
nodeType
==
3
&&
start
.
nodeValue
.
length
===
0
){
start
.
parentNode
.
removeChild
(
start
);
if
(
!
rng
.
startContainer
.
childNodes
[
rng
.
startOffset
]){
br
=
br
.
cloneNode
(
false
);
rng
.
startContainer
.
appendChild
(
br
);
rng
.
setStartBefore
(
br
);
rng
.
collapse
(
true
);
}
}
rng
.
select
();
rng
.
select
();
me
.
_setTextToContainer
(
keymap
.
Enter
);
me
.
_setTextToContainer
(
keymap
.
Enter
);
}
}
};
};
...
...
src/module/editor.range.js
View file @
d6f01c94
...
@@ -71,6 +71,13 @@ Minder.Range = kity.createClass('Range',function(){
...
@@ -71,6 +71,13 @@ Minder.Range = kity.createClass('Range',function(){
start
.
appendChild
(
char
);
start
.
appendChild
(
char
);
this
.
nativeRange
.
setStart
(
char
,
1
);
this
.
nativeRange
.
setStart
(
char
,
1
);
this
.
nativeRange
.
collapse
(
true
);
this
.
nativeRange
.
collapse
(
true
);
}
else
if
(
this
.
collapsed
&&
start
.
nodeType
==
1
){
start
=
start
.
childNodes
[
this
.
startOffset
];
if
(
start
&&
start
.
nodeType
==
3
&&
start
.
nodeValue
.
length
===
0
){
this
.
nativeRange
.
setStart
(
start
,
1
);
this
.
nativeRange
.
collapse
(
true
);
}
}
}
try
{
try
{
this
.
nativeSel
.
removeAllRanges
();
this
.
nativeSel
.
removeAllRanges
();
...
@@ -84,6 +91,7 @@ Minder.Range = kity.createClass('Range',function(){
...
@@ -84,6 +91,7 @@ Minder.Range = kity.createClass('Range',function(){
_updateBoundary
:
function
(){
_updateBoundary
:
function
(){
var
nRange
=
this
.
nativeRange
;
var
nRange
=
this
.
nativeRange
;
this
.
startContainer
=
nRange
.
startContainer
;
this
.
startContainer
=
nRange
.
startContainer
;
this
.
startContainer
=
nRange
.
startContainer
;
this
.
endContainer
=
nRange
.
endContainer
;
this
.
endContainer
=
nRange
.
endContainer
;
this
.
startOffset
=
nRange
.
startOffset
;
this
.
startOffset
=
nRange
.
startOffset
;
this
.
endOffset
=
nRange
.
endOffset
;
this
.
endOffset
=
nRange
.
endOffset
;
...
@@ -108,6 +116,9 @@ Minder.Range = kity.createClass('Range',function(){
...
@@ -108,6 +116,9 @@ Minder.Range = kity.createClass('Range',function(){
setStartAfter
:
function
(
node
){
setStartAfter
:
function
(
node
){
return
this
.
setStart
(
node
.
parentNode
,
utils
.
getNodeIndex
(
node
)
+
1
);
return
this
.
setStart
(
node
.
parentNode
,
utils
.
getNodeIndex
(
node
)
+
1
);
},
},
setStartBefore
:
function
(
node
){
return
this
.
setStart
(
node
.
parentNode
,
utils
.
getNodeIndex
(
node
));
},
setEnd
:
function
(
node
,
offset
){
setEnd
:
function
(
node
,
offset
){
this
.
nativeRange
.
setEnd
(
node
,
offset
);
this
.
nativeRange
.
setEnd
(
node
,
offset
);
this
.
_updateBoundary
();
this
.
_updateBoundary
();
...
...
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