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
2a887e44
Commit
2a887e44
authored
Mar 18, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
merge from dev
parents
9ac8bb2a
87c70fe5
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
321 additions
and
201 deletions
+321
-201
CHANGELOG.md
CHANGELOG.md
+40
-0
kityminder.all.js
dist/kityminder.all.js
+113
-78
kityminder.all.min.js
dist/kityminder.all.min.js
+5
-5
social.js
social/social.js
+50
-40
keymap.js
src/core/keymap.js
+5
-2
minder.event.js
src/core/minder.event.js
+1
-1
minder.js
src/core/minder.js
+45
-44
editor.js
src/module/editor.js
+2
-0
editor.range.js
src/module/editor.range.js
+6
-0
editor.receiver.js
src/module/editor.receiver.js
+53
-23
layout.default.js
src/module/layout.default.js
+0
-8
select.js
src/module/select.js
+1
-0
No files found.
CHANGELOG.md
0 → 100644
View file @
2a887e44
# KityMinder Change List
----------
## v1.1.0
### 功能更新
1.
添加了粘贴剪贴复制功能
2.
添加了本地自动保存草稿的功能
3.
发布版本上添加了 Github 地址
### 功能调整
1.
视野定位功能抽取为 camera 命令,并且创建新文件和打开文件会把视野定位到根节点
### 问题修复
1.
修正了 bottom 主题的位置问题
2.
修正了子节点全部删除后展开/收缩标志依然存在画布上的问题
3.
修复了 bottom 主题的键盘导航出错的问题
4.
滚轮缩放的问题
----------
## v1.0.1
### 问题修复
1.
修复 png 导出问题。
----------
## v1.0.0
首个版本发布,包括基本的编辑功能。
dist/kityminder.all.js
View file @
2a887e44
This diff is collapsed.
Click to expand it.
dist/kityminder.all.min.js
View file @
2a887e44
This source diff could not be displayed because it is too large. You can
view the blob
instead.
social/social.js
View file @
2a887e44
...
@@ -130,11 +130,14 @@ $( function () {
...
@@ -130,11 +130,14 @@ $( function () {
by
:
'time'
,
by
:
'time'
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
if
(
result
.
list
.
length
)
{
if
(
result
.
list
.
length
)
{
if
(
!
isShareLink
&&
!
thisMapFilename
)
{
if
(
!
isShareLink
&&
!
thisMapFilename
&&
!
draft
.
data
)
{
loadPersonal
(
result
.
list
[
0
].
path
);
loadPersonal
(
result
.
list
[
0
].
path
);
}
else
{
}
else
{
$user_btn
.
loading
(
false
);
$user_btn
.
loading
(
false
);
}
}
if
(
draft
.
data
)
{
setFileSaved
(
false
);
}
addToRecentMenu
(
result
.
list
);
addToRecentMenu
(
result
.
list
);
}
}
}
}
...
@@ -166,27 +169,24 @@ $( function () {
...
@@ -166,27 +169,24 @@ $( function () {
function
loadPersonal
(
path
)
{
function
loadPersonal
(
path
)
{
var
sto
=
baidu
.
frontia
.
personalStorage
;
var
sto
=
baidu
.
frontia
.
personalStorage
;
thisMapFilename
=
path
;
$user_btn
.
loading
(
'加载“'
+
getFileName
(
path
)
+
'”...'
);
if
(
thisMapFilename
==
draft
.
filename
)
{
sto
.
getFileUrl
(
path
,
{
$user_btn
.
loading
(
false
).
text
(
getFileName
(
path
)
);
success
:
function
(
url
)
{
setFileSaved
(
false
);
$
.
ajax
(
{
}
else
{
cache
:
false
,
$user_btn
.
loading
(
'加载“'
+
getFileName
(
path
)
+
'”...'
);
url
:
url
,
sto
.
getFileUrl
(
path
,
{
dataType
:
'text'
,
success
:
function
(
url
)
{
success
:
function
(
result
)
{
$
.
ajax
(
{
thisMapFilename
=
path
;
cache
:
false
,
window
.
km
.
importData
(
result
,
'json'
);
url
:
url
,
window
.
km
.
execCommand
(
'camera'
,
window
.
km
.
getRoot
()
);
dataType
:
'text'
,
$user_btn
.
loading
(
false
);
success
:
function
(
result
)
{
setFileSaved
(
true
);
window
.
km
.
importData
(
result
,
'json'
);
clearDraft
();
$user_btn
.
loading
(
false
).
text
(
getFileName
(
path
)
);
}
isFileSaved
=
true
;
}
);
}
}
}
);
}
);
}
}
);
}
}
}
function
getMapFileName
()
{
function
getMapFileName
()
{
...
@@ -204,14 +204,17 @@ $( function () {
...
@@ -204,14 +204,17 @@ $( function () {
var
data
=
window
.
km
.
exportData
(
'json'
);
var
data
=
window
.
km
.
exportData
(
'json'
);
save
(
data
,
thisMapFilename
||
getMapFileName
(),
function
(
success
,
info
)
{
save
(
data
,
thisMapFilename
||
getMapFileName
(),
function
(
success
,
info
)
{
if
(
success
)
{
if
(
success
)
{
thisMapFilename
=
info
.
path
;
$save_btn
.
text
(
'已保存!'
);
$save_btn
.
text
(
'已保存!'
);
if
(
!
thisMapFilename
)
{
if
(
!
thisMapFilename
)
{
thisMapFilename
=
info
.
path
;
addToRecentMenu
(
[
info
]
);
addToRecentMenu
(
[
info
]
);
$user_btn
.
text
(
getFileName
(
thisMapFilename
)
);
$user_btn
.
text
(
getFileName
(
thisMapFilename
)
);
checkAutoSave
();
}
}
setFileSaved
(
true
);
}
else
{
$save_btn
.
loading
(
false
).
text
(
'保存失败!'
);
}
}
console
.
log
(
info
);
}
);
}
);
$save_btn
.
loading
(
'正在保存...'
);
$save_btn
.
loading
(
'正在保存...'
);
}
}
...
@@ -221,14 +224,14 @@ $( function () {
...
@@ -221,14 +224,14 @@ $( function () {
var
options
=
{
var
options
=
{
ondup
:
thisMapFilename
?
sto
.
constant
.
ONDUP_OVERWRITE
:
sto
.
constant
.
ONDUP_NEWCOPY
,
ondup
:
thisMapFilename
?
sto
.
constant
.
ONDUP_OVERWRITE
:
sto
.
constant
.
ONDUP_NEWCOPY
,
success
:
function
(
result
)
{
success
:
function
(
result
)
{
setFileSaved
(
true
);
callback
(
!!
result
.
path
,
result
);
callback
(
true
,
result
);
},
},
error
:
function
(
error
)
{
error
:
function
(
error
)
{
callback
(
false
,
error
);
callback
(
false
,
error
);
}
}
};
};
sto
.
uploadTextFile
(
file
,
filename
,
options
);
sto
.
uploadTextFile
(
file
,
filename
,
options
);
clearDraft
();
}
}
function
uuid
()
{
function
uuid
()
{
...
@@ -320,16 +323,18 @@ $( function () {
...
@@ -320,16 +323,18 @@ $( function () {
var
pattern
=
/path=
(
.+
?)([
&#
]
|$
)
/
;
var
pattern
=
/path=
(
.+
?)([
&#
]
|$
)
/
;
var
match
=
pattern
.
exec
(
window
.
location
)
||
pattern
.
exec
(
document
.
referrer
);
var
match
=
pattern
.
exec
(
window
.
location
)
||
pattern
.
exec
(
document
.
referrer
);
if
(
!
match
)
return
;
if
(
!
match
)
return
;
thisMapFilename
=
decodeURIComponent
(
match
[
1
]
);
var
path
=
decodeURIComponent
(
match
[
1
]
);
loadPersonal
(
path
);
}
}
function
setFileSaved
(
saved
)
{
function
setFileSaved
(
saved
)
{
$save_btn
.
disabled
(
saved
||
!
currentUser
);
$save_btn
.
disabled
(
!
currentUser
||
saved
);
if
(
saved
)
{
if
(
saved
)
{
$user_btn
.
text
(
getFileName
(
thisMapFilename
)
);
$user_btn
.
text
(
getFileName
(
thisMapFilename
)
);
clearDraft
();
}
else
{
}
else
{
$save_btn
.
text
(
'保存'
);
$save_btn
.
text
(
'保存'
);
$user_btn
.
text
(
getFileName
(
thisMapFilename
||
getMapFileName
()
)
+
' *'
);
$user_btn
.
text
(
getFileName
(
thisMapFilename
||
draft
.
filename
||
getMapFileName
()
)
+
' *'
);
}
}
}
}
...
@@ -337,7 +342,7 @@ $( function () {
...
@@ -337,7 +342,7 @@ $( function () {
var
sto
=
window
.
localStorage
;
var
sto
=
window
.
localStorage
;
if
(
!
sto
)
return
;
if
(
!
sto
)
return
;
draft
=
{
draft
=
{
filename
:
thisMapFilename
,
filename
:
thisMapFilename
||
getMapFileName
()
,
data
:
window
.
km
.
exportData
(
'json'
)
data
:
window
.
km
.
exportData
(
'json'
)
};
};
sto
.
setItem
(
'draft_filename'
,
draft
.
filename
);
sto
.
setItem
(
'draft_filename'
,
draft
.
filename
);
...
@@ -351,29 +356,34 @@ $( function () {
...
@@ -351,29 +356,34 @@ $( function () {
if
(
!
sto
)
return
;
if
(
!
sto
)
return
;
draft
.
data
=
sto
.
getItem
(
'draft_data'
);
draft
.
data
=
sto
.
getItem
(
'draft_data'
);
draft
.
filename
=
sto
.
getItem
(
'draft_filename'
);
thisMapFilename
=
draft
.
filename
=
sto
.
getItem
(
'draft_filename'
);
if
(
draft
.
data
)
{
if
(
draft
.
data
)
{
window
.
km
.
importData
(
draft
.
data
,
'json'
);
window
.
km
.
importData
(
draft
.
data
,
'json'
);
setFileSaved
(
false
);
setFileSaved
(
false
);
}
}
}
}
loadAutoSave
();
function
clearDraft
()
{
var
sto
=
window
.
localStorage
;
if
(
!
sto
)
return
;
sto
.
removeItem
(
'draft_data'
);
sto
.
removeItem
(
'draft_filename'
);
}
loadShare
();
loadShare
();
if
(
!
isShareLink
)
{
loadAutoSave
();
}
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
currentUser
=
baidu
.
frontia
.
getCurrentAccount
();
if
(
currentUser
)
{
if
(
currentUser
)
{
setCurrentUser
(
currentUser
);
setCurrentUser
(
currentUser
);
loadPath
();
loadPath
();
if
(
thisMapFilename
)
{
loadPersonal
(
thisMapFilename
);
}
}
else
{
loadAutoSave
();
}
}
window
.
km
.
on
(
'contentchange'
,
function
()
{
window
.
km
.
on
(
'contentchange'
,
checkAutoSave
);
checkAutoSave
();
}
);
}
);
}
);
\ No newline at end of file
src/core/keymap.js
View file @
2a887e44
...
@@ -35,7 +35,10 @@ var keymap = KityMinder.keymap = {
...
@@ -35,7 +35,10 @@ var keymap = KityMinder.keymap = {
"b"
:
66
,
"b"
:
66
,
'i'
:
73
,
'i'
:
73
,
//回退
'z'
:
90
,
'z'
:
90
,
'y'
:
89
'y'
:
89
,
//粘贴
'v'
:
86
,
'x'
:
88
};
};
\ No newline at end of file
src/core/minder.event.js
View file @
2a887e44
...
@@ -21,7 +21,7 @@ kity.extendClass( Minder, {
...
@@ -21,7 +21,7 @@ kity.extendClass( Minder, {
_bindKeyboardEvents
:
function
()
{
_bindKeyboardEvents
:
function
()
{
if
(
(
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPod'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPad'
)
==
-
1
)
)
{
if
(
(
navigator
.
userAgent
.
indexOf
(
'iPhone'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPod'
)
==
-
1
)
&&
(
navigator
.
userAgent
.
indexOf
(
'iPad'
)
==
-
1
)
)
{
//只能在这里做,要不无法触发
//只能在这里做,要不无法触发
Utils
.
listen
(
document
.
body
,
'keydown keyup keypress'
,
this
.
_firePharse
.
bind
(
this
)
);
Utils
.
listen
(
document
.
body
,
'keydown keyup keypress
paste
'
,
this
.
_firePharse
.
bind
(
this
)
);
}
}
},
},
_firePharse
:
function
(
e
)
{
_firePharse
:
function
(
e
)
{
...
...
src/core/minder.js
View file @
2a887e44
...
@@ -28,7 +28,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -28,7 +28,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
=
new
kity
.
Paper
();
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_paper
.
getNode
().
setAttribute
(
'contenteditable'
,
true
);
this
.
_paper
.
getNode
().
ondragstart
=
function
(
e
)
{
this
.
_paper
.
getNode
().
ondragstart
=
function
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
};
};
...
@@ -64,47 +64,48 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -64,47 +64,48 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this
.
_shortcutkeys
=
{};
this
.
_shortcutkeys
=
{};
this
.
_bindshortcutKeys
();
this
.
_bindshortcutKeys
();
},
},
isTextEditStatus
:
function
()
{
isTextEditStatus
:
function
()
{
return
false
;
return
false
;
},
},
addShortcutKeys
:
function
(
cmd
,
keys
)
{
addShortcutKeys
:
function
(
cmd
,
keys
)
{
var
obj
=
{},
km
=
this
;
var
obj
=
{},
km
=
this
;
if
(
keys
)
{
if
(
keys
)
{
obj
[
cmd
]
=
keys
obj
[
cmd
]
=
keys
}
else
{
}
else
{
obj
=
cmd
;
obj
=
cmd
;
}
}
utils
.
each
(
obj
,
function
(
k
,
v
)
{
utils
.
each
(
obj
,
function
(
k
,
v
)
{
km
.
_shortcutkeys
[
k
.
toLowerCase
()
]
=
v
;
km
.
_shortcutkeys
[
k
.
toLowerCase
()
]
=
v
;
});
}
);
},
},
getShortcutKey
:
function
(
cmdName
)
{
getShortcutKey
:
function
(
cmdName
)
{
return
this
.
_shortcutkeys
[
cmdName
]
return
this
.
_shortcutkeys
[
cmdName
]
},
},
_bindshortcutKeys
:
function
()
{
_bindshortcutKeys
:
function
()
{
var
me
=
this
,
var
me
=
this
,
shortcutkeys
=
this
.
_shortcutkeys
;
shortcutkeys
=
this
.
_shortcutkeys
;
function
checkkey
(
key
,
keyCode
,
e
){
switch
(
key
){
function
checkkey
(
key
,
keyCode
,
e
)
{
case
'ctrl'
:
switch
(
key
)
{
case
'cmd'
:
case
'ctrl'
:
if
(
e
.
ctrlKey
||
e
.
metaKey
){
case
'cmd'
:
return
true
;
if
(
e
.
ctrlKey
||
e
.
metaKey
)
{
}
return
true
;
break
;
}
case
'alt'
:
break
;
if
(
e
.
altKey
){
case
'alt'
:
return
true
if
(
e
.
altKey
)
{
}
return
true
break
;
}
case
'shift'
:
break
;
if
(
e
.
shiftKey
){
case
'shift'
:
return
true
;
if
(
e
.
shiftKey
)
{
}
return
true
;
}
}
}
if
(
keyCode
==
keymap
[
key
])
{
if
(
keyCode
==
keymap
[
key
]
)
{
return
true
;
return
true
;
}
}
return
false
return
false
...
@@ -114,15 +115,15 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -114,15 +115,15 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
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
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
var
keys
=
shortcutkeys
[
i
].
toLowerCase
().
split
(
'+'
);
var
current
=
0
;
var
current
=
0
;
utils
.
each
(
keys
,
function
(
i
,
k
)
{
utils
.
each
(
keys
,
function
(
i
,
k
)
{
if
(
checkkey
(
k
,
keyCode
,
originEvent
))
{
if
(
checkkey
(
k
,
keyCode
,
originEvent
)
)
{
current
++
;
current
++
;
}
}
});
}
);
if
(
current
==
keys
.
length
)
{
if
(
current
==
keys
.
length
)
{
if
(
me
.
queryCommandState
(
i
)
!=
-
1
)
if
(
me
.
queryCommandState
(
i
)
!=
-
1
)
me
.
execCommand
(
i
);
me
.
execCommand
(
i
);
originEvent
.
preventDefault
();
originEvent
.
preventDefault
();
...
@@ -132,38 +133,38 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
...
@@ -132,38 +133,38 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
}
}
}
);
}
);
},
},
_initContextmenu
:
function
()
{
_initContextmenu
:
function
()
{
this
.
contextmenus
=
[];
this
.
contextmenus
=
[];
},
},
addContextmenu
:
function
(
item
)
{
addContextmenu
:
function
(
item
)
{
if
(
utils
.
isArray
(
item
))
{
if
(
utils
.
isArray
(
item
)
)
{
this
.
contextmenus
=
this
.
contextmenus
.
concat
(
item
);
this
.
contextmenus
=
this
.
contextmenus
.
concat
(
item
);
}
else
{
}
else
{
this
.
contextmenus
.
push
(
item
);
this
.
contextmenus
.
push
(
item
);
}
}
return
this
;
return
this
;
},
},
getContextmenu
:
function
()
{
getContextmenu
:
function
()
{
return
this
.
contextmenus
;
return
this
.
contextmenus
;
},
},
_initStatus
:
function
()
{
_initStatus
:
function
()
{
this
.
_status
=
"normal"
;
this
.
_status
=
"normal"
;
this
.
_rollbackStatus
=
"normal"
;
this
.
_rollbackStatus
=
"normal"
;
},
},
setStatus
:
function
(
status
)
{
setStatus
:
function
(
status
)
{
if
(
status
)
{
if
(
status
)
{
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_rollbackStatus
=
this
.
_status
;
this
.
_status
=
status
;
this
.
_status
=
status
;
}
else
{
}
else
{
this
.
_status
=
''
;
this
.
_status
=
''
;
}
}
return
this
;
return
this
;
},
},
rollbackStatus
:
function
()
{
rollbackStatus
:
function
()
{
this
.
_status
=
this
.
_rollbackStatus
;
this
.
_status
=
this
.
_rollbackStatus
;
},
},
getStatus
:
function
()
{
getStatus
:
function
()
{
return
this
.
_status
;
return
this
.
_status
;
}
}
}
);
}
);
...
...
src/module/editor.js
View file @
2a887e44
...
@@ -41,6 +41,8 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -41,6 +41,8 @@ KityMinder.registerModule( "TextEditModule", function () {
node
=
selectionShape
.
getData
(
'relatedNode'
);
node
=
selectionShape
.
getData
(
'relatedNode'
);
e
.
stopPropagationImmediately
();
e
.
stopPropagationImmediately
();
}
}
if
(
this
.
getStatus
()
==
'textedit'
)
this
.
fire
(
'contentchange'
);
km
.
setStatus
(
'normal'
)
km
.
setStatus
(
'normal'
)
}
}
if
(
node
){
if
(
node
){
...
...
src/module/editor.range.js
View file @
2a887e44
...
@@ -35,6 +35,7 @@ Minder.Range = kity.createClass('Range',{
...
@@ -35,6 +35,7 @@ Minder.Range = kity.createClass('Range',{
startOffset
:
range
.
startOffset
startOffset
:
range
.
startOffset
}
}
},
},
collapse
:
function
(
toStart
){
collapse
:
function
(
toStart
){
this
.
nativeRange
.
collapse
(
toStart
===
true
);
this
.
nativeRange
.
collapse
(
toStart
===
true
);
return
this
;
return
this
;
...
@@ -42,5 +43,10 @@ Minder.Range = kity.createClass('Range',{
...
@@ -42,5 +43,10 @@ Minder.Range = kity.createClass('Range',{
insertNode
:
function
(
node
){
insertNode
:
function
(
node
){
this
.
nativeRange
.
insertNode
(
node
);
this
.
nativeRange
.
insertNode
(
node
);
return
this
;
return
this
;
},
updateNativeRange
:
function
(){
this
.
nativeRange
=
this
.
nativeSel
.
getRangeAt
(
0
);
return
this
;
}
}
});
});
\ No newline at end of file
src/module/editor.receiver.js
View file @
2a887e44
...
@@ -5,6 +5,7 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -5,6 +5,7 @@ Minder.Receiver = kity.createClass('Receiver',{
this
.
selection
&&
this
.
selection
.
setHide
();
this
.
selection
&&
this
.
selection
.
setHide
();
this
.
range
&&
this
.
range
.
nativeSel
.
removeAllRanges
();
this
.
range
&&
this
.
range
.
nativeSel
.
removeAllRanges
();
this
.
index
=
0
;
this
.
index
=
0
;
this
.
inputLength
=
0
;
return
this
;
return
this
;
},
},
setTextEditStatus
:
function
(
status
){
setTextEditStatus
:
function
(
status
){
...
@@ -22,7 +23,7 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -22,7 +23,7 @@ Minder.Receiver = kity.createClass('Receiver',{
_div
.
className
=
'km_receiver'
;
_div
.
className
=
'km_receiver'
;
this
.
container
=
document
.
body
.
insertBefore
(
_div
,
document
.
body
.
firstChild
);
this
.
container
=
document
.
body
.
insertBefore
(
_div
,
document
.
body
.
firstChild
);
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}'
);
//
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}'
);
//
this
.
km
.
on
(
'textedit.beforekeyup textedit.keydown'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
));
this
.
km
.
on
(
'textedit.beforekeyup textedit.keydown
textedit.paste
'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
));
this
.
timer
=
null
;
this
.
timer
=
null
;
this
.
index
=
0
;
this
.
index
=
0
;
},
},
...
@@ -74,8 +75,32 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -74,8 +75,32 @@ Minder.Receiver = kity.createClass('Receiver',{
var
orgEvt
=
e
.
originEvent
;
var
orgEvt
=
e
.
originEvent
;
var
keyCode
=
orgEvt
.
keyCode
;
var
keyCode
=
orgEvt
.
keyCode
;
var
keys
=
KityMinder
.
keymap
;
var
keys
=
KityMinder
.
keymap
;
function
setTextToContainer
(){
var
text
=
me
.
container
.
textContent
.
replace
(
/
[\u
200b
\t\r\n]
/g
,
''
);
if
(
me
.
textShape
.
getOpacity
()
==
0
){
me
.
textShape
.
setOpacity
(
1
);
}
me
.
textShape
.
setContent
(
text
);
me
.
setContainerStyle
();
me
.
minderNode
.
setText
(
text
);
if
(
text
.
length
==
0
){
me
.
textShape
.
setContent
(
'a'
);
me
.
textShape
.
setOpacity
(
0
);
}
me
.
km
.
updateLayout
(
me
.
minderNode
);
me
.
setBaseOffset
();
me
.
updateTextData
();
me
.
updateIndex
();
me
.
updateSelection
();
me
.
timer
=
setTimeout
(
function
(){
me
.
selection
.
setShow
()
},
500
);
}
switch
(
e
.
type
){
switch
(
e
.
type
){
case
'keydown'
:
case
'keydown'
:
switch
(
e
.
originEvent
.
keyCode
)
{
switch
(
e
.
originEvent
.
keyCode
)
{
case
keys
.
Enter
:
case
keys
.
Enter
:
...
@@ -86,8 +111,33 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -86,8 +111,33 @@ Minder.Receiver = kity.createClass('Receiver',{
e
.
preventDefault
();
e
.
preventDefault
();
break
;
break
;
}
}
if
(
e
.
originEvent
.
ctrlKey
||
e
.
originEvent
.
metaKey
){
//粘贴
if
(
keyCode
==
keymap
.
v
){
setTimeout
(
function
(){
me
.
range
.
updateNativeRange
().
insertNode
(
$
(
'<span>$$_kityminder_bookmark_$$</span>'
)[
0
]);
me
.
container
.
innerHTML
=
me
.
container
.
textContent
.
replace
(
/
[\u
200b
\t\r\n]
/g
,
''
);
var
index
=
me
.
container
.
textContent
.
indexOf
(
'$$_kityminder_bookmark_$$'
);
me
.
container
.
textContent
=
me
.
container
.
textContent
.
replace
(
'$$_kityminder_bookmark_$$'
,
''
);
me
.
range
.
setStart
(
me
.
container
.
firstChild
,
index
).
collapse
(
true
).
select
();
setTextToContainer
()
},
100
);
}
//剪切
if
(
keyCode
==
keymap
.
x
){
setTimeout
(
function
(){
setTextToContainer
()
},
100
);
}
return
;
}
break
;
break
;
case
'beforekeyup'
:
case
'beforekeyup'
:
switch
(
keyCode
){
switch
(
keyCode
){
case
keymap
.
Enter
:
case
keymap
.
Enter
:
case
keymap
.
Tab
:
case
keymap
.
Tab
:
...
@@ -105,34 +155,14 @@ Minder.Receiver = kity.createClass('Receiver',{
...
@@ -105,34 +155,14 @@ Minder.Receiver = kity.createClass('Receiver',{
return
;
return
;
}
}
var
text
=
this
.
container
.
textContent
.
replace
(
/
\u
200b/g
,
''
);
if
(
this
.
textShape
.
getOpacity
()
==
0
){
this
.
textShape
.
setOpacity
(
1
);
}
this
.
textShape
.
setContent
(
text
);
this
.
setContainerStyle
();
this
.
minderNode
.
setText
(
text
);
if
(
text
.
length
==
0
){
this
.
textShape
.
setContent
(
'a'
);
this
.
textShape
.
setOpacity
(
0
);
}
this
.
km
.
updateLayout
(
this
.
minderNode
);
this
.
setBaseOffset
();
this
.
updateTextData
();
this
.
updateIndex
();
this
.
updateSelection
();
this
.
timer
=
setTimeout
(
function
(){
setTextToContainer
();
me
.
selection
.
setShow
()
},
500
);
return
true
;
return
true
;
}
}
},
},
updateIndex
:
function
(){
updateIndex
:
function
(){
this
.
index
=
this
.
range
.
getStart
().
startOffset
;
this
.
index
=
this
.
range
.
getStart
().
startOffset
;
},
},
...
...
src/module/layout.default.js
View file @
2a887e44
...
@@ -551,14 +551,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
...
@@ -551,14 +551,6 @@ KityMinder.registerModule( "LayoutDefault", function () {
node
.
setType
(
"main"
);
node
.
setType
(
"main"
);
}
else
{
}
else
{
node
.
setType
(
"sub"
);
node
.
setType
(
"sub"
);
var
isExpand
=
parent
.
getData
(
"expand"
);
if
(
isExpand
===
undefined
)
{
isExpand
=
true
;
parent
.
setData
(
"expand"
,
isExpand
);
}
// if ( !isExpand ) {
// return false;
// }
}
}
//计算位置等流程
//计算位置等流程
updateBg
(
node
);
updateBg
(
node
);
...
...
src/module/select.js
View file @
2a887e44
...
@@ -101,6 +101,7 @@ KityMinder.registerModule( "Select", function () {
...
@@ -101,6 +101,7 @@ KityMinder.registerModule( "Select", function () {
if
(
!
downNode
)
{
if
(
!
downNode
)
{
this
.
removeAllSelectedNodes
();
this
.
removeAllSelectedNodes
();
marqueeActivator
.
selectStart
(
e
);
marqueeActivator
.
selectStart
(
e
);
this
.
setStatus
(
'normal'
)
this
.
setStatus
(
'normal'
)
}
}
...
...
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