11( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . Codemirror = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
2+ /*!
3+ Copyright (c) 2015 Jed Watson.
4+ Licensed under the MIT License (MIT), see
5+ http://jedwatson.github.io/classnames
6+ */
7+ /* global define */
8+
9+ ( function ( ) {
10+ 'use strict' ;
11+
12+ var hasOwn = { } . hasOwnProperty ;
13+
14+ function classNames ( ) {
15+ var classes = '' ;
16+
17+ for ( var i = 0 ; i < arguments . length ; i ++ ) {
18+ var arg = arguments [ i ] ;
19+ if ( ! arg ) continue ;
20+
21+ var argType = typeof arg ;
22+
23+ if ( argType === 'string' || argType === 'number' ) {
24+ classes += ' ' + arg ;
25+ } else if ( Array . isArray ( arg ) ) {
26+ classes += ' ' + classNames . apply ( null , arg ) ;
27+ } else if ( argType === 'object' ) {
28+ for ( var key in arg ) {
29+ if ( hasOwn . call ( arg , key ) && arg [ key ] ) {
30+ classes += ' ' + key ;
31+ }
32+ }
33+ }
34+ }
35+
36+ return classes . substr ( 1 ) ;
37+ }
38+
39+ if ( typeof module !== 'undefined' && module . exports ) {
40+ module . exports = classNames ;
41+ } else if ( typeof define === 'function' && typeof define . amd === 'object' && define . amd ) {
42+ // register as 'classnames', consistent with npm package name
43+ define ( 'classnames' , function ( ) {
44+ return classNames ;
45+ } ) ;
46+ } else {
47+ window . classNames = classNames ;
48+ }
49+ } ( ) ) ;
50+
51+ } , { } ] , 2 :[ function ( require , module , exports ) {
252// CodeMirror, copyright (c) by Marijn Haverbeke and others
353// Distributed under an MIT license: http://codemirror.net/LICENSE
454
88568906return CodeMirror ;
88578907} ) ;
88588908
8859- } , { } ] , 2 :[ function ( require , module , exports ) {
8909+ } , { } ] , 3 :[ function ( require , module , exports ) {
88608910( function ( global ) {
88618911'use strict' ;
88628912
88638913var CM = require ( 'codemirror' ) ;
88648914var React = ( typeof window !== "undefined" ? window [ 'React' ] : typeof global !== "undefined" ? global [ 'React' ] : null ) ;
8915+ var className = require ( 'classnames' ) ;
88658916
88668917var CodeMirror = React . createClass ( {
88678918displayName : 'CodeMirror' ,
@@ -8871,7 +8922,8 @@ var CodeMirror = React.createClass({
88718922onFocusChange : React . PropTypes . func ,
88728923options : React . PropTypes . object ,
88738924path : React . PropTypes . string ,
8874- value : React . PropTypes . string
8925+ value : React . PropTypes . string ,
8926+ className : React . PropTypes . any
88758927} ,
88768928
88778929getInitialState : function getInitialState ( ) {
@@ -8881,7 +8933,7 @@ var CodeMirror = React.createClass({
88818933} ,
88828934
88838935componentDidMount : function componentDidMount ( ) {
8884- var textareaNode = React . findDOMNode ( this . refs . textarea ) ;
8936+ var textareaNode = this . refs . textarea ;
88858937this . codeMirror = CM . fromTextArea ( textareaNode , this . props . options ) ;
88868938this . codeMirror . on ( 'change' , this . codemirrorValueChanged ) ;
88878939this . codeMirror . on ( 'focus' , this . focusChanged . bind ( this , true ) ) ;
@@ -8934,13 +8986,14 @@ var CodeMirror = React.createClass({
89348986} ,
89358987
89368988render : function render ( ) {
8937- var className = 'ReactCodeMirror' ;
8989+ var editorClassName = className ( 'ReactCodeMirror' , this . props . className ) ;
8990+
89388991if ( this . state . isFocused ) {
89398992className += ' ReactCodeMirror--focused' ;
89408993}
89418994return React . createElement (
89428995'div' ,
8943- { className : className } ,
8996+ { className : editorClassName } ,
89448997React . createElement ( 'textarea' , { ref : 'textarea' , name : this . props . path , defaultValue : '' , autoComplete : 'off' } )
89458998) ;
89468999}
@@ -8950,5 +9003,5 @@ var CodeMirror = React.createClass({
89509003module . exports = CodeMirror ;
89519004
89529005} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
8953- } , { "codemirror " :1 } ] } , { } , [ 2 ] ) ( 2 )
9006+ } , { "classnames " :1 , "codemirror" : 2 } ] } , { } , [ 3 ] ) ( 3 )
89549007} ) ;
0 commit comments