Search code examples
liferaywysiwygliferay-6.2

Liferay WYSIWYG editor copy from Word


I saw Liferay's WYSIWYG editor has option to copy content from Word. But I notice that the formating (especially headings) don't match and the images are not copied. Is it a known issue?

Does Liferay support integration with any WYSIWYG editor in which I can copy content from word as is without losing the formatting and images?


Solution

  • It is a known issue that will be fixed in Liferay 7.0.0 M1 - see https://issues.liferay.com/browse/LPS-29493 .

    Liferay uses CK Editor, which can copy the Word content including styles. CK Editor needs to be configured to preserve the styles. The options are:

    To preserve the styles in Liferay 6.2, you need to create a JSP hook and customize the configuration of the editor.

    To test the functionality without the hook, you can open any web content article and modify the configuration of the current CK Editor instance. Run the following commands in JavaScript console of your browser:

    CKEDITOR.instances['_15_articleContent'].config.pasteFromWordRemoveStyles = false;
    CKEDITOR.instances['_15_articleContent'].config.pasteFromWordRemoveFontStyles = false;
    

    Pay attention to the HTML source of the copied document - there will be a lot of inlined styles. It may now be exactly what you want. You may need some additional processing to clean up the document. That would mean another hook.