You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
disabling formgroup with tinymce in material tab gives 'node cannot be null or undefined' bug. #167
What is the current behavior?
I am using my tinymce editor with form-group reactive forms. As per the standard functional flow in my component there is a global Redux state for progress bar with boolean value which gets set in HTTP interceptor accordingly. I subscribe to it and disable the form group when progress bar (means API call is in progress) is true and enable it when set to false. This piece of functionality have created subtle multiple bugs in my component. Getting 'node cannot be null or undefined' error, form-group with tinymce getting dirty automatically when changing tab, other form fields in form-group also not getting disabled in UI.
What is the expected behavior?
Expected behavior was to disable a whole formgroup without any repercussions.
Which versions of TinyMCE/TinyMCE-Angular, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or TinyMCE-Angular?
I am using version "@tinymce/tinymce-angular": "^3.5.0" and "tinymce": "^5.2.0"
core.js:15724 ERROR Error: Node cannot be null or undefined at Object.ot [as fromDom] (tinymce.min.js:9) at cE (tinymce.min.js:9) at mE (tinymce.min.js:9) at tinymce.min.js:9 at FE.set [as setMode] (tinymce.min.js:9) at EditorComponent.push../node_modules/@tinymce/tinymce-angular/fesm5/tinymce-tinymce-angular.js.EditorComponent.setDisabledState (tinymce-tinymce-angular.js:559) at forms.js:2062 at forms.js:2831 at Array.forEach (<anonymous>) at FormControl.push../node_modules/@angular/forms/fesm5/forms.js.AbstractControl.disable (forms.js:2831)
this is the exception I get every time and seems to be primary reason for all the above bugs. Due to this the else code block in _disableFormsDuringProgress() doesn't run hence not enabling the form again. Sometimes the values are also not stored correctly in payload as the form is disabled. It makes the data corrupted which causes further bugs as form getting dirty automatically. I tried to initialize the tinymce config in component too rather then in html to have kind of full control in a single place but then it gives pah error as 'tinymce/silves/theme.js' cant found. I think docs should also be updated regarding it.
I don't think I'm following correctly on the issue. So the problem is not disabling the component but changing tabs?
Could you provide a small replication case to better understand the issue? I don't see any issues with your editor configuration and enabling/disabling the editor as a form component seems to be working normally. If you can create one replication case in a code sandbox I could take a look into it.
https://codesandbox.io/s/elastic-poitras-j8vu2, To reproduce change the tab at least once and click the button u will note the error . Well I am pretty sure what the problem is. Changing tab destroys the editor instance. If we re enter the tab with editor the init event generates again with new editor ID which means new editor instance. so when forms get disable, the model form control is bonded with destroyed instance of editor due to which throws error of 'node cannot be null or undefined'. @jscasca
changed the title [-]disabling formgroup with tinymce in it creates multiple bugs[/-][+]disabling formgroup with tinymce in material tab gives 'node cannot be null or undefined' bug.[/+]on Jun 3, 2020
@nischi the workaround I have implemented is to separate template and TS code and then manually update form control values with help of editor built in events. Here is the code
template
<div [hidden]="editorLoaded === false">
<editor [disabled]="(progressBar$ | async)" [init]="defaultConfig"></editor>
<mat-error *ngIf="emailForm.controls.inputEditor.invalid">
Please enter email body without any script tag.
</mat-error>
</div>
Hello I am using "@tinymce/tinymce-angular": "^7.0.0" and I have this issue too, ERROR Error: Uncaught (in promise): Error: Node cannot be null or undefined
Activity
airasyaqub commentedon Jun 2, 2020
core.js:15724 ERROR Error: Node cannot be null or undefined at Object.ot [as fromDom] (tinymce.min.js:9) at cE (tinymce.min.js:9) at mE (tinymce.min.js:9) at tinymce.min.js:9 at FE.set [as setMode] (tinymce.min.js:9) at EditorComponent.push../node_modules/@tinymce/tinymce-angular/fesm5/tinymce-tinymce-angular.js.EditorComponent.setDisabledState (tinymce-tinymce-angular.js:559) at forms.js:2062 at forms.js:2831 at Array.forEach (<anonymous>) at FormControl.push../node_modules/@angular/forms/fesm5/forms.js.AbstractControl.disable (forms.js:2831)this is the exception I get every time and seems to be primary reason for all the above bugs. Due to this the else code block in _disableFormsDuringProgress() doesn't run hence not enabling the form again. Sometimes the values are also not stored correctly in payload as the form is disabled. It makes the data corrupted which causes further bugs as form getting dirty automatically. I tried to initialize the tinymce config in component too rather then in html to have kind of full control in a single place but then it gives pah error as 'tinymce/silves/theme.js' cant found. I think docs should also be updated regarding it.
@jscasca kindly can u please help me out with it.
jscasca commentedon Jun 3, 2020
Hi @airasyaqub
I don't think I'm following correctly on the issue. So the problem is not disabling the component but changing tabs?
Could you provide a small replication case to better understand the issue? I don't see any issues with your editor configuration and enabling/disabling the editor as a form component seems to be working normally. If you can create one replication case in a code sandbox I could take a look into it.
airasyaqub commentedon Jun 3, 2020
https://codesandbox.io/s/elastic-poitras-j8vu2, To reproduce change the tab at least once and click the button u will note the error . Well I am pretty sure what the problem is. Changing tab destroys the editor instance. If we re enter the tab with editor the init event generates again with new editor ID which means new editor instance. so when forms get disable, the model form control is bonded with destroyed instance of editor due to which throws error of 'node cannot be null or undefined'. @jscasca
[-]disabling formgroup with tinymce in it creates multiple bugs[/-][+]disabling formgroup with tinymce in material tab gives 'node cannot be null or undefined' bug.[/+]airasyaqub commentedon Jun 12, 2020
@jscasca have u looked into it ?
jscasca commentedon Jun 24, 2020
We are still working on how to fix this issue. Sorry it's taking so long
nischi commentedon Sep 9, 2020
Any update or workaround?
airasyaqub commentedon Sep 9, 2020
@nischi the workaround I have implemented is to separate template and TS code and then manually update form control values with help of editor built in events. Here is the code
template
TS code
nischi commentedon Sep 9, 2020
@airasyaqub awesome, thanks a lot for the code
bassemnaffeti commentedon Sep 21, 2023
Hello I am using "@tinymce/tinymce-angular": "^7.0.0" and I have this issue too,
ERROR Error: Uncaught (in promise): Error: Node cannot be null or undefinedTinyITAdmin commentedon Sep 21, 2023
Ref: INT-3231
tiny-ben-tran commentedon Mar 17, 2026
@airasyaqub, @bassemnaffeti, it appears that the issue is fixed when updated
@tinymce/tinymce-angularandangularto7and15respectively.