add buttons

This commit is contained in:
Philipp Kühn
2020-04-16 20:50:20 +02:00
parent fa1c61ebbc
commit c11605bc55
2 changed files with 15 additions and 2 deletions

View File

@@ -18,7 +18,6 @@ module.exports = function (api) {
.test(/\.jsx?$/)
.use()
.loader('babel-loader')
// .options({ appendTsSuffixTo: [/\.vue$/] })
globby.sync('./packages/*', { onlyDirectories: true })
.map(name => name.replace('./packages/', ''))

View File

@@ -11,14 +11,28 @@ export default class TestComponent extends Component {
componentDidMount() {
this.editor = new Editor({
element: this.editorNode.current,
content: '<p>this is rendered in react</p>',
content: '<p>rendered in <strong>react</strong></p>',
extensions: extensions(),
})
this.forceUpdate()
}
render() {
return (
<div>
{this.editor &&
<div>
<button onClick={() => this.editor.focus().removeMarks()}>
clear formatting
</button>
<button
onClick={() => this.editor.focus().bold()}
className={`${this.editor.isActive('bold') ? 'is-active' : ''}`}
>
bold
</button>
</div>
}
<div ref={this.editorNode} />
</div>
)