ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.47k forks source link

When you paste from word, the images don't have special markup for caption element. #3937

Open zoarif opened 4 years ago

zoarif commented 4 years ago

test file.docx

Type of report

Feature request: When you paste from word, the images don't have special markup for caption element.

Provide description of the new feature

The caption associated with images should have different markup than just a

tag so that we can differentiate and identify them. This is the markup I saw for caption associated with image in paste event in evt.data.dataValue is:

Figure 1: This is my friend Mel 

Figure 1: This is my friend Mel 
Dumluregn commented 4 years ago

Pasting from your file I didn't see anything that could suggest that paragraph is a caption 🤔 However when I added my own caption, it seems there is something that could be useful:

<p class=MsoCaption><span lang=EN-US>Figure </span><!--[if supportFields]><span
lang=EN-US><span style='mso-element:field-begin'></span><span
style='mso-spacerun:yes'> </span>SEQ Figure \* ARABIC <span style='mso-element:
field-separator'></span></span><![endif]--><span lang=EN-US><span
style='mso-no-proof:yes'>1</span></span><!--[if supportFields]><span
lang=EN-US style='mso-no-proof:yes'><span style='mso-element:field-end'></span></span><![endif]--><span
lang=EN-US>: CKEditor4<o:p></o:p></span></p>

test.file.docx

<p class=MsoCaption> class appears here, so it possibly could be converted to <caption> element. However taking into account how much of research each change in Paste from Word filters requires and how important this change seems to be, I wouldn't expect us to change it any time soon. Instead as a workaround you could simply tweak ACF to not remove class=MsoCaption and work with paste listeners to automatically convert it to <caption> elements.