diff --git a/bower.json b/bower.json index 1f801466..85708203 100644 --- a/bower.json +++ b/bower.json @@ -5,6 +5,7 @@ "fontawesome": "~4.3.0", "react-router": "~0.13.3", "reflux": "~0.2.8", - "moment": "~2.10.3" + "moment": "~2.10.3", + "markdown-it": "~4.3.1" } } diff --git a/browser/main/Components/BlueprintForm.jsx b/browser/main/Components/BlueprintForm.jsx index a054b61f..85307a8e 100644 --- a/browser/main/Components/BlueprintForm.jsx +++ b/browser/main/Components/BlueprintForm.jsx @@ -2,6 +2,7 @@ var React = require('react/addons') var ReactRouter = require('react-router') var CodeEditor = require('./CodeEditor') var Catalyst = require('../Mixins/Catalyst') +var Markdown = require('../Mixins/Markdown') var Select = require('react-select') var request = require('superagent') @@ -28,7 +29,11 @@ var getOptions = function (input, callback) { } var BlueprintForm = React.createClass({ - mixins: [Catalyst.LinkedStateMixin, ReactRouter.State], + mixins: [Catalyst.LinkedStateMixin, ReactRouter.State, Markdown], + statics: { + EDIT_MODE: 0, + PREVIEW_MODE: 1 + }, propTypes: { close: React.PropTypes.func }, @@ -38,7 +43,8 @@ var BlueprintForm = React.createClass({ title: '', content: '', Tags: [] - } + }, + mode: BlueprintForm.EDIT_MODE } }, componentDidMount: function () { @@ -54,19 +60,31 @@ var BlueprintForm = React.createClass({ blueprint.content = value this.setState({blueprint: blueprint}) }, + togglePreview: function () { + this.setState({mode: this.state.mode === BlueprintForm.EDIT_MODE ? BlueprintForm.PREVIEW_MODE : BlueprintForm.EDIT_MODE}) + }, submit: function () { console.log(this.state.blueprint) }, render: function () { + var content = this.state.mode === BlueprintForm.EDIT_MODE ? ( +
+ +
+ ) : ( +
+
Preview mode
+
+
+ ) + return (
-
- -
+ {content}