Problem/Motivation

When adding a CSS class to a table using Editor Advanced Table, the class attribute replaces the essential CKEditor widget classes on the figure wrapper element instead of being applied to the <table> element. This breaks the visual selection handles and widget functionality in the editing view.

Expected behavior:

  <figure class="table ck-widget ck-widget_with-selection-handle">
    <table class="my-custom-class">

Actual behavior:

  <figure class="my-custom-class">
    <table>

Root Cause

When the CKEditor 5 Table Properties plugin is enabled, tables are wrapped in elements in the editing view. The downcast converter for the tableClass attribute uses mapper.toViewElement(), which returns the figure wrapper instead of the actual table element.

Using writer.setAttribute("class", ...) on the figure completely overwrites its existing classes ("table ck-widget ck-widget_with-selection-handle"), breaking the widget's visual functionality.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

    1 hidden branch
  • 1.0.x Comparechanges, plain diff MR !1

Comments

sergio morais created an issue. See original summary.

sergio morais’s picture

Issue summary: View changes
sergio morais’s picture

Issue summary: View changes
sergio morais’s picture

Issue summary: View changes
sergio morais’s picture

Issue summary: View changes

sergio morais’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergio morais’s picture

Status: Fixed » Closed (fixed)