Commit a876ca99 authored by techird's avatar techird

Merge branch 'dev' of github.com:kitygraph/kityminder into dev

parents df63a21c b88ee449
(function(){
function getKMBasePath ( docUrl, confUrl ) {
( function () {
function getKMBasePath( docUrl, confUrl ) {
return getBasePath( docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath() );
}
function getConfigFilePath () {
function getConfigFilePath() {
var configPath = document.getElementsByTagName('script');
var configPath = document.getElementsByTagName( 'script' );
return configPath[ configPath.length -1 ].src;
return configPath[ configPath.length - 1 ].src;
}
function getBasePath ( docUrl, confUrl ) {
function getBasePath( docUrl, confUrl ) {
var basePath = confUrl;
if(/^(\/|\\\\)/.test(confUrl)){
if ( /^(\/|\\\\)/.test( confUrl ) ) {
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/,'');
basePath = /^.+?\w(\/|\\\\)/.exec( docUrl )[ 0 ] + confUrl.replace( /^(\/|\\\\)/, '' );
}else if ( !/^[a-z]+:/i.test( confUrl ) ) {
} else if ( !/^[a-z]+:/i.test( confUrl ) ) {
docUrl = docUrl.split( "#" )[0].split( "?" )[0].replace( /[^\\\/]+$/, '' );
docUrl = docUrl.split( "#" )[ 0 ].split( "?" )[ 0 ].replace( /[^\\\/]+$/, '' );
basePath = docUrl + "" + confUrl;
......@@ -34,15 +34,15 @@
}
function optimizationPath ( path ) {
function optimizationPath( path ) {
var protocol = /^[a-z]+:\/\//.exec( path )[ 0 ],
tmp = null,
res = [];
path = path.replace( protocol, "" ).split( "?" )[0].split( "#" )[0];
path = path.replace( protocol, "" ).split( "?" )[ 0 ].split( "#" )[ 0 ];
path = path.replace( /\\/g, '/').split( /\// );
path = path.replace( /\\/g, '/' ).split( /\// );
path[ path.length - 1 ] = "";
......@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏
toolbars: [
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node'
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | switchlayout'
]
//设置主题
......@@ -79,4 +79,4 @@
//设置km整体的z-index大小
//,zIndex : 1000
};
})()
} )()
\ No newline at end of file
......@@ -62,9 +62,11 @@ $dependency = Array(
,'src/adapter/view.js'
,'src/adapter/dialog.js'
,'src/adapter/tooltips.js'
,'src/adapter/layout.js'
,'src/adapter/node.js'
,'src/protocal/plain.js'
,'src/protocal/json.js'
,'src/protocal/png.js'
);
$content = "";
......
......@@ -10,12 +10,13 @@ KityMinder.LANG[ 'zh-cn' ] = {
'fontfamily': '字体',
'fontsize': '字号',
'layoutstyle': '主题',
'node':'节点操作',
'node': '节点操作',
'saveto': '导出',
'hand': '允许拖拽',
'zoom-in': '放大',
'zoom-out': '缩小',
'markers': '添加标签'
'markers': '添加标签',
'switchlayout': '切换主题'
},
'popupcolor': {
'clearColor': '清空颜色',
......@@ -40,10 +41,10 @@ KityMinder.LANG[ 'zh-cn' ] = {
}
}
},
'node':{
'appendsiblingnode':'插入兄弟节点',
'appendchildnode':'插入孩子节点',
'removenode':'删除节点'
'node': {
'appendsiblingnode': '插入兄弟节点',
'appendchildnode': '插入孩子节点',
'removenode': '删除节点'
}
};
\ No newline at end of file
KM.registerToolbarUI( 'layoutstyle fontfamily fontsize inserttopic', function ( name ) {
KM.registerToolbarUI( 'fontfamily fontsize', function ( name ) {
var me = this,
label = me.getLang( 'tooltips.' + name ),
......@@ -19,9 +19,7 @@ KM.registerToolbarUI( 'layoutstyle fontfamily fontsize inserttopic', function (
}
switch ( name ) {
case 'layoutstyle':
options = transForLayoutstyle( options );
break;
case 'fontfamily':
options = transForFontfamily( options );
......@@ -31,8 +29,6 @@ KM.registerToolbarUI( 'layoutstyle fontfamily fontsize inserttopic', function (
options = transForFontsize( options );
break;
case 'inserttopic':
optons
}
//实例化
......@@ -64,24 +60,6 @@ KM.registerToolbarUI( 'layoutstyle fontfamily fontsize inserttopic', function (
return comboboxWidget.button().addClass( 'kmui-combobox' );
function transForLayoutstyle( options ) {
var tempItems = [];
utils.each( options.items, function ( k, v ) {
options.value.push( k );
tempItems.push( k );
options.autowidthitem.push( $.wordCountAdaptive( tempItems[ tempItems.length - 1 ] ) );
} );
options.items = tempItems;
return options;
}
//字体参数转换
function transForFontfamily( options ) {
......
KM.registerToolbarUI( 'switchlayout', function ( name ) {
var me = this,
label = me.getLang( 'tooltips.' + name ),
options = {
label: label,
title: label,
comboboxName: name,
items: me.getLayoutStyleItems() || [],
itemStyles: [],
value: me.getLayoutStyleItems(),
autowidthitem: [],
enabledRecord:false
},
$combox = null;
if ( options.items.length == 0 ) {
return null;
}
//实例化
$combox = $.kmuibuttoncombobox( options ).css( 'zIndex', me.getOptions( 'zIndex' ) + 1 );
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
me.execCommand( name, res.value );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
} );
//状态反射
me.on( 'interactchange', function () {
var state = this.queryCommandState( name ),
value = this.queryCommandValue( name );
//设置按钮状态
comboboxWidget.button().kmui().disabled( state == -1 ).active( state == 1 );
if ( value ) {
//设置label
value = value.replace( /['"]/g, '' ).toLowerCase().split( /['|"]?\s*,\s*[\1]?/ );
comboboxWidget.selectItemByLabel( value );
}
} );
return comboboxWidget.button().addClass( 'kmui-combobox' );
} );
\ No newline at end of file
......@@ -2,11 +2,11 @@ KM.registerToolbarUI( 'node', function ( name ) {
var shortcutKeys = {
"appendsiblingnode": "enter",
"appendchildnode": "tab",
"removenode":"del|backspace"
"removenode": "del|backspace"
};
var me = this,
msg = me.getLang('node'),
msg = me.getLang( 'node' ),
label = me.getLang( 'tooltips.' + name ),
options = {
label: label,
......@@ -15,10 +15,10 @@ KM.registerToolbarUI( 'node', function ( name ) {
items: me.getOptions( name ) || [],
itemStyles: [],
value: [],
autowidthitem: []
autowidthitem: [],
enabledRecord: false
},
$combox = null;
if ( options.items.length == 0 ) {
return null;
}
......@@ -28,21 +28,21 @@ KM.registerToolbarUI( 'node', function ( name ) {
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
me.execCommand( res.value );
}).on( "beforeshow", function () {
me.execCommand( res.value, new MinderNode( me.getLang().topic ) );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
}
var combox = $combox.kmui();
combox.traverseItems(function(label,value){
if(me.queryCommandState(value) == -1){
combox.disableItemByLabel(label)
}else{
combox.enableItemByLabel(label)
combox.traverseItems( function ( label, value ) {
if ( me.queryCommandState( value ) == -1 ) {
combox.disableItemByLabel( label )
} else {
combox.enableItemByLabel( label )
}
})
});
} )
} );
return comboboxWidget.button().addClass( 'kmui-combobox' );
......@@ -55,7 +55,7 @@ KM.registerToolbarUI( 'node', function ( name ) {
utils.each( options.items, function ( k, v ) {
options.value.push( v );
tempItems.push( (msg[k]||k) + '(' + shortcutKeys[v].toUpperCase() + ')');
tempItems.push( ( msg[ k ] || k ) + '(' + shortcutKeys[ v ].toUpperCase() + ')' );
options.autowidthitem.push( $.wordCountAdaptive( tempItems[ tempItems.length - 1 ] ) );
} );
......@@ -64,5 +64,4 @@ KM.registerToolbarUI( 'node', function ( name ) {
}
});
} );
\ No newline at end of file
......@@ -30,6 +30,53 @@ KM.registerToolbarUI( 'saveto', function ( name ) {
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
if ( res.value === "png" ) {
var svghtml = $( "#kityminder .kmui-editor-body" ).html();
var rootBox = me.getRoot().getRenderContainer().getRenderBox();
var svg = $( svghtml ).attr( {
width: rootBox.x + me.getRenderContainer().getWidth() + 20,
height: rootBox.y + me.getRenderContainer().getHeight() + 20,
viewBox: null
} );
var div = $( "<div></div>" ).append( svg );
svghtml = div.html();
var canvas = $( '<canvas style="border:2px solid black;" width="' + svg.attr( "width" ) + '" height="' + svg.attr( "height" ) + '"></canvas>' );
var ctx = canvas[ 0 ].getContext( "2d" );
var DOMURL = self.URL || self.webkitURL || self;
var img = new Image();
var svg = new Blob( [ svghtml ], {
type: "image/svg+xml;charset=utf-8"
} );
var url = DOMURL.createObjectURL( svg );
img.onload = function () {
ctx.drawImage( img, 0, 0 );
DOMURL.revokeObjectURL( url );
var type = 'png';
var imgData = canvas[ 0 ].toDataURL( type );
var _fixType = function ( type ) {
type = type.toLowerCase().replace( /jpg/i, 'jpeg' );
var r = type.match( /png|jpeg|bmp|gif/ )[ 0 ];
return 'image/' + r;
};
imgData = imgData.replace( _fixType( type ), 'image/octet-stream' );
var saveFile = function ( data, filename ) {
var save_link = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'a' );
save_link.href = data;
save_link.download = filename;
var event = document.createEvent( 'MouseEvents' );
event.initMouseEvent( 'click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null );
save_link.dispatchEvent( event );
};
// 下载后的问题名
var filename = 'kityminder_' + ( new Date() ).getTime() + '.' + type;
// download
saveFile( imgData, filename );
};
img.src = url;
return "png";
}
var data = me.exportData( res.value );
var p = KityMinder.findProtocal( res.value );
var a = downloadLink;
......
......@@ -69,6 +69,9 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._shortcutkeys = {};
this._bindshortcutKeys();
},
isTextEditStatus:function(){
return false;
},
addShortcutKeys: function ( cmd, keys ) {
var obj = {},km = this;
if ( keys ) {
......@@ -122,6 +125,10 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
current++;
}
});
//todo 暂时通过receiver判断
if(me.isTextEditStatus()){
return;
}
if(current == keys.length){
if ( me.queryCommandState( i ) != -1 )
me.execCommand( i );
......
......@@ -32,7 +32,7 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
function boxMapper( node ) {
return node.getRenderContainer().getRenderBox();
return node.getRenderContainer().getRenderBox( 'top' );
}
// 对拖动对象的一个替代盒子,控制整个拖放的逻辑,包括:
......
......@@ -14,6 +14,12 @@ KityMinder.registerModule( "TextEditModule", function () {
km.isTextEditStatus = function(){
return km.receiver.isTextEditStatus();
};
var selectionByClick = false;
return {
//插入光标
"init":function(){
......@@ -23,12 +29,19 @@ KityMinder.registerModule( "TextEditModule", function () {
'beforemousedown':function(e){
sel.setHide();
var node = e.getTargetNode();
if(!node){
var selectionShape = e.kityEvent.targetShape;
if(selectionShape && selectionShape.getType() == 'Selection'){
selectionByClick = true;
node = selectionShape.getData('relatedNode');
e.stopPropagationImmediately();
}
}
if(node){
var textShape = node.getTextShape();
textShape.setStyle('cursor','default');
if ( this.isSingleSelect() && node.isSelected() && e.kityEvent.targetShape.getType().toLowerCase()== 'text') {
if ( this.isSingleSelect() && node.isSelected()) {// && e.kityEvent.targetShape.getType().toLowerCase()== 'text'
sel.collapse();
node.getTextShape().setStyle('cursor','text');
receiver.setTextEditStatus(true)
......@@ -42,27 +55,44 @@ KityMinder.registerModule( "TextEditModule", function () {
.setCurrentIndex(e.getPosition())
.updateSelection()
.setRange(range);
sel.setData('relatedNode',node);
mouseDownStatus = true;
lastEvtPosition = e.getPosition();
if(selectionByClick){
sel.setShow();
selectionByClick = false;
}
}
}
},
'mouseup':function(e){
if(!sel.collapsed && mouseDownStatus){
if(mouseDownStatus){
if(!sel.collapsed ){
receiver.updateRange(range)
}else
sel.setShow()
}
mouseDownStatus = false;
oneTime = 0;
},
'beforemousemove':function(e){
if(mouseDownStatus){
e.stopPropagationImmediately();
var offset = e.getPosition();
if(Math.abs(offset.y - lastEvtPosition.y) > 2 && Math.abs(lastEvtPosition.x - offset.x) < 1 ){
sel.setHide();
mouseDownStatus = false;
return;
}
dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir);
receiver.updateSelectionByMousePosition(offset,dir)
.updateSelectionShow(dir);
sel.stroke('none',0);
lastEvtPosition = e.getPosition();
}
},
'dblclick':function(e){
......@@ -73,8 +103,8 @@ KityMinder.registerModule( "TextEditModule", function () {
sel.setStartOffset(0);
sel.setEndOffset(text.getContent().length);
sel.setShow();
receiver.updateSelectionShow(1)
.updateRange(range);
receiver.setContainerTxt(text.getContent()).updateSelectionShow(1)
.updateRange(range).setTextEditStatus(true)
}
},
......@@ -117,7 +147,7 @@ KityMinder.registerModule( "TextEditModule", function () {
receiver.updateSelectionShow(1)
.updateRange(range);
return;
}
......@@ -130,10 +160,11 @@ KityMinder.registerModule( "TextEditModule", function () {
}else{
receiver.updateSelectionShow(1)
}
return;
}
receiver.clear().setTextEditStatus(false);
},
'selectionclear':function(){
receiver.setTextEditStatus(false).clear()
......
......@@ -16,7 +16,12 @@ Minder.Range = kity.createClass('Range',{
return this;
},
setStart:function(node,index){
try{
this.nativeRange.setStart(node,index);
}catch(e){
console.log(e)
}
return this;
},
setEnd:function(node,index){
......
......@@ -223,16 +223,17 @@ Minder.Receiver = kity.createClass('Receiver',{
return false;
}
if(offset.x >= v.x && offset.x <= v.x + v.width){
if(me.index == i){
if(i == 0){
me.selection.setStartOffset(i)
}
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else if(i > me.index){
me.selection.setStartOffset(me.index);
me.selection.setEndOffset(i + (dir == 1 ? 1 : 0))
}else{
me.selection.setStartOffset(i + (dir == 1 ? 1 : 0))
me.selection.setStartOffset(i + (dir == 1 ? 1 : 0));
me.selection.setEndOffset(me.index)
}
return false;
......@@ -246,7 +247,7 @@ Minder.Receiver = kity.createClass('Receiver',{
width = 0 ;
if(this.selection.collapsed){
this.selection.updateShow(startOffset,0);
this.selection.updateShow(startOffset||this.textData[this.textData.length-1],0);
return this;
}
if(!endOffset){
......@@ -269,5 +270,9 @@ Minder.Receiver = kity.createClass('Receiver',{
setIndex:function(index){
this.index = index;
return this
},
setContainerTxt:function(txt){
this.container.textContent = txt;
return this;
}
});
\ No newline at end of file
......@@ -5,18 +5,20 @@ Minder.Selection = kity.createClass( 'Selection', {
this.callBase();
this.height = height || 20;
this.stroke( color || 'blue', width || 1 );
this.width = 1;
this.fill('#99C8FF');
this.stroke( color || 'rgb(27,171,255)', width || 1 );
this.width = 0;
this.fill('rgb(27,171,255)');
this.setHide();
this.timer = null;
this.collapsed = true;
this.startOffset = this.endOffset = 0;
this.setOpacity(0.5)
this.setOpacity(0.5);
this.setStyle('cursor','text');
},
collapse : function(toEnd){
this.stroke( 'blue', 1 );
this.stroke( 'rgb(27,171,255)', 1 );
this.setOpacity(1);
this.width = 1;
this.collapsed = true;
if(toEnd){
......@@ -37,7 +39,8 @@ Minder.Selection = kity.createClass( 'Selection', {
return this;
}
this.collapsed = false;
this.stroke('none');
this.stroke('none',0);
this.setOpacity(0.5);
return this;
},
setEndOffset:function(offset){
......@@ -51,10 +54,14 @@ Minder.Selection = kity.createClass( 'Selection', {
return this;
}
this.collapsed = false;
this.stroke('none');
this.stroke('none',0);
this.setOpacity(0.5);
return this;
},
updateShow : function(offset,width){
if(width){
this.setShowHold();
}
this.setPosition(offset).setWidth(width);
return this;
},
......@@ -64,7 +71,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this.y = offset.y;
} catch ( e ) {
console.log(e)
debugger
}
return this.update();
......
This diff is collapsed.
......@@ -8,7 +8,11 @@ KityMinder.registerModule( "LayoutModule", function () {
return this._layoutStyles[ name ];
},
getLayoutStyleItems: function () {
return this._layoutStyles;
var items = [];
for ( var key in this._layoutStyles ) {
items.push( key );
}
return items;
},
getCurrentStyle: function () {
var _root = this.getRoot();
......@@ -90,7 +94,10 @@ KityMinder.registerModule( "LayoutModule", function () {
var SwitchLayoutCommand = kity.createClass( "SwitchLayoutCommand", ( function () {
return {
base: Command,
execute: switchLayout
execute: switchLayout,
queryValue: function ( km ) {
return km.getCurrentStyle();
}
};
} )() );
var AppendChildNodeCommand = kity.createClass( "AppendChildNodeCommand", ( function () {
......@@ -98,9 +105,6 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command,
execute: function ( km, node ) {
var parent = km.getSelectedNode();
if ( !parent ) {
return false;
}
km.appendChildNode( parent, node );
km.select( node, true );
return node;
......@@ -120,9 +124,6 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command,
execute: function ( km, node ) {
var selectedNode = km.getSelectedNode();
if ( !selectedNode ) {
return false;
}
if ( selectedNode.isRoot() ) {
node.setType( "main" );
km.appendChildNode( selectedNode, node );
......@@ -134,8 +135,9 @@ KityMinder.registerModule( "LayoutModule", function () {
return node;
},
queryState: function ( km ) {
var selectedNode = km.getSelectedNode();
if ( !selectedNode || selectedNode === km.getRoot() ) {
var selectedNodes = km.getSelectedNodes();
//没选中节点和单选root的时候返回不可执行
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) ) {
return -1;
} else {
return 0;
......@@ -149,10 +151,6 @@ KityMinder.registerModule( "LayoutModule", function () {
execute: function ( km ) {
var selectedNodes = km.getSelectedNodes();
var _root = km.getRoot();
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && !selectedNodes[ 0 ].getParent() ) ) {
km.select( _root );
return false;
}
var _buffer = [];
for ( var i = 0; i < selectedNodes.length; i++ ) {
_buffer.push( selectedNodes[ i ] );
......@@ -167,7 +165,7 @@ KityMinder.registerModule( "LayoutModule", function () {
},
queryState: function ( km ) {
var selectedNodes = km.getSelectedNodes();
if ( ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) || selectedNodes.length === 0 ) {
if ( selectedNodes.length === 0 || ( selectedNodes.length === 1 && selectedNodes[ 0 ] === km.getRoot() ) ) {
return -1;
} else {
return 0;
......
......@@ -29,7 +29,9 @@ KityMinder.registerModule( "Select", function () {
startPosition = g.snapToSharp( e.getPosition() );
},
selectMove: function ( e ) {
if ( minder.isTextEditStatus() ) {
return;
}
if ( !startPosition ) return;
var p1 = startPosition,
......@@ -65,7 +67,7 @@ KityMinder.registerModule( "Select", function () {
// 计算选中范围
minder.getRoot().traverse( function ( node ) {
var renderBox = node.getRenderContainer().getRenderBox();
var renderBox = node.getRenderContainer().getRenderBox( "top" );
if ( g.isBoxIntersect( renderBox, marquee ) ) {
selectedNodes.push( node );
}
......@@ -80,7 +82,7 @@ KityMinder.registerModule( "Select", function () {
}
if ( marqueeMode ) {
marqueeShape.fadeOut( 200, 'ease', 0, function () {
if(marqueeShape.remove) marqueeShape.remove();
if ( marqueeShape.remove ) marqueeShape.remove();
} );
marqueeMode = false;
}
......
KityMinder.registerProtocal( "png", function () {
var LINE_ENDING = '\n',
TAB_CHAR = '\t';
function repeat( s, n ) {
var result = "";
while ( n-- ) result += s;
return result;
}
function encode( json, level ) {
var local = "";
level = level || 0;
local += repeat( TAB_CHAR, level );
local += json.data.text + LINE_ENDING;
if ( json.children ) {
json.children.forEach( function ( child ) {
local += encode( child, level + 1 );
} );
}
return local;
}
function isEmpty( line ) {
return !/\S/.test( line );
}
function getLevel( line ) {
var level = 0;
while ( line.charAt( level ) === TAB_CHAR ) level++;
return level;
}
function getNode( line ) {
return {
data: {
text: line.replace( new RegExp( '^' + TAB_CHAR + '*' ), '' )
}
};
}
function decode( local ) {
var json,
parentMap = {},
lines = local.split( LINE_ENDING ),
line, level, node;
function addChild( parent, child ) {
var children = parent.children || ( parent.children = [] );
children.push( child );
}
for ( var i = 0; i < lines.length; i++ ) {
line = lines[ i ];
if ( isEmpty( line ) ) continue;
level = getLevel( line );
node = getNode( line );
if ( level === 0 ) {
if ( json ) {
throw new Error( 'Invalid local format' );
}
json = node;
} else {
if ( !parentMap[ level - 1 ] ) {
throw new Error( 'Invalid local format' );
}
addChild( parentMap[ level - 1 ], node );
}
parentMap[ level ] = node;
}
return json;
}
var lastTry, lastResult;
function recognize( local ) {
if ( !Utils.isString( local ) ) return false;
lastTry = local;
try {
lastResult = decode( local );
} catch ( e ) {
lastResult = null;
}
return !!lastResult;
}
return {
fileDescription: 'png',
fileExtension: '.png',
encode: function ( json ) {
return encode( json, 0 );
},
decode: function ( local ) {
if ( lastTry == local && lastResult ) {
return lastResult;
}
return decode( local );
},
recognize: recognize,
recognizePriority: -1
};
} );
\ No newline at end of file
......@@ -51,7 +51,8 @@
//自动记录
autoRecord: true,
//最多记录条数
recordCount: 5
recordCount: 5,
enabledRecord:true
},
init: function( options ){
......@@ -133,6 +134,7 @@
*/
select: function( index ){
var options = this.data( 'options' ),
itemCount = options.itemCount,
items = options.autowidthitem;
......@@ -162,6 +164,7 @@
this.trigger( 'changebefore', items[ index ] );
this._update( index );
this.trigger( 'changeafter', items[ index ] );
......@@ -330,6 +333,7 @@
var options = this.data("options"),
newStack = [];
if(this.data('options').enabledRecord){
$.each( options.recordStack, function( i, item ){
if( item != index ) {
......@@ -346,6 +350,8 @@
}
options.recordStack = newStack;
}
options.selected = index;
this._repaint();
......
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