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
83f109be
Commit
83f109be
authored
May 04, 2014
by
Zswang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加编辑节点的快捷键和菜单
parent
e5e1a7f4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
30 deletions
+70
-30
zh-cn.js
lang/zh-cn/zh-cn.js
+2
-1
node.js
src/adapter/node.js
+2
-1
keymap.js
src/core/keymap.js
+28
-24
editor.js
src/module/editor.js
+5
-4
editor.receiver.js
src/module/editor.receiver.js
+1
-0
keyboard.js
src/module/keyboard.js
+4
-0
layout.js
src/module/layout.js
+28
-0
No files found.
lang/zh-cn/zh-cn.js
View file @
83f109be
...
...
@@ -48,7 +48,8 @@ KityMinder.LANG[ 'zh-cn' ] = {
'node'
:
{
'appendsiblingnode'
:
'插入同级节点'
,
'appendchildnode'
:
'插入子节点'
,
'removenode'
:
'删除节点'
'removenode'
:
'删除节点'
,
'editnode'
:
'编辑节点'
},
'layout'
:
{
'default'
:
'左右展开'
,
...
...
src/adapter/node.js
View file @
83f109be
...
...
@@ -2,7 +2,8 @@ KM.registerToolbarUI( 'node', function ( name ) {
var
shortcutKeys
=
{
"appendsiblingnode"
:
"enter"
,
"appendchildnode"
:
"tab"
,
"removenode"
:
"del|backspace"
"removenode"
:
"del|backspace"
,
"editnode"
:
"F2"
};
var
me
=
this
,
...
...
src/core/keymap.js
View file @
83f109be
...
...
@@ -3,41 +3,45 @@ var keymap = KityMinder.keymap = {
'Tab'
:
9
,
'Enter'
:
13
,
'Shift'
:
16
,
'Control'
:
17
,
'Alt'
:
18
,
'CapsLock'
:
20
,
'Shift'
:
16
,
'Control'
:
17
,
'Alt'
:
18
,
'CapsLock'
:
20
,
'Esc'
:
27
,
'Esc'
:
27
,
'Spacebar'
:
32
,
'Spacebar'
:
32
,
'PageUp'
:
33
,
'PageDown'
:
34
,
'End'
:
35
,
'Home'
:
36
,
'PageUp'
:
33
,
'PageDown'
:
34
,
'End'
:
35
,
'Home'
:
36
,
'Left'
:
37
,
'Up'
:
38
,
'Right'
:
39
,
'Down'
:
40
,
'Left'
:
37
,
'Up'
:
38
,
'Right'
:
39
,
'Down'
:
40
,
'Insert'
:
45
,
'Insert'
:
45
,
'Del'
:
46
,
'Del'
:
46
,
'NumLock'
:
144
,
'NumLock'
:
144
,
'Cmd'
:
91
,
'Cmd'
:
91
,
'='
:
187
,
'-'
:
189
,
'F2'
:
113
,
'F3'
:
114
,
'F4'
:
115
,
"b"
:
66
,
'i'
:
73
,
'='
:
187
,
'-'
:
189
,
"b"
:
66
,
'i'
:
73
,
//回退
'z'
:
90
,
'y'
:
89
,
'z'
:
90
,
'y'
:
89
,
//粘贴
'v'
:
86
,
'x'
:
88
,
...
...
src/module/editor.js
View file @
83f109be
...
...
@@ -135,12 +135,13 @@ KityMinder.registerModule( "TextEditModule", function () {
"resize"
:
function
(
e
)
{
sel
.
setHide
();
},
'execCommand'
:
function
(
e
)
{
"execCommand"
:
function
(
e
)
{
var
cmds
=
{
'appendchildnode'
:
1
,
'appendsiblingnode'
:
1
'appendchildnode'
:
1
,
'appendsiblingnode'
:
1
,
'editnode'
:
1
};
if
(
cmds
[
e
.
commandName
]
){
if
(
cmds
[
e
.
commandName
]
){
var
node
=
km
.
getSelectedNode
();
if
(
!
node
){
...
...
src/module/editor.receiver.js
View file @
83f109be
...
...
@@ -175,6 +175,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
switch
(
keyCode
)
{
case
keymap
.
Enter
:
case
keymap
.
Tab
:
case
keymap
.
F2
:
if
(
this
.
keydownNode
===
this
.
minderNode
)
{
this
.
rollbackStatus
();
this
.
setTextEditStatus
(
false
);
...
...
src/module/keyboard.js
View file @
83f109be
...
...
@@ -146,6 +146,10 @@ KityMinder.registerModule( "KeyboardModule", function () {
e
.
preventDefault
();
if
(
this
.
queryCommandState
(
'removenode'
)
!==
-
1
)
this
.
execCommand
(
'removenode'
);
break
;
case
keys
.
F2
:
e
.
preventDefault
();
if
(
this
.
queryCommandState
(
'editnode'
)
!==
-
1
)
this
.
execCommand
(
'editnode'
);
break
;
case
keys
.
Left
:
navigateTo
(
this
,
'left'
);
...
...
src/module/layout.js
View file @
83f109be
...
...
@@ -195,12 +195,33 @@ KityMinder.registerModule( "LayoutModule", function () {
}
};
}
)()
);
var
EditNodeCommand
=
kity
.
createClass
(
"EditNodeCommand"
,
(
function
()
{
return
{
base
:
Command
,
execute
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
return
null
;
}
km
.
select
(
selectedNode
,
true
);
},
queryState
:
function
(
km
)
{
var
selectedNode
=
km
.
getSelectedNode
();
if
(
!
selectedNode
)
{
return
-
1
;
}
else
{
return
0
;
}
}
};
}
)()
);
return
{
"commands"
:
{
"appendchildnode"
:
AppendChildNodeCommand
,
"appendsiblingnode"
:
AppendSiblingNodeCommand
,
"removenode"
:
RemoveNodeCommand
,
"editnode"
:
EditNodeCommand
,
"switchlayout"
:
SwitchLayoutCommand
},
"events"
:
{
...
...
@@ -236,6 +257,12 @@ KityMinder.registerModule( "LayoutModule", function () {
this
.
execCommand
(
'appendchildnode'
,
new
MinderNode
(
this
.
getLang
(
'topic'
)
)
)
},
cmdName
:
'appendchildnode'
},
{
label
:
this
.
getLang
(
'node.editnode'
),
exec
:
function
()
{
this
.
execCommand
(
'editnode'
,
null
);
},
cmdName
:
'editnode'
},
{
label
:
this
.
getLang
(
'node.removenode'
),
cmdName
:
'removenode'
...
...
@@ -249,6 +276,7 @@ KityMinder.registerModule( "LayoutModule", function () {
"node"
:
{
'appendsiblingnode'
:
'appendsiblingnode'
,
'appendchildnode'
:
'appendchildnode'
,
'editnode'
:
'editnode'
,
'removenode'
:
'removenode'
},
'defaultExpand'
:
{
...
...
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