Support upcasting from plain text hand-written code to CK Editor 5 plugin

Created on 6 February 2024, 5 months ago

Problem/Motivation

Both <footnotes data-value="" data-text="Text"></footnotes> and <footnotes data-value="">Text</footnotes> are supported when rendering the content. However, only the former is supported by the CK Editor 5 plugin. Opening the latter in CK Editor 5 would require re-entering the text.

Steps to reproduce

Hand-write your footnotes code, then switch to CK Editor 5.

Proposed resolution

  1. Add an elementToAttribute() upcast so any html content within the footnotes tag can get converted to the data-text if exists.
  2. It should check if data-text exists first and is not empty, and if so, it should not overwrite - data-text should take priority.
  3. See https://ckeditor.com/docs/ckeditor5/latest/framework/deep-dive/conversio... for details.
  4. You can see the attributeToAttribute() conversion here. Check the model element for child html and upcast it via elementToAttribute()

Remaining tasks

  1. Write merge request
  2. Add test into the existing FunctionalJavascript test

User interface changes

None

API changes

None

Data model changes

None

✨ Feature request
Status

Active

Version

4.0

Component

Footnotes

Created by

πŸ‡¬πŸ‡§United Kingdom scott_euser

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024