Commit a7f18700 authored by campaign's avatar campaign

修复ie11的光标

parent 0a733593
......@@ -11,7 +11,12 @@ Minder.Range = kity.createClass('Range',{
this.nativeRange.setStart(char,1);
this.nativeRange.collapse(true);
}
this.nativeSel.removeAllRanges();
try{
this.nativeSel.removeAllRanges();
}catch(e){
}
this.nativeSel.addRange(this.nativeRange);
return this;
},
......
......@@ -16,12 +16,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this.textEditStatus;
},
constructor: function ( km ) {
var me = this;
this.setKityMinder( km );
this.textEditStatus = false;
var _div = document.createElement( 'div' );
_div.setAttribute( 'contenteditable', true );
_div.className = 'km_receiver';
this.container = document.body.insertBefore( _div, document.body.firstChild );
if(browser.ie && browser.version == 11){
utils.listen(this.container,'keydown keypress keyup',function(e){
me.keyboardEvents.call(me,new MinderEvent(e.type == 'keyup' ? "beforekeyup": e.type,e))
})
}
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.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) );
this.timer = null;
......@@ -114,6 +120,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
switch ( e.type ) {
case 'keydown':
isTypeText = false;
isKeypress = false;
switch ( e.originEvent.keyCode ) {
......@@ -162,6 +169,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
case 'keypress':
if ( isTypeText )
setTextToContainer();
isKeypress = true;
......@@ -169,7 +177,6 @@ Minder.Receiver = kity.createClass( 'Receiver', {
case 'beforekeyup':
switch ( keyCode ) {
case keymap.Enter:
case keymap.Tab:
......@@ -241,18 +248,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
setContainerStyle: function () {
var textShapeBox = this.getBaseOffset('screen');
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 5 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
if(!this.selection.isShow()){
var paperContainer = this.km.getPaper();
var width = paperContainer.node.parentNode.clientWidth;
var height = paperContainer.node.parentNode.clientHeight;
if(width < this.container.offsetWidth + this.container.offsetLeft){
this.km.getRenderContainer().translate(width/-3, 0);
this.setContainerStyle();
}else if (height < this.container.offsetTop + this.container.offsetHeight){
this.km.getRenderContainer().translate(0, height/-3);
this.setContainerStyle()
......
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