Skip to content

fix: update column resize logic to account for RTL tables#335

Open
priceld wants to merge 1 commit intoProseMirror:masterfrom
priceld:rtl-support
Open

fix: update column resize logic to account for RTL tables#335
priceld wants to merge 1 commit intoProseMirror:masterfrom
priceld:rtl-support

Conversation

@priceld
Copy link
Copy Markdown

@priceld priceld commented Mar 16, 2026

Fixes #333

This change updates the column resize logic for tables that are in the RTL direction. The direction of the table needs to be examined:

  1. in the mousemove handler to determine which cell will (potentially) be resized. In RTL, this is the column to the right of the cell border. In LTR, it is the column to the left.
  2. in the mousedown handler to identify the direction for the "resizing" action. This value is cached for the duration of the resize action and is used to calculate the column width.

Ideally, the direction of the table would only be checked once, but I couldn't see a clean way to do that without a breaking change to ResizeState.

I did not update any tests since the resize plugin isn't currently tested.


Demo
Screen.Recording.2026-03-16.at.3.35.01.PM.mp4

Note

Disclaimer: I did use an LLM to get me started on this change, but I have reviewed and tested everything myself.

Comment thread src/columnresizing.ts
Comment on lines +157 to +165
if (event.clientX - left <= handleWidth) {
const tableDOM = domTableAround(target);
const isRTL = isTableRTL(tableDOM);
cell = edgeCell(view, event, isRTL ? 'end' : 'start', handleWidth);
} else if (right - event.clientX <= handleWidth) {
const tableDOM = domTableAround(target);
const isRTL = isTableRTL(tableDOM);
cell = edgeCell(view, event, isRTL ? 'start' : 'end', -handleWidth);
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I duplicated the isTableRTL in each branch of the if to hopefully save a little on performance.

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 this pull request may close these issues.

Column Resizing does not work in RTL directionality

1 participant