Commit beba0c5a authored by Akikonata's avatar Akikonata

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

parents 573a39c4 898701c4
...@@ -60,11 +60,13 @@ ...@@ -60,11 +60,13 @@
} }
window.KITYMINDER_CONFIG = { window.KITYMINDER_CONFIG = {
'KITYMINDER_HOME_URL': getKMBasePath(), 'KITYMINDER_HOME_URL': getKMBasePath()
//定义工具栏 //定义工具栏
toolbars: [ ,toolbars: [
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | switchlayout | help' 'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | switchlayout | help'
] ]
//只读模式,默认是false
//readOnly : false
//设置主题 //设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题 //,defaultlayoutstyle : 'default' //设置默认的主题
......
...@@ -1463,13 +1463,13 @@ baidu.frontia = {}, function(e) { ...@@ -1463,13 +1463,13 @@ baidu.frontia = {}, function(e) {
return e.every(function(e) { return e.every(function(e) {
return "file" !== e.type || e.value && e.value instanceof File ? "string" !== e.type || e.value && "string" == typeof e.value ? "array" !== e.type || e.value && "Array" === Object.prototype.toString.call(e.value).slice(8, -1) ? !0 : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: targets is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: target is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: file is null or not typeof File of DOM")), !1) return "file" !== e.type || e.value && e.value instanceof File ? "string" !== e.type || e.value && "string" == typeof e.value ? "array" !== e.type || e.value && "Array" === Object.prototype.toString.call(e.value).slice(8, -1) ? !0 : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: targets is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: target is invalid")), !1) : (r.options.error(new o(i.INVALID_PARAMS, "[" + t + "]: file is null or not typeof File of DOM")), !1)
}) })
},_createAjaxOpt: function(t, r) { },_createAjaxOpt: function(t, r, cb) {
var i = this, s = {callback: function(e) { var i = this, s = {callback: function(e) {
if (e.error_code) { if (e.error_code) {
var r = new o(e); var r = new o(e);
i.options.error(r), t.err_code = r.code, t.err_msg = r.message i.options.error(r), t.err_code = r.code, t.err_msg = r.message
} else } else
i.options.success(e), t.err_code = 0; (cb && cb.success || i.options.success)(e), t.err_code = 0;
t.restimestamp = a(), n(t) t.restimestamp = a(), n(t)
},onerror: function(r, s) { },onerror: function(r, s) {
try { try {
...@@ -1518,13 +1518,13 @@ baidu.frontia = {}, function(e) { ...@@ -1518,13 +1518,13 @@ baidu.frontia = {}, function(e) {
var t = new o(e); var t = new o(e);
u.options.error(t), c.err_code = t.code, c.err_msg = t.message u.options.error(t), c.err_code = t.code, c.err_msg = t.message
} else } else
u.options.success(p), c.err_code = 0; (s.success || u.options.success)(p), c.err_code = 0;
c.restimestamp = a(), n(c) c.restimestamp = a(), n(c)
},onerror: function(t, r) { },onerror: function(t, r) {
try { try {
var i = e.util.parseJSON(t.responseText) var i = e.util.parseJSON(t.responseText)
} catch (s) { } catch (ss) {
return u.options.error(s, t), void 0 return (s.error || u.options.error)(ss, t), void 0
} }
var r = new o(i); var r = new o(i);
u.options.error(r, t), c.err_code = r.code, c.err_msg = r.message, c.restimestamp = a(), n(c) u.options.error(r, t), c.err_code = r.code, c.err_msg = r.message, c.restimestamp = a(), n(c)
...@@ -1550,7 +1550,7 @@ baidu.frontia = {}, function(e) { ...@@ -1550,7 +1550,7 @@ baidu.frontia = {}, function(e) {
o.method = "list"; o.method = "list";
var c = e.getCurrentAccount(); var c = e.getCurrentAccount();
c && (accessToken = c.getAccessToken()), o.access_token = accessToken; c && (accessToken = c.getAccessToken()), o.access_token = accessToken;
var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt(i, {dataType: "json"}), p = e.ajax; var u = t(n, o, ["success", "error"]), f = r("file?", u.query), l = s._createAjaxOpt(i, {dataType: "json"}, o), p = e.ajax;
p.get(f, {}, l) p.get(f, {}, l)
} }
},listStreamFile: function(n) { },listStreamFile: function(n) {
......
...@@ -2,6 +2,9 @@ echo -e "\033[0;33;1mPublish start." ...@@ -2,6 +2,9 @@ echo -e "\033[0;33;1mPublish start."
echo -e "\033[0;33;1m> Checking out gh-pages\033[0m" echo -e "\033[0;33;1m> Checking out gh-pages\033[0m"
git checkout -q gh-pages git checkout -q gh-pages
echo -e "\033[0;33;1m> Merging server changes\033[0m"
git pull origin gh-pages
echo -e "\033[0;33;1m> Merging dev commits\033[0m" echo -e "\033[0;33;1m> Merging dev commits\033[0m"
git merge dev -qm "merge from dev" git merge dev -qm "merge from dev"
......
...@@ -63,6 +63,8 @@ $( function () { ...@@ -63,6 +63,8 @@ $( function () {
// 当前连接是否指示要加载一个分享的脑图 // 当前连接是否指示要加载一个分享的脑图
isShareLink, isShareLink,
isPathLink,
uuid = function () { uuid = function () {
return ( ( +new Date() * 10000 ) + ( Math.random() * 9999 ) ).toString( 36 ); return ( ( +new Date() * 10000 ) + ( Math.random() * 9999 ) ).toString( 36 );
}, },
...@@ -90,12 +92,11 @@ $( function () { ...@@ -90,12 +92,11 @@ $( function () {
initUI(); initUI();
initFrontia(); initFrontia();
loadShare(); loadShare();
loadPath();
checkLogin(); checkLogin();
bindShortCuts(); bindShortCuts();
watchChanges();
bindDraft(); bindDraft();
loadDraft( 0 ); watchChanges();
if ( !loadPath() && !isShareLink ) loadDraft( 0 );
} }
// 创建 UI // 创建 UI
...@@ -220,8 +221,17 @@ $( function () { ...@@ -220,8 +221,17 @@ $( function () {
// documemt.referrer 是为了支持被嵌在 iframe 里的情况 // documemt.referrer 是为了支持被嵌在 iframe 里的情况
var match = pattern.exec( window.location ) || pattern.exec( document.referrer ); var match = pattern.exec( window.location ) || pattern.exec( document.referrer );
if ( !match ) return; if ( !match ) return;
if ( !currentAccount ) {
setTimeout( function () {
if ( !currentAccount ) return login();
setRemotePath( decodeURIComponent( match[ 1 ], true ) );
loadRemote();
}, 1000 );
return false;
}
setRemotePath( decodeURIComponent( match[ 1 ], true ) ); setRemotePath( decodeURIComponent( match[ 1 ], true ) );
loadRemote(); loadRemote();
return true;
} }
function setRemotePath( path, saved ) { function setRemotePath( path, saved ) {
......
setlocal EnableDelayedExpansion
del /q /s .\spec\coverage\json_files\*.json
for /f %%j in ('karma start ./spec/karma.conf.js') do set karmaRe=%%j
for /f %%i in ('node ./spec/mergeCoverageForIstanbul.js') do set re=%%i
istanbul report html spec/coverage/json_files/%re%.json
\ No newline at end of file
karmaɵĽjsonʽ
\ No newline at end of file
// Karma configuration
// Generated on Wed Oct 09 2013 19:20:49 GMT+0800 (中国标准时间)
//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'
// reporters: ['progress'],
// web server port
port: 9876,
// 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,
// 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'
// 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'
}
});
};
/**
* Created by dongyancen on 14-3-26.
*/
var fs = require('fs');
var browsers = ['Chrome', 'Firefox', 'PhantomJS', 'IE'];
var result_forBrowser = {};
var jsonFileBasePath = './spec/coverage/json_files/';
var jsonFiles = fs.readdirSync(jsonFileBasePath);
var finalJsonFile = 'defaultFileName';
var curPath = '/spec';
var resultPath = '.';
//找出所有的json文件
for (var i = 0; i < jsonFiles.length; i++) {
// json文件名必须是有8位的日期和6位的时间戳如:-20140326_161249
if (!isJsonFiles(jsonFiles[i])) {
jsonFiles.splice(i, 1);
i--;
}
}
//没有找到合适的文件
if(jsonFiles.length==0)return;
//先排序 按时间从小到大 及从旧到新
jsonFiles.sort(function (f1, f2) {
var t1 = getFileTime(f1);//形如['-20140326_161249','20140326','161249']
var t2 = getFileTime(f2);
var dateDiff = parseInt(t1[1]) - parseInt(t2[1]);
if (dateDiff != 0)return dateDiff;
else return parseInt(t1[2]) - parseInt(t2[2]);
});
//以时间命名新的文件
finalJsonFile = getFileTime(jsonFiles[jsonFiles.length-1])[0].substring(1);
//如:20140326_161249
//取最新的
// 按浏览器类型分类 result_forBrowser属性形如:{'Crome':'filename1','Firefox':'filename2'}
for (i = 0; i < jsonFiles.length; i++) {
for (var j = 0; j < browsers.length; j++) {
if (eval('/' + browsers[j] + '/.test("' + jsonFiles[i] + '");')) {
eval('result_forBrowser.' + browsers[j] + '="' + jsonFiles[i] + '";');
}
}
}
//以上得到所有要合计的json文件
//读取,合计数字,需要合计的属性: 's' 'b' 'f' 'l'
//修正路径
var jsonToWrite = null;
for (var a in result_forBrowser) {
var r = fs.readFileSync(jsonFileBasePath + result_forBrowser[a]);
if (!jsonToWrite) {
jsonToWrite = JSON.parse(r);
continue;
} else {
jsonToWrite = mergeResult(jsonToWrite, JSON.parse(r));
}
}
//写文件
fs.writeFileSync(jsonFileBasePath+finalJsonFile+'.json',JSON.stringify(jsonToWrite));
function isJsonFiles(fileName) {
var e = fileName.substring(fileName.lastIndexOf(".") + 1);
// json文件名必须是有8位的日期和6位的时间戳如:-20140326_161249
//否则无法判断文件生成时间,也就无法合并同一次运行产生的结果
return e == 'json' && getFileTime(fileName);
}
function getFileTime(fileName) {
// json文件名必须是有8位的日期和6位的时间戳如:-20140326_161249
return fileName.match(/-(\d{8})_(\d{6})/);
}
function mergeResult(allR, addR) {
var resultR = {};
for (var allRKey in allR) {
if (addR[allRKey]) {
allR[allRKey] = mergeDetail(allR[allRKey], addR[allRKey], 's', 1);
allR[allRKey] = mergeDetail(allR[allRKey], addR[allRKey], 'f', 1);
allR[allRKey] = mergeDetail(allR[allRKey], addR[allRKey], 'l', 1);
allR[allRKey] = mergeDetail(allR[allRKey], addR[allRKey], 'b', 2);
}
//修正路径
resultR[fixPath(allRKey)] = allR[allRKey]
}
return resultR;
}
//type = 1 合并 s f l ,如:{"1":1,"2":1,"3":1}
//type = 2 合并 b ,如:{"1":[0,0],"2":[0,0]}
function mergeDetail(allEle, addEle, attrName, type) {
if (allEle[attrName] && addEle[attrName]) {
if (type == 1) {
for (var k in allEle[attrName]) {
//todo 现在没有考虑两个文件中同一项覆盖率的统计行数不一致的问题
if ( parseInt(allEle[attrName][k])==0 && parseInt(addEle[attrName][k]) ==1) {
allEle[attrName][k] = 1;
}
}
}
else if (type == 2) {
for (var k in allEle[attrName]) {
//todo 现在没有考虑两个文件中同一项覆盖率的统计行数不一致的问题
if (addEle[attrName][k]) {
if (parseInt(allEle[attrName][k][0])==0 &&parseInt(addEle[attrName][k][0])==1 ) {
allEle[attrName][k][0] = 1;
}
if (parseInt(allEle[attrName][k][1])==0 &&parseInt(addEle[attrName][k][1])==1 ) {
allEle[attrName][k][1] = 1;
}
}
}
}
}
return allEle;
}
//修正路径
function fixPath(oldPath){
//例如把 "D:/workspace/ufinder/_src/core/finder.js" 修正为
// ./_src/core/finder.js 注意这里一定要用相对路径(相对于_spec/coverage)
var s = __dirname.replace(/\\/g,'/');
if(s.lastIndexOf(curPath)){
s = s.substring(0,s.lastIndexOf(curPath) );
}
oldPath = oldPath.replace(s,resultPath);
return oldPath;
}
console.log(finalJsonFile);
\ No newline at end of file
setlocal EnableDelayedExpansion
del /q /s .\coverage\json_files\*.json
for /f %%j in ('karma start ./karma.conf.js') do set karmaRe=%%j
for /f %%i in ('node ./mergeCoverageForIstanbul.js') do set re=%%i
istanbul report html coverage/json_files/%re%.json
pause
@echo off
setlocal EnableDelayedExpansion
del /q /s .\coverage\json_files\*.*
karma start ./karma.conf.js
\ No newline at end of file
...@@ -32,7 +32,8 @@ function exportNode( node ) { ...@@ -32,7 +32,8 @@ function exportNode( node ) {
var DEFAULT_TEXT = { var DEFAULT_TEXT = {
'root': 'maintopic', 'root': 'maintopic',
'main': 'topic' 'main': 'topic',
'sub': 'topic'
}; };
function importNode( node, json, km ) { function importNode( node, json, km ) {
...@@ -40,14 +41,14 @@ function importNode( node, json, km ) { ...@@ -40,14 +41,14 @@ function importNode( node, json, km ) {
for ( var field in data ) { for ( var field in data ) {
node.setData( field, data[ field ] ); node.setData( field, data[ field ] );
} }
node.setText( data.text || km.getLang( DEFAULT_TEXT[ data.type ] ) ); node.setText( data.text || km.getLang( DEFAULT_TEXT[ node.getType() ] ) );
var childrenTreeData = json.children; var childrenTreeData = json.children;
if ( !childrenTreeData ) return; if ( !childrenTreeData ) return;
for ( var i = 0; i < childrenTreeData.length; i++ ) { for ( var i = 0; i < childrenTreeData.length; i++ ) {
var childNode = new MinderNode(); var childNode = new MinderNode();
importNode( childNode, childrenTreeData[ i ], km );
node.appendChild( childNode ); node.appendChild( childNode );
importNode( childNode, childrenTreeData[ i ], km );
} }
return node; return node;
} }
......
//这里只放不是由模块产生的默认参数 //这里只放不是由模块产生的默认参数
KM.defaultOptions = { KM.defaultOptions = {
zIndex : 1000, zIndex : 1000,
lang:'zh-cn' lang:'zh-cn',
readyOnly:false
}; };
\ No newline at end of file
...@@ -25,6 +25,10 @@ kity.extendClass( Minder, { ...@@ -25,6 +25,10 @@ kity.extendClass( Minder, {
} }
}, },
_firePharse: function ( e ) { _firePharse: function ( e ) {
// //只读模式下强了所有的事件操作
// if(this.readOnly === true){
// return false;
// }
var beforeEvent, preEvent, executeEvent; var beforeEvent, preEvent, executeEvent;
if ( e.type == 'DOMMouseScroll' ) { if ( e.type == 'DOMMouseScroll' ) {
......
...@@ -10,6 +10,9 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", { ...@@ -10,6 +10,9 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._initContextmenu(); this._initContextmenu();
this._initModules(); this._initModules();
if(this.getOptions('readOnly') === true){
this.setDisabled();
}
this.fire( 'ready' ); this.fire( 'ready' );
}, },
getOptions: function ( key ) { getOptions: function ( key ) {
...@@ -166,6 +169,46 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", { ...@@ -166,6 +169,46 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
}, },
getStatus: function () { getStatus: function () {
return this._status; return this._status;
},
setDisabled : function(){
var me = this;
//禁用命令
me.bkqueryCommandState = me.queryCommandState;
me.bkqueryCommandValue = me.queryCommandValue;
me.queryCommandState = function (type) {
var cmd = this._getCommand(type);
if(cmd && cmd.enableReadOnly === false){
return me.bkqueryCommandState.apply(me, arguments);
}
return -1;
};
me.queryCommandValue = function (type) {
var cmd = this._getCommand(type);
if(cmd && cmd.enableReadOnly === false){
return me.bkqueryCommandValue.apply(me, arguments);
}
return null;
};
this.setStatus('readonly');
me.fire('interactchange');
},
setEnabled : function(){
var me = this;
if (me.bkqueryCommandState) {
me.queryCommandState = me.bkqueryCommandState;
delete me.bkqueryCommandState;
}
if (me.bkqueryCommandValue) {
me.queryCommandValue = me.bkqueryCommandValue;
delete me.bkqueryCommandValue;
}
this.rollbackStatus();
me.fire('interactchange');
} }
} ); } );
......
...@@ -27,7 +27,6 @@ KityMinder.registerModule( "TextEditModule", function () { ...@@ -27,7 +27,6 @@ KityMinder.registerModule( "TextEditModule", function () {
}, },
"events": { "events": {
'normal.beforemousedown textedit.beforemousedown':function(e){ 'normal.beforemousedown textedit.beforemousedown':function(e){
if(e.isRightMB()){ if(e.isRightMB()){
e.stopPropagationImmediately(); e.stopPropagationImmediately();
return; return;
......
...@@ -27,7 +27,7 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -27,7 +27,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition = null, lastPosition = null,
currentPosition = null; currentPosition = null;
this._minder.on( 'normal.beforemousedown', function ( e ) { this._minder.on( 'normal.beforemousedown readonly.beforemousedown', function ( e ) {
// 点击未选中的根节点临时开启 // 点击未选中的根节点临时开启
if ( e.getTargetNode() == this.getRoot() && if ( e.getTargetNode() == this.getRoot() &&
( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) { ( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) {
...@@ -94,7 +94,8 @@ KityMinder.registerModule( 'View', function () { ...@@ -94,7 +94,8 @@ KityMinder.registerModule( 'View', function () {
}, },
queryState: function ( minder ) { queryState: function ( minder ) {
return minder._viewDragger.isEnabled() ? 1 : 0; return minder._viewDragger.isEnabled() ? 1 : 0;
} },
enableReadOnly : false
} ); } );
var CameraCommand = kity.createClass( "CameraCommand", { var CameraCommand = kity.createClass( "CameraCommand", {
...@@ -106,7 +107,8 @@ KityMinder.registerModule( 'View', function () { ...@@ -106,7 +107,8 @@ KityMinder.registerModule( 'View', function () {
dy = viewport.center.y - offset.y; dy = viewport.center.y - offset.y;
km.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" ); km.getRenderContainer().fxTranslate( dx, dy, 1000, "easeOutQuint" );
this.setContentChanged( false ); this.setContentChanged( false );
} },
enableReadOnly : false
} ); } );
return { return {
...@@ -148,7 +150,7 @@ KityMinder.registerModule( 'View', function () { ...@@ -148,7 +150,7 @@ KityMinder.registerModule( 'View', function () {
e.preventDefault(); e.preventDefault();
}, },
'normal.dblclick': function ( e ) { 'normal.dblclick readonly.dblclick': function ( e ) {
if ( e.getTargetNode() ) return; if ( e.getTargetNode() ) return;
this.execCommand( 'camera', this.getRoot() ); this.execCommand( 'camera', this.getRoot() );
} }
......
...@@ -41,7 +41,8 @@ KityMinder.registerModule( 'Zoom', function () { ...@@ -41,7 +41,8 @@ KityMinder.registerModule( 'Zoom', function () {
}, },
queryState: function ( minder ) { queryState: function ( minder ) {
return ( minder._zoomValue > 1 / MAX_ZOOM ) ? 0 : -1; return ( minder._zoomValue > 1 / MAX_ZOOM ) ? 0 : -1;
} },
enableReadOnly : false
} ); } );
var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', { var ZoomOutCommand = kity.createClass( 'ZoomOutCommand', {
...@@ -53,7 +54,8 @@ KityMinder.registerModule( 'Zoom', function () { ...@@ -53,7 +54,8 @@ KityMinder.registerModule( 'Zoom', function () {
}, },
queryState: function ( minder ) { queryState: function ( minder ) {
return ( minder._zoomValue < 1 / MIN_ZOOM ) ? 0 : -1; return ( minder._zoomValue < 1 / MIN_ZOOM ) ? 0 : -1;
} },
enableReadOnly : false
} ); } );
return { return {
...@@ -79,7 +81,7 @@ KityMinder.registerModule( 'Zoom', function () { ...@@ -79,7 +81,7 @@ KityMinder.registerModule( 'Zoom', function () {
'ready': function () { 'ready': function () {
this._zoomValue = 1; this._zoomValue = 1;
}, },
'normal.mousewheel': function ( e ) { 'normal.mousewheel readonly.mousewheel': function ( e ) {
if ( !e.originEvent.ctrlKey ) return; if ( !e.originEvent.ctrlKey ) return;
var delta = e.originEvent.wheelDelta; var delta = e.originEvent.wheelDelta;
var me = this; var me = this;
......
...@@ -25,7 +25,7 @@ KityMinder.registerProtocal( 'mindmanager', function () { ...@@ -25,7 +25,7 @@ KityMinder.registerProtocal( 'mindmanager', function () {
function processTopic(topic, obj){ function processTopic(topic, obj){
//处理文本 //处理文本
obj.data = { text : topic.Text && topic.Text.PlainText || '_' }; // 节点默认的文本,没有Text属性 obj.data = { text : topic.Text && topic.Text.PlainText || '' }; // 节点默认的文本,没有Text属性
// 处理标签 // 处理标签
if(topic.Task){ if(topic.Task){
......
...@@ -69,7 +69,9 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -69,7 +69,9 @@ KityMinder.registerProtocal( 'xmind', function () {
function xml2km(xml){ function xml2km(xml){
var json = $.xml2json(xml); var json = $.xml2json(xml);
var result = {}; var result = {};
processTopic(json.sheet.topic, result); var sheet = json.sheet;
var topic = utils.isArray(sheet) ? sheet[0].topic : sheet.topic;
processTopic(topic, result);
return result; return result;
} }
......
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