[sideToolbarPlugin] : 'Cannot read property 'getBoundingClientRect' of undefined'
See original GitHub issuei am constantly getting this error and the side toolbar is also not showing up -
import React, { Component } from 'react'
import Editor, { createEditorStateWithText } from 'draft-js-plugins-editor'
import createSideToolbarPlugin from 'draft-js-side-toolbar-plugin'
import 'draft-js-side-toolbar-plugin/lib/plugin.css'
const sideToolbarPlugin = createSideToolbarPlugin()
const { SideToolbar } = sideToolbarPlugin
const plugins = [sideToolbarPlugin]
const text = 'Write Something ...'
class Creator extends Component {
state = {
editorState: createEditorStateWithText(text)
}
onChange = (editorState) => {
this.setState({
editorState
})
}
focus = () => {
this.main.focus()
}
render() {
console.log(this.state)
return (
<div style={{ marginTop: 20, minHeight: '300px' }} onClick={this.focus}>
<div>
<Editor
editorState={this.state.editorState}
onChange={this.onChange}
plugins={plugins}
ref={(element) => { this.main = element}}
/>
<SideToolbar/>
</div>
</div>
)
}
}
export default Creator
"draft-js": "^0.10.5", "draft-js-plugins-editor": "^2.0.4", "draft-js-side-toolbar-plugin": "^2.0.1",
error -
TypeError: Cannot read property 'getBoundingClientRect' of undefined
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Cannot read property 'getBoundingClientRect' of undefined ...
Nevertheless, I cannot find a solution to this problem. Error. Uncaught TypeError: Cannot read property 'getBoundingClientRect' of undefined.
Read more >TypeError: Cannot read property 'getBoundingClientRect' of null
Description of the problem: Cannot type anything in the text box on Pavlovia but works perfectly fine in desktop Error message: TypeError: Cannot...
Read more >TypeError Cannot read property 'getBoundingClientRect' of ...
It's due to Pendo not doing a null check in the code. Is it possible to include a null check so we can...
Read more >Error: Uncaught TypeError: Cannot read property ... - Odoo
Uncaught TypeError : Cannot read property 'getBoundingClientRect' of undefined http://ubuntu:8069/web/content/929-81684fc/\web\.assets_common\.js\:4741\\
Read more >TypeError: Cannot read property 'getBoundingClientRect' of ...
Forum Thread - TypeError: Cannot read property 'getBoundingClientRect' of undefined). Please referesh your page and try again.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue.
Try downgrading your draft-js to 0.10.1. That’s how I got the draft-js-side-toolbar-plugin to work.
npm install draft-js@0.10.1 --save
try version the latest version of the plugins please - it’s now fixed