Commit 0a9329d1 authored by campaign's avatar campaign

优化输入文字体验

parent fd624c72
...@@ -23,7 +23,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -23,7 +23,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div.className = 'km_receiver'; _div.className = 'km_receiver';
this.container = document.body.insertBefore( _div, document.body.firstChild ); this.container = document.body.insertBefore( _div, document.body.firstChild );
utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); // utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); //
this.km.on( 'textedit.beforekeyup textedit.keydown textedit.paste', utils.proxy( this.keyboardEvents, this ) ); this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) );
this.timer = null; this.timer = null;
this.index = 0; this.index = 0;
}, },
...@@ -107,9 +107,13 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -107,9 +107,13 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me.selection.setShow() me.selection.setShow()
}, 500 ); }, 500 );
} }
var isTypeText = false;
var isKeypress = false;
switch ( e.type ) { switch ( e.type ) {
case 'keydown': case 'keydown':
isTypeText = false;
isKeypress = false;
switch ( e.originEvent.keyCode ) { switch ( e.originEvent.keyCode ) {
case keys.Enter: case keys.Enter:
case keys.Tab: case keys.Tab:
...@@ -149,8 +153,18 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -149,8 +153,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
} }
return; return;
} }
setTextToContainer(); isTypeText = true;
break; break;
case 'keypress':
if(isTypeText)
setTextToContainer();
isKeypress = true;
break;
case 'beforekeyup': case 'beforekeyup':
...@@ -168,7 +182,9 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -168,7 +182,9 @@ Minder.Receiver = kity.createClass( 'Receiver', {
} }
if(!isKeypress){
setTextToContainer();
}
return true; return true;
} }
......
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