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
42512cd0
Commit
42512cd0
authored
Sep 24, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复粘贴
parent
4803fcb3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
15 deletions
+44
-15
clipboard.js
src/module/clipboard.js
+3
-3
editor.js
src/module/editor.js
+3
-2
editor.keyboard.js
src/module/editor.keyboard.js
+38
-10
No files found.
src/module/clipboard.js
View file @
42512cd0
...
...
@@ -81,9 +81,9 @@ KityMinder.registerModule( "ClipboardModule", function () {
'paste'
:
PasteCommand
},
'commandShortcutKeys'
:
{
'copy'
:
'
ctrl+c
'
,
'cut'
:
'ctrl+x'
,
'paste'
:
'ctrl+v'
'copy'
:
'
normal::ctrl+c|
'
,
'cut'
:
'
normal::
ctrl+x'
,
'paste'
:
'
normal::
ctrl+v'
}
};
}
);
\ No newline at end of file
src/module/editor.js
View file @
42512cd0
...
...
@@ -128,15 +128,16 @@ KityMinder.registerModule('TextEditModule', function() {
receiver
.
clear
();
},
'inputready.keyup'
:
function
(
e
){
'inputready.keyup'
:
function
(){
if
(
sel
.
isHide
()){
inputStatusReady
(
me
.
getSelectedNode
());
inputStatusReady
(
this
.
getSelectedNode
());
}
},
//当节点选区通过键盘发生变化时,输入状态要准备好
'normal.keyup'
:
function
(
e
)
{
var
node
=
this
.
getSelectedNode
();
var
keyCode
=
e
.
getKeyCode
();
if
(
node
)
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
&&
!
sel
.
isShow
()
)
{
var
orgEvt
=
e
.
originEvent
;
...
...
src/module/editor.keyboard.js
View file @
42512cd0
...
...
@@ -12,6 +12,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
this
.
lastMinderNode
=
null
;
this
.
isTypeText
=
false
;
this
.
_initEvent
();
this
.
isShortcutCopyKey
=
false
;
},
//给接受容器绑定事件
_initEvent
:
function
(){
...
...
@@ -118,7 +119,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
},
200
);
me
.
km
.
setStatus
(
'textedit'
);
},
_input
:
function
(
e
){
_input
:
function
(){
var
me
=
this
;
if
(
browser
.
ipad
)
{
setTimeout
(
function
()
{
...
...
@@ -139,7 +140,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me
.
_handlerEnterkey
();
e
.
preventDefault
();
return
false
;
}
}
;
case
keymap
.
Tab
:
if
(
this
.
selection
.
isShow
()){
this
.
re
.
clear
();
...
...
@@ -168,7 +169,8 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
case
keymap
.
Alt
:
case
keymap
.
Cmd
:
case
keymap
.
F2
:
if
(
this
.
selection
.
isHide
()
&&
this
.
km
.
getStatus
()
!=
'textedit'
){
if
(
this
.
selection
.
isHide
()
&&
this
.
km
.
getStatus
()
!=
'textedit'
&&
this
.
km
.
getStatus
()
!=
'inputready'
){
this
.
km
.
setStatus
(
'normal'
);
return
;
}
...
...
@@ -183,8 +185,10 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
88
:
1
,
67
:
1
}[
keyCode
]){
//修正在cvs方式下_keyup会把节点文字选中
this
.
isShortcutCopyKey
=
true
;
this
.
km
.
setStatus
(
'normal'
);
return
;
}
...
...
@@ -193,24 +197,38 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
setTimeout
(
function
()
{
me
.
range
.
updateNativeRange
().
insertNode
(
$
(
'<span>$$_kityminder_bookmark_$$</span>'
)[
0
]);
me
.
container
.
innerHTML
=
utils
.
unhtml
(
me
.
container
.
textContent
.
replace
(
/
[\u
200b
\t\r\n]
/g
,
''
));
var
index
=
me
.
container
.
textContent
.
indexOf
(
'$$_kityminder_bookmark_$$'
);
me
.
container
.
textContent
=
me
.
container
.
textContent
.
replace
(
'$$_kityminder_bookmark_$$'
,
''
);
me
.
range
.
setStart
(
me
.
container
.
firstChild
,
index
).
collapse
(
true
).
select
();
var
brArr
=
[];
utils
.
each
(
me
.
container
.
getElementsByTagName
(
'br'
),
function
(
i
,
br
){
brArr
.
push
(
br
);
});
utils
.
each
(
brArr
,
function
(
i
,
br
){
var
textNode
=
document
.
createTextNode
(
'
\
n'
);
br
.
parentNode
.
insertBefore
(
textNode
,
br
);
br
.
parentNode
.
removeChild
(
br
);
});
var
textContent
=
me
.
container
.
textContent
.
replace
(
/
[\u
200b
\t\r]
/g
,
''
);
var
index
=
textContent
.
indexOf
(
'$$_kityminder_bookmark_$$'
);
me
.
re
.
setContainerTxt
(
textContent
.
replace
(
'$$_kityminder_bookmark_$$'
,
''
));
me
.
range
.
setStartOffset
(
index
).
collapse
(
true
).
select
();
me
.
_setTextToContainer
(
keyCode
);
},
10
0
);
},
5
0
);
return
;
}
//剪切
if
(
keyCode
==
keymap
.
x
)
{
setTimeout
(
function
()
{
me
.
_setTextToContainer
(
keyCode
);
},
10
0
);
},
5
0
);
return
;
}
}
this
.
isShortcutCopyKey
=
false
;
//针对不能连续删除做处理
if
(
keymap
.
Del
==
keyCode
||
keymap
.
Backspace
==
keyCode
)
me
.
_setTextToContainer
(
keyCode
);
...
...
@@ -260,6 +278,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me
.
_setTextToContainer
(
keyCode
);
return
;
}
if
(
this
.
isTypeText
)
{
me
.
_setTextToContainer
(
keyCode
);
return
;
...
...
@@ -277,6 +296,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
var
timer
;
var
node
=
this
.
km
.
getSelectedNode
();
if
(
this
.
km
.
getStatus
()
==
'normal'
&&
node
&&
this
.
selection
.
isHide
()){
if
(
this
.
isShortcutCopyKey
){
console
.
log
(
this
.
km
.
getStatus
())
return
;
}
if
(
node
&&
this
.
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
this
.
re
.
updateByMinderNode
(
node
);
...
...
@@ -333,6 +359,8 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
rng
.
setStartBefore
(
br
);
rng
.
collapse
(
true
);
}
rng
.
select
();
me
.
_setTextToContainer
(
keymap
.
Enter
);
...
...
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