Skip to content

Commit

Permalink
Build code
Browse files Browse the repository at this point in the history
  • Loading branch information
timnew committed Oct 21, 2015
1 parent d01276f commit 5bf2a20
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "react-codemirror",
"version": "0.1.7",
"version": "0.2.0",
"description": "React Codemirror",
"main": "dist/codemirror.min.js",
"homepage": "https://github.com/JedWatson/react-codemirror",
Expand Down
65 changes: 59 additions & 6 deletions dist/react-codemirror.js
@@ -1,4 +1,54 @@
(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){
/*!
Copyright (c) 2015 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */

(function () {
'use strict';

var hasOwn = {}.hasOwnProperty;

function classNames () {
var classes = '';

for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;

var argType = typeof arg;

if (argType === 'string' || argType === 'number') {
classes += ' ' + arg;
} else if (Array.isArray(arg)) {
classes += ' ' + classNames.apply(null, arg);
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes += ' ' + key;
}
}
}
}

return classes.substr(1);
}

if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// register as 'classnames', consistent with npm package name
define('classnames', function () {
return classNames;
});
} else {
window.classNames = classNames;
}
}());

},{}],2:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

Expand Down Expand Up @@ -8856,12 +8906,13 @@
return CodeMirror;
});

},{}],2:[function(require,module,exports){
},{}],3:[function(require,module,exports){
(function (global){
'use strict';

var CM = require('codemirror');
var React = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
var className = require('classnames');

var CodeMirror = React.createClass({
displayName: 'CodeMirror',
Expand All @@ -8871,7 +8922,8 @@ var CodeMirror = React.createClass({
onFocusChange: React.PropTypes.func,
options: React.PropTypes.object,
path: React.PropTypes.string,
value: React.PropTypes.string
value: React.PropTypes.string,
className: React.PropTypes.any
},

getInitialState: function getInitialState() {
Expand All @@ -8881,7 +8933,7 @@ var CodeMirror = React.createClass({
},

componentDidMount: function componentDidMount() {
var textareaNode = React.findDOMNode(this.refs.textarea);
var textareaNode = this.refs.textarea;
this.codeMirror = CM.fromTextArea(textareaNode, this.props.options);
this.codeMirror.on('change', this.codemirrorValueChanged);
this.codeMirror.on('focus', this.focusChanged.bind(this, true));
Expand Down Expand Up @@ -8934,13 +8986,14 @@ var CodeMirror = React.createClass({
},

render: function render() {
var className = 'ReactCodeMirror';
var editorClassName = className('ReactCodeMirror', this.props.className);

if (this.state.isFocused) {
className += ' ReactCodeMirror--focused';
}
return React.createElement(
'div',
{ className: className },
{ className: editorClassName },
React.createElement('textarea', { ref: 'textarea', name: this.props.path, defaultValue: '', autoComplete: 'off' })
);
}
Expand All @@ -8950,5 +9003,5 @@ var CodeMirror = React.createClass({
module.exports = CodeMirror;

}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"codemirror":1}]},{},[2])(2)
},{"classnames":1,"codemirror":2}]},{},[3])(3)
});
10 changes: 5 additions & 5 deletions dist/react-codemirror.min.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions lib/Codemirror.js
Expand Up @@ -2,6 +2,7 @@

var CM = require('codemirror');
var React = require('react');
var className = require('classnames');

var CodeMirror = React.createClass({
displayName: 'CodeMirror',
Expand All @@ -11,7 +12,8 @@ var CodeMirror = React.createClass({
onFocusChange: React.PropTypes.func,
options: React.PropTypes.object,
path: React.PropTypes.string,
value: React.PropTypes.string
value: React.PropTypes.string,
className: React.PropTypes.any
},

getInitialState: function getInitialState() {
Expand All @@ -21,7 +23,7 @@ var CodeMirror = React.createClass({
},

componentDidMount: function componentDidMount() {
var textareaNode = React.findDOMNode(this.refs.textarea);
var textareaNode = this.refs.textarea;
this.codeMirror = CM.fromTextArea(textareaNode, this.props.options);
this.codeMirror.on('change', this.codemirrorValueChanged);
this.codeMirror.on('focus', this.focusChanged.bind(this, true));
Expand Down Expand Up @@ -74,13 +76,14 @@ var CodeMirror = React.createClass({
},

render: function render() {
var className = 'ReactCodeMirror';
var editorClassName = className('ReactCodeMirror', this.props.className);

if (this.state.isFocused) {
className += ' ReactCodeMirror--focused';
}
return React.createElement(
'div',
{ className: className },
{ className: editorClassName },
React.createElement('textarea', { ref: 'textarea', name: this.props.path, defaultValue: '', autoComplete: 'off' })
);
}
Expand Down

0 comments on commit 5bf2a20

Please sign in to comment.