Answer the question
In order to leave comments, you need to log in
How to connect Sirtrevor Editor?
Sir Trevor
import React, {PureComponent} from 'react';
import SirTrevor from 'sir-trevor';
const editor = new SirTrevor.Editor({
el: document.querySelector('.js-st-instance'),
defaultType: 'Text',
iconUrl: 'build/sir-trevor-icons.svg'
});
class Add extends PureComponent {
render() {
return (
<div>
<textarea class="js-st-instance"></textarea>
</div>
)
}
TypeError: Cannot read property 'nextSibling' of null
Answer the question
In order to leave comments, you need to log in
Try to hang initialization on the event after mounting the data in the DOM
...
componentDidMount() {
const { editorArea } = this.refs;
const editor = new SirTrevor.Editor({
el: editorArea,
defaultType: 'Text',
iconUrl: 'build/sir-trevor-icons.svg'
});
}
render() {
return (
<div>
<textarea className="js-st-instance" ref="editorArea"></textarea>
</div>
)
}
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question