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
429fb645
Commit
429fb645
authored
Jul 07, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipad支持编辑
parent
edaec00e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
editor.js
src/module/editor.js
+9
-1
editor.receiver.js
src/module/editor.receiver.js
+19
-2
keyboard.js
src/module/keyboard.js
+28
-0
No files found.
src/module/editor.js
View file @
429fb645
...
@@ -106,6 +106,7 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -106,6 +106,7 @@ KityMinder.registerModule('TextEditModule', function() {
lastEvtPosition
=
e
.
getPosition
(
this
.
getRenderContainer
());
lastEvtPosition
=
e
.
getPosition
(
this
.
getRenderContainer
());
if
(
selectionReadyShow
){
if
(
selectionReadyShow
){
textShape
.
setStyle
(
'cursor'
,
'text'
);
textShape
.
setStyle
(
'cursor'
,
'text'
);
sel
.
clearBaseOffset
();
sel
.
clearBaseOffset
();
receiver
.
updateSelection
();
receiver
.
updateSelection
();
...
@@ -156,7 +157,8 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -156,7 +157,8 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
&&
!
selectionReadyShow
&&
receiver
.
isReady
())
{
if
(
node
&&
!
selectionReadyShow
&&
receiver
.
isReady
())
{
sel
.
collapse
();
sel
.
collapse
(
true
);
sel
.
setColor
(
node
.
getStyle
(
'text-selection-color'
));
sel
.
setColor
(
node
.
getStyle
(
'text-selection-color'
));
...
@@ -165,6 +167,12 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -165,6 +167,12 @@ KityMinder.registerModule('TextEditModule', function() {
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
receiver
.
updateSelection
();
receiver
.
updateSelection
();
//必须再次focus,要不不能呼出键盘
if
(
browser
.
ipad
){
receiver
.
focus
();
}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
sel
.
setShow
();
sel
.
setShow
();
},
200
);
},
200
);
...
...
src/module/editor.receiver.js
View file @
429fb645
...
@@ -23,9 +23,16 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -23,9 +23,16 @@ Minder.Receiver = kity.createClass('Receiver', {
if
(
browser
.
ie
&&
browser
.
version
==
11
||
browser
.
ipad
)
{
if
(
browser
.
ie
&&
browser
.
version
==
11
||
browser
.
ipad
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup input'
,
function
(
e
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup input'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
'beforekeyup'
:
e
.
type
,
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
.
km
.
on
(
'inputready.beforekeyup inputready.beforekeydown textedit.beforekeyup textedit.beforekeydown textedit.keypress textedit.paste'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
));
this
.
timer
=
null
;
this
.
timer
=
null
;
this
.
index
=
0
;
this
.
index
=
0
;
...
@@ -344,6 +351,13 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -344,6 +351,13 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
Del
:
case
keymap
.
Del
:
case
keymap
.
Backspace
:
case
keymap
.
Backspace
:
case
keymap
.
Spacebar
:
case
keymap
.
Spacebar
:
if
(
browser
.
ipad
){
if
(
this
.
selection
.
isHide
()){
this
.
km
.
setStatus
(
'normal'
);
return
;
}
}
setTextToContainer
(
keyCode
);
setTextToContainer
(
keyCode
);
return
;
return
;
}
}
...
@@ -400,7 +414,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -400,7 +414,7 @@ Minder.Receiver = kity.createClass('Receiver', {
setContainerStyle
:
function
()
{
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
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
.
x
+
'px;top:'
+
(
textShapeBox
.
y
+
(
/
\?
debug$/
.
test
(
location
.
href
)?
30
:
0
)
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
return
this
;
return
this
;
...
@@ -577,5 +591,8 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -577,5 +591,8 @@ Minder.Receiver = kity.createClass('Receiver', {
},
},
isReady
:
function
(){
isReady
:
function
(){
return
this
.
_ready
;
return
this
.
_ready
;
},
focus
:
function
(){
this
.
container
.
focus
();
}
}
});
});
\ No newline at end of file
src/module/keyboard.js
View file @
429fb645
...
@@ -182,6 +182,34 @@ KityMinder.registerModule("KeyboardModule", function() {
...
@@ -182,6 +182,34 @@ KityMinder.registerModule("KeyboardModule", function() {
break
;
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