Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure / image / figcaption revisited #123

Closed
indigoxela opened this issue Jul 13, 2024 · 1 comment · Fixed by #124
Closed

Figure / image / figcaption revisited #123

indigoxela opened this issue Jul 13, 2024 · 1 comment · Fixed by #124

Comments

@indigoxela
Copy link
Member

indigoxela commented Jul 13, 2024

There's some room for improvement with figure / figcaption.

According to developer.mozilla.org figcaption may contain a lot more than we allow now.
But we also can't allow all valid elements, as that would break compatibility to CKE (4 and 5, core), which in turn would lead to odd situations, when toggling between editors (OK, v5 allows less than v4).

However, currently Tiny (the library) allows to add whatever's actually valid, but toggling source mode (as an example, anything that triggers conversion to data attribute), the paragraphs are gone. And that's odd from user perspective.

Another problem: if a figure with image and figcaption is the only element in the editor, it's a bit tricky to escape (get the cursor outside the figure). EDIT: it's hitting an keyboard arrow button twice. 😉

Another problem: how in the world did I manage to introduce a similar linked-image-in-figure bug as core CKE5 has? (The link from caption content slips to the image, the link from the image (if any) to the caption.) Fix that.

Nested markup in caption's also broken - they get stripped when saving. Not nice.

See also:

@indigoxela
Copy link
Member Author

indigoxela commented Jul 17, 2024

Fixed so far:

  • Links from figcaption get wrapped around image - fixed by filtering the link list
  • Stricter handling for content allowed in figcaption (schema alteration) to get results closer to what CKE4 had
  • Simplified figcaption parsing to use Tiny's tools
  • Extend figcaption serializer to also take more and nested tags into account

Still pending:

Function captionAstNodeToString() grew quite a bit. Not sure if I can simplify that. Probably not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant