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
0333a2d9
Commit
0333a2d9
authored
Jun 10, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
merge reflact
parents
c007c290
045469a1
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
31 deletions
+66
-31
CHANGELOG.md
CHANGELOG.md
+4
-0
zip.js
lib/zip.js
+10
-4
browser.js
src/core/browser.js
+3
-1
default.js
src/layout/default.js
+2
-6
editor.js
src/module/editor.js
+17
-9
editor.receiver.js
src/module/editor.receiver.js
+22
-11
mindmanager.js
src/protocal/mindmanager.js
+4
-0
xmind.js
src/protocal/xmind.js
+4
-0
No files found.
CHANGELOG.md
View file @
0333a2d9
# KityMinder 更新日志
## v1.2.0
### 功能更新
1.
支持ipad上的文字编辑
## v1.1.3.1
...
...
lib/zip.js
View file @
0333a2d9
...
...
@@ -716,11 +716,17 @@
function
seekEOCDR
(
offset
,
entriesCallback
)
{
reader
.
readUint8Array
(
reader
.
size
-
offset
,
offset
,
function
(
bytes
)
{
var
dataView
=
getDataHelper
(
bytes
.
length
,
bytes
).
view
;
if
(
dataView
.
getUint32
(
0
)
!=
0x504b0506
)
{
seekEOCDR
(
offset
+
1
,
entriesCallback
);
}
else
{
entriesCallback
(
dataView
);
try
{
if
(
dataView
.
getUint32
(
0
)
!=
0x504b0506
)
{
seekEOCDR
(
offset
+
1
,
entriesCallback
);
}
else
{
entriesCallback
(
dataView
);
}
}
catch
(
e
){
console
.
log
(
e
);
onerror
(
ERR_READ
);
}
},
function
()
{
onerror
(
ERR_READ
);
});
...
...
src/core/browser.js
View file @
0333a2d9
...
...
@@ -67,7 +67,9 @@ var browser = KityMinder.browser = function(){
* }
* ```
*/
quirks
:
(
document
.
compatMode
==
'BackCompat'
)
quirks
:
(
document
.
compatMode
==
'BackCompat'
),
ipad
:
(
agent
.
indexOf
(
'ipad'
)
>
-
1
)
};
/**
...
...
src/layout/default.js
View file @
0333a2d9
...
...
@@ -18,12 +18,8 @@ KityMinder.registerLayout('default', kity.createClass({
node
=
node
.
parent
;
}
var
mainIndex
=
node
.
getIndex
();
return
{
0
:
'right'
,
1
:
'right'
,
2
:
'left'
,
3
:
'left'
}[
mainIndex
]
||
(
mainIndex
%
2
?
'right'
:
'left'
);
var
length
=
node
.
parent
.
children
.
length
;
return
mainIndex
<
length
/
2
?
'right'
:
'left'
;
},
doLayoutRoot
:
function
(
root
)
{
...
...
src/module/editor.js
View file @
0333a2d9
...
...
@@ -45,7 +45,7 @@ KityMinder.registerModule('TextEditModule', function() {
};
var
selectionByClick
=
false
;
var
dragmoveTimer
;
return
{
'events'
:
{
'ready'
:
function
()
{
...
...
@@ -132,7 +132,12 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
var
orgEvt
=
e
.
originEvent
,
keyCode
=
orgEvt
.
keyCode
;
if
(
keymap
.
isSelectedNodeKey
[
keyCode
]
&&
km
.
getStatus
()
!=
'textedit'
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
)
{
if
(
keymap
.
isSelectedNodeKey
[
keyCode
]
&&
km
.
getStatus
()
!=
'textedit'
&&
!
orgEvt
.
ctrlKey
&&
!
orgEvt
.
metaKey
&&
!
orgEvt
.
shiftKey
&&
!
orgEvt
.
altKey
)
{
//准备输入状态
var
textShape
=
node
.
getTextShape
();
...
...
@@ -162,16 +167,18 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
mouseDownStatus
)
{
if
(
!
sel
.
collapsed
)
{
try
{
receiver
.
updateRange
(
range
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
else
}
else
{
sel
.
setShow
();
}
else
{
}
if
(
browser
.
ipad
)
{
receiver
.
container
.
focus
();
}
//当选中节点后,输入状态准备
var
node
=
e
.
getTargetNode
();
if
(
node
)
{
...
...
@@ -206,7 +213,8 @@ KityMinder.registerModule('TextEditModule', function() {
oneTime
=
0
;
},
'textedit.beforemousemove'
:
function
(
e
)
{
if
(
mouseDownStatus
)
{
//ipad下不做框选
if
(
mouseDownStatus
&&
!
browser
.
ipad
)
{
e
.
stopPropagationImmediately
();
var
offset
=
e
.
getPosition
(
this
.
getRenderContainer
());
...
...
@@ -268,10 +276,10 @@ KityMinder.registerModule('TextEditModule', function() {
receiver
.
clear
().
setTextEditStatus
(
false
);
km
.
setStatus
(
'normal'
);
},
"resize"
:
function
(
e
)
{
'resize'
:
function
(
e
)
{
sel
.
setHide
();
},
"execCommand"
:
function
(
e
)
{
'execCommand'
:
function
(
e
)
{
var
cmds
=
{
'appendchildnode'
:
1
,
'appendsiblingnode'
:
1
,
...
...
src/module/editor.receiver.js
View file @
0333a2d9
...
...
@@ -27,12 +27,12 @@ Minder.Receiver = kity.createClass('Receiver', {
_div
.
setAttribute
(
'contenteditable'
,
true
);
_div
.
className
=
'km_receiver'
;
this
.
container
=
_div
;
if
(
browser
.
ie
&&
browser
.
version
==
11
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
"beforekeyup"
:
e
.
type
,
e
));
if
(
browser
.
ie
&&
browser
.
version
==
11
||
browser
.
ipad
)
{
utils
.
listen
(
this
.
container
,
'keydown keypress keyup
input
'
,
function
(
e
)
{
me
.
keyboardEvents
.
call
(
me
,
new
MinderEvent
(
e
.
type
==
'keyup'
?
'beforekeyup'
:
e
.
type
,
e
));
});
}
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{white-space:nowrap;position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);
}
'
);
//
utils
.
addCssRule
(
'km_receiver_css'
,
' .km_receiver{white-space:nowrap;position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);'
);
//
this
.
km
.
on
(
'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste'
,
utils
.
proxy
(
this
.
keyboardEvents
,
this
));
this
.
timer
=
null
;
this
.
index
=
0
;
...
...
@@ -97,7 +97,7 @@ Minder.Receiver = kity.createClass('Receiver', {
}
//#46 修复在ff下定位到文字后方空格光标不移动问题
if
(
browser
.
gecko
&&
/
\s
$/
.
test
(
text
))
{
text
+=
"
\
u200b"
;
text
+=
'
\
u200b'
;
}
me
.
minderNode
.
setText
(
text
);
...
...
@@ -129,6 +129,14 @@ Minder.Receiver = kity.createClass('Receiver', {
switch
(
e
.
type
)
{
case
'input'
:
if
(
browser
.
ipad
)
{
setTimeout
(
function
()
{
setTextToContainer
();
});
}
break
;
case
'keydown'
:
this
.
isTypeText
=
keyCode
==
229
||
keyCode
===
0
;
switch
(
keyCode
)
{
...
...
@@ -169,7 +177,6 @@ Minder.Receiver = kity.createClass('Receiver', {
}
return
;
}
setTimeout
(
function
()
{
setTextToContainer
();
});
...
...
@@ -253,8 +260,10 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
},
setContainerStyle
:
function
()
{
var
textShapeBox
=
this
.
getBaseOffset
(
'screen'
);
this
.
container
.
style
.
cssText
=
";left:"
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
+
textShapeBox
.
height
*
0.1
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
var
textShapeBox
=
this
.
getBaseOffset
(
'paper'
);
this
.
container
.
style
.
cssText
=
';left:'
+
(
browser
.
ipad
?
'-'
:
''
)
+
textShapeBox
.
x
+
'px;top:'
+
(
textShapeBox
.
y
+
textShapeBox
.
height
*
0.1
)
+
'px;width:'
+
textShapeBox
.
width
+
'px;height:'
+
textShapeBox
.
height
+
'px;'
;
if
(
!
this
.
selection
.
isShow
())
{
var
paperContainer
=
this
.
km
.
getPaper
();
...
...
@@ -351,7 +360,8 @@ Minder.Receiver = kity.createClass('Receiver', {
if
(
offset
.
x
<=
v
.
x
+
v
.
width
/
2
)
{
me
.
selection
.
collapse
();
}
else
{
me
.
selection
.
setEndOffset
(
i
+
((
me
.
selection
.
endOffset
>
i
||
dir
==
1
)
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
));
me
.
selection
.
setEndOffset
(
i
+
((
me
.
selection
.
endOffset
>
i
||
dir
==
1
)
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
));
}
}
else
if
(
i
>
me
.
index
)
{
...
...
@@ -359,7 +369,8 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
selection
.
setEndOffset
(
i
+
1
);
}
else
{
if
(
dir
==
1
)
{
me
.
selection
.
setStartOffset
(
i
+
(
offset
.
x
>=
v
.
x
+
v
.
width
/
2
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
));
me
.
selection
.
setStartOffset
(
i
+
(
offset
.
x
>=
v
.
x
+
v
.
width
/
2
&&
i
!=
me
.
textData
.
length
-
1
?
1
:
0
));
}
else
{
me
.
selection
.
setStartOffset
(
i
);
}
...
...
@@ -385,7 +396,7 @@ Minder.Receiver = kity.createClass('Receiver', {
var
lastOffset
=
this
.
textData
[
this
.
textData
.
length
-
1
];
width
=
lastOffset
.
x
-
startOffset
.
x
+
lastOffset
.
width
;
}
catch
(
e
)
{
console
.
log
(
'e'
);
console
.
log
(
e
);
}
}
else
{
...
...
src/protocal/mindmanager.js
View file @
0333a2d9
...
...
@@ -74,6 +74,10 @@ KityMinder.registerProtocal( 'mindmanager', function () {
return
result
;
}
function
onerror
(){
alert
(
'文件过程解压出错,请检查该文件是否损坏'
);
}
function
getEntries
(
file
,
onend
)
{
zip
.
createReader
(
new
zip
.
BlobReader
(
file
),
function
(
zipReader
)
{
zipReader
.
getEntries
(
onend
);
...
...
src/protocal/xmind.js
View file @
0333a2d9
...
...
@@ -80,6 +80,10 @@ KityMinder.registerProtocal( 'xmind', function () {
return
result
;
}
function
onerror
(){
alert
(
'文件过程解压出错,请检查该文件是否损坏'
);
}
function
getEntries
(
file
,
onend
)
{
zip
.
createReader
(
new
zip
.
BlobReader
(
file
),
function
(
zipReader
)
{
zipReader
.
getEntries
(
onend
);
...
...
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