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
6acbbdf4
Commit
6acbbdf4
authored
Jan 20, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Plain Diff
fixed conflict
parents
a87ee4c9
7fcb5d76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
3 deletions
+59
-3
minder.js
src/core/minder.js
+43
-0
minder.module.js
src/core/minder.module.js
+5
-0
history.js
src/module/history.js
+11
-3
No files found.
src/core/minder.js
View file @
6acbbdf4
...
...
@@ -21,7 +21,9 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_initEvents
();
this
.
_initMinder
();
this
.
_initSelection
();
this
.
_initShortcutKey
();
this
.
_initModules
();
this
.
fire
(
'ready'
);
},
getOptions
:
function
(
key
)
{
...
...
@@ -77,6 +79,47 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
},
getRenderTarget
:
function
()
{
return
this
.
_renderTarget
;
},
_initShortcutKey
:
function
(){
this
.
_shortcutkeys
=
{};
this
.
_bindshortcutKeys
();
},
addShortcutKeys
:
function
(
cmd
,
keys
)
{
var
obj
=
{};
if
(
keys
)
{
obj
[
cmd
]
=
keys
}
else
{
obj
=
cmd
;
}
utils
.
extend
(
this
.
_shortcutkeys
,
obj
)
},
_bindshortcutKeys
:
function
()
{
var
me
=
this
,
shortcutkeys
=
this
.
_shortcutkeys
;
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
();
}
}
}
}
});
}
}
);
...
...
src/core/minder.module.js
View file @
6acbbdf4
...
...
@@ -39,6 +39,11 @@ kity.extendClass( Minder, {
}
}
//添加模块的快捷键
if
(
moduleDeals
.
addShortcutKeys
){
this
.
addShortcutKeys
(
moduleDeals
.
addShortcutKeys
)
}
}
},
...
...
src/module/history.js
View file @
6acbbdf4
...
...
@@ -103,7 +103,10 @@ KityMinder.registerModule( "HistoryModule", function () {
queryState
:
function
(
km
)
{
km
.
historyManager
.
hasUndo
?
0
:
-
1
;
},
isNeedUndo
:
true
isNeedUndo
:
function
()
{
return
false
;
}
}
),
"redo"
:
kity
.
createClass
(
"RedoCommand"
,
{
base
:
Command
,
...
...
@@ -115,10 +118,15 @@ KityMinder.registerModule( "HistoryModule", function () {
queryState
:
function
(
km
)
{
return
km
.
historyManager
.
hasRedo
?
0
:
-
1
;
},
isNeedUndo
:
true
isNeedUndo
:
function
()
{
return
false
;
}
}
)
},
addShortcutKeys
:
{
"Undo"
:
"ctrl+90"
,
//undo
"Redo"
:
"ctrl+89"
//redo
},
"events"
:
{
"saveScene"
:
function
(
e
)
{
this
.
historyManager
.
saveScene
();
...
...
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