Skip to content

Commit 5bf2a20

Browse files
committed
Build code
1 parent d01276f commit 5bf2a20

File tree

4 files changed

+72
-16
lines changed

4 files changed

+72
-16
lines changed

‎bower.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-codemirror",
3-
"version": "0.1.7",
3+
"version": "0.2.0",
44
"description": "React Codemirror",
55
"main": "dist/codemirror.min.js",
66
"homepage": "https://github.com/JedWatson/react-codemirror",

‎dist/react-codemirror.js‎

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,54 @@
11
(function(f){if(typeofexports==="object"&&typeofmodule!=="undefined"){module.exports=f()}elseif(typeofdefine==="function"&&define.amd){define([],f)}else{varg;if(typeofwindow!=="undefined"){g=window}elseif(typeofglobal!=="undefined"){g=global}elseif(typeofself!=="undefined"){g=self}else{g=this}g.Codemirror=f()}})(function(){vardefine,module,exports;return(functione(t,n,r){functions(o,u){if(!n[o]){if(!t[o]){vara=typeofrequire=="function"&&require;if(!u&&a)returna(o,!0);if(i)returni(o,!0);varf=newError("Cannot find module '"+o+"'");throwf.code="MODULE_NOT_FOUND",f}varl=n[o]={exports:{}};t[o][0].call(l.exports,function(e){varn=t[o][1][e];returns(n?n:e)},l,l.exports,e,t,n,r)}returnn[o].exports}vari=typeofrequire=="function"&&require;for(varo=0;o<r.length;o++)s(r[o]);returns})({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+
varhasOwn={}.hasOwnProperty;
13+
14+
functionclassNames(){
15+
varclasses='';
16+
17+
for(vari=0;i<arguments.length;i++){
18+
vararg=arguments[i];
19+
if(!arg)continue;
20+
21+
varargType=typeofarg;
22+
23+
if(argType==='string'||argType==='number'){
24+
classes+=' '+arg;
25+
}elseif(Array.isArray(arg)){
26+
classes+=' '+classNames.apply(null,arg);
27+
}elseif(argType==='object'){
28+
for(varkeyinarg){
29+
if(hasOwn.call(arg,key)&&arg[key]){
30+
classes+=' '+key;
31+
}
32+
}
33+
}
34+
}
35+
36+
returnclasses.substr(1);
37+
}
38+
39+
if(typeofmodule!=='undefined'&&module.exports){
40+
module.exports=classNames;
41+
}elseif(typeofdefine==='function'&&typeofdefine.amd==='object'&&define.amd){
42+
// register as 'classnames', consistent with npm package name
43+
define('classnames',function(){
44+
returnclassNames;
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

@@ -8856,12 +8906,13 @@
88568906
returnCodeMirror;
88578907
});
88588908

8859-
},{}],2:[function(require,module,exports){
8909+
},{}],3:[function(require,module,exports){
88608910
(function(global){
88618911
'use strict';
88628912

88638913
varCM=require('codemirror');
88648914
varReact=(typeofwindow!=="undefined" ? window['React'] : typeofglobal!=="undefined" ? global['React'] : null);
8915+
varclassName=require('classnames');
88658916

88668917
varCodeMirror=React.createClass({
88678918
displayName: 'CodeMirror',
@@ -8871,7 +8922,8 @@ var CodeMirror = React.createClass({
88718922
onFocusChange: React.PropTypes.func,
88728923
options: React.PropTypes.object,
88738924
path: React.PropTypes.string,
8874-
value: React.PropTypes.string
8925+
value: React.PropTypes.string,
8926+
className: React.PropTypes.any
88758927
},
88768928

88778929
getInitialState: functiongetInitialState(){
@@ -8881,7 +8933,7 @@ var CodeMirror = React.createClass({
88818933
},
88828934

88838935
componentDidMount: functioncomponentDidMount(){
8884-
vartextareaNode=React.findDOMNode(this.refs.textarea);
8936+
vartextareaNode=this.refs.textarea;
88858937
this.codeMirror=CM.fromTextArea(textareaNode,this.props.options);
88868938
this.codeMirror.on('change',this.codemirrorValueChanged);
88878939
this.codeMirror.on('focus',this.focusChanged.bind(this,true));
@@ -8934,13 +8986,14 @@ var CodeMirror = React.createClass({
89348986
},
89358987

89368988
render: functionrender(){
8937-
varclassName='ReactCodeMirror';
8989+
vareditorClassName=className('ReactCodeMirror',this.props.className);
8990+
89388991
if(this.state.isFocused){
89398992
className+=' ReactCodeMirror--focused';
89408993
}
89418994
returnReact.createElement(
89428995
'div',
8943-
{className: className},
8996+
{className: editorClassName},
89448997
React.createElement('textarea',{ref: 'textarea',name: this.props.path,defaultValue: '',autoComplete: 'off'})
89458998
);
89468999
}
@@ -8950,5 +9003,5 @@ var CodeMirror = React.createClass({
89509003
module.exports=CodeMirror;
89519004

89529005
}).call(this,typeofglobal!=="undefined" ? global : typeofself!=="undefined" ? self : typeofwindow!=="undefined" ? window : {})
8953-
},{"codemirror":1}]},{},[2])(2)
9006+
},{"classnames":1,"codemirror":2}]},{},[3])(3)
89549007
});

‎dist/react-codemirror.min.js‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/Codemirror.js‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
varCM=require('codemirror');
44
varReact=require('react');
5+
varclassName=require('classnames');
56

67
varCodeMirror=React.createClass({
78
displayName: 'CodeMirror',
@@ -11,7 +12,8 @@ var CodeMirror = React.createClass({
1112
onFocusChange: React.PropTypes.func,
1213
options: React.PropTypes.object,
1314
path: React.PropTypes.string,
14-
value: React.PropTypes.string
15+
value: React.PropTypes.string,
16+
className: React.PropTypes.any
1517
},
1618

1719
getInitialState: functiongetInitialState(){
@@ -21,7 +23,7 @@ var CodeMirror = React.createClass({
2123
},
2224

2325
componentDidMount: functioncomponentDidMount(){
24-
vartextareaNode=React.findDOMNode(this.refs.textarea);
26+
vartextareaNode=this.refs.textarea;
2527
this.codeMirror=CM.fromTextArea(textareaNode,this.props.options);
2628
this.codeMirror.on('change',this.codemirrorValueChanged);
2729
this.codeMirror.on('focus',this.focusChanged.bind(this,true));
@@ -74,13 +76,14 @@ var CodeMirror = React.createClass({
7476
},
7577

7678
render: functionrender(){
77-
varclassName='ReactCodeMirror';
79+
vareditorClassName=className('ReactCodeMirror',this.props.className);
80+
7881
if(this.state.isFocused){
7982
className+=' ReactCodeMirror--focused';
8083
}
8184
returnReact.createElement(
8285
'div',
83-
{className: className},
86+
{className: editorClassName},
8487
React.createElement('textarea',{ref: 'textarea',name: this.props.path,defaultValue: '',autoComplete: 'off'})
8588
);
8689
}

0 commit comments

Comments
(0)