question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[sideToolbarPlugin] : 'Cannot read property 'getBoundingClientRect' of undefined'

See original GitHub issue

i 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
iamawwsomecommented, Jan 29, 2018

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

1reaction
juliankrispelcommented, Mar 29, 2018

try version the latest version of the plugins please - it’s now fixed

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found