Commit 2c074007 authored by campaign's avatar campaign

修复ie下range的报错

parent 181512d2
......@@ -3,6 +3,9 @@ Minder.Range = kity.createClass('Range',{
this.nativeRange = document.createRange();
this.nativeSel = window.getSelection();
},
hasNativeRange : function(){
return this.nativeSel.rangeCount != 0 ;
},
select:function(){
var start = this.nativeRange.startContainer;
if(start.nodeType == 1 && start.childNodes.length == 0){
......
......@@ -83,6 +83,9 @@ Minder.Receiver = kity.createClass( 'Receiver', {
var keys = KityMinder.keymap;
function setTextToContainer() {
if(!me.range.hasNativeRange()){
return;
}
var text = me.container.textContent.replace( /[\u200b\t\r\n]/g, '' );
if ( me.textShape.getOpacity() == 0 ) {
......@@ -176,7 +179,6 @@ Minder.Receiver = kity.createClass( 'Receiver', {
break;
case 'beforekeyup':
switch ( keyCode ) {
case keymap.Enter:
case keymap.Tab:
......
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