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
Expand all
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 更新日志
## v1.3.0
### 体验优化
1.
当在空白处右键时,在菜单项中添加插入节点选项
### BUG修复
1.
修复在空白节点有时会出现a字符的问题
## 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'] = {
'fresh-purple'
:
'浪漫紫'
,
'fresh-pink'
:
'脑残粉'
},
'insert'
:{
//'maintopic':'插入中心主题',
'topic'
:
'插入分支主题'
},
'maintopic'
:
'中心主题'
,
'topic'
:
'分支主题'
,
'tooltips'
:
{
...
...
spec/core/command.js
View file @
1e0a7717
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
(){
})
...
...
spec/core/utils.js
View file @
1e0a7717
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
(){
...
...
@@ -8,6 +48,31 @@ describe("utils", function () {
};
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
(){
expect
(
utils
.
compareObject
(
obj1
,
obj2
)).
toBeTruthy
();
});
...
...
@@ -21,5 +86,126 @@ describe("utils", function () {
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 @@
///import core/module;
///import core/event;
///import core/minder;
///import core/minder.data.compatibility;
///import core/minder.data;
///import core/minder.event;
///import core/minder.module;
///import core/minder.command;
///import core/minder.node;
///import core/minder.select;
\ No newline at end of file
///import core/minder.select;
///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
This diff is collapsed.
Click to expand it.
spec/tools/caseSource.php
View file @
1e0a7717
...
...
@@ -51,16 +51,40 @@ class Kiss
print
'<script type="text/javascript" src="'
.
$this
->
testPath
.
$f
.
'"></script>'
.
"
\n
"
;
}
}
//先引用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文件,最后加载与用例同名的原文件
$importurl
=
"
{
$this
->
testPath
}
tools/import.php?f=
$this->name
"
;
if
(
$cov
)
$importurl
.=
'^&cov=true'
;
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
"<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
)
{
...
...
spec/tools/css/test.css
View file @
1e0a7717
...
...
@@ -147,7 +147,7 @@ a.button:active span {
}
.runningarea
{
height
:
6
0%
;
height
:
10
0%
;
}
.runningmaindiv
{
...
...
spec/tools/import.php
View file @
1e0a7717
...
...
@@ -39,7 +39,7 @@ function importSrc(){
$path
=
$i
.
'.js'
;
$srcFile
=
Config
::
$projroot
.
Config
::
$src_PATH
.
$path
;
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
)){
...
...
@@ -50,7 +50,7 @@ function importSrc(){
if
(
custom_strEmpty
(
$statment
)){
continue
;
}
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
{
break
;
}
...
...
@@ -59,7 +59,7 @@ function importSrc(){
}
//加载与用例同名的原文件,并避免重复加载
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
();
\ 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) {
var
iframe
=
document
.
createElement
(
'iframe'
);
iframe
.
id
=
fid
;
iframe
.
src
=
url
;
iframe
.
style
.
minHeight
=
"1500px"
;
addClass
(
iframe
,
"runningframe"
);
runningarea
.
appendChild
(
iframe
);
wb
.
kissstart
=
new
Date
().
getTime
();
...
...
spec/tools/run.php
View file @
1e0a7717
...
...
@@ -60,7 +60,12 @@ $cov = array_key_exists( 'cov' , $_GET );
};
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
();
}
})();
...
...
src/adapter/contextmenu.js
View file @
1e0a7717
...
...
@@ -18,7 +18,7 @@ KM.registerUI( 'contextmenu', function () {
if
(
item
.
exec
){
item
.
exec
.
apply
(
km
)
item
.
exec
.
apply
(
me
);
}
else
{
me
.
execCommand
(
item
.
cmdName
);
}
...
...
@@ -50,11 +50,19 @@ KM.registerUI( 'contextmenu', function () {
data
.
length
&&
data
.
push
(
item
);
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
){
data
.
push
({
label
:
item
.
label
,
value
:
item
.
cmdName
})
})
;
}
});
if
(
data
.
length
){
...
...
@@ -79,6 +87,6 @@ KM.registerUI( 'contextmenu', function () {
if
(
e
.
isRightMB
()){
//e.stopPropagationImmediately();
}
})
})
;
}
);
src/module/editor.js
View file @
1e0a7717
...
...
@@ -20,6 +20,7 @@ KityMinder.registerModule('TextEditModule', function() {
function
inputStatusReady
(
node
){
if
(
node
&&
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
var
color
=
node
.
getStyle
(
'text-selection-color'
);
//准备输入状态
...
...
@@ -47,8 +48,6 @@ KityMinder.registerModule('TextEditModule', function() {
}
receiver
.
minderNode
.
setTmpData
(
'_lastTextContent'
,
receiver
.
textShape
.
getContent
());
km
.
setStatus
(
'inputready'
);
}
...
...
@@ -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
;
selectionReadyShow
=
sel
.
isShow
();
...
...
@@ -104,6 +93,7 @@ KityMinder.registerModule('TextEditModule', function() {
if
(
node
){
var
textShape
=
node
.
getTextShape
();
textShape
.
setStyle
(
'cursor'
,
'default'
);
if
(
this
.
isSingleSelect
()
&&
node
.
isSelected
())
{
sel
.
collapse
(
true
);
...
...
src/module/editor.receiver.js
View file @
1e0a7717
...
...
@@ -75,7 +75,9 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
},
getTextShapeHeight
:
function
()
{
return
this
.
textShape
.
getRenderBox
().
height
;
var
height
=
this
.
textShape
.
getRenderBox
().
height
;
return
height
||
this
.
minderNode
.
_lastTextShapeBox
.
height
;
},
setKityMinder
:
function
(
km
)
{
this
.
km
=
km
;
...
...
@@ -115,7 +117,6 @@ Minder.Receiver = kity.createClass('Receiver', {
var
keyCode
=
orgEvt
.
keyCode
;
function
setTextToContainer
()
{
clearTimeout
(
me
.
timer
);
if
(
!
me
.
range
.
hasNativeRange
())
{
return
;
...
...
@@ -139,26 +140,11 @@ Minder.Receiver = kity.createClass('Receiver', {
text
+=
'
\
u200b'
;
}
//如果接受框已经空了,并且已经添加了占位的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
.
minderNode
.
setText
(
text
);
me
.
setContainerStyle
();
me
.
minderNode
.
getRenderContainer
().
bringTop
();
me
.
minderNode
.
render
();
//移动光标不做layout
if
(
!
keymap
.
notContentChange
[
keyCode
]){
clearTimeout
(
me
.
inputTextTimer
);
...
...
@@ -170,9 +156,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me
.
textShape
=
me
.
minderNode
.
getRenderer
(
'TextRenderer'
).
getRenderShape
();
if
(
text
.
length
===
0
)
{
me
.
textShape
.
setOpacity
(
0
);
}
me
.
setBaseOffset
();
me
.
updateTextOffsetData
();
me
.
updateRange
();
...
...
@@ -187,18 +171,7 @@ Minder.Receiver = kity.createClass('Receiver', {
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
)
{
case
'input'
:
...
...
@@ -223,7 +196,7 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
fire
(
'contentchange'
);
}
restoreTextContent
();
return
;
case
keymap
.
left
:
case
keymap
.
right
:
...
...
@@ -233,7 +206,6 @@ Minder.Receiver = kity.createClass('Receiver', {
case
keymap
.
Del
:
case
keymap
[
'/'
]:
if
(
this
.
selection
.
isHide
()){
restoreTextContent
();
this
.
km
.
setStatus
(
'normal'
);
return
;
}
...
...
@@ -257,7 +229,7 @@ Minder.Receiver = kity.createClass('Receiver', {
88
:
1
,
67
:
1
}[
keyCode
]){
restoreTextContent
();
this
.
km
.
setStatus
(
'normal'
);
return
;
}
...
...
@@ -305,7 +277,6 @@ Minder.Receiver = kity.createClass('Receiver', {
this
.
km
.
setStatus
(
'normal'
);
this
.
km
.
fire
(
'contentchange'
);
}
restoreTextContent
();
return
;
}
if
(
keymap
.
Enter
==
keyCode
&&
(
this
.
isTypeText
||
browser
.
mac
&&
browser
.
gecko
))
{
...
...
@@ -343,6 +314,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
true
;
case
'keyup'
:
var
node
=
this
.
km
.
getSelectedNode
();
if
(
this
.
km
.
getStatus
()
==
'normal'
&&
node
&&
this
.
selection
.
isHide
()){
if
(
node
&&
this
.
km
.
isSingleSelect
()
&&
node
.
isSelected
())
{
...
...
@@ -374,8 +346,6 @@ Minder.Receiver = kity.createClass('Receiver', {
}
this
.
minderNode
.
setTmpData
(
'_lastTextContent'
,
this
.
textShape
.
getContent
());
this
.
km
.
setStatus
(
'inputready'
);
}
...
...
@@ -390,7 +360,7 @@ Minder.Receiver = kity.createClass('Receiver', {
return
this
;
},
updateTextOffsetData
:
function
()
{
this
.
textShape
.
textData
=
this
.
getTextOffsetData
();
this
.
getTextOffsetData
();
return
this
;
},
setSelection
:
function
(
selection
)
{
...
...
@@ -452,6 +422,15 @@ Minder.Receiver = kity.createClass('Receiver', {
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
;
},
setCurrentIndex
:
function
(
offset
)
{
...
...
@@ -460,6 +439,10 @@ Minder.Receiver = kity.createClass('Receiver', {
var
hadChanged
=
false
;
//要剪掉基数
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
)
{
//点击开始之前
if
(
i
===
0
&&
offset
.
x
<=
v
.
x
)
{
...
...
@@ -578,6 +561,9 @@ Minder.Receiver = kity.createClass('Receiver', {
updateContainerRangeBySel
:
function
(){
var
me
=
this
;
var
node
=
this
.
container
.
firstChild
;
if
(
!
node
){
node
=
this
.
container
;
}
this
.
range
.
setStart
(
node
,
this
.
selection
.
startOffset
);
this
.
range
.
setEnd
(
node
,
this
.
selection
.
endOffset
);
if
(
browser
.
gecko
){
...
...
src/module/node.js
View file @
1e0a7717
...
...
@@ -111,6 +111,16 @@ KityMinder.registerModule('NodeModule', function() {
cmdName
:
'RemoveNode'
},
{
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', {
.
setAttr
(
'text-rendering'
,
'inherit'
);
},
update
:
function
(
text
,
node
)
{
this
.
setTextStyle
(
node
,
text
.
setContent
(
node
.
getText
()));
var
box
=
text
.
getBoundaryBox
();
var
r
=
Math
.
round
;
if
(
kity
.
Browser
.
ie
)
{
box
.
y
+=
1
;
update
:
function
(
text
,
node
)
{
var
tmpText
=
node
.
getText
();
this
.
setTextStyle
(
node
,
text
.
setContent
(
tmpText
));
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
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
)
{
...
...
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