-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disabling formgroup with tinymce in material tab gives 'node cannot be null or undefined' bug. #167
Comments
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. |
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. |
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 |
@jscasca have u looked into it ? |
We are still working on how to fix this issue. Sorry it's taking so long |
Any update or workaround? |
@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
|
@airasyaqub awesome, thanks a lot for the code |
Hello I am using "@tinymce/tinymce-angular": "^7.0.0" and I have this issue too, |
Ref: INT-3231 |
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"
below is my code:
<editor formControlName="inputEditor" [init]="defaultConfig"></editor>
private _disableFormsDuringProgress() { this.progressBar$.subscribe(res => { if (res) { this.emailForm.disable(); } else { this.emailForm.enable(); } }); }
public defaultConfig: any = { height: 700, base_url: '/tinymce', // Root for resources suffix: '.min', plugins: [ 'advlist autolink link image lists charmap print hr anchor pagebreak', 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking', 'table emoticons template paste help' ], browser_spellcheck: true, toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify |' + ' bullist numlist outdent indent | link image | print media fullpage | ' + 'forecolor backcolor emoticons | help', menubar: 'file edit view insert format tools table help', branding: false, setup: (editor: any) => { this.editor = editor; this.editor.on('init', () => { this.editorLoaded = true; }); } };
The text was updated successfully, but these errors were encountered: