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
Show 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 () {
...
@@ -81,9 +81,9 @@ KityMinder.registerModule( "ClipboardModule", function () {
'paste'
:
PasteCommand
'paste'
:
PasteCommand
},
},
'commandShortcutKeys'
:
{
'commandShortcutKeys'
:
{
'copy'
:
'
ctrl+c
'
,
'copy'
:
'
normal::ctrl+c|
'
,
'cut'
:
'ctrl+x'
,
'cut'
:
'
normal::
ctrl+x'
,
'paste'
:
'ctrl+v'
'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() {
...
@@ -128,15 +128,16 @@ KityMinder.registerModule('TextEditModule', function() {
receiver
.
clear
();
receiver
.
clear
();
},
},
'inputready.keyup'
:
function
(
e
){
'inputready.keyup'
:
function
(){
if
(
sel
.
isHide
()){
if
(
sel
.
isHide
()){
inputStatusReady
(
me
.
getSelectedNode
());
inputStatusReady
(
this
.
getSelectedNode
());
}
}
},
},
//当节点选区通过键盘发生变化时,输入状态要准备好
//当节点选区通过键盘发生变化时,输入状态要准备好
'normal.keyup'
:
function
(
e
)
{
'normal.keyup'
:
function
(
e
)
{
var
node
=
this
.
getSelectedNode
();
var
node
=
this
.
getSelectedNode
();
var
keyCode
=
e
.
getKeyCode
();
if
(
node
)
{
if
(
node
)
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
&&
!
sel
.
isShow
()
)
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
()
&&
!
sel
.
isShow
()
)
{
var
orgEvt
=
e
.
originEvent
;
var
orgEvt
=
e
.
originEvent
;
...
...
src/module/editor.keyboard.js
View file @
42512cd0
...
@@ -12,6 +12,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -12,6 +12,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
this
.
lastMinderNode
=
null
;
this
.
lastMinderNode
=
null
;
this
.
isTypeText
=
false
;
this
.
isTypeText
=
false
;
this
.
_initEvent
();
this
.
_initEvent
();
this
.
isShortcutCopyKey
=
false
;
},
},
//给接受容器绑定事件
//给接受容器绑定事件
_initEvent
:
function
(){
_initEvent
:
function
(){
...
@@ -118,7 +119,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -118,7 +119,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
},
200
);
},
200
);
me
.
km
.
setStatus
(
'textedit'
);
me
.
km
.
setStatus
(
'textedit'
);
},
},
_input
:
function
(
e
){
_input
:
function
(){
var
me
=
this
;
var
me
=
this
;
if
(
browser
.
ipad
)
{
if
(
browser
.
ipad
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -139,7 +140,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -139,7 +140,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me
.
_handlerEnterkey
();
me
.
_handlerEnterkey
();
e
.
preventDefault
();
e
.
preventDefault
();
return
false
;
return
false
;
}
}
;
case
keymap
.
Tab
:
case
keymap
.
Tab
:
if
(
this
.
selection
.
isShow
()){
if
(
this
.
selection
.
isShow
()){
this
.
re
.
clear
();
this
.
re
.
clear
();
...
@@ -168,7 +169,8 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -168,7 +169,8 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
case
keymap
.
Alt
:
case
keymap
.
Alt
:
case
keymap
.
Cmd
:
case
keymap
.
Cmd
:
case
keymap
.
F2
:
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'
);
this
.
km
.
setStatus
(
'normal'
);
return
;
return
;
}
}
...
@@ -183,8 +185,10 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -183,8 +185,10 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
88
:
1
,
88
:
1
,
67
:
1
67
:
1
}[
keyCode
]){
}[
keyCode
]){
//修正在cvs方式下_keyup会把节点文字选中
this
.
isShortcutCopyKey
=
true
;
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
setStatus
(
'normal'
);
return
;
return
;
}
}
...
@@ -193,24 +197,38 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -193,24 +197,38 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
setTimeout
(
function
()
{
setTimeout
(
function
()
{
me
.
range
.
updateNativeRange
().
insertNode
(
$
(
'<span>$$_kityminder_bookmark_$$</span>'
)[
0
]);
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
brArr
=
[];
var
index
=
me
.
container
.
textContent
.
indexOf
(
'$$_kityminder_bookmark_$$'
);
utils
.
each
(
me
.
container
.
getElementsByTagName
(
'br'
),
function
(
i
,
br
){
me
.
container
.
textContent
=
me
.
container
.
textContent
.
replace
(
'$$_kityminder_bookmark_$$'
,
''
);
brArr
.
push
(
br
);
me
.
range
.
setStart
(
me
.
container
.
firstChild
,
index
).
collapse
(
true
).
select
();
});
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
);
me
.
_setTextToContainer
(
keyCode
);
},
10
0
);
},
5
0
);
return
;
return
;
}
}
//剪切
//剪切
if
(
keyCode
==
keymap
.
x
)
{
if
(
keyCode
==
keymap
.
x
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
me
.
_setTextToContainer
(
keyCode
);
me
.
_setTextToContainer
(
keyCode
);
},
10
0
);
},
5
0
);
return
;
return
;
}
}
}
}
this
.
isShortcutCopyKey
=
false
;
//针对不能连续删除做处理
//针对不能连续删除做处理
if
(
keymap
.
Del
==
keyCode
||
keymap
.
Backspace
==
keyCode
)
if
(
keymap
.
Del
==
keyCode
||
keymap
.
Backspace
==
keyCode
)
me
.
_setTextToContainer
(
keyCode
);
me
.
_setTextToContainer
(
keyCode
);
...
@@ -260,6 +278,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -260,6 +278,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me
.
_setTextToContainer
(
keyCode
);
me
.
_setTextToContainer
(
keyCode
);
return
;
return
;
}
}
if
(
this
.
isTypeText
)
{
if
(
this
.
isTypeText
)
{
me
.
_setTextToContainer
(
keyCode
);
me
.
_setTextToContainer
(
keyCode
);
return
;
return
;
...
@@ -277,6 +296,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -277,6 +296,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
var
timer
;
var
timer
;
var
node
=
this
.
km
.
getSelectedNode
();
var
node
=
this
.
km
.
getSelectedNode
();
if
(
this
.
km
.
getStatus
()
==
'normal'
&&
node
&&
this
.
selection
.
isHide
()){
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
())
{
if
(
node
&&
this
.
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
this
.
re
.
updateByMinderNode
(
node
);
this
.
re
.
updateByMinderNode
(
node
);
...
@@ -333,6 +359,8 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
...
@@ -333,6 +359,8 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
rng
.
setStartBefore
(
br
);
rng
.
setStartBefore
(
br
);
rng
.
collapse
(
true
);
rng
.
collapse
(
true
);
}
}
rng
.
select
();
rng
.
select
();
me
.
_setTextToContainer
(
keymap
.
Enter
);
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