Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions src/components/group-add-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { addPost } from '../actions'

import inline from 'formula_one/src/css/inline.css'
import main from '../css/group-post-card.css'
import { Editor } from '@tinymce/tinymce-react'

class GroupAddPost extends React.Component {
constructor (props) {
Expand Down Expand Up @@ -52,6 +53,11 @@ class GroupAddPost extends React.Component {
[name]: value
})
}

handleEditorChange = (content) => {
this.setState({text: content.level.content})
}

handleClick = () => {
var formData = new FormData()
formData.append('group', this.props.activeGroup.data.id)
Expand Down Expand Up @@ -168,13 +174,25 @@ class GroupAddPost extends React.Component {
required
error={error && errorExist(message, 'text')}
>
<TextArea
autoHeight
rows={2}
onChange={this.handleChange}
name='text'
<Editor
apiKey="fb3pb0ana4mvi60jwhefs3g2u3501d9s915efud2rh6ax2ek"
onChange={this.handleEditorChange}
textareaName="text"
value={this.state.text}
placeholder='Write something here...'
initialValue="Write something here..."
init={{
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
toolbar:
'undo redo | formatselect | bold italic backcolor | \
alignleft aligncenter alignright alignjustify | \
bullist numlist outdent indent | removeformat | help'
}}

/>
</Form.Field>

Expand Down
17 changes: 16 additions & 1 deletion src/components/group-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { Tiles } from 'formula_one'
import { setGroupList } from '../actions'
import { urlGroupDetailView } from '../urls'

import { Editor } from '@tinymce/tinymce-react'


class GroupList extends React.PureComponent {
componentDidMount () {
this.props.SetGroupList()
Expand All @@ -21,7 +24,19 @@ class GroupList extends React.PureComponent {
tiles={groupList.data.map(group => {
return {
name: group.name,
desc: <span>{group.shortDescription}</span>,
desc: <Editor apikey="fb3pb0ana4mvi60jwhefs3g2u3501d9s915efud2rh6ax2ek" init={{
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
toolbar:
'undo redo | formatselect | bold italic backcolor | \
alignleft aligncenter alignright alignjustify | \
bullist numlist outdent indent | removeformat | help'
}}
disabled={true} inline={true} initialValue={group.shortDescription} />,
link: urlGroupDetailView(group.slug),
iconName: 'users',
imageUrl: group.logo
Expand Down
20 changes: 19 additions & 1 deletion src/components/group-post-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Card, Image, Icon, Dropdown, Modal, Button } from 'semantic-ui-react'
import { DefaultDP } from 'formula_one'
import { removePost } from '../actions'
import '../css/group-post-card.css'
import { Editor } from '@tinymce/tinymce-react'

class GroupPostCard extends React.Component {
constructor (props) {
Expand Down Expand Up @@ -106,7 +107,24 @@ class GroupPostCard extends React.Component {
</div>
</Card.Content>
<Card.Content>
<div styleName='post-card-description'>{post.text}</div>
<div styleName='post-card-description'>
<Editor apikey="fb3pb0ana4mvi60jwhefs3g2u3501d9s915efud2rh6ax2ek"
init={{
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
toolbar:
'undo redo | formatselect | bold italic backcolor | \
alignleft aligncenter alignright alignjustify | \
bullist numlist outdent indent | removeformat | help'
}}
disabled={true}
inline={true}
initialValue={post.text} />
</div>
{post.image && (
<div styleName='post-card-image-container'>
<Image
Expand Down
48 changes: 41 additions & 7 deletions src/components/purpose-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { getTheme } from 'formula_one'
import { changeActiveGroup } from '../actions'
import '../css/group.css'

import { Editor } from '@tinymce/tinymce-react'

class PurposeCard extends React.Component {
constructor (props) {
super(props)
Expand Down Expand Up @@ -75,6 +77,15 @@ class PurposeCard extends React.Component {
})
}

handleEditorChange = (content) => {
const { activeGroup, field } = this.props
const { data } = activeGroup

this.setState({[field]: content.level.content})

}


render () {
const { error, message, success } = this.state
const { activeGroup, heading, field } = this.props
Expand Down Expand Up @@ -133,18 +144,41 @@ class PurposeCard extends React.Component {
) && error
}
>
<TextArea
autoHeight
name={field}
value={this.state[field]}
onChange={this.handleChange}
/>

<Editor apikey="fb3pb0ana4mvi60jwhefs3g2u3501d9s915efud2rh6ax2ek"
init={{
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
}}
value={this.state[field]}
textareaName={field}
onChange={this.handleEditorChange}
/>
</Form.Field>
</Form>
<Dimmer active={inEditMode === field && !error} inverted />
</Dimmer.Dimmable>
) : (
data[field] || 'None'
<Editor apikey="fb3pb0ana4mvi60jwhefs3g2u3501d9s915efud2rh6ax2ek"
init={{
menubar: false,
plugins: [
'advlist autolink lists link image charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code help wordcount'
],
}}
value={data[field]}
textareaName={field}
inline={true}
disabled={true}
onChange={this.handleEditorChange}
/>
|| 'None'
)}
</Segment>
</React.Fragment>
Expand Down