From 227464a857773a0d3059b84bbca9c5e99057955d Mon Sep 17 00:00:00 2001 From: Omar Shariff Date: Wed, 23 Nov 2016 15:32:15 +0800 Subject: [PATCH 1/2] Adds node_modules to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 57510a2..bbc0c0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ _site/ +/node_modules From 4ce94015a0ab965a986d8b094aa1d8ac5e12670b Mon Sep 17 00:00:00 2001 From: Omar Shariff Date: Wed, 23 Nov 2016 15:34:03 +0800 Subject: [PATCH 2/2] Converts jsx to vanilla to allow compilation with brunch --- lib/diffDecorator.js | 25 +++++++++++++++++++------ lib/diffEditor.js | 42 ++++++++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/lib/diffDecorator.js b/lib/diffDecorator.js index 87ba755..cff1d6c 100644 --- a/lib/diffDecorator.js +++ b/lib/diffDecorator.js @@ -23,17 +23,30 @@ function diffDecorator(strategies) { } // Decorators +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; -var InsertSpan = function (props) { - return {props.children}; +var InsertSpan = function InsertSpan(props) { + return React.createElement( + "span", + _extends({}, props, { className: "diff-insert" }), + props.children + ); }; -var EqualSpan = function (props) { - return {props.children}; +var EqualSpan = function EqualSpan(props) { + return React.createElement( + "span", + _extends({}, props, { className: "diff-equal" }), + props.children + ); }; -var DeleteSpan = function (props) { - return {props.children}; +var DeleteSpan = function DeleteSpan(props) { + return React.createElement( + "span", + _extends({}, props, { className: "diff-delete" }), + props.children + ); }; module.exports = diffDecorator; diff --git a/lib/diffEditor.js b/lib/diffEditor.js index ef60a8d..f54adf7 100644 --- a/lib/diffEditor.js +++ b/lib/diffEditor.js @@ -149,30 +149,36 @@ var DiffEditor = React.createClass({ render: function () { var before; if (!this.props.before.hidden) { - before =
- -
; + before = React.createElement( + 'div', + { className: 'diff-before' }, + React.createElement(Draft.Editor, { + readOnly: this.props.before.readOnly, + editorState: this.state.beforeState, + onChange: this.onBeforeChange + }) + ); } var after; if (!this.props.after.hidden) { - after =
- -
; + after = React.createElement( + 'div', + { className: 'diff-after' }, + React.createElement(Draft.Editor, { + readOnly: this.props.after.readOnly, + editorState: this.state.afterState, + onChange: this.onAfterChange + }) + ); } - return
- {before} - {after} -
; + return React.createElement( + 'div', + { className: 'diff-editor' }, + before, + after + ); } });