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 = {
...
@@ -28,5 +28,14 @@ var keymap = KityMinder.keymap = {
'NumLock'
:
144
,
'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", {
...
@@ -87,25 +87,46 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
_bindshortcutKeys
:
function
()
{
_bindshortcutKeys
:
function
()
{
var
me
=
this
,
var
me
=
this
,
shortcutkeys
=
this
.
_shortcutkeys
;
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
originEvent
=
e
.
originEvent
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
var
keyCode
=
originEvent
.
keyCode
||
originEvent
.
which
;
for
(
var
i
in
shortcutkeys
)
{
for
(
var
i
in
shortcutkeys
)
{
var
tmp
=
shortcutkeys
[
i
].
split
(
','
);
var
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
for
(
var
t
=
0
,
ti
;
ti
=
tmp
[
t
++
];
)
{
var
current
=
0
;
ti
=
ti
.
split
(
':'
);
utils
.
each
(
keys
,
function
(
i
,
k
){
var
key
=
ti
[
0
],
if
(
checkkey
(
k
,
keyCode
,
originEvent
)){
param
=
ti
[
1
];
current
++
;
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
();
}
}
}
});
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 () {
...
@@ -69,8 +69,8 @@ KityMinder.registerModule( "basestylemodule", function () {
}
)
}
)
},
},
addShortcutKeys
:
{
addShortcutKeys
:
{
"bold"
:
"ctrl+
66
"
,
//bold
"bold"
:
"ctrl+
b
"
,
//bold
"italic"
:
"ctrl+
73
"
//italic
"italic"
:
"ctrl+
i
"
//italic
},
},
"events"
:
{
"events"
:
{
"beforeRenderNode"
:
function
(
e
)
{
"beforeRenderNode"
:
function
(
e
)
{
...
...
src/module/history.js
View file @
87667b8c
...
@@ -138,8 +138,8 @@ KityMinder.registerModule( "HistoryModule", function () {
...
@@ -138,8 +138,8 @@ KityMinder.registerModule( "HistoryModule", function () {
}
)
}
)
},
},
addShortcutKeys
:
{
addShortcutKeys
:
{
"Undo"
:
"ctrl+
90
"
,
//undo
"Undo"
:
"ctrl+
z
"
,
//undo
"Redo"
:
"ctrl+
89
"
//redo
"Redo"
:
"ctrl+
y
"
//redo
},
},
"events"
:
{
"events"
:
{
"saveScene"
:
function
(
e
)
{
"saveScene"
:
function
(
e
)
{
...
...
src/module/zoom.js
View file @
87667b8c
...
@@ -62,7 +62,7 @@ KityMinder.registerModule( 'Zoom', function () {
...
@@ -62,7 +62,7 @@ KityMinder.registerModule( 'Zoom', function () {
'zoom-out'
:
ZoomOutCommand
'zoom-out'
:
ZoomOutCommand
},
},
addShortcutKeys
:
{
addShortcutKeys
:
{
"zoom-in"
:
"
+
"
,
//=
"zoom-in"
:
"
=
"
,
//=
"zoom-out"
:
"-"
//-
"zoom-out"
:
"-"
//-
},
},
events
:
{
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