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
87667b8c
Commit
87667b8c
authored
Feb 20, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
3de023b6
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
20 deletions
+50
-20
keymap.js
src/core/keymap.js
+10
-1
minder.js
src/core/minder.js
+35
-14
basestyle.js
src/module/basestyle.js
+2
-2
history.js
src/module/history.js
+2
-2
zoom.js
src/module/zoom.js
+1
-1
No files found.
src/core/keymap.js
View file @
87667b8c
...
...
@@ -28,5 +28,14 @@ var keymap = KityMinder.keymap = {
'NumLock'
:
144
,
'Cmd'
:
91
'Cmd'
:
91
,
'='
:
187
,
'-'
:
189
,
"b"
:
66
,
'i'
:
73
,
'z'
:
90
,
'y'
:
89
};
\ No newline at end of file
src/core/minder.js
View file @
87667b8c
...
...
@@ -87,25 +87,46 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
_bindshortcutKeys
:
function
()
{
var
me
=
this
,
shortcutkeys
=
this
.
_shortcutkeys
;
me
.
on
(
'keydown'
,
function
(
e
)
{
function
checkkey
(
key
,
keyCode
,
e
){
switch
(
key
){
case
'ctrl'
:
case
'cmd'
:
if
(
e
.
ctrlKey
||
e
.
metaKey
){
return
true
;
}
break
;
case
'alt'
:
if
(
e
.
altKey
){
return
true
}
break
;
case
'shift'
:
if
(
e
.
shiftKey
){
return
true
;
}
}
if
(
keyCode
==
keymap
[
key
]){
return
true
;
}
return
false
}
me
.
on
(
'keydown'
,
function
(
e
)
{
var
originEvent
=
e
.
originEvent
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
for
(
var
i
in
shortcutkeys
)
{
var
tmp
=
shortcutkeys
[
i
].
split
(
','
);
for
(
var
t
=
0
,
ti
;
ti
=
tmp
[
t
++
];
)
{
ti
=
ti
.
split
(
':'
);
var
key
=
ti
[
0
],
param
=
ti
[
1
];
if
(
/^
(
ctrl
)(\+
shift
)?\+(\d
+
)
$/
.
test
(
key
.
toLowerCase
()
)
||
/^
(\d
+
)
$/
.
test
(
key
)
)
{
if
(
(
(
RegExp
.
$1
==
'ctrl'
?
(
originEvent
.
ctrlKey
||
originEvent
.
metaKey
)
:
0
)
&&
(
RegExp
.
$2
!=
""
?
originEvent
[
RegExp
.
$2
.
slice
(
1
)
+
"Key"
]
:
1
)
&&
keyCode
==
RegExp
.
$3
)
||
keyCode
==
RegExp
.
$1
)
{
if
(
me
.
queryCommandState
(
i
,
param
)
!=
-
1
)
me
.
execCommand
(
i
,
param
);
e
.
preventDefault
();
}
var
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
var
current
=
0
;
utils
.
each
(
keys
,
function
(
i
,
k
){
if
(
checkkey
(
k
,
keyCode
,
originEvent
)){
current
++
;
}
});
if
(
current
==
keys
.
length
){
if
(
me
.
queryCommandState
(
i
)
!=
-
1
)
me
.
execCommand
(
i
);
originEvent
.
preventDefault
();
break
;
}
}
...
...
src/module/basestyle.js
View file @
87667b8c
...
...
@@ -69,8 +69,8 @@ KityMinder.registerModule( "basestylemodule", function () {
}
)
},
addShortcutKeys
:
{
"bold"
:
"ctrl+
66
"
,
//bold
"italic"
:
"ctrl+
73
"
//italic
"bold"
:
"ctrl+
b
"
,
//bold
"italic"
:
"ctrl+
i
"
//italic
},
"events"
:
{
"beforeRenderNode"
:
function
(
e
)
{
...
...
src/module/history.js
View file @
87667b8c
...
...
@@ -138,8 +138,8 @@ KityMinder.registerModule( "HistoryModule", function () {
}
)
},
addShortcutKeys
:
{
"Undo"
:
"ctrl+
90
"
,
//undo
"Redo"
:
"ctrl+
89
"
//redo
"Undo"
:
"ctrl+
z
"
,
//undo
"Redo"
:
"ctrl+
y
"
//redo
},
"events"
:
{
"saveScene"
:
function
(
e
)
{
...
...
src/module/zoom.js
View file @
87667b8c
...
...
@@ -62,7 +62,7 @@ KityMinder.registerModule( 'Zoom', function () {
'zoom-out'
:
ZoomOutCommand
},
addShortcutKeys
:
{
"zoom-in"
:
"
+
"
,
//=
"zoom-in"
:
"
=
"
,
//=
"zoom-out"
:
"-"
//-
},
events
:
{
...
...
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