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
726ee5bb
Commit
726ee5bb
authored
Jul 08, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release-1.2.0' of github.com:fex-team/kityminder into release-1.2.0
parents
ef6bcd56
548d0666
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
4 deletions
+60
-4
editor.js
src/module/editor.js
+9
-1
editor.receiver.js
src/module/editor.receiver.js
+23
-3
keyboard.js
src/module/keyboard.js
+28
-0
No files found.
src/module/editor.js
View file @
726ee5bb
...
...
@@ -106,6 +106,7 @@ KityMinder.registerModule('TextEditModule', function() {
lastEvtPosition
=
e
.
getPosition
(
this
.
getRenderContainer
());
if
(
selectionReadyShow
){
textShape
.
setStyle
(
'cursor'
,
'text'
);
sel
.
clearBaseOffset
();
receiver
.
updateSelection
();
...
...
@@ -156,7 +157,8 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
&&
!
selectionReadyShow
&&
receiver
.
isReady
())
{
sel
.
collapse
();
sel
.
collapse
(
true
);
sel
.
setColor
(
node
.
getStyle
(
'text-selection-color'
));
...
...
@@ -165,6 +167,12 @@ KityMinder.registerModule('TextEditModule', function() {
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
receiver
.
updateSelection
();
//必须再次focus,要不不能呼出键盘
if
(
browser
.
ipad
){
receiver
.
focus
();
}
setTimeout
(
function
()
{
sel
.
setShow
();
},
200
);
...
...
src/module/editor.receiver.js
View file @
726ee5bb
...
...
@@ -10,6 +10,7 @@ Minder.Receiver = kity.createClass('Receiver', {
}
this
.
index
=
0
;
this
.
isTypeText
=
false
;
this
.
lastMinderNode
=
null
;
return
this
;
},
constructor
:
function
(
km
,
sel
,
range
)
{
...
...
@@ -20,12 +21,19 @@ Minder.Receiver = kity.createClass('Receiver', {
_div
.
setAttribute
(
'contenteditable'
,
true
);
_div
.
className
=
'km_receiver'
;
this
.
container
=
_div
;
if
(
browser
.
ie
&&
browser
.
version
==
11
||
browser
.
ipad
)
{
if
(
browser
.
ipad
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup input'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
'beforekeyup'
:
e
.
type
,
e
));
if
(
e
.
type
==
'keyup'
){
if
(
me
.
km
.
getStatus
()
==
'normal'
){
me
.
km
.
fire
(
'keyup'
,
e
);
}
}
});
}
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{white-space:nowrap;position:absolute;padding:0;margin:0;word-wrap:break-word;
clip:rect(1em 1em 1em 1em);'
);
//
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{white-space:nowrap;position:absolute;padding:0;margin:0;word-wrap:break-word;
'
+
(
/
\?
debug$/
.
test
(
location
.
href
)?
''
:
'clip:rect(1em 1em 1em 1em);'
));
this
.
km
.
on
(
'inputready.beforekeyup inputready.beforekeydown textedit.beforekeyup textedit.beforekeydown textedit.keypress textedit.paste'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
));
this
.
timer
=
null
;
this
.
index
=
0
;
...
...
@@ -124,7 +132,9 @@ Minder.Receiver = kity.createClass('Receiver', {
if
(
browser
.
gecko
&&
/
\s
$/
.
test
(
text
))
{
text
+=
'
\
u200b'
;
}
if
(
text
.
length
===
0
)
{
me
.
minderNode
.
setTmpData
(
'_lastTextContent'
,
me
.
textShape
.
getContent
());
me
.
minderNode
.
setText
(
'a'
);
}
else
{
...
...
@@ -348,6 +358,13 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
Del
:
case
keymap
.
Backspace
:
case
keymap
.
Spacebar
:
if
(
browser
.
ipad
){
if
(
this
.
selection
.
isHide
()){
this
.
km
.
setStatus
(
'normal'
);
return
;
}
}
setTextToContainer
(
keyCode
);
return
;
}
...
...
@@ -404,7 +421,7 @@ Minder.Receiver = kity.createClass('Receiver', {
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
this
.
container
.
style
.
cssText
=
';left:'
+
(
browser
.
ipad
?
'-'
:
''
)
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
)
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
+
(
/
\?
debug$/
.
test
(
location
.
href
)?
30
:
0
)
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
return
this
;
...
...
@@ -581,5 +598,8 @@ Minder.Receiver = kity.createClass('Receiver', {
},
isReady
:
function
(){
return
this
.
_ready
;
},
focus
:
function
(){
this
.
container
.
focus
();
}
});
\ No newline at end of file
src/module/keyboard.js
View file @
726ee5bb
...
...
@@ -182,6 +182,34 @@ KityMinder.registerModule("KeyboardModule", function() {
break
;
}
},
'normal.keyup'
:
function
(
e
){
if
(
browser
.
ipad
){
var
keys
=
KityMinder
.
keymap
;
var
node
=
e
.
getTargetNode
();
var
lang
=
this
.
getLang
();
if
(
this
.
receiver
)
this
.
receiver
.
keydownNode
=
node
;
var
keyEvent
=
e
.
originEvent
;
if
(
keyEvent
.
altKey
||
keyEvent
.
ctrlKey
||
keyEvent
.
metaKey
||
keyEvent
.
shiftKey
)
return
;
switch
(
keyEvent
.
keyCode
)
{
case
keys
.
Enter
:
this
.
execCommand
(
'AppendSiblingNode'
,
lang
.
topic
);
e
.
preventDefault
();
break
;
case
keys
.
Backspace
:
case
keys
.
Del
:
e
.
preventDefault
();
this
.
execCommand
(
'RemoveNode'
);
break
;
}
}
}
}
};
...
...
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