Skip to content

Commit d551c5b

Browse files
committed
Updating build
1 parent 2c6f252 commit d551c5b

File tree

3 files changed

+48
-32
lines changed

3 files changed

+48
-32
lines changed

‎dist/react-codemirror.js‎

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
module.exports=classNames;
4141
}elseif(typeofdefine==='function'&&typeofdefine.amd==='object'&&define.amd){
4242
// register as 'classnames', consistent with npm package name
43-
define('classnames',function(){
43+
define('classnames',[],function(){
4444
returnclassNames;
4545
});
4646
}else{
@@ -461,7 +461,7 @@
461461
if(horiz.clientWidth)scroll(horiz.scrollLeft,"horizontal");
462462
});
463463

464-
this.checkedOverlay=false;
464+
this.checkedZeroWidth=false;
465465
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
466466
if(ie&&ie_version<8)this.horiz.style.minHeight=this.vert.style.minWidth="18px";
467467
}
@@ -496,29 +496,43 @@
496496
this.horiz.firstChild.style.width="0";
497497
}
498498

499-
if(!this.checkedOverlay&&measure.clientHeight>0){
500-
if(sWidth==0)this.overlayHack();
501-
this.checkedOverlay=true;
499+
if(!this.checkedZeroWidth&&measure.clientHeight>0){
500+
if(sWidth==0)this.zeroWidthHack();
501+
this.checkedZeroWidth=true;
502502
}
503503

504504
return{right: needsV ? sWidth : 0,bottom: needsH ? sWidth : 0};
505505
},
506506
setScrollLeft: function(pos){
507507
if(this.horiz.scrollLeft!=pos)this.horiz.scrollLeft=pos;
508+
if(this.disableHoriz)this.enableZeroWidthBar(this.horiz,this.disableHoriz);
508509
},
509510
setScrollTop: function(pos){
510511
if(this.vert.scrollTop!=pos)this.vert.scrollTop=pos;
512+
if(this.disableVert)this.enableZeroWidthBar(this.vert,this.disableVert);
511513
},
512-
overlayHack: function(){
514+
zeroWidthHack: function(){
513515
varw=mac&&!mac_geMountainLion ? "12px" : "18px";
514-
this.horiz.style.minHeight=this.vert.style.minWidth=w;
515-
varself=this;
516-
varbarMouseDown=function(e){
517-
if(e_target(e)!=self.vert&&e_target(e)!=self.horiz)
518-
operation(self.cm,onMouseDown)(e);
519-
};
520-
on(this.vert,"mousedown",barMouseDown);
521-
on(this.horiz,"mousedown",barMouseDown);
516+
this.horiz.style.height=this.vert.style.width=w;
517+
this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";
518+
this.disableHoriz=newDelayed;
519+
this.disableVert=newDelayed;
520+
},
521+
enableZeroWidthBar: function(bar,delay){
522+
bar.style.pointerEvents="auto";
523+
functionmaybeDisable(){
524+
// To find out whether the scrollbar is still visible, we
525+
// check whether the element under the pixel in the bottom
526+
// left corner of the scrollbar box is the scrollbar box
527+
// itself (when the bar is still visible) or its filler child
528+
// (when the bar is hidden). If it is still visible, we keep
529+
// it enabled, if it's hidden, we disable pointer events.
530+
varbox=bar.getBoundingClientRect();
531+
varelt=document.elementFromPoint(box.left+1,box.bottom-1);
532+
if(elt!=bar)bar.style.pointerEvents="none";
533+
elsedelay.set(1000,maybeDisable);
534+
}
535+
delay.set(1000,maybeDisable);
522536
},
523537
clear: function(){
524538
varparent=this.horiz.parentNode;
@@ -3144,7 +3158,8 @@
31443158

31453159
if(cm.state.focused&&op.updateInput)
31463160
cm.display.input.reset(op.typing);
3147-
if(op.focus&&op.focus==activeElt())ensureFocus(op.cm);
3161+
if(op.focus&&op.focus==activeElt()&&(!document.hasFocus||document.hasFocus()))
3162+
ensureFocus(op.cm);
31483163
}
31493164

31503165
functionendOperation_finish(op){
@@ -3829,7 +3844,7 @@
38293844

38303845
// Determines whether an event happened in the gutter, and fires the
38313846
// handlers for the corresponding event.
3832-
functiongutterEvent(cm,e,type,prevent,signalfn){
3847+
functiongutterEvent(cm,e,type,prevent){
38333848
try{varmX=e.clientX,mY=e.clientY;}
38343849
catch(e){returnfalse;}
38353850
if(mX>=Math.floor(cm.display.gutters.getBoundingClientRect().right))returnfalse;
@@ -3846,14 +3861,14 @@
38463861
if(g&&g.getBoundingClientRect().right>=mX){
38473862
varline=lineAtHeight(cm.doc,mY);
38483863
vargutter=cm.options.gutters[i];
3849-
signalfn(cm,type,cm,line,gutter,e);
3864+
signal(cm,type,cm,line,gutter,e);
38503865
returne_defaultPrevented(e);
38513866
}
38523867
}
38533868
}
38543869

38553870
functionclickInGutter(cm,e){
3856-
returngutterEvent(cm,e,"gutterClick",true,signalLater);
3871+
returngutterEvent(cm,e,"gutterClick",true);
38573872
}
38583873

38593874
// Kludge to work around strange IE behavior where it'll sometimes
@@ -4292,7 +4307,7 @@
42924307

42934308
functioncontextMenuInGutter(cm,e){
42944309
if(!hasHandler(cm,"gutterContextMenu"))returnfalse;
4295-
returngutterEvent(cm,e,"gutterContextMenu",false,signal);
4310+
returngutterEvent(cm,e,"gutterContextMenu",false);
42964311
}
42974312

42984313
// UPDATING
@@ -7125,7 +7140,7 @@
71257140
spanEndStyle="";
71267141
}
71277142
if(m.className)spanStyle+=" "+m.className;
7128-
if(m.css)css=m.css;
7143+
if(m.css)css=(css ? css+";" : "")+m.css;
71297144
if(m.startStyle&&sp.from==pos)spanStartStyle+=" "+m.startStyle;
71307145
if(m.endStyle&&sp.to==nextChange)spanEndStyle+=" "+m.endStyle;
71317146
if(m.title&&!title)title=m.title;
@@ -7394,6 +7409,7 @@
73947409
this.id=++nextDocId;
73957410
this.modeOption=mode;
73967411
this.lineSep=lineSep;
7412+
this.extend=false;
73977413

73987414
if(typeoftext=="string")text=this.splitLines(text);
73997415
updateDoc(this,{from: start,to: start,text: text});
@@ -8901,7 +8917,7 @@
89018917

89028918
// THE END
89038919

8904-
CodeMirror.version="5.8.0";
8920+
CodeMirror.version="5.9.0";
89058921

89068922
returnCodeMirror;
89078923
});
@@ -8938,8 +8954,8 @@ var CodeMirror = React.createClass({
89388954
this.codeMirror.on('change',this.codemirrorValueChanged);
89398955
this.codeMirror.on('focus',this.focusChanged.bind(this,true));
89408956
this.codeMirror.on('blur',this.focusChanged.bind(this,false));
8941-
this._currentCodemirrorValue=this.props.value;
8942-
this.codeMirror.setValue(this.props.value);
8957+
this._currentCodemirrorValue=this.props.defaultValue||this.props.value||'';
8958+
this.codeMirror.setValue(this._currentCodemirrorValue);
89438959
},
89448960

89458961
componentWillUnmount: functioncomponentWillUnmount(){
@@ -8950,7 +8966,7 @@ var CodeMirror = React.createClass({
89508966
},
89518967

89528968
componentWillReceiveProps: functioncomponentWillReceiveProps(nextProps){
8953-
if(this.codeMirror&&this._currentCodemirrorValue!==nextProps.value){
8969+
if(this.codeMirror&&nextProps.value!==undefined&&this._currentCodemirrorValue!==nextProps.value){
89548970
this.codeMirror.setValue(nextProps.value);
89558971
}
89568972
if(typeofnextProps.options==='object'){

0 commit comments

Comments
(0)