import React, { Component } from 'react';
import { Map } from 'immutable';
import Editor, { createEditorStateWithText } from 'draft-js-plugins-editor'; // eslint-disable-line import/no-unresolved
import createHashtagPlugin from 'draft-js-hashtag-plugin'; // eslint-disable-line import/no-unresolved
import editorStyles from './editorStyles.css';
import hashtagStyles from './hashtagStyles.css';

const theme = Map({
  hashtag: hashtagStyles.hashtag,
});
const hashtagPlugin = createHashtagPlugin({ theme });
const plugins = [hashtagPlugin];
const text = 'In this editor, we can even apply our own styles … #design #theme';

export default class CustomHashtagEditor extends Component {

  state = {
    editorState: createEditorStateWithText(text),
  };

  onChange = (editorState) => {
    this.setState({
      editorState,
    });
  };

  focus = () => {
    this.editor.focus();
  };

  render() {
    return (
      <div className={editorStyles.editor} onClick={this.focus}>
        <Editor
          editorState={this.state.editorState}
          onChange={this.onChange}
          plugins={plugins}
          ref={(element) => { this.editor = element; }}
        />
      </div>
    );
  }
}

@@ -39,41 +39,8 @@
 t';%0A
-import %7B Map %7D from 'immutable';%0A
 impo
@@ -360,66 +360,8 @@
 ';%0A%0A
-const theme = Map(%7B%0A  hashtag: hashtagStyles.hashtag,%0A%7D);%0A
 cons
@@ -405,16 +405,31 @@
 (%7B theme
+: hashtagStyles
  %7D);%0Acon

Fix custom hashtag example