Using wysiwyg version: 7.x-2.2+29-dev with ckeditor library version: 4.3.2.ba625e6.

wysiwyg ckeditor profile configured with "Advanced Content Filter" set to "disabled".

When I paste a word document (docx) into ckeditor, it appears that the "rteindent1", "rteindent2", etc classes are stripped and changed to

tags. If I paste an html document into ckeditor with the same classes, the class tags are preserved, but do the text is not indented.

wysiwyg profile configured to use "Editor css", so I modified ckeditor library styles.js and added this line to CKEDITOR.stylesSet.add

{ name: 'rteindent1', element: 'class', styles: {'margin-left': '40px' } }

But the editor still strips out the rteindents. Any suggestions?

Thanks!

CommentFileSizeAuthor
rteindent1 sample.png23.7 KBSomebodySysop
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

Issue tags: -ckeditor, -rteindent

That style definition makes no sense since it assumes there's an element named 'class' and applying the style should set a left margin on it. The name is what would be displayed in the Styles dropdown in the toolbar. I don't think that's relevant for this problem though, since it's probably caused by the filtering done in the pastefromword plugin.

I would advise against modifying the editor library itself, we don't support anything but its default state in Wysiwyg module.

Word is extremely bad at representing indents in a sane way. Browsers also have a say in what actually gets pasted after copying something, so this behavior may vary between browsers. If it's just got classes, there's not even a real list in there. If CKEditor detects a pseudo-list like that, it will create the proper ol/ul/li tags when it can, or possibly use the values from the indentClasses setting, I don't honestly know what it'll do.

If the rteindent classes are still there after you've pasted, you'd have to add style rules for them in your stylesheets to have them look indented, since they're not styled by default in Drupal or any theme I know of.

I can't find any code explicitly converting those classes to any tags, but the Word filtering code is so complex I never bothered digging deep into it. Maybe CKEditor by default removes all classes when pasting from word and converting to some tag?

You can override all of the Word filtering code by changing the pasteFromWordCleanupFile setting through implementing hook_wysiwyg_editor_settings_alter().

Myself, I don't allow pasting from Word and forcibly interpret everything as text to just get rid of the insanity, but I can understand if you can't do that.