tinymce / tinymce/tinymce

image_caption unable to remove class from figure element.

Open
#5,067 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component: cE=false status: escalated
Dominant language
TypeScript
Stars
16.3k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

When an image is given a caption through the "image_caption" feature you can add custom classes to the figure element via the "style_formats" dropdown but you cannot remove them.

I've set up a fiddle here: http://fiddle.tinymce.com/0ggaab/11

1.) Insert an image with the "Show caption" option selected.
2.) Select FIGURE > FIGCAPTION and apply the Align Left style from the dropdown. (Selecting figure does nothing even though the selector for that style is figure)
3.) If you view the source you can see the "align-left" class is added to the figure element as expected. You can also see it marked as applied in the style_format dropdown.
4.) Go to the dropdown and try to remove the class, nothing happens.

If you go into the source and remove both the image and align-left classes then hit save, you can add and remove the Align Left style via the dropdown with no issues.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior in the linked TinyMCE fiddle, focusing on the image_caption feature and the style_formats dropdown with figure and figcaption selected. Trace how the Align Left style is applied to the figure and verify that choosing it again or removing it also removes align-left while preserving the caption; no repository file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.