Problem/Motivation
If you paste from office, default <a>
tags for citations and the final footnote references are added. These could be converted to to benefit from this module's functionality using the ClipboardPipeline provided by CK Editor 5.
Steps to reproduce
Paste from Word or LibreOffice Docs and the markup is pasted as is.
Proposed resolution
Implement the ClipboardPipeline to capture pasted content.
Example markup from LibreOffice:
<p style="line-height:100%;margin-bottom:0cm;">
Proin viverra, ligula sit amet ultrices semper, ligula arcu tristique sapien, a accumsan nisi mauris ac eros. Etiam sollicitudin, ipsum eu pulvinar rutrum, tellus ipsum laoreet sapien, quis venenatis ante odio sit amet eros. Fusce neque. Suspendisse faucibus, nunc et pellentesque egestas, lacus ante convallis tellus, vitae iaculis lacus elit id tortor. Nullam tincidunt adipiscing enim.<a class="sdfootnoteanc" href="#sdfootnote1sym" name="sdfootnote1anc"><sup>1</sup></a>
</p>
<p style="line-height:100%;margin-bottom:0cm;">
Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Suspendisse nisl elit, rhoncus eget<a class="sdfootnoteanc" href="#sdfootnote2sym" name="sdfootnote2anc"><sup>2</sup></a>, elementum ac, condimentum eget, diam. Proin magna. Donec vitae orci sed dolor rutrum auctor. Integer tincidunt.
</p>
<div id="sdfootnote1">
<p class="sdfootnote">
<a class="sdfootnotesym" href="#sdfootnote1anc" name="sdfootnote1sym">1</a> Footnote – 1 - Test
</p>
</div>
<div id="sdfootnote2">
<p class="sdfootnote">
<a class="sdfootnotesym" href="#sdfootnote2anc" name="sdfootnote2sym">2</a> Footnote – 2 Test
</p>
</div>
Example markup from Word:
<p>
Proin viverra, ligula sit amet ultrices semper, ligula arcu tristique sapien, a accumsan nisi mauris ac eros. Etiam sollicitudin, ipsum eu pulvinar rutrum, tellus ipsum laoreet sapien, quis venenatis ante odio sit amet eros. Fusce neque. Suspendisse faucibus, nunc et pellentesque egestas, lacus ante convallis tellus, vitae iaculis lacus elit id tortor. Nullam tincidunt adipiscing enim.<a href="#_ftn1" name="_ftnref1" title=""><span style="font-family:"Calibri",sans-serif;font-size:12.0pt;">[1]</span></a><o:p></o:p>
</p>
<p>
Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Suspendisse nisl elit, rhoncus eget<a href="#_ftn2" name="_ftnref2" title=""><span style="font-family:"Calibri",sans-serif;font-size:12.0pt;">[2]</span></a>, elementum ac, condimentum eget, diam. Proin magna. Donec vitae orci sed dolor rutrum auctor. Integer tincidunt.<o:p></o:p>
</p>
<div>
<hr align="left" size="1" width="33%">
<div id="ftn1">
<p>
<a href="#_ftnref1" name="_ftn1" title=""><span style="font-family:"Calibri",sans-serif;font-size:10.0pt;">[1]</span></a> Footnote – 1 - Test<o:p></o:p>
</p>
</div>
<div id="ftn2">
<p>
<a href="#_ftnref2" name="_ftn2" title=""><span style="font-family:"Calibri",sans-serif;font-size:10.0pt;">[2]</span></a> Footnote – 2 Test<o:p></o:p>
</p>
</div>
</div>
Remaining tasks
- Implement the ClipboardPipeline. I have started this off putting the code in the right place. The function
transformClipboardContent
in assets/js/ckeditor5_plugins/footnotes/src/footnotesediting.js is where the work is needed.
- Its currently just ChatGPT written code which results in a a broken
<footnotes>
element.
- Add tests via FootnotesCkeditorPluginTest
User interface changes
No visible changes, but paste from word or libreoffice will change.
API changes
None
Data model changes
None