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
1e0a7717
Commit
1e0a7717
authored
Sep 05, 2014
by
techird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:fex-team/kityminder into dev
parents
938b2bb3
f2941b7f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
617 additions
and
215 deletions
+617
-215
CHANGELOG.md
CHANGELOG.md
+9
-0
kity
kity
+1
-1
zh-cn.js
lang/zh-cn/zh-cn.js
+4
-0
command.js
spec/core/command.js
+23
-0
utils.js
spec/core/utils.js
+186
-0
import.js
spec/import.js
+85
-1
karma.conf.js
spec/karma.conf.js
+193
-146
caseSource.php
spec/tools/caseSource.php
+25
-1
test.css
spec/tools/css/test.css
+1
-1
import.php
spec/tools/import.php
+3
-3
ZeroClipboard.js
spec/tools/js/ZeroClipboard.js
+1
-0
inflate.js
spec/tools/js/inflate.js
+5
-0
run.js
spec/tools/js/run.js
+1
-0
run.php
spec/tools/run.php
+5
-0
contextmenu.js
src/adapter/contextmenu.js
+11
-3
editor.js
src/module/editor.js
+2
-12
editor.receiver.js
src/module/editor.receiver.js
+26
-40
node.js
src/module/node.js
+10
-0
text.js
src/module/text.js
+26
-7
No files found.
CHANGELOG.md
View file @
1e0a7717
# KityMinder 更新日志
# KityMinder 更新日志
## v1.3.0
### 体验优化
1.
当在空白处右键时,在菜单项中添加插入节点选项
### BUG修复
1.
修复在空白节点有时会出现a字符的问题
## v1.2.1
## v1.2.1
### 体验优化
### 体验优化
...
...
kity
@
f83c5f10
Subproject commit f
ec9187f532aea5284d1fac25767dcca9ad43ce4
Subproject commit f
83c5f109addefd4f89ba11b4dfa88c191809e77
lang/zh-cn/zh-cn.js
View file @
1e0a7717
...
@@ -14,6 +14,10 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -14,6 +14,10 @@ KityMinder.LANG['zh-cn'] = {
'fresh-purple'
:
'浪漫紫'
,
'fresh-purple'
:
'浪漫紫'
,
'fresh-pink'
:
'脑残粉'
'fresh-pink'
:
'脑残粉'
},
},
'insert'
:{
//'maintopic':'插入中心主题',
'topic'
:
'插入分支主题'
},
'maintopic'
:
'中心主题'
,
'maintopic'
:
'中心主题'
,
'topic'
:
'分支主题'
,
'topic'
:
'分支主题'
,
'tooltips'
:
{
'tooltips'
:
{
...
...
spec/core/command.js
View file @
1e0a7717
describe
(
"command"
,
function
()
{
describe
(
"command"
,
function
()
{
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
.
getKityMinder
(
'kityminder'
);
obj
=
document
.
getElementById
(
'kityminder'
);
});
afterEach
(
function
(){
// obj = null;
// document.body.removeChild(kityMinderDiv);
});
it
(
''
,
function
(){
it
(
''
,
function
(){
})
})
...
...
spec/core/utils.js
View file @
1e0a7717
describe
(
"utils"
,
function
()
{
describe
(
"utils"
,
function
()
{
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
;
}
});
afterEach
(
function
(){
// document.body.removeChild(kityMinderDiv);
// console.log(km);
});
// 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;
// }
describe
(
'compareObject'
,
function
(){
describe
(
'compareObject'
,
function
(){
...
@@ -8,6 +48,31 @@ describe("utils", function () {
...
@@ -8,6 +48,31 @@ describe("utils", function () {
};
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
// console.log(km);
console
.
log
(
document
.
getElementById
(
'kityminder'
));
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
});
...
@@ -21,5 +86,126 @@ describe("utils", function () {
...
@@ -21,5 +86,126 @@ describe("utils", function () {
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
})
});
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
describe
(
'compareObject'
,
function
(){
var
obj1
=
{
'test'
:[
1
,
2
],
'test1'
:
1
};
var
obj2
=
utils
.
clonePlainObject
(
obj1
);
it
(
'相等'
,
function
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
it
(
'长度不同'
,
function
(){
obj2
.
test2
=
'1'
;
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
it
(
'数组中的数据不同'
,
function
(){
obj1
.
test
[
2
]
=
{};
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeFalsy
();
})
});
});
});
\ No newline at end of file
spec/import.js
View file @
1e0a7717
...
@@ -8,9 +8,93 @@
...
@@ -8,9 +8,93 @@
///import core/module;
///import core/module;
///import core/event;
///import core/event;
///import core/minder;
///import core/minder;
///import core/minder.data.compatibility;
///import core/minder.data;
///import core/minder.data;
///import core/minder.event;
///import core/minder.event;
///import core/minder.module;
///import core/minder.module;
///import core/minder.command;
///import core/minder.command;
///import core/minder.node;
///import core/minder.node;
///import core/minder.select;
///import core/minder.select;
\ No newline at end of file
///import core/keymap;
///import core/minder.lang;
///import core/minder.defaultoptions;
///import core/minder.preference;
///import core/browser;
///import core/layout;
///import core/connect;
///import core/render;
///import core/theme;
///import core/template;
///import layout/default;
///import layout/default.connect;
///import layout/bottom;
///import layout/filetree;
///import theme/default;
///import theme/snow;
///import theme/fresh;
///import template/structure;
///import module/node;
///import module/text;
///import module/expand;
///import module/outline;
///import module/geometry;
///import module/history;
///import module/progress;
///import module/priority;
///import module/image;
///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.range;
///import module/editor.receiver;
///import module/editor.selection;
///import module/basestyle;
///import module/font;
///import module/zoom;
///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 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
spec/karma.conf.js
View file @
1e0a7717
...
@@ -3,165 +3,212 @@
...
@@ -3,165 +3,212 @@
//karma-coverage@0.1.4
//karma-coverage@0.1.4
module
.
exports
=
function
(
config
)
{
module
.
exports
=
function
(
config
)
{
var
base_path
=
'../'
;
var
base_path
=
'../'
;
config
.
set
({
config
.
set
({
// base path, that will be used to resolve files and exclude
// base path, that will be used to resolve files and exclude
basePath
:
''
,
basePath
:
''
,
// frameworks to use
// frameworks to use
frameworks
:
[
'jasmine'
],
frameworks
:
[
'jasmine'
],
// list of files / patterns to load in the browser
// list of files / patterns to load in the browser
files
:
[
files
:
[
base_path
+
'spec/tools/js/UserAction.js'
base_path
+
'spec/tools/js/UserAction.js'
,
base_path
+
'spec/SpecHelper.js'
,
base_path
+
'spec/SpecHelper.js'
,
base_path
+
'kity/dist/kitygraph.all.js'
,
base_path
+
'lib/jquery-2.1.0.min.js'
,
base_path
+
'lib/jquery-2.1.0.min.js'
,
base_path
+
'lib/ZeroClipboard.min.js'
,
base_path
+
'lib/jquery.xml2json.js'
,
base_path
+
'spec/tools/js/ZeroClipboard.js'
,
base_path
+
'src/core/kityminder.js'
,
base_path
+
'kity/dist/kity.js'
,
base_path
+
'src/core/utils.js'
,
base_path
+
'src/core/command.js'
,
base_path
+
'src/core/node.js'
,
base_path
+
'src/core/module.js'
,
base_path
+
'src/core/kityminder.js'
,
base_path
+
'src/core/event.js'
,
base_path
+
'src/core/utils.js'
,
base_path
+
'src/core/minder.js'
,
base_path
+
'src/core/command.js'
,
base_path
+
'src/core/minder.data.js'
,
base_path
+
'src/core/node.js'
,
base_path
+
'src/core/minder.event.js'
,
base_path
+
'src/core/module.js'
,
base_path
+
'src/core/minder.module.js'
,
base_path
+
'src/core/event.js'
,
base_path
+
'src/core/minder.command.js'
,
base_path
+
'src/core/minder.js'
,
base_path
+
'src/core/minder.node.js'
,
base_path
+
'src/core/minder.data.compatibility.js'
,
base_path
+
'src/core/keymap.js'
,
base_path
+
'src/core/minder.data.js'
,
base_path
+
'src/core/minder.lang.js'
,
base_path
+
'src/core/minder.event.js'
,
base_path
+
'src/core/minder.defaultoptions.js'
,
base_path
+
'src/core/minder.module.js'
,
base_path
+
'src/module/geometry.js'
,
base_path
+
'src/core/minder.command.js'
,
base_path
+
'src/module/history.js'
,
base_path
+
'src/core/minder.node.js'
,
base_path
+
'src/module/icon.js'
,
base_path
+
'src/core/minder.select.js'
,
base_path
+
'src/module/layout.js'
,
base_path
+
'src/core/keymap.js'
,
base_path
+
'src/module/layout.default.js'
,
base_path
+
'src/core/minder.lang.js'
,
base_path
+
'src/module/layout.bottom.js'
,
base_path
+
'src/core/minder.defaultoptions.js'
,
base_path
+
'src/core/minder.select.js'
,
base_path
+
'src/core/minder.preference.js'
,
base_path
+
'src/module/view.js'
,
base_path
+
'src/core/browser.js'
,
base_path
+
'src/module/dragtree.js'
,
base_path
+
'src/core/layout.js'
,
base_path
+
'src/module/dropfile.js'
,
base_path
+
'src/core/connect.js'
,
base_path
+
'src/module/keyboard.js'
,
base_path
+
'src/core/render.js'
,
base_path
+
'src/module/select.js'
,
base_path
+
'src/core/theme.js'
,
base_path
+
'src/module/history.js'
,
base_path
+
'src/core/template.js'
,
base_path
+
'src/module/editor.js'
,
base_path
+
'src/layout/default.js'
,
base_path
+
'src/module/editor.range.js'
,
base_path
+
'src/layout/default.connect.js'
,
base_path
+
'src/module/editor.receiver.js'
,
base_path
+
'src/layout/bottom.js'
,
base_path
+
'src/module/editor.selection.js'
,
base_path
+
'src/layout/filetree.js'
,
base_path
+
'src/module/basestyle.js'
,
base_path
+
'src/theme/default.js'
,
base_path
+
'src/module/font.js'
,
base_path
+
'src/theme/snow.js'
,
base_path
+
'src/module/zoom.js'
,
base_path
+
'src/theme/fresh.js'
,
base_path
+
'src/ui/jquery-ui-1.10.4.custom.min.js'
,
base_path
+
'src/template/structure.js'
,
base_path
+
'src/ui/widget.js'
,
base_path
+
'src/module/node.js'
,
base_path
+
'src/ui/button.js'
,
base_path
+
'src/module/text.js'
,
base_path
+
'src/ui/toolbar.js'
,
base_path
+
'src/module/expand.js'
,
base_path
+
'src/ui/menu.js'
,
base_path
+
'src/module/outline.js'
,
base_path
+
'src/ui/dropmenu.js'
,
base_path
+
'src/module/geometry.js'
,
base_path
+
'src/ui/splitbutton.js'
,
base_path
+
'src/module/history.js'
,
base_path
+
'src/ui/colorsplitbutton.js'
,
base_path
+
'src/module/progress.js'
,
base_path
+
'src/ui/popup.js'
,
base_path
+
'src/module/priority.js'
,
base_path
+
'src/ui/scale.js'
,
base_path
+
'src/module/image.js'
,
base_path
+
'src/ui/colorpicker.js'
,
base_path
+
'src/module/resource.js'
,
base_path
+
'src/ui/combobox.js'
,
base_path
+
'src/module/view.js'
,
base_path
+
'src/ui/buttoncombobox.js'
,
base_path
+
'src/module/dragtree.js'
,
base_path
+
'src/ui/modal.js'
,
base_path
+
'src/module/dropfile.js'
,
base_path
+
'src/ui/tooltip.js'
,
base_path
+
'src/module/keyboard.js'
,
base_path
+
'src/ui/tab.js'
,
base_path
+
'src/module/select.js'
,
base_path
+
'src/ui/separator.js'
,
base_path
+
'src/module/history.js'
,
base_path
+
'src/ui/scale.js'
,
base_path
+
'src/module/editor.js'
,
base_path
+
'src/adapter/utils.js'
,
base_path
+
'src/module/editor.range.js'
,
base_path
+
'src/adapter/adapter.js'
,
base_path
+
'src/module/editor.receiver.js'
,
base_path
+
'src/adapter/button.js'
,
base_path
+
'src/module/editor.selection.js'
,
base_path
+
'src/adapter/combobox.js'
,
base_path
+
'src/module/basestyle.js'
,
base_path
+
'src/adapter/saveto.js'
,
base_path
+
'src/module/font.js'
,
base_path
+
'src/adapter/view.js'
,
base_path
+
'src/module/zoom.js'
,
base_path
+
'src/adapter/tooltips.js'
,
base_path
+
'src/module/hyperlink.js'
,
base_path
+
'src/adapter/layout.js'
,
base_path
+
'src/module/arrange.js'
,
base_path
+
'src/adapter/node.js'
,
base_path
+
'src/module/paste.js'
,
base_path
+
'src/adapter/contextmenu.js'
,
base_path
+
'src/ui/jquery-ui-1.10.4.custom.min.js'
,
base_path
+
'src/adapter/dialog.js'
,
base_path
+
'src/ui/widget.js'
,
base_path
+
'src/protocal/xmind.js'
,
base_path
+
'src/ui/button.js'
,
base_path
+
'src/protocal/freemind.js'
,
base_path
+
'src/ui/toolbar.js'
,
base_path
+
'src/protocal/mindmanager.js'
,
base_path
+
'src/ui/menu.js'
,
base_path
+
'src/protocal/plain.js'
,
base_path
+
'src/ui/dropmenu.js'
,
base_path
+
'src/protocal/json.js'
,
base_path
+
'src/ui/splitbutton.js'
,
base_path
+
'src/protocal/png.js'
,
base_path
+
'src/ui/colorsplitbutton.js'
,
base_path
+
'src/protocal/svg.js'
,
base_path
+
'src/ui/popup.js'
,
base_path
+
'spec/core/*.js'
,
base_path
+
'src/ui/scale.js'
,
base_path
+
'spec/module/*.js'
,
base_path
+
'src/ui/colorpicker.js'
,
base_path
+
'spec/protocal/*.js'
,
base_path
+
'src/ui/combobox.js'
,
base_path
+
'src/ui/buttoncombobox.js'
],
,
base_path
+
'src/ui/modal.js'
,
base_path
+
'src/ui/tooltip.js'
,
base_path
+
'src/ui/tab.js'
// list of files to exclude
,
base_path
+
'src/ui/separator.js'
exclude
:
[
,
base_path
+
'src/ui/scale.js'
'karma.conf.js'
,
base_path
+
'src/adapter/utils.js'
],
,
base_path
+
'src/adapter/adapter.js'
,
base_path
+
'src/adapter/button.js'
,
base_path
+
'src/adapter/combobox.js'
// test results reporter to use
,
base_path
+
'src/adapter/color.js'
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
,
base_path
+
'src/adapter/saveto.js'
,
base_path
+
'src/adapter/tooltips.js'
,
base_path
+
'src/adapter/face.js'
,
base_path
+
'src/adapter/node.js'
,
base_path
+
'src/adapter/contextmenu.js'
,
base_path
+
'src/adapter/dialog.js'
,
base_path
+
'src/adapter/hyperlink.js'
,
base_path
+
'src/adapter/image.js'
,
base_path
+
'src/adapter/zoom.js'
,
base_path
+
'src/protocal/xmind.js'
,
base_path
+
'src/protocal/freemind.js'
,
base_path
+
'src/protocal/mindmanager.js'
,
base_path
+
'src/protocal/plain.js'
,
base_path
+
'src/protocal/json.js'
,
base_path
+
'src/protocal/png.js'
,
base_path
+
'src/protocal/svg.js'
,
base_path
+
'kityminder.config.js'
,
base_path
+
'lang/zh-cn/zh-cn.js'
,
base_path
+
'lib/zip.js'
,
base_path
+
'spec/tools/js/inflate.js'
,
base_path
+
'lib/jquery.xml2json.js'
,
base_path
+
'lib/baidu-frontia-js-full-1.0.0.js'
// ,base_path+'social/draftmanager.js'
// ,base_path+'social/social.js'
,
base_path
+
'social/social.css'
,
base_path
+
'themes/default/css/import.css'
,
base_path
+
'spec/core/*.js'
,
base_path
+
'spec/module/*.js'
,
base_path
+
'spec/protocal/*.js'
],
// list of files to exclude
exclude
:
[
'karma.conf.js'
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
// reporters: ['progress'],
// reporters: ['progress'],
// web server port
// web server port
port
:
9876
,
port
:
9876
,
// enable / disable colors in the output (reporters and logs)
// enable / disable colors in the output (reporters and logs)
colors
:
true
,
colors
:
true
,
// level of logging
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel
:
config
.
LOG_INFO
,
logLevel
:
config
.
LOG_INFO
,
// enable / disable watching file and executing tests whenever any file changes
// enable / disable watching file and executing tests whenever any file changes
autoWatch
:
true
,
autoWatch
:
true
,
// Start these browsers, currently available:
// Start these browsers, currently available:
// - Chrome
// - Chrome
// - ChromeCanary
// - ChromeCanary
// - Firefox
// - Firefox
// - Opera
// - Opera
// - Safari (only Mac)
// - Safari (only Mac)
// - PhantomJS
// - PhantomJS
// - IE (only Windows)
// - IE (only Windows)
browsers
:
[
'Firefox'
,
'Chrome'
],
//,'Chrome'
browsers
:
[
'Firefox'
,
'Chrome'
],
//,'Chrome'
// If browser does not capture in given timeout [ms], kill it
// If browser does not capture in given timeout [ms], kill it
captureTimeout
:
60000
,
captureTimeout
:
60000
,
// Continuous Integration mode
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
// if true, it capture browsers, run tests and exit
singleRun
:
true
,
singleRun
:
true
,
//coverage
//coverage
reporters
:
[
'progress'
,
'coverage'
,
'junit'
],
reporters
:
[
'progress'
,
'coverage'
,
'junit'
],
preprocessors
:
{
preprocessors
:
{
'../src/core/*.js'
:
[
'coverage'
],
'../src/core/*.js'
:
[
'coverage'
],
'../src/adapter/*.js'
:
[
'coverage'
],
'../src/adapter/*.js'
:
[
'coverage'
],
'../src/module/*.js'
:
[
'coverage'
],
'../src/module/*.js'
:
[
'coverage'
],
'../src/protocal/*.js'
:
[
'coverage'
],
'../src/protocal/*.js'
:
[
'coverage'
],
'../src/ui/*.js'
:
[
'coverage'
]
'../src/ui/*.js'
:
[
'coverage'
],
}
'../src/layout/*.js'
:
[
'coverage'
],
,
'../src/template/*.js'
:
[
'coverage'
],
coverageReporter
:
{
'../src/theme/*.js'
:
[
'coverage'
]
type
:
'text'
,
}
dir
:
'./coverage/json_files/'
,
}
coverageReporter
:
{
,
type
:
'text'
,
junitReporter
:
{
dir
:
'./coverage/json_files/'
outputFile
:
'./test-results.xml'
}
}
,
});
junitReporter
:
{
outputFile
:
'./test-results.xml'
}
});
};
};
spec/tools/caseSource.php
View file @
1e0a7717
...
@@ -51,16 +51,40 @@ class Kiss
...
@@ -51,16 +51,40 @@ class Kiss
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$f
.
'"></script>'
.
"
\n
"
;
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$f
.
'"></script>'
.
"
\n
"
;
}
}
}
}
//先引用kity
//先引用kity
print
"<script src='../../kity/dist/kitygraph.all.js'></script>
\n
"
;
print
"<script src='../../lib/jquery-2.1.0.min.js'></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
"
;
//分成两部分:一部分默认加载(可配置),一部分针对文件加载(例如在文件头部有注释标注依赖文件,根据依赖文件动态加载)
//分成两部分:一部分默认加载(可配置),一部分针对文件加载(例如在文件头部有注释标注依赖文件,根据依赖文件动态加载)
// core里面的文件全部加载,module加载用例对应的src文件,最后加载与用例同名的原文件
// core里面的文件全部加载,module加载用例对应的src文件,最后加载与用例同名的原文件
$importurl
=
"
{
$this
->
testPath
}
tools/import.php?f=
$this->name
"
;
$importurl
=
"
{
$this
->
testPath
}
tools/import.php?f=
$this->name
"
;
if
(
$cov
)
$importurl
.=
'^&cov=true'
;
if
(
$cov
)
$importurl
.=
'^&cov=true'
;
print
"<script type='text/javascript' src='"
.
$importurl
.
"' ></script>
\n
"
;
print
"<script type='text/javascript' src='"
.
$importurl
.
"' ></script>
\n
"
;
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 src='../../social/draftmanager.js' charset='utf-8'></script>\n";
// print "<script src='../../social/social.js' charset='utf-8'></script>\n";
//引用测试文件
//引用测试文件
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$this
->
name
.
'.js"></script>'
.
"
\n
"
;
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$this
->
name
.
'.js"></script>'
.
"
\n
"
;
print
"<link href='../../social/social.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
"
;
}
}
public
function
match
(
$matcher
)
public
function
match
(
$matcher
)
{
{
...
...
spec/tools/css/test.css
View file @
1e0a7717
...
@@ -147,7 +147,7 @@ a.button:active span {
...
@@ -147,7 +147,7 @@ a.button:active span {
}
}
.runningarea
{
.runningarea
{
height
:
6
0%
;
height
:
10
0%
;
}
}
.runningmaindiv
{
.runningmaindiv
{
...
...
spec/tools/import.php
View file @
1e0a7717
...
@@ -39,7 +39,7 @@ function importSrc(){
...
@@ -39,7 +39,7 @@ function importSrc(){
$path
=
$i
.
'.js'
;
$path
=
$i
.
'.js'
;
$srcFile
=
Config
::
$projroot
.
Config
::
$src_PATH
.
$path
;
$srcFile
=
Config
::
$projroot
.
Config
::
$src_PATH
.
$path
;
if
(
file_exists
(
$srcFile
))
{
if
(
file_exists
(
$srcFile
))
{
echo
"document.write('<script charset=utf-8 src=
\"
$srcFile
\"
></script>');"
;
echo
"document.write('<script charset=utf-8 src=
\"
$srcFile
\"
></script>');
\n
"
;
}
}
}
}
if
(
file_exists
(
$this_src
)){
if
(
file_exists
(
$this_src
)){
...
@@ -50,7 +50,7 @@ function importSrc(){
...
@@ -50,7 +50,7 @@ function importSrc(){
if
(
custom_strEmpty
(
$statment
)){
if
(
custom_strEmpty
(
$statment
)){
continue
;
continue
;
}
else
if
(
preg_match
(
'/\/\/\/import\s+([^;]+);?/ies'
,
$statment
,
$r
)){
}
else
if
(
preg_match
(
'/\/\/\/import\s+([^;]+);?/ies'
,
$statment
,
$r
)){
echo
"document.write('<script charset=utf-8 src=
\"
"
.
Config
::
$projroot
.
Config
::
$src_PATH
.
$r
[
1
]
.
".js
\"
></script>');"
;
echo
"document.write('<script charset=utf-8 src=
\"
"
.
Config
::
$projroot
.
Config
::
$src_PATH
.
$r
[
1
]
.
".js
\"
></script>');
\n
"
;
}
else
{
}
else
{
break
;
break
;
}
}
...
@@ -59,7 +59,7 @@ function importSrc(){
...
@@ -59,7 +59,7 @@ function importSrc(){
}
}
//加载与用例同名的原文件,并避免重复加载
//加载与用例同名的原文件,并避免重复加载
if
(
$flag_ownSrc
){
if
(
$flag_ownSrc
){
echo
"document.write('<script charset=utf-8 src=
\"
"
.
$this_src
.
"
\"
></script>');"
;
echo
"document.write('<script charset=utf-8 src=
\"
"
.
$this_src
.
"
\"
></script>');
\n
"
;
}
}
}
}
importSrc
();
importSrc
();
\ No newline at end of file
spec/tools/js/ZeroClipboard.js
0 → 100644
View file @
1e0a7717
ZeroClipboard
.
setDefaults
(
{
moviePath
:
'../../../lib/ZeroClipboard.swf'
}
);
\ No newline at end of file
spec/tools/js/inflate.js
0 → 100644
View file @
1e0a7717
/**
*
* Created by Ryan on 14-9-3.
*/
zip
.
inflateJSPath
=
'../../../lib/inflate.js'
;
spec/tools/js/run.js
View file @
1e0a7717
...
@@ -132,6 +132,7 @@ function run(kiss,runnext) {
...
@@ -132,6 +132,7 @@ function run(kiss,runnext) {
var
iframe
=
document
.
createElement
(
'iframe'
);
var
iframe
=
document
.
createElement
(
'iframe'
);
iframe
.
id
=
fid
;
iframe
.
id
=
fid
;
iframe
.
src
=
url
;
iframe
.
src
=
url
;
iframe
.
style
.
minHeight
=
"1500px"
;
addClass
(
iframe
,
"runningframe"
);
addClass
(
iframe
,
"runningframe"
);
runningarea
.
appendChild
(
iframe
);
runningarea
.
appendChild
(
iframe
);
wb
.
kissstart
=
new
Date
().
getTime
();
wb
.
kissstart
=
new
Date
().
getTime
();
...
...
spec/tools/run.php
View file @
1e0a7717
...
@@ -60,7 +60,12 @@ $cov = array_key_exists( 'cov' , $_GET );
...
@@ -60,7 +60,12 @@ $cov = array_key_exists( 'cov' , $_GET );
};
};
function
execJasmine
()
{
function
execJasmine
()
{
// jasmineEnv.beforeEach(function(){console.log(12)});
// jasmine.Suite.beforeEach(function(){console.log(123)});
// console.log(jasmineEnv.currentSpec);
// jasmineEnv.currentSpec.start=function(){console.log(123)};
jasmineEnv
.
execute
();
jasmineEnv
.
execute
();
}
}
})();
})();
...
...
src/adapter/contextmenu.js
View file @
1e0a7717
...
@@ -18,7 +18,7 @@ KM.registerUI( 'contextmenu', function () {
...
@@ -18,7 +18,7 @@ KM.registerUI( 'contextmenu', function () {
if
(
item
.
exec
){
if
(
item
.
exec
){
item
.
exec
.
apply
(
km
)
item
.
exec
.
apply
(
me
);
}
else
{
}
else
{
me
.
execCommand
(
item
.
cmdName
);
me
.
execCommand
(
item
.
cmdName
);
}
}
...
@@ -50,11 +50,19 @@ KM.registerUI( 'contextmenu', function () {
...
@@ -50,11 +50,19 @@ KM.registerUI( 'contextmenu', function () {
data
.
length
&&
data
.
push
(
item
);
data
.
length
&&
data
.
push
(
item
);
return
;
return
;
}
}
if
(
item
.
query
){
if
(
item
.
query
.
apply
(
me
)
!=
-
1
)
data
.
push
({
label
:
item
.
label
,
value
:
item
.
cmdName
});
return
;
}
if
(
me
.
queryCommandState
(
item
.
cmdName
)
!=-
1
){
if
(
me
.
queryCommandState
(
item
.
cmdName
)
!=-
1
){
data
.
push
({
data
.
push
({
label
:
item
.
label
,
label
:
item
.
label
,
value
:
item
.
cmdName
value
:
item
.
cmdName
})
})
;
}
}
});
});
if
(
data
.
length
){
if
(
data
.
length
){
...
@@ -79,6 +87,6 @@ KM.registerUI( 'contextmenu', function () {
...
@@ -79,6 +87,6 @@ KM.registerUI( 'contextmenu', function () {
if
(
e
.
isRightMB
()){
if
(
e
.
isRightMB
()){
//e.stopPropagationImmediately();
//e.stopPropagationImmediately();
}
}
})
})
;
}
);
}
);
src/module/editor.js
View file @
1e0a7717
...
@@ -20,6 +20,7 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -20,6 +20,7 @@ KityMinder.registerModule('TextEditModule', function() {
function
inputStatusReady
(
node
){
function
inputStatusReady
(
node
){
if
(
node
&&
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
if
(
node
&&
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
var
color
=
node
.
getStyle
(
'text-selection-color'
);
var
color
=
node
.
getStyle
(
'text-selection-color'
);
//准备输入状态
//准备输入状态
...
@@ -47,8 +48,6 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -47,8 +48,6 @@ KityMinder.registerModule('TextEditModule', function() {
}
}
receiver
.
minderNode
.
setTmpData
(
'_lastTextContent'
,
receiver
.
textShape
.
getContent
());
km
.
setStatus
(
'inputready'
);
km
.
setStatus
(
'inputready'
);
}
}
...
@@ -73,16 +72,6 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -73,16 +72,6 @@ KityMinder.registerModule('TextEditModule', function() {
}
}
if
(
receiver
.
minderNode
){
var
textShape
=
receiver
.
minderNode
.
getTextShape
();
if
(
textShape
&&
textShape
.
getOpacity
()
===
0
){
receiver
.
minderNode
.
setText
(
receiver
.
minderNode
.
getTmpData
(
'_lastTextContent'
));
receiver
.
minderNode
.
render
();
receiver
.
minderNode
.
getTextShape
().
setOpacity
(
1
);
km
.
layout
(
300
);
}
}
mouseDownStatus
=
true
;
mouseDownStatus
=
true
;
selectionReadyShow
=
sel
.
isShow
();
selectionReadyShow
=
sel
.
isShow
();
...
@@ -104,6 +93,7 @@ KityMinder.registerModule('TextEditModule', function() {
...
@@ -104,6 +93,7 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
){
if
(
node
){
var
textShape
=
node
.
getTextShape
();
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
sel
.
collapse
(
true
);
sel
.
collapse
(
true
);
...
...
src/module/editor.receiver.js
View file @
1e0a7717
...
@@ -75,7 +75,9 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -75,7 +75,9 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
return
this
;
},
},
getTextShapeHeight
:
function
()
{
getTextShapeHeight
:
function
()
{
return
this
.
textShape
.
getRenderBox
().
height
;
var
height
=
this
.
textShape
.
getRenderBox
().
height
;
return
height
||
this
.
minderNode
.
_lastTextShapeBox
.
height
;
},
},
setKityMinder
:
function
(
km
)
{
setKityMinder
:
function
(
km
)
{
this
.
km
=
km
;
this
.
km
=
km
;
...
@@ -115,7 +117,6 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -115,7 +117,6 @@ Minder.Receiver = kity.createClass('Receiver', {
var
keyCode
=
orgEvt
.
keyCode
;
var
keyCode
=
orgEvt
.
keyCode
;
function
setTextToContainer
()
{
function
setTextToContainer
()
{
clearTimeout
(
me
.
timer
);
clearTimeout
(
me
.
timer
);
if
(
!
me
.
range
.
hasNativeRange
())
{
if
(
!
me
.
range
.
hasNativeRange
())
{
return
;
return
;
...
@@ -139,26 +140,11 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -139,26 +140,11 @@ Minder.Receiver = kity.createClass('Receiver', {
text
+=
'
\
u200b'
;
text
+=
'
\
u200b'
;
}
}
me
.
minderNode
.
setText
(
text
);
//如果接受框已经空了,并且已经添加了占位的a了就什么都不做了
if
(
text
.
length
===
0
&&
me
.
textShape
.
getOpacity
()
===
0
){
return
;
}
if
(
text
.
length
===
0
)
{
me
.
minderNode
.
setTmpData
(
'_lastTextContent'
,
me
.
textShape
.
getContent
());
me
.
minderNode
.
setText
(
'a'
);
}
else
{
me
.
minderNode
.
setText
(
text
);
if
(
me
.
textShape
.
getOpacity
()
===
0
)
{
me
.
textShape
.
setOpacity
(
1
);
}
}
me
.
setContainerStyle
();
me
.
setContainerStyle
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
me
.
minderNode
.
render
();
me
.
minderNode
.
render
();
//移动光标不做layout
//移动光标不做layout
if
(
!
keymap
.
notContentChange
[
keyCode
]){
if
(
!
keymap
.
notContentChange
[
keyCode
]){
clearTimeout
(
me
.
inputTextTimer
);
clearTimeout
(
me
.
inputTextTimer
);
...
@@ -170,9 +156,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -170,9 +156,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
textShape
=
me
.
minderNode
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
me
.
textShape
=
me
.
minderNode
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
if
(
text
.
length
===
0
)
{
me
.
textShape
.
setOpacity
(
0
);
}
me
.
setBaseOffset
();
me
.
setBaseOffset
();
me
.
updateTextOffsetData
();
me
.
updateTextOffsetData
();
me
.
updateRange
();
me
.
updateRange
();
...
@@ -187,18 +171,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -187,18 +171,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
km
.
setStatus
(
'textedit'
);
me
.
km
.
setStatus
(
'textedit'
);
}
}
function
restoreTextContent
(){
if
(
me
.
minderNode
){
var
textShape
=
me
.
minderNode
.
getTextShape
();
if
(
textShape
&&
textShape
.
getOpacity
()
===
0
){
me
.
minderNode
.
setText
(
me
.
minderNode
.
getTmpData
(
'_lastTextContent'
));
me
.
minderNode
.
render
();
me
.
minderNode
.
getTextShape
().
setOpacity
(
1
);
me
.
km
.
layout
(
300
);
}
}
}
switch
(
e
.
type
)
{
switch
(
e
.
type
)
{
case
'input'
:
case
'input'
:
...
@@ -223,7 +196,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -223,7 +196,7 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
fire
(
'contentchange'
);
this
.
km
.
fire
(
'contentchange'
);
}
}
restoreTextContent
();
return
;
return
;
case
keymap
.
left
:
case
keymap
.
left
:
case
keymap
.
right
:
case
keymap
.
right
:
...
@@ -233,7 +206,6 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -233,7 +206,6 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
Del
:
case
keymap
.
Del
:
case
keymap
[
'/'
]:
case
keymap
[
'/'
]:
if
(
this
.
selection
.
isHide
()){
if
(
this
.
selection
.
isHide
()){
restoreTextContent
();
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
setStatus
(
'normal'
);
return
;
return
;
}
}
...
@@ -257,7 +229,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -257,7 +229,7 @@ Minder.Receiver = kity.createClass('Receiver', {
88
:
1
,
88
:
1
,
67
:
1
67
:
1
}[
keyCode
]){
}[
keyCode
]){
restoreTextContent
();
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
setStatus
(
'normal'
);
return
;
return
;
}
}
...
@@ -305,7 +277,6 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -305,7 +277,6 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
fire
(
'contentchange'
);
this
.
km
.
fire
(
'contentchange'
);
}
}
restoreTextContent
();
return
;
return
;
}
}
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
...
@@ -343,6 +314,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -343,6 +314,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
true
;
return
true
;
case
'keyup'
:
case
'keyup'
:
var
node
=
this
.
km
.
getSelectedNode
();
var
node
=
this
.
km
.
getSelectedNode
();
if
(
this
.
km
.
getStatus
()
==
'normal'
&&
node
&&
this
.
selection
.
isHide
()){
if
(
this
.
km
.
getStatus
()
==
'normal'
&&
node
&&
this
.
selection
.
isHide
()){
if
(
node
&&
this
.
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
if
(
node
&&
this
.
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
...
@@ -374,8 +346,6 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -374,8 +346,6 @@ Minder.Receiver = kity.createClass('Receiver', {
}
}
this
.
minderNode
.
setTmpData
(
'_lastTextContent'
,
this
.
textShape
.
getContent
());
this
.
km
.
setStatus
(
'inputready'
);
this
.
km
.
setStatus
(
'inputready'
);
}
}
...
@@ -390,7 +360,7 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -390,7 +360,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
return
this
;
},
},
updateTextOffsetData
:
function
()
{
updateTextOffsetData
:
function
()
{
this
.
textShape
.
textData
=
this
.
getTextOffsetData
();
this
.
getTextOffsetData
();
return
this
;
return
this
;
},
},
setSelection
:
function
(
selection
)
{
setSelection
:
function
(
selection
)
{
...
@@ -452,6 +422,15 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -452,6 +422,15 @@ Minder.Receiver = kity.createClass('Receiver', {
height
:
box
.
height
height
:
box
.
height
});
});
}
}
if
(
this
.
textData
.
length
===
0
){
var
lastBox
=
this
.
minderNode
.
_lastTextShapeBox
;
this
.
textData
.
push
({
x
:
lastBox
.
x
,
y
:
lastBox
.
y
,
width
:
0
,
height
:
lastBox
.
height
});
}
return
this
;
return
this
;
},
},
setCurrentIndex
:
function
(
offset
)
{
setCurrentIndex
:
function
(
offset
)
{
...
@@ -460,6 +439,10 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -460,6 +439,10 @@ Minder.Receiver = kity.createClass('Receiver', {
var
hadChanged
=
false
;
var
hadChanged
=
false
;
//要剪掉基数
//要剪掉基数
this
.
_getRelativeValue
(
offset
);
this
.
_getRelativeValue
(
offset
);
if
(
this
.
textData
.
length
==
1
&&
this
.
textData
[
0
].
width
===
0
){
me
.
index
=
0
;
return
this
;
}
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
utils
.
each
(
this
.
textData
,
function
(
i
,
v
)
{
//点击开始之前
//点击开始之前
if
(
i
===
0
&&
offset
.
x
<=
v
.
x
)
{
if
(
i
===
0
&&
offset
.
x
<=
v
.
x
)
{
...
@@ -578,6 +561,9 @@ Minder.Receiver = kity.createClass('Receiver', {
...
@@ -578,6 +561,9 @@ Minder.Receiver = kity.createClass('Receiver', {
updateContainerRangeBySel
:
function
(){
updateContainerRangeBySel
:
function
(){
var
me
=
this
;
var
me
=
this
;
var
node
=
this
.
container
.
firstChild
;
var
node
=
this
.
container
.
firstChild
;
if
(
!
node
){
node
=
this
.
container
;
}
this
.
range
.
setStart
(
node
,
this
.
selection
.
startOffset
);
this
.
range
.
setStart
(
node
,
this
.
selection
.
startOffset
);
this
.
range
.
setEnd
(
node
,
this
.
selection
.
endOffset
);
this
.
range
.
setEnd
(
node
,
this
.
selection
.
endOffset
);
if
(
browser
.
gecko
){
if
(
browser
.
gecko
){
...
...
src/module/node.js
View file @
1e0a7717
...
@@ -111,6 +111,16 @@ KityMinder.registerModule('NodeModule', function() {
...
@@ -111,6 +111,16 @@ KityMinder.registerModule('NodeModule', function() {
cmdName
:
'RemoveNode'
cmdName
:
'RemoveNode'
},
{
},
{
divider
:
1
divider
:
1
},{
label
:
this
.
getLang
(
'insert.topic'
),
exec
:
function
()
{
this
.
select
(
this
.
getRoot
());
this
.
execCommand
(
'AppendSiblingNode'
,
this
.
getLang
(
'topic'
));
},
query
:
function
(){
var
nodes
=
this
.
getSelectedNodes
();
return
nodes
.
length
===
0
?
0
:
-
1
;
}
}]
}]
};
};
});
});
\ No newline at end of file
src/module/text.js
View file @
1e0a7717
...
@@ -10,16 +10,35 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
...
@@ -10,16 +10,35 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
.
setAttr
(
'text-rendering'
,
'inherit'
);
.
setAttr
(
'text-rendering'
,
'inherit'
);
},
},
update
:
function
(
text
,
node
)
{
update
:
function
(
text
,
node
)
{
this
.
setTextStyle
(
node
,
text
.
setContent
(
node
.
getText
()));
var
box
=
text
.
getBoundaryBox
();
var
tmpText
=
node
.
getText
();
var
r
=
Math
.
round
;
if
(
kity
.
Browser
.
ie
)
{
this
.
setTextStyle
(
node
,
text
.
setContent
(
tmpText
));
box
.
y
+=
1
;
if
(
tmpText
.
length
||
!
this
.
_lastBox
){
var
box
=
text
.
getBoundaryBox
();
var
r
=
Math
.
round
;
if
(
kity
.
Browser
.
ie
)
{
box
.
y
+=
1
;
}
this
.
_lastBox
=
{
x
:
r
(
box
.
x
),
y
:
r
(
box
.
y
),
width
:
r
(
box
.
width
),
height
:
r
(
box
.
height
)
};
}
else
{
this
.
_lastBox
.
width
=
0
;
}
}
var
lastBox
=
this
.
_lastBox
;
node
.
_lastTextShapeBox
=
lastBox
;
return
function
()
{
return
function
()
{
return
new
kity
.
Box
(
r
(
box
.
x
),
r
(
box
.
y
),
r
(
box
.
width
),
r
(
box
.
height
)
);
return
new
kity
.
Box
(
lastBox
.
x
,
lastBox
.
y
,
lastBox
.
width
,
lastBox
.
height
);
};
};
},
},
setTextStyle
:
function
(
node
,
text
)
{
setTextStyle
:
function
(
node
,
text
)
{
...
...
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