We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Paste from word throws error

Greetings,


I have a RTE in a modal and when i want to past something from word i get the following error in my console:

ej2.min.js:9  Uncaught TypeError: Cannot read properties of undefined (reading 'parentNode')

    at e.getImmediateBlockNode (ej2.min.js:9:1035355)

    at e.insertTempNode (ej2.min.js:9:1031503)

    at e.pasteInsertHTML (ej2.min.js:9:1028754)

    at e.Insert (ej2.min.js:9:1025687)

    at e.applyHtml (ej2.min.js:9:1088735)

    at e.notify (ej2.min.js:9:57103)

    at e.execCommand (ej2.min.js:9:1117611)

    at e.formatting (ej2.min.js:9:1172802)

    at e.pasteClean (ej2.min.js:9:1161426)

    at e.notify (ej2.min.js:9:57103)


When i open my moda, the textarea is focussed, when i click outside the area and back in, i can paste without errors thrown. I updated to the latest version 


3 Replies

VJ Vinitha Jeyakumar Syncfusion Team October 11, 2022 10:57 AM UTC

Hi Jordi,


We have tried to replicate the reported issue at our end by rendering the Rich Text Editor inside the modal Dialog and pasted some contents from Word to Editor. but we didn't face any issue as you reported. we have also prepared a video illustration and sample for your reference.



Can you please share the details below,

  • Exact issue reproducing steps.
  • Issue replicating entire code snippet.
  • Issue replicating video illustration.
  • If possible, please share us with the runnable issue reproducing sample or modify the attached sample with the issue reproducing code.

Regards,
Vinitha


JS Jordi Stevens October 13, 2022 02:20 PM UTC

Hi,


I adjusted the project how i'm using it. I also added a clip in the zip on how to reproduce it.


I'm not using the syncfusion modal. I also need to refresh the editor when opening the modal, if i don't, the toolbar doesn't show up. 


Sometimes the RTE has a value from the database and sometimes i need to clear it by using "". When i do this, the cursor is inside the RTE and then i can't paste.


So to reproduce it: 


use button to open modal. 

Immediatly paste and you'll get the error 

If you click outside and back in, you can just paste without error.


I think the clip will show it better.


Attachment: Core_new_app_1874255753_db48d1b3.zip


VY Vinothkumar Yuvaraj Syncfusion Team October 14, 2022 02:50 PM UTC

Hi Jordi Stevens, 


We have checked your reported query. To meet your requirements, we recommend the refreshUI function to refresh the RichTextEditor toolbar

and also inserting database data inside the P tag and assign into RichTextEditor value. Kindly refer to the attached code snippet and sample for your reference.


  function(e) {

                var editor = $("#omschrijvingRapportFeedback")[0].ej2_instances[0];

      editor.refreshUI();

      editor.value = "<p></p>";

  });


API link: https://ej2.syncfusion.com/documentation/api/rich-text-editor#refreshui

https://ej2.syncfusion.com/documentation/api/rich-text-editor#value


Please check the attached sample and let us know if you have any concerns.


Regards,

Vinothkumar


Attachment: Core_new_app_1_d20e5881.zip

Loader.
Live Chat Icon For mobile
Up arrow icon