|
|
@ -7,6 +7,20 @@ import method from '../global/method'; |
|
|
|
import { getluckysheetfile } from '../methods/get' |
|
|
|
import { toJson } from '../global/api'; |
|
|
|
|
|
|
|
let undoTimer,redoTimer; |
|
|
|
function undoAccessible(len) { |
|
|
|
clearTimeout(undoTimer); |
|
|
|
undoTimer = setTimeout(() => { |
|
|
|
$('#luckysheet-icon-undo')[len ? 'removeClass' : 'addClass']('disabled'); |
|
|
|
}, 10); |
|
|
|
} |
|
|
|
function redoAccessible(len) { |
|
|
|
clearTimeout(redoTimer); |
|
|
|
redoTimer = setTimeout(() => { |
|
|
|
$('#luckysheet-icon-redo')[len ? 'removeClass' : 'addClass']('disabled'); |
|
|
|
}, 10); |
|
|
|
} |
|
|
|
|
|
|
|
const initListener = function(){ |
|
|
|
// createProxy(Store,['jfredo']);
|
|
|
|
createProxy(Store, 'jfredo',(target, property, val, receiver)=>{ |
|
|
@ -14,7 +28,13 @@ const initListener = function(){ |
|
|
|
// 钩子函数
|
|
|
|
method.createHookFunction('updated',val) |
|
|
|
} |
|
|
|
undoAccessible(Store.jfredo.length); |
|
|
|
} ); |
|
|
|
createProxy(Store, 'jfundo',(target, property, val, receiver)=>{ |
|
|
|
redoAccessible(Store.jfundo.length); |
|
|
|
} ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createProxy(Store, 'asyncLoad', (target, property, val, receiver)=>{ |
|
|
|
if(property === 'length' && val === 0){ |
|
|
|