Paste from Microsoft Word #1876
Replies: 14 comments 2 replies
-
The problem is that Editor.js is not actually WYSIWYG. Surely some plugins might look like WYSIWYG components but the way of rendering is up to you and HTML output (or any other) might look completely different from how it looks in the editor. I've tried to handle paste from MS Word, the data from Word comes in RTF format (text/rtf). It can be parsed, converted and passed to the plugins on the client but there is too much data, browser just can't process it and gets crushed. If you are able to help with that and maybe make some investigation it would be really helpful! |
Beta Was this translation helpful? Give feedback.
-
Thank you for the information. I guess this is one of the few tradeoffs that EditorJs needs to make at the moment. I will try to do some investigation to see if I can figure out some sort of solution to this issue. If I figure anything out, I'll report back. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Perhaps a compromise would be a "work area" where you can paste in the document just to have it right there while you rebuild it into sections inside the editor. I guess it would be a single rich text block but it wouldn't render clientside, its just for reference. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I've made a few observations trying to get Copy + Paste from MS Word into Chrome on MacOS, and here's what I've found. My only goal has been to support bold, italic and anchor tags with href property. I do not want to copy in any other markup or images. When I copy + pasted from MS Word into Chrome, nothing would happen. However it works properly in both FireFox and Safari without any intervention from me. So I did a little digging. If I copy and paste from MS Word, the If I copy the same text into TextEdit then into Chrome, I focused on parsing the "text/html" data. I don't know about MS Word's formatting, but I saw there are |
Beta Was this translation helpful? Give feedback.
-
Hi all, Has there been any further progress on this issue? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hey guys, Any update about this issue? |
Beta Was this translation helpful? Give feedback.
-
Probably not as helpful given the context but the team I'm with just switched everything over to TinyMCE v5 - it doesn't use the block approach but is surprisingly feature complete and handles content from Word amazingly well. |
Beta Was this translation helpful? Give feedback.
-
@bsodmike I have seen Tiny pretty awesome tool, can I get a JSON Like output from it (Or that is what you meant by it not using the block approach)? |
Beta Was this translation helpful? Give feedback.
-
As per the docs, JSON output should be possible. |
Beta Was this translation helpful? Give feedback.
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
My PR allows to handle paste from MS Word :) Waiting for review and merge. |
Beta Was this translation helpful? Give feedback.
-
The solutions is here: src/components/modules/paste.ts: public async processDataTransfer(dataTransfer: DataTransfer, isDragNDrop = false): Promise<void> {
const { Tools } = this.Editor;
const types = dataTransfer.types;
/**
* In Microsoft Edge types is DOMStringList. So 'contains' is used to check if 'Files' type included
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const includesFiles = types.includes ? types.includes('Files') : (types as any).contains('Files');
const isPowerPointText = ['text/plain', 'text/html', 'text/rtf', 'Files'].every(type => types.includes(type));
if (includesFiles && !_.isEmpty(this.toolsFiles) && !isPowerPointText) {
await this.processFiles(dataTransfer.files);
return;
}
... |
Beta Was this translation helpful? Give feedback.
-
When i am pasting text from MS Word to Chrome on Mac the text is still being converted to an embedded image. Is there a solution yet? |
Beta Was this translation helpful? Give feedback.
-
A common use case for a WYSIWYG editor is to allow users to paste from Microsoft Word and match the styling as found in the document.
EditorJs does not have this functionality.
Is pasting from Microsoft Word on the roadmap?
Beta Was this translation helpful? Give feedback.
All reactions