Skip to content

Conversation

@d3m1d0v
Copy link
Member

@d3m1d0v d3m1d0v commented Dec 2, 2025

  1. Fixed positions of plus buttons

    Details

    image

  2. Fixed positions of row and column controls

    Details

    image

  3. Fixed row dragging

    Details

    image

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Visual Tests Report is ready.

@d3m1d0v d3m1d0v force-pushed the fix-yfm-table-floating branch 2 times, most recently from 7bf4b75 to 40e4d76 Compare December 3, 2025 15:19
@d3m1d0v d3m1d0v force-pushed the fix-yfm-table-floating branch from 40e4d76 to 68c55e2 Compare December 4, 2025 12:06
@d3m1d0v d3m1d0v marked this pull request as ready for review December 4, 2025 12:23
@d3m1d0v d3m1d0v requested a review from makhnatkin as a code owner December 4, 2025 12:23
@d3m1d0v d3m1d0v force-pushed the fix-yfm-table-floating branch from 68c55e2 to 2a4f6d1 Compare December 4, 2025 14:16
const rect = (tableNode as Element).getBoundingClientRect();
table.style.width = rect.width + 'px';
const tableNode = view.domAtPos(tableDesc.pos + 1).node;
isHorizontallyScrolled = (tableNode as Element).scrollLeft > 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
isHorizontallyScrolled = (tableNode as Element).scrollLeft > 0;
isHorizontallyScrolled = tableNode instanceof Element && tableNode.scrollLeft > 0;

isHorizontallyScrolled = (tableNode as Element).scrollLeft > 0;

const tbodyNode = view.domAtPos(tableDesc.bodyPos + 1).node;
const tbodyRect = (tbodyNode as Element).getBoundingClientRect();
Copy link
Collaborator

Choose a reason for hiding this comment

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

same

// left border of table
if (cellMiddle - EDGE_OFFSET <= tableRect.left) {
const visible = cellRect.right - tableRect.left;
cellRect.width = (visible - EDGE_OFFSET) * 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a potential issue when the cell is barely visible: visible - EDGE_OFFSET can become negative, leading to negative width values.

I suggest clamping the adjusted value

    const visible = cellRect.right - tableRect.left;
    const adjusted = Math.max(0, visible - EDGE_OFFSET);
    cellRect.width = adjusted * 2;

@makhnatkin
Copy link
Collaborator

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.

4 participants