0

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?

Sandeep Nair
  • 3,630
  • 3
  • 26
  • 38

1 Answers1

2

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.

Tomas Pinos
  • 2,812
  • 14
  • 22
  • Will this also copy images? – Sandeep Nair Feb 25 '15 at 13:03
  • AFAIK CK Editor doesn't support copy & pasting images by default. Though, there exist plugins that enable it - for example Simple Uploads (http://alfonsoml.blogspot.cz/p/simpleuploads-plugin-for-ckeditor.html ). I don't know any free alternative. – Tomas Pinos Feb 25 '15 at 13:13