Commit 6cee6acf authored by campaign's avatar campaign

by zhanyi

parent 1724ab59
......@@ -26,5 +26,7 @@ var keymap = KityMinder.keymap = {
'Del':46,
'NumLock':144
'NumLock':144,
'Cmd':91
};
\ No newline at end of file
......@@ -31,6 +31,9 @@ KityMinder.registerModule( "TextEditModule", function () {
.setRange(range);
}
}
},
'restoreScene':function(){
cursor.setHide();
}
}
};
......
......@@ -68,13 +68,13 @@ Minder.Receiver = kity.createClass('Receiver',{
clearTimeout(this.timer);
var me = this;
var keyCode = e.originEvent.keyCode;
var orgEvt = e.originEvent;
var keyCode = orgEvt.keyCode;
switch(e.type){
case 'beforekeyup':
if(this.isTextEditStatus()){
switch(keyCode){
case keymap.Enter:
case keymap.Tab:
......@@ -82,6 +82,12 @@ Minder.Receiver = kity.createClass('Receiver',{
this.clear();
e.stopPropagation();
return;
case keymap.Shift:
case keymap.Control:
case keymap.Alt:
case keymap.Cmd:
return;
}
var text = (this.container.textContent || this.container.innerText).replace(/\u200b/g,'');
......@@ -96,7 +102,7 @@ Minder.Receiver = kity.createClass('Receiver',{
this.timer = setTimeout(function(){
me.cursor.setShow()
},500);
},500);
return true;
}
......
......@@ -58,6 +58,7 @@ KityMinder.registerModule( "HistoryModule", function () {
this.km.initStyle();
this.update();
this.km.fire('restoreScene');
},
getScene: function () {
return new Scene( this.km.getRoot() )
......@@ -93,8 +94,7 @@ KityMinder.registerModule( "HistoryModule", function () {
this.historyManager = new HistoryManager( this );
var keys = {
// /*Backspace*/ 8:1, /*Delete*/ 46:1,
/*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1,
/*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1,/*Command*/91:1,
37:1, 38:1, 39:1, 40:1
},
keycont = 0,
......@@ -152,26 +152,26 @@ KityMinder.registerModule( "HistoryModule", function () {
}
},
"keydown":function(e){
// var orgEvt = e.originEvent;
// var keyCode = orgEvt.keyCode || orgEvt.which;
// if (!keys[keyCode] && !orgEvt.ctrlKey && !orgEvt.metaKey && !orgEvt.shiftKey && !orgEvt.altKey) {
//
//
// if (km.historyManager.list.length == 0) {
// km.historyManager.saveScene();
// }
// clearTimeout(saveSceneTimer);
//
// saveSceneTimer = setTimeout(function(){
// km.historyManager.saveScene();
// },200);
//
// lastKeyCode = keyCode;
// keycont++;
// if (keycont >= km.getOptions('maxInputCount') ) {
// km.historyManager.saveScene()
// }
// }
var orgEvt = e.originEvent;
var keyCode = orgEvt.keyCode || orgEvt.which;
if (!keys[keyCode] && !orgEvt.ctrlKey && !orgEvt.metaKey && !orgEvt.shiftKey && !orgEvt.altKey) {
if (km.historyManager.list.length == 0) {
km.historyManager.saveScene();
}
clearTimeout(saveSceneTimer);
saveSceneTimer = setTimeout(function(){
km.historyManager.saveScene();
},200);
lastKeyCode = keyCode;
keycont++;
if (keycont >= km.getOptions('maxInputCount') ) {
km.historyManager.saveScene()
}
}
}
}
};
......
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