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
f3bccfde
Commit
f3bccfde
authored
Feb 18, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
e1040310
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
editor.js
src/module/editor.js
+36
-0
editor.receiver.js
src/module/editor.receiver.js
+8
-2
keyboard.js
src/module/keyboard.js
+3
-0
No files found.
src/module/editor.js
View file @
f3bccfde
...
...
@@ -83,7 +83,43 @@ KityMinder.registerModule( "TextEditModule", function () {
},
'stopTextEdit'
:
function
(){
sel
.
setHide
();
receiver
.
clear
().
setTextEditStatus
(
false
);
},
'execCommand'
:
function
(
e
){
var
cmds
=
{
'appendchildnode'
:
1
,
'appendsiblingnode'
:
1
};
if
(
cmds
[
e
.
commandName
]){
var
node
=
km
.
getSelectedNode
();
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
node
.
getTextShape
().
setStyle
(
'cursor'
,
'text'
);
receiver
.
setTextEditStatus
(
true
)
.
setSelection
(
sel
)
.
setKityMinder
(
this
)
.
setMinderNode
(
node
)
.
setTextShape
(
textShape
)
.
setBaseOffset
()
.
setContainerStyle
()
.
setSelectionHeight
()
.
getTextOffsetData
()
.
setIndex
(
0
)
.
updateSelection
()
.
setRange
(
range
);
sel
.
setStartOffset
(
0
);
sel
.
setEndOffset
(
textShape
.
getContent
().
length
);
sel
.
setShow
();
receiver
.
updateSelectionShow
(
1
)
.
updateRange
(
range
);
}
}
}
};
...
...
src/module/editor.receiver.js
View file @
f3bccfde
...
...
@@ -77,8 +77,10 @@ Minder.Receiver = kity.createClass('Receiver',{
switch
(
keyCode
){
case
keymap
.
Enter
:
case
keymap
.
Tab
:
this
.
setTextEditStatus
(
false
);
this
.
clear
();
if
(
this
.
keydownNode
===
this
.
minderNode
){
this
.
setTextEditStatus
(
false
);
this
.
clear
();
}
e
.
preventDefault
();
return
;
case
keymap
.
Shift
:
...
...
@@ -263,5 +265,9 @@ Minder.Receiver = kity.createClass('Receiver',{
range
.
setEnd
(
node
,
this
.
selection
.
endOffset
);
range
.
select
();
return
this
;
},
setIndex
:
function
(
index
){
this
.
index
=
index
;
return
this
}
});
\ No newline at end of file
src/module/keyboard.js
View file @
f3bccfde
...
...
@@ -67,6 +67,7 @@ KityMinder.registerModule( "KeyboardModule", function () {
buildPositionNetwork
(
this
.
getRoot
()
);
},
keydown
:
function
(
e
)
{
var
keys
=
KityMinder
.
keymap
;
if
(
this
.
receiver
.
isTextEditStatus
()
)
{
switch
(
e
.
originEvent
.
keyCode
)
{
...
...
@@ -85,6 +86,8 @@ KityMinder.registerModule( "KeyboardModule", function () {
}
return
;
}
var
node
=
e
.
getTargetNode
();
this
.
receiver
.
keydownNode
=
node
;
switch
(
e
.
originEvent
.
keyCode
)
{
case
keys
.
Enter
:
this
.
execCommand
(
'appendSiblingNode'
,
new
MinderNode
(
'Topic'
)
);
...
...
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