Cannot read property 'body' of undefined
See original GitHub issueSometimes exception occurs in
getBody: function() { return this.bodyElement || this.getDoc().body; }
getDoc
returns undefined.
getDoc
should return .document for iframe. But sometimes iframe is not created.
iframe is created by the following method:
/**
* Initializes the editor this will be called automatically when all plugins/themes and language packs are loaded by the rendered method.
This method will setup the iframe and create the theme and plugin instances.
*
* @method init
*/
init: function() {
So I think getBody is called before all plugins are loaded.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:30 (6 by maintainers)
Top Results From Across the Web
Cannot read property 'body' of undefined after POST (MEAN ...
TypeError : Cannot read property 'body' of undefined after POST (MEAN) you will get this error when your localhost ip is changed or...
Read more >Cannot read property 'body' of undefined · Issue #7562 - GitHub
This happened for me when the page redirected and there technically was no response. Chrome gets rid of response data when the page ......
Read more >Cannot read property 'body' of undefined (Example) - Treehouse
Cannot read property 'body' of undefined. I've reviewed the video multiple times and I'm not seeing my error. Can anyone help?
Read more >Cannot read property req body undefined in express - YouTube
codercrab #express # body -parserCannot read property req body undefined in express ||Express req body is undefined for post requests.
Read more >[Solved] Cannot read Properties of Undefined in JavaScript
The "Cannot read properties of undefined" error occurs when you try to access a property or a method on a variable that stores...
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 Free
Top 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
The solution is simple for the getDoc() == undefined and for error with getBody. You need to modify angular ui directive in way like that:
function toggleDisable(disabled) { if (disabled) { ensureInstance(); if (tinyInstance) { tinyInstance.getBody().setAttribute('contenteditable', false); } } else { ensureInstance(); if (tinyInstance && !tinyInstance.settings.readonly && tinyInstance.getDoc()) { tinyInstance.getBody().setAttribute('contenteditable', true); } } }
So when you add additional check for getDoc then error is disapear at least for this was working for me to remove this error.Is anyone still having this problem?