Commit 1e0a7717 authored by techird's avatar techird

Merge branch 'dev' of github.com:fex-team/kityminder into dev

parents 938b2bb3 f2941b7f
# KityMinder 更新日志
## v1.3.0
### 体验优化
1. 当在空白处右键时,在菜单项中添加插入节点选项
### BUG修复
1. 修复在空白节点有时会出现a字符的问题
## v1.2.1
### 体验优化
......
Subproject commit fec9187f532aea5284d1fac25767dcca9ad43ce4
Subproject commit f83c5f109addefd4f89ba11b4dfa88c191809e77
......@@ -14,6 +14,10 @@ KityMinder.LANG['zh-cn'] = {
'fresh-purple': '浪漫紫',
'fresh-pink': '脑残粉'
},
'insert':{
//'maintopic':'插入中心主题',
'topic':'插入分支主题'
},
'maintopic': '中心主题',
'topic': '分支主题',
'tooltips': {
......
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(){
})
......
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
......@@ -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
......@@ -3,165 +3,212 @@
//karma-coverage@0.1.4
module.exports = function(config) {
var base_path = '../';
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
base_path+'spec/tools/js/UserAction.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.xml2json.js'
,base_path+'src/core/kityminder.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/event.js'
,base_path+'src/core/minder.js'
,base_path+'src/core/minder.data.js'
,base_path+'src/core/minder.event.js'
,base_path+'src/core/minder.module.js'
,base_path+'src/core/minder.command.js'
,base_path+'src/core/minder.node.js'
,base_path+'src/core/keymap.js'
,base_path+'src/core/minder.lang.js'
,base_path+'src/core/minder.defaultoptions.js'
,base_path+'src/module/geometry.js'
,base_path+'src/module/history.js'
,base_path+'src/module/icon.js'
,base_path+'src/module/layout.js'
,base_path+'src/module/layout.default.js'
,base_path+'src/module/layout.bottom.js'
,base_path+'src/core/minder.select.js'
,base_path+'src/module/view.js'
,base_path+'src/module/dragtree.js'
,base_path+'src/module/dropfile.js'
,base_path+'src/module/keyboard.js'
,base_path+'src/module/select.js'
,base_path+'src/module/history.js'
,base_path+'src/module/editor.js'
,base_path+'src/module/editor.range.js'
,base_path+'src/module/editor.receiver.js'
,base_path+'src/module/editor.selection.js'
,base_path+'src/module/basestyle.js'
,base_path+'src/module/font.js'
,base_path+'src/module/zoom.js'
,base_path+'src/ui/jquery-ui-1.10.4.custom.min.js'
,base_path+'src/ui/widget.js'
,base_path+'src/ui/button.js'
,base_path+'src/ui/toolbar.js'
,base_path+'src/ui/menu.js'
,base_path+'src/ui/dropmenu.js'
,base_path+'src/ui/splitbutton.js'
,base_path+'src/ui/colorsplitbutton.js'
,base_path+'src/ui/popup.js'
,base_path+'src/ui/scale.js'
,base_path+'src/ui/colorpicker.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'
,base_path+'src/ui/separator.js'
,base_path+'src/ui/scale.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'
,base_path+'src/adapter/saveto.js'
,base_path+'src/adapter/view.js'
,base_path+'src/adapter/tooltips.js'
,base_path+'src/adapter/layout.js'
,base_path+'src/adapter/node.js'
,base_path+'src/adapter/contextmenu.js'
,base_path+'src/adapter/dialog.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+'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'
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
base_path+'spec/tools/js/UserAction.js'
,base_path+'spec/SpecHelper.js'
,base_path+'lib/jquery-2.1.0.min.js'
,base_path+'lib/ZeroClipboard.min.js'
,base_path+'spec/tools/js/ZeroClipboard.js'
,base_path+'kity/dist/kity.js'
,base_path+'src/core/kityminder.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/event.js'
,base_path+'src/core/minder.js'
,base_path+'src/core/minder.data.compatibility.js'
,base_path+'src/core/minder.data.js'
,base_path+'src/core/minder.event.js'
,base_path+'src/core/minder.module.js'
,base_path+'src/core/minder.command.js'
,base_path+'src/core/minder.node.js'
,base_path+'src/core/minder.select.js'
,base_path+'src/core/keymap.js'
,base_path+'src/core/minder.lang.js'
,base_path+'src/core/minder.defaultoptions.js'
,base_path+'src/core/minder.preference.js'
,base_path+'src/core/browser.js'
,base_path+'src/core/layout.js'
,base_path+'src/core/connect.js'
,base_path+'src/core/render.js'
,base_path+'src/core/theme.js'
,base_path+'src/core/template.js'
,base_path+'src/layout/default.js'
,base_path+'src/layout/default.connect.js'
,base_path+'src/layout/bottom.js'
,base_path+'src/layout/filetree.js'
,base_path+'src/theme/default.js'
,base_path+'src/theme/snow.js'
,base_path+'src/theme/fresh.js'
,base_path+'src/template/structure.js'
,base_path+'src/module/node.js'
,base_path+'src/module/text.js'
,base_path+'src/module/expand.js'
,base_path+'src/module/outline.js'
,base_path+'src/module/geometry.js'
,base_path+'src/module/history.js'
,base_path+'src/module/progress.js'
,base_path+'src/module/priority.js'
,base_path+'src/module/image.js'
,base_path+'src/module/resource.js'
,base_path+'src/module/view.js'
,base_path+'src/module/dragtree.js'
,base_path+'src/module/dropfile.js'
,base_path+'src/module/keyboard.js'
,base_path+'src/module/select.js'
,base_path+'src/module/history.js'
,base_path+'src/module/editor.js'
,base_path+'src/module/editor.range.js'
,base_path+'src/module/editor.receiver.js'
,base_path+'src/module/editor.selection.js'
,base_path+'src/module/basestyle.js'
,base_path+'src/module/font.js'
,base_path+'src/module/zoom.js'
,base_path+'src/module/hyperlink.js'
,base_path+'src/module/arrange.js'
,base_path+'src/module/paste.js'
,base_path+'src/ui/jquery-ui-1.10.4.custom.min.js'
,base_path+'src/ui/widget.js'
,base_path+'src/ui/button.js'
,base_path+'src/ui/toolbar.js'
,base_path+'src/ui/menu.js'
,base_path+'src/ui/dropmenu.js'
,base_path+'src/ui/splitbutton.js'
,base_path+'src/ui/colorsplitbutton.js'
,base_path+'src/ui/popup.js'
,base_path+'src/ui/scale.js'
,base_path+'src/ui/colorpicker.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'
,base_path+'src/ui/separator.js'
,base_path+'src/ui/scale.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'
,base_path+'src/adapter/color.js'
,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'],
// web server port
port: 9876,
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Firefox','Chrome'],//,'Chrome'
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Firefox','Chrome'],//,'Chrome'
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
//coverage
reporters: ['progress', 'coverage','junit'],
preprocessors: {
'../src/core/*.js': ['coverage'],
'../src/adapter/*.js': ['coverage'],
'../src/module/*.js': ['coverage'],
'../src/protocal/*.js': ['coverage'],
'../src/ui/*.js': ['coverage']
}
,
coverageReporter: {
type: 'text',
dir: './coverage/json_files/'
}
,
junitReporter: {
outputFile: './test-results.xml'
}
});
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: true,
//coverage
reporters: ['progress', 'coverage','junit'],
preprocessors: {
'../src/core/*.js': ['coverage'],
'../src/adapter/*.js': ['coverage'],
'../src/module/*.js': ['coverage'],
'../src/protocal/*.js': ['coverage'],
'../src/ui/*.js': ['coverage'],
'../src/layout/*.js': ['coverage'],
'../src/template/*.js': ['coverage'],
'../src/theme/*.js': ['coverage']
}
,
coverageReporter: {
type: 'text',
dir: './coverage/json_files/'
}
,
junitReporter: {
outputFile: './test-results.xml'
}
});
};
......@@ -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 )
{
......
......@@ -147,7 +147,7 @@ a.button:active span {
}
.runningarea {
height: 60%;
height: 100%;
}
.runningmaindiv {
......
......@@ -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
ZeroClipboard.setDefaults( { moviePath: '../../../lib/ZeroClipboard.swf' } );
\ No newline at end of file
/**
*
* Created by Ryan on 14-9-3.
*/
zip.inflateJSPath = '../../../lib/inflate.js';
......@@ -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();
......
......@@ -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();
}
})();
......
......@@ -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();
}
})
});
} );
......@@ -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);
......
......@@ -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){
......
......@@ -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
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment