Override Document Editor Paste Behavior
Currently I am using a document editor container to import a Word .docx from a server which is then displayed to the user for additional editing if required which is working great. However I am running into an issue when trying to paste text sometimes. If it's unformatted, plain text, it will paste in correctly. However if I try to paste from another source, be it Word doc, PDF, website, etc. it will attempt to call the service URL to paste with formatting via the server-side "SystemClipboard" endpoint.
Given the frontend and server-side security and how http calls are made, I'd ideally like to just paste the plain text without any formatting and limit further calls to the backend. To this end and looking at the documentation, I tried overriding the @keyDown event to just call the paste() method instead of hitting the service URL but then realized that the document editor container does not have any events bubbling up to listen to.
Is it possible to do one of the below:
- Set the paste behavior to always just paste plain text (as a property), or
- Access Document Editor events from Document Editor Container
Thank you for the above. I might be misunderstanding so I think an example might better illustrate what I'm encountering. And I understand about the programmatic access to the clipboard, I'll ignore that path for now.
I've attached some snippets:
- Step 1 shows the blank document editor container.
- Step 2 shows that I am copying a portion of the URL to paste into the document editor container.
- Step 3 shows a successful paste (using ctrl + v).
- Step 4 shows a new selection that I want to copy from the webpage (this forum's page, in fact).
- Step 5 shows that when I try to paste (ctrl + v) this selection (if I right click inside the document editor container, the paste option is greyed out), an attempted call is made to the backend "/SystemClipboard" which failed for security reasons (no issue with the failed call).
Attachment: Snippets_623d89ea.zip
|
Paste with formatting |
For converting the HTML/RTF format (received from system clipboard) to SFDT format content. Whereas plain text received from system clipboard will be pasted directly in client-side. |
Hello,
I ended up just adding the backend method per the Github link which works for my purposes.
Thank you for all your time on this. Feel free to close this or mark as complete.
- 5 Replies
- 2 Participants
-
DT Doug Thierjung
- Sep 9, 2021 04:58 PM UTC
- Sep 15, 2021 03:43 AM UTC