add buttons
This commit is contained in:
@@ -18,7 +18,6 @@ module.exports = function (api) {
|
|||||||
.test(/\.jsx?$/)
|
.test(/\.jsx?$/)
|
||||||
.use()
|
.use()
|
||||||
.loader('babel-loader')
|
.loader('babel-loader')
|
||||||
// .options({ appendTsSuffixTo: [/\.vue$/] })
|
|
||||||
|
|
||||||
globby.sync('./packages/*', { onlyDirectories: true })
|
globby.sync('./packages/*', { onlyDirectories: true })
|
||||||
.map(name => name.replace('./packages/', ''))
|
.map(name => name.replace('./packages/', ''))
|
||||||
|
|||||||
@@ -11,14 +11,28 @@ export default class TestComponent extends Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.editor = new Editor({
|
this.editor = new Editor({
|
||||||
element: this.editorNode.current,
|
element: this.editorNode.current,
|
||||||
content: '<p>this is rendered in react</p>',
|
content: '<p>rendered in <strong>react</strong></p>',
|
||||||
extensions: extensions(),
|
extensions: extensions(),
|
||||||
})
|
})
|
||||||
|
this.forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<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 ref={this.editorNode} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user