Commit 1c5ab318 authored by techird's avatar techird

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

parents 4735257a 324518d3
......@@ -4,7 +4,8 @@
###功能更新
1. 添加保存时可修改文件名
2. 添加超链接
3. 优化了当输入中文时,中文显示位置与光标距离过远的问题4.
3. 优化了当输入中文时,中文显示位置与光标距离过远的问题
4. 选中节点时,按F2直接进入文字编辑状态
###问题修复
1. 修复当滚动鼠标滚轮时,光标不跟着移动的问题
......
......@@ -18,6 +18,7 @@
,'core/keymap.js'
,'core/minder.lang.js'
,'core/minder.defaultoptions.js'
,'core/minder.preference.js'
,'core/browser.js'
,'module/geometry.js'
,'module/history.js'
......
......@@ -16,7 +16,18 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this.fire( 'ready' );
},
getOptions: function ( key ) {
return this._options[ key ];
var val;
if(key){
val = this.getPreferences(key);
return val === null || val === undefined ? this._options[ key ] : val;
}else{
val = this.getPreferences();
if(val){
return utils.extend(val,this._options,true)
}else{
return this._options;
}
}
},
setDefaultOptions: function ( key, val,cover) {
var obj = {};
......@@ -26,9 +37,10 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
obj = key;
}
utils.extend( this._options, obj, !cover );
},
setOptions: function ( key, val ) {
this.setDefaultOptions(key,val,true)
this.setPreferences(key,val)
},
_initMinder: function () {
......
kity.extendClass( Minder, function(){
var ROOTKEY = 'kityminder_preference';
//创建存储机制
var LocalStorage = ( function () {
var storage = window.localStorage,
LOCAL_FILE = "localStorage";
return {
saveLocalData: function ( key, data ) {
if ( storage && data) {
storage.setItem( key, data );
return true;
}
return false;
},
getLocalData: function ( key ) {
if ( storage ) {
return storage.getItem( key );
}
return null;
},
removeItem: function ( key ) {
storage && storage.removeItem( key );
}
};
} )();
return {
setPreferences:function(key,value){
var obj = {};
if ( Utils.isString( key ) ) {
obj[ key ] = value;
} else {
obj = key;
}
var data = LocalStorage.getLocalData(ROOTKEY);
if(data){
data = JSON.parse(data);
utils.extend(data, obj);
}else{
data = obj;
}
LocalStorage.saveLocalData(ROOTKEY,JSON.stringify(data));
},
getPreferences:function(key){
var data = LocalStorage.getLocalData(ROOTKEY);
if(data){
data = JSON.parse(data);
return key ? data[key] : data
}
return null;
},
resetPreferences:function(pres){
var str = pres ? JSON.parse(pres) : '';
LocalStorage.saveLocalData(str)
}
}
}() );
\ No newline at end of file
......@@ -212,7 +212,10 @@ KityMinder.registerModule( "LayoutModule", function () {
} else {
return 0;
}
}
},
isNeedUndo: function () {
return false;
}
};
} )() );
......@@ -228,21 +231,7 @@ KityMinder.registerModule( "LayoutModule", function () {
"ready": function () {
this.setDefaultOptions( 'layoutstyle', this.getLayoutStyleItems() );
switchLayout( this, this.getOptions( 'defaultlayoutstyle' ) );
//读取cookies
var getCookie = function ( name ) {
var arr, reg = new RegExp( "(^| )" + name + "=([^;]*)(;|$)" );
if ( arr = document.cookie.match( reg ) ) return unescape( arr[ 2 ] );
else return null;
}
var expand = getCookie( 'expand' );
if ( expand ) {
if ( expand === 'all' ) {
this.setOptions( 'defaultExpand', {
'defaultLayer': 0,
'defaultSubShow': 0
} );
}
}
},
"click": function ( e ) {
var ico = e.kityEvent.targetShape && e.kityEvent.targetShape.container;
......
......@@ -333,7 +333,7 @@
var options = this.data("options"),
newStack = [];
debugger
if(this.data('options').enabledRecord){
$.each( options.recordStack, function( i, item ){
......
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