WebSpellChecker / ckeditor-plugin-scayt

SCAYT Plugin for CKEditor 4 is a plugin for multilingual check spelling and grammar as you type in CKEditor 4.
https://webspellchecker.com/wsc-scayt-ckeditor4/
Other
13 stars 21 forks source link

ckeditor scayt throws Uncaught Error: Error in Rangy WrappedRange module: createRange(): Parameter must be a Window object or DOM node #141

Closed balajijana closed 6 years ago

balajijana commented 7 years ago

Hi Support,

I am using scayt in the ckeditor as external plugin. I am able to add and save the new content. when i try to edit and save the content i am getting the following error : Uncaught Error: Error in Rangy WrappedRange module: createRange(): Parameter must be a Window object or DOM node. Please let me know how the issue can be rectified?

AAbakumov commented 7 years ago

Hello @balajijana could you please share us with a sample where we can take a look at the reported issue ( e.g. using https://jsfiddle.net/) or provide to us CKEditor package and your Html page.

balajijana commented 7 years ago

Yes please see the attached console error. editor_console

AAbakumov commented 7 years ago

@balajijana Thank you for provided info, but could you please emulate ur problem using https://jsfiddle.net/ or provide us your CKEditor with our SCAYT plugin.

Also please describe vendor.min.js - ZoneTask.invoke workflow

jshaptala commented 7 years ago

Since there is no response and details provided for about 4 months – we mark this issue as closed.

wiggydave10 commented 7 years ago

I have a similar issue, and am able to reproduce the problem (see attached project).

To reproduce: 1) Open "home.html" 2) Open developer tools and open console tab 3) Click "Edit Text" button 4) Modal will open with CKEditor containing text, click "Close" button. 5) Click "Edit Text" button again See: Modal opens with CKEditor containing text, and "Uncaught Error: Error in Rangy WrappedRange module: createRange(): Parameter must be a Window object or DOM node" error in console.

Note: In the javascript when the modal opens it replaces the content of the modal (this would be done via ajax in our actual system).

CKeditorReplaceError.zip ckeditorerror

jshaptala commented 7 years ago

Hello @wiggydave10,

Thank you for describing steps and providing your sample. With this information we were able to reproduce the mentioned problem. We have added this problem to our backlog for investigation. As soon as we have the fix, we will include it to one of our releases. We will keep you posted.

Sincerely,

rivetta-fr commented 7 years ago

to solve this problem I call function hereafter before opening new edit form: function ckeditordestroy(){ if (CKEDITOR.instances.postcontent){ CKEDITOR.instances.postcontent.destroy(); } }

wiggydave10 commented 7 years ago

@officinalab sadly this doesn't seem to work. It still generates the same error message. Looks like postcontent is always undefined. I've tried using the editor id instead of the postcontent (maybe I was meant to, but just being stupid), however, I get different errors instead (see below)

Uncaught TypeError: Cannot convert object to primitive value and Uncaught TypeError: Cannot read property 'document' of null

rivetta-fr commented 7 years ago

In my case is postcontent but you must use the name defined with: CKEDITOR.replace( 'postcontent', {});

rivetta-fr commented 7 years ago

The problem is done that you have already an instance of ckeditor in use, please see doc: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#destroy

wiggydave10 commented 7 years ago

@officinalab so I have an editor which I replace with CKEDITOR.replace( 'mainEditor' so I have added the destroy function using CKEDITOR.instances.mainEditor.destroy(), however, I get the 2 previous errors.

Uncaught TypeError: Cannot convert object to primitive value and Uncaught TypeError: Cannot read property 'document' of null

Have you been able to fix it on my example? If so how did you do it?

wiggydave10 commented 7 years ago

@officinalab apologies. I was being stupid. I thought the destroy was being called before the content got replaced, but it wasn't. Seems to have done the trick. Thanks for your help.

rivetta-fr commented 7 years ago

Welcome! I updated your example here: ck.zip

jshaptala commented 6 years ago

Hi @wiggydave10,

The suggestion from @officinalab is correct. You should call the destroy before the element replace.

@officinalab, thanks for your help.

Best Regards,

rivetta-fr commented 6 years ago

Don't mention it! @wsc-julia-shaptala