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
db5f981f
Commit
db5f981f
authored
Jul 08, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加全选功能
parent
825fb382
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
5 deletions
+40
-5
keymap.js
src/core/keymap.js
+2
-1
editor.receiver.js
src/module/editor.receiver.js
+23
-4
select.js
src/module/select.js
+15
-0
No files found.
src/core/keymap.js
View file @
db5f981f
...
@@ -96,5 +96,6 @@ var keymap = KityMinder.keymap = (function(origin) {
...
@@ -96,5 +96,6 @@ var keymap = KityMinder.keymap = (function(origin) {
40
:
1
,
40
:
1
,
13
:
1
,
13
:
1
,
9
:
1
9
:
1
}
},
'a'
:
65
});
});
\ No newline at end of file
src/module/editor.receiver.js
View file @
db5f981f
...
@@ -233,10 +233,12 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -233,10 +233,12 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
F2
:
case
keymap
.
F2
:
// case keymap.Del:
// case keymap.Del:
// case keymap.Backspace:
// case keymap.Backspace:
if
(
this
.
selection
.
isHide
()){
if
(
this
.
selection
.
isHide
()){
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
setStatus
(
'normal'
);
return
;
}
}
return
;
}
}
//针对按住shift+方向键进行处理
//针对按住shift+方向键进行处理
if
(
orgEvt
.
shiftKey
&&
keymap
.
direction
[
keyCode
]
&&
this
.
selection
.
isShow
()){
if
(
orgEvt
.
shiftKey
&&
keymap
.
direction
[
keyCode
]
&&
this
.
selection
.
isShow
()){
...
@@ -317,15 +319,32 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -317,15 +319,32 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
range
.
setStart
(
me
.
container
.
firstChild
,
index
).
collapse
(
true
).
select
();
me
.
range
.
setStart
(
me
.
container
.
firstChild
,
index
).
collapse
(
true
).
select
();
setTextToContainer
(
keyCode
);
setTextToContainer
(
keyCode
);
},
100
);
},
100
);
return
;
}
}
//剪切
//剪切
if
(
keyCode
==
keymap
.
x
)
{
if
(
keyCode
==
keymap
.
x
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
setTextToContainer
(
keyCode
);
setTextToContainer
(
keyCode
);
},
100
);
},
100
);
return
;
}
}
return
;
//全选键位监控
if
(
keymap
.
a
==
keyCode
)
{
if
(
me
.
selection
.
isHide
()){
return
;
}
else
{
me
.
selection
.
setStartOffset
(
0
)
.
setEndOffset
(
me
.
textShape
.
getContent
().
length
);
me
.
updateContainerRangeBySel
().
updateSelectionShow
();
return
;
}
}
}
}
//针对不能连续删除做处理
//针对不能连续删除做处理
if
(
keymap
.
Del
||
keymap
.
Backspace
)
if
(
keymap
.
Del
||
keymap
.
Backspace
)
setTextToContainer
(
keyCode
);
setTextToContainer
(
keyCode
);
...
@@ -379,7 +398,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -379,7 +398,7 @@ Minder.Receiver = kity.createClass('Receiver', {
setTextToContainer
(
keyCode
);
setTextToContainer
(
keyCode
);
return
;
return
;
}
}
if
(
this
.
selection
.
baseOffset
===
null
)
if
(
this
.
selection
.
baseOffset
===
null
&&
this
.
selection
.
collapsed
)
setTextToContainer
(
keyCode
);
setTextToContainer
(
keyCode
);
return
true
;
return
true
;
}
}
...
@@ -588,7 +607,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -588,7 +607,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
return
this
;
},
},
updateContainerRangeBySel
:
function
(){
updateContainerRangeBySel
:
function
(){
this
.
updateRange
(
this
.
range
);
return
this
.
updateRange
(
this
.
range
);
},
},
setIndex
:
function
(
index
)
{
setIndex
:
function
(
index
)
{
this
.
index
=
index
;
this
.
index
=
index
;
...
...
src/module/select.js
View file @
db5f981f
...
@@ -146,6 +146,21 @@ KityMinder.registerModule('Select', function() {
...
@@ -146,6 +146,21 @@ KityMinder.registerModule('Select', function() {
// 清理一下选择状态
// 清理一下选择状态
marqueeActivator
.
selectEnd
(
e
);
marqueeActivator
.
selectEnd
(
e
);
},
//全选操作
'normal.keydown inputready.keydown'
:
function
(
e
){
var
keyEvent
=
e
.
originEvent
;
if
(
(
keyEvent
.
ctrlKey
||
keyEvent
.
metaKey
)
&&
keymap
.
a
==
keyEvent
.
keyCode
){
var
selectedNodes
=
[];
this
.
getRoot
().
traverse
(
function
(
node
){
selectedNodes
.
push
(
node
);
});
this
.
select
(
selectedNodes
,
true
);
}
}
}
}
}
};
};
...
...
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