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
b4d1216c
Commit
b4d1216c
authored
Sep 10, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:fex-team/kityminder into dev
parents
62615c38
564bb5a4
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
184 additions
and
86 deletions
+184
-86
command.js
spec/core/command.js
+6
-6
minder.command.js
spec/core/minder.command.js
+21
-0
node.js
spec/core/node.js
+20
-0
utils.js
spec/core/utils.js
+6
-24
import.js
spec/import.js
+59
-34
caseSource.php
spec/tools/caseSource.php
+20
-8
utils.js
src/core/utils.js
+5
-0
editor.js
src/module/editor.js
+7
-4
editor.keyboard.js
src/module/editor.keyboard.js
+23
-6
editor.range.js
src/module/editor.range.js
+14
-2
editor.receiver.js
src/module/editor.receiver.js
+3
-2
No files found.
spec/core/command.js
View file @
b4d1216c
describe
(
"command"
,
function
()
{
//初始化kityminder
var
kityMinderDiv
=
document
.
createElement
(
"div"
);
kityMinderDiv
.
id
=
"kityminder"
;
kityMinderDiv
.
style
.
height
=
"500px"
;
...
...
@@ -6,11 +7,9 @@ describe("command", function () {
var
obj
;
var
km
;
beforeEach
(
function
(){
document
.
body
.
appendChild
(
kityMinderDiv
);
km
=
KM
.
get
KityMinder
(
'kityminder'
);
km
=
KM
.
get
Minder
(
'kityminder'
,
window
.
KITYMINDER_CONFIG
);
obj
=
document
.
getElementById
(
'kityminder'
);
});
...
...
@@ -18,11 +17,12 @@ describe("command", function () {
// obj = null;
// document.body.removeChild(kityMinderDiv);
});
//kityminder初始化end
it
(
''
,
function
(){
console
.
log
(
km
);
obj
=
document
.
getElementById
(
'kityminder'
);
console
.
log
(
obj
);
})
});
\ No newline at end of file
spec/core/minder.command.js
View file @
b4d1216c
describe
(
"minder.command"
,
function
()
{
//初始化kityminder
var
kityMinderDiv
=
document
.
createElement
(
"div"
);
kityMinderDiv
.
id
=
"kityminder"
;
kityMinderDiv
.
style
.
height
=
"500px"
;
kityMinderDiv
.
style
.
position
=
"relative"
;
var
obj
;
var
km
;
beforeEach
(
function
(){
document
.
body
.
appendChild
(
kityMinderDiv
);
km
=
KM
.
getMinder
(
'kityminder'
,
window
.
KITYMINDER_CONFIG
);
obj
=
document
.
getElementById
(
'kityminder'
);
});
afterEach
(
function
(){
// obj = null;
// document.body.removeChild(kityMinderDiv);
});
//kityminder初始化end
it
(
''
,
function
(){
})
...
...
spec/core/node.js
View file @
b4d1216c
describe
(
"node"
,
function
()
{
//初始化kityminder
var
kityMinderDiv
=
document
.
createElement
(
"div"
);
kityMinderDiv
.
id
=
"kityminder"
;
kityMinderDiv
.
style
.
height
=
"500px"
;
kityMinderDiv
.
style
.
position
=
"relative"
;
var
obj
;
var
km
;
beforeEach
(
function
(){
document
.
body
.
appendChild
(
kityMinderDiv
);
km
=
KM
.
getMinder
(
'kityminder'
,
window
.
KITYMINDER_CONFIG
);
obj
=
document
.
getElementById
(
'kityminder'
);
});
afterEach
(
function
(){
// obj = null;
// document.body.removeChild(kityMinderDiv);
});
//kityminder初始化end
var
root
=
new
KM
.
MinderNode
(
'root'
);
var
first
=
new
KM
.
MinderNode
(
'first'
);
...
...
spec/core/utils.js
View file @
b4d1216c
describe
(
"utils"
,
function
()
{
//初始化kityminder
var
kityMinderDiv
=
document
.
createElement
(
"div"
);
kityMinderDiv
.
id
=
"kityminder"
;
kityMinderDiv
.
style
.
height
=
"500px"
;
kityMinderDiv
.
style
.
position
=
"relative"
;
var
obj
;
var
km
;
var
flag
=
true
;
beforeEach
(
function
(){
if
(
flag
){
document
.
getElementById
(
'HTMLReporter'
).
appendChild
(
kityMinderDiv
);
km
=
KM
.
getKityMinder
(
'kityminder'
);
obj
=
document
.
getElementById
(
'kityminder'
);
flag
=
false
;
}
document
.
body
.
appendChild
(
kityMinderDiv
);
km
=
KM
.
getMinder
(
'kityminder'
,
window
.
KITYMINDER_CONFIG
);
obj
=
document
.
getElementById
(
'kityminder'
);
});
afterEach
(
function
(){
// obj = null;
// document.body.removeChild(kityMinderDiv);
// console.log(km);
});
//kityminder初始化end
// var kityMinderDiv = document.createElement("div");
// kityMinderDiv.id = "kityminder";
// kityMinderDiv.style.height = "500px";
// kityMinderDiv.style.position = "relative";
// var obj;
// var km;
// var flag = true;
//
// if(flag){
// document.body.appendChild(kityMinderDiv);
// km = KM.getKityMinder('kityminder');
// obj = document.getElementById('kityminder');
// flag = false;
// }
...
...
spec/import.js
View file @
b4d1216c
...
...
@@ -45,11 +45,11 @@
///import module/resource;
///import module/view;
///import module/dragtree;
///import module/dropfile;
///import module/keyboard;
///import module/select;
///import module/history;
///import module/editor;
///import module/editor.keyboard;
///import module/editor.range;
///import module/editor.receiver;
///import module/editor.selection;
...
...
@@ -59,42 +59,67 @@
///import module/hyperlink;
///import module/arrange;
///import module/paste;
///import ui/jquery-ui-1.10.4.custom.min;
///import ui/widget;
///import ui/button;
///import ui/toolbar;
///import ui/menu;
///import ui/dropmenu;
///import ui/splitbutton;
///import ui/colorsplitbutton;
///import ui/popup;
///import ui/scale;
///import ui/colorpicker;
///import ui/combobox;
///import ui/buttoncombobox;
///import ui/modal;
///import ui/tooltip;
///import ui/tab;
///import ui/separator;
///import ui/scale;
///import adapter/utils;
///import adapter/adapter;
///import adapter/button;
///import adapter/combobox;
///import adapter/color;
///import adapter/saveto;
///import adapter/tooltips;
///import adapter/face;
///import adapter/node;
///import adapter/contextmenu;
///import adapter/dialog;
///import adapter/hyperlink;
///import adapter/image;
///import adapter/zoom;
///import module/style;
///import protocal/xmind;
///import protocal/freemind;
///import protocal/mindmanager;
///import protocal/plain;
///import protocal/json;
///import protocal/png;
///import protocal/svg;
\ No newline at end of file
///import protocal/svg;
///import ui/ui;
///import ui/eve;
///import ui/fuix;
///import ui/fiox;
///import ui/doc;
///import ui/widget/commandbutton;
///import ui/widget/commandbuttonset;
///import ui/widget/commandinputmenu;
///import ui/widget/friendlytimespan;
///import ui/widget/locallist;
///import ui/widget/netdiskfinder;
///import ui/widget/menutab;
///import ui/menu/menu;
///import ui/menu/header;
///import ui/menu/default;
///import ui/menu/new/new;
///import ui/menu/open/open;
///import ui/menu/open/recent;
///import ui/menu/open/netdisk;
///import ui/menu/open/local;
///import ui/menu/open/draft;
///import ui/menu/save/save;
///import ui/menu/save/netdisk;
///import ui/menu/save/download;
///import ui/menu/share/share;
///import ui/topbar/history;
///import ui/topbar/user;
///import ui/topbar/search;
///import ui/topbar/title;
///import ui/ribbon/tabs;
///import ui/ribbon/idea/insert;
///import ui/ribbon/idea/arrange;
///import ui/ribbon/idea/operation;
///import ui/ribbon/idea/attachment;
///import ui/ribbon/idea/link;
///import ui/ribbon/idea/image;
///import ui/ribbon/idea/priority;
///import ui/ribbon/idea/progress;
///import ui/ribbon/idea/resource;
///import ui/ribbon/appearence/template;
///import ui/ribbon/appearence/theme;
///import ui/ribbon/appearence/layout;
///import ui/ribbon/appearence/style;
///import ui/ribbon/appearence/font;
///import ui/ribbon/appearence/color;
///import ui/ribbon/view/level;
spec/tools/caseSource.php
View file @
b4d1216c
...
...
@@ -58,9 +58,21 @@ class Kiss
//先引用kity
print
"<script src='../../lib/jquery-2.1.0.min.js'></script>
\n
"
;
print
"<script src='../../lib/jquery.xml2json.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/jquery.transit.min.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/jquery.blob.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/zip.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/promise-1.0.0.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/ZeroClipboard.min.js' charset='utf-8'></script>
\n
"
;
print
"<script type='text/javascript'>ZeroClipboard.setDefaults( { moviePath: '../../lib/ZeroClipboard.swf' } );</script>
\n
"
;
print
"<script src='../../kity/dist/kity.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/fui/dev-lib/jhtmls.min.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/fui/dist/fui.all.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/fio/src/fio.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/fio/provider/netdisk/oauth.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/fio/provider/netdisk/netdisk.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lib/kity/dist/kity.js' charset='utf-8'></script>
\n
"
;
//分成两部分:一部分默认加载(可配置),一部分针对文件加载(例如在文件头部有注释标注依赖文件,根据依赖文件动态加载)
// core里面的文件全部加载,module加载用例对应的src文件,最后加载与用例同名的原文件
...
...
@@ -70,10 +82,10 @@ class Kiss
print
"<script src='../../kityminder.config.js' charset='utf-8'></script>
\n
"
;
print
"<script src='../../lang/zh-cn/zh-cn.js' charset='utf-8'></script>
\n
"
;
print
"<script
src='../../lib/zip.js' charset='utf-8'>
</script>
\n
"
;
print
"<script
>zip.inflateJSPath = '../../lib/inflate.js'
;</script>
\n
"
;
print
"<script src='../../lib/jquery.xml2json.js' charset='utf-8'>
</script>
\n
"
;
print
"<script src='../../lib/baidu-frontia-js-full-1.0.0.js' charset='utf-8'></script>
\n
"
;
print
"<script
type='text/javascript'>zip.inflateJSPath = '../../lib/inflate.js';
</script>
\n
"
;
print
"<script
type='text/javascript'>window._bd_share_config=
{
'common':{'bdSnsKey':{},'bdMini':'2','bdMiniList':[],'bdPic':'','bdStyle':'1','bdSize':'32'},'share':{}
}
;with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)]
;</script>
\n
"
;
// print "<script>zip.inflateJSPath = '../../lib/inflate.js';
</script>\n";
//
print "<script src='../../lib/baidu-frontia-js-full-1.0.0.js' charset='utf-8'></script>\n";
// print "<script src='../../social/draftmanager.js' charset='utf-8'></script>\n";
// print "<script src='../../social/social.js' charset='utf-8'></script>\n";
...
...
@@ -81,8 +93,8 @@ class Kiss
//引用测试文件
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$this
->
name
.
'.js"></script>'
.
"
\n
"
;
print
"<link href='../../
social/socia
l.css' rel='stylesheet'>
\n
"
;
print
"<link href='../../themes/default/css/import.css' type='text/css' rel='stylesheet' />
\n
"
;
print
"<link href='../../
ui/theme/default/css/default.al
l.css' rel='stylesheet'>
\n
"
;
//
print "<link href='../../themes/default/css/import.css' type='text/css' rel='stylesheet' />\n";
print
"<link href='../../favicon.ico' type='image/x-icon' rel='shortcut icon'>
\n
"
;
print
"<link href='../../favicon.ico' type='image/x-icon' rel='apple-touch-icon-precomposed'>
\n
"
;
}
...
...
src/core/utils.js
View file @
b4d1216c
...
...
@@ -281,7 +281,12 @@ var utils = Utils = KityMinder.Utils = {
utils
.
each
(
data
,
function
(
i
,
arr
){
if
(
initIndex
+
arr
.
length
>=
index
){
if
(
index
-
initIndex
==
arr
.
length
){
if
(
arr
.
length
==
1
&&
arr
[
0
].
width
===
0
){
initIndex
++
;
return
;
}
result
=
{
x
:
arr
[
arr
.
length
-
1
].
x
+
arr
[
arr
.
length
-
1
].
width
,
y
:
arr
[
arr
.
length
-
1
].
y
...
...
src/module/editor.js
View file @
b4d1216c
...
...
@@ -210,11 +210,14 @@ KityMinder.registerModule('TextEditModule', function() {
var
node
=
e
.
getTargetNode
();
e
.
stopPropagationImmediately
();
var
offset
=
e
.
getPosition
(
node
.
getRenderContainer
());
if
(
node
){
var
offset
=
e
.
getPosition
(
node
.
getRenderContainer
());
receiver
.
updateSelectionByMousePosition
(
offset
)
.
updateSelection
(
offset
)
.
updateContainerRangeBySel
();
receiver
.
updateSelectionByMousePosition
(
offset
)
.
updateSelection
(
offset
)
.
updateContainerRangeBySel
();
}
}
else
if
(
mouseDownStatus
&&
!
selectionReadyShow
){
...
...
src/module/editor.keyboard.js
View file @
b4d1216c
...
...
@@ -83,7 +83,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
// }
//重新渲染节点
me
.
minderNode
.
setText
(
text
);
me
.
re
.
setContainerStyle
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
...
...
@@ -109,10 +108,11 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
me
.
timer
=
setTimeout
(
function
()
{
if
(
me
.
selection
.
isShow
()){
me
.
selection
.
setShow
();
}
},
200
);
...
...
@@ -227,7 +227,7 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
case
keymap
.
F2
:
if
(
browser
.
ipad
){
if
(
this
.
selection
.
isShow
()){
this
.
clear
();
this
.
re
.
clear
();
this
.
km
.
setStatus
(
'inputready'
);
clearTimeout
(
me
.
inputTextTimer
);
e
.
preventDefault
();
...
...
@@ -237,12 +237,13 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
}
return
;
}
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
me
.
_setTextToContainer
(
keyCode
);
}
if
(
this
.
keydownNode
===
this
.
minderNode
)
{
this
.
rollbackStatus
();
this
.
clear
();
if
(
this
.
re
.
keydownNode
===
this
.
re
.
minderNode
)
{
this
.
km
.
rollbackStatus
();
this
.
re
.
clear
();
}
e
.
preventDefault
();
return
;
...
...
@@ -308,6 +309,11 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
},
//处理软回车操作
_handlerEnterkey
:
function
(){
function
removeTmpTextNode
(
node
){
if
(
node
&&
node
.
nodeType
==
3
&&
node
.
nodeValue
.
length
===
0
){
node
.
parentNode
.
removeChild
(
node
);
}
}
var
rng
=
this
.
range
;
var
br
=
document
.
createElement
(
'br'
);
var
me
=
this
;
...
...
@@ -315,11 +321,22 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
rng
.
deleteContents
();
}
rng
.
insertNode
(
br
);
removeTmpTextNode
(
br
.
previousSibling
);
removeTmpTextNode
(
br
.
nextSibling
);
rng
.
setStartAfter
(
br
);
rng
.
collapse
(
true
);
var
start
=
rng
.
startContainer
.
childNodes
[
rng
.
startOffset
];
if
(
!
start
){
br
=
br
.
cloneNode
(
false
);
rng
.
startContainer
.
appendChild
(
br
);
rng
.
setStartBefore
(
br
);
rng
.
collapse
(
true
);
}
rng
.
select
();
me
.
_setTextToContainer
(
keymap
.
Enter
);
}
};
...
...
src/module/editor.range.js
View file @
b4d1216c
...
...
@@ -28,13 +28,13 @@ Minder.Range = kity.createClass('Range',function(){
var
rOffset
=
0
,
cont
=
rng
.
container
;
utils
.
each
(
cont
.
childNodes
,
function
(
index
,
node
){
if
(
node
.
nodeType
==
1
){
rOffset
++
;
if
(
rOffset
==
offset
){
rng
[
'set'
+
dir
](
cont
,
index
);
return
false
;
}
rOffset
++
;
return
;
}
...
...
@@ -65,12 +65,20 @@ Minder.Range = kity.createClass('Range',function(){
return
this
.
_updateBoundary
();
},
select
:
function
(){
var
start
=
this
.
nativeRange
.
startContainer
;
if
(
start
.
nodeType
==
1
&&
start
.
childNodes
.
length
===
0
){
var
char
=
document
.
createTextNode
(
'
\
u200b'
);
start
.
appendChild
(
char
);
this
.
nativeRange
.
setStart
(
char
,
1
);
this
.
nativeRange
.
collapse
(
true
);
}
else
if
(
this
.
collapsed
&&
start
.
nodeType
==
1
){
start
=
start
.
childNodes
[
this
.
startOffset
];
if
(
start
&&
start
.
nodeType
==
3
&&
start
.
nodeValue
.
length
===
0
){
this
.
nativeRange
.
setStart
(
start
,
1
);
this
.
nativeRange
.
collapse
(
true
);
}
}
try
{
this
.
nativeSel
.
removeAllRanges
();
...
...
@@ -84,6 +92,7 @@ Minder.Range = kity.createClass('Range',function(){
_updateBoundary
:
function
(){
var
nRange
=
this
.
nativeRange
;
this
.
startContainer
=
nRange
.
startContainer
;
this
.
startContainer
=
nRange
.
startContainer
;
this
.
endContainer
=
nRange
.
endContainer
;
this
.
startOffset
=
nRange
.
startOffset
;
this
.
endOffset
=
nRange
.
endOffset
;
...
...
@@ -108,6 +117,9 @@ Minder.Range = kity.createClass('Range',function(){
setStartAfter
:
function
(
node
){
return
this
.
setStart
(
node
.
parentNode
,
utils
.
getNodeIndex
(
node
)
+
1
);
},
setStartBefore
:
function
(
node
){
return
this
.
setStart
(
node
.
parentNode
,
utils
.
getNodeIndex
(
node
));
},
setEnd
:
function
(
node
,
offset
){
this
.
nativeRange
.
setEnd
(
node
,
offset
);
this
.
_updateBoundary
();
...
...
src/module/editor.receiver.js
View file @
b4d1216c
...
...
@@ -194,8 +194,8 @@ Minder.Receiver = kity.createClass('Receiver', {
return
false
;
}
if
(
i
==
arr
.
length
-
1
&&
offset
.
x
>=
v
.
x
)
{
me
.
index
+=
arr
.
length
;
me
.
index
+=
(
arr
.
length
==
1
&&
arr
[
0
].
width
===
0
?
0
:
arr
.
length
);
return
false
;
}
});
...
...
@@ -245,7 +245,8 @@ Minder.Receiver = kity.createClass('Receiver', {
return
false
;
}
if
(
i
==
arr
.
length
-
1
&&
offset
.
x
>=
v
.
x
)
{
result
+=
arr
.
length
;
result
+=
(
arr
.
length
==
1
&&
arr
[
0
].
width
===
0
?
0
:
arr
.
length
);
return
false
;
}
...
...
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