I'm trying to add react-rte to my project, but I can't make it work.
I'm using preact, and I'm trying to add a single component in my story book called RichText:
I copied the demo example and keep only what I need.
It looks like this:
import React, { Component } from 'react';
import RichTextEditor, { createEmptyValue } from 'react-rte';
import autobind from 'class-autobind';
export default class RichText extends Component {
constructor() {
super(...arguments);
autobind(this);
this.state = {
value: createEmptyValue(),
readOnly: false,
};
}
render() {
let { value } = this.state;
return (
<div className="editor-demo">
<div className="row">
<RichTextEditor
value={value}
onChange={this._onChange}
className="react-rte-demo"
placeholder="Tell a story"
toolbarClassName="demo-toolbar"
editorClassName="demo-editor"
readOnly={this.state.readOnly}
/>
</div>
<div className="row">
<textarea
className="source"
placeholder="Editor Source"
value={value.toString('html')}
onChange={this._onChangeSource}
/>
</div>
</div>
);
}
_onChange(value) {
this.setState({ value });
}
_onChangeSource(event) {
let source = event.target.value;
let oldValue = this.state.value;
this.setState({
value: oldValue.setContentFromString(source, 'html'),
});
}
}
Can't make it work, the issue is something like : "Cannot create property 'current' on string 'editor'"
Hello,
I'm trying to add react-rte to my project, but I can't make it work. I'm using preact, and I'm trying to add a single component in my story book called RichText:
I copied the demo example and keep only what I need. It looks like this:
Can't make it work, the issue is something like : "Cannot create property 'current' on string 'editor'"
Please help