diff --git a/client/coral-admin/src/routes/Configure/components/StreamSettings.js b/client/coral-admin/src/routes/Configure/components/StreamSettings.js index 1bd7534af..9c216a853 100644 --- a/client/coral-admin/src/routes/Configure/components/StreamSettings.js +++ b/client/coral-admin/src/routes/Configure/components/StreamSettings.js @@ -4,7 +4,7 @@ import t from 'coral-framework/services/i18n'; import styles from './Configure.css'; import {Checkbox, Textfield} from 'react-mdl'; import {Card, Icon, TextArea} from 'coral-ui'; -import MarkdownEditor from 'coral-admin/src/components/MarkdownEditor'; +import MarkdownEditor from 'coral-framework/components/MarkdownEditor'; const TIMESTAMPS = { weeks: 60 * 60 * 24 * 7, diff --git a/client/coral-configure/components/Markdown.js b/client/coral-configure/components/Markdown.js new file mode 100644 index 000000000..482467987 --- /dev/null +++ b/client/coral-configure/components/Markdown.js @@ -0,0 +1,23 @@ +import React, {PureComponent, PropTypes} from 'react'; +import marked from 'marked'; + +const renderer = new marked.Renderer(); + +// Set link target to `_parent` to work properly in an embed. +renderer.link = (href, title, text) => + `${text}`; + +marked.setOptions({renderer}); + +export default class Markdown extends PureComponent { + render() { + const {content, ...rest} = this.props; + const __html = marked(content); + return
; + } +} + +Markdown.propTypes = { + content: PropTypes.string, +}; + diff --git a/client/coral-configure/components/QuestionBoxBuilder.js b/client/coral-configure/components/QuestionBoxBuilder.js index 17d33beb6..ca19c0e7b 100644 --- a/client/coral-configure/components/QuestionBoxBuilder.js +++ b/client/coral-configure/components/QuestionBoxBuilder.js @@ -1,9 +1,10 @@ import React from 'react'; import QuestionBox from 'talk-plugin-questionbox/QuestionBox'; -import {Icon, TextField} from 'coral-ui'; +import {Icon} from 'coral-ui'; import DefaultIcon from './DefaultIcon'; import cn from 'classnames'; import styles from './QuestionBoxBuilder.css'; +import MarkdownEditor from 'coral-framework/components/MarkdownEditor'; class QuestionBoxBuilder extends React.Component { render() { @@ -57,14 +58,12 @@ class QuestionBoxBuilder extends React.Component { icon={questionBoxIcon} content={questionBoxContent} /> - - handleChange({}, {questionBoxContent: value})} /> +
); } diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js index 59e81e8c5..a5d6cf8aa 100644 --- a/client/coral-configure/containers/ConfigureStreamContainer.js +++ b/client/coral-configure/containers/ConfigureStreamContainer.js @@ -53,15 +53,16 @@ class ConfigureStreamContainer extends Component { } } - handleChange (e) { - const changes = {}; + handleChange (e, newChanges) { + let changes = {}; + + if (changes) { + changes = {...newChanges}; + } if (e.target && e.target.id === 'qboxenable') { changes.questionBoxEnable = e.target.checked; } - if (e.target && e.target.id === 'qboxcontent') { - changes.questionBoxContent = e.target.value; - } if (e.currentTarget && e.currentTarget.id === 'qboxicon') { changes.questionBoxIcon = e.currentTarget.dataset.icon; } @@ -69,6 +70,8 @@ class ConfigureStreamContainer extends Component { changes.premodLinksEnable = e.target.value; } + console.log(changes) + this.setState({ changed: true, dirtySettings: { diff --git a/client/coral-admin/src/components/MarkdownEditor.css b/client/coral-framework/components/MarkdownEditor.css similarity index 100% rename from client/coral-admin/src/components/MarkdownEditor.css rename to client/coral-framework/components/MarkdownEditor.css diff --git a/client/coral-admin/src/components/MarkdownEditor.js b/client/coral-framework/components/MarkdownEditor.js similarity index 100% rename from client/coral-admin/src/components/MarkdownEditor.js rename to client/coral-framework/components/MarkdownEditor.js