Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,16 @@ function TableCellResizer({editor}: {editor: LexicalEditor}): JSX.Element {
window.scrollY + pointerCurrentPos.y / zoom
}px`;
styles[draggingDirection].height = '3px';
styles[draggingDirection].width = `${tableRect.width}px`;
/**
* Compute how far the table from the end of editor then use it as width of resizer indicator
*/
const contentEditableElement = document.querySelector(
'.ContentEditable__root',
);
Comment on lines +421 to +423

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const contentEditableElement = document.querySelector(
'.ContentEditable__root',
);
const contentEditableElement = editor.getRootElement();

const editorWidth =
contentEditableElement?.getBoundingClientRect().right ?? 0;

styles[draggingDirection].width = `${editorWidth - tableRect.left}px`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
styles[draggingDirection].width = `${editorWidth - tableRect.left}px`;
styles[draggingDirection].width = `${Math.min(tableRect.width, editorWidth - tableRect.left)}px`;

I don't think the intention here is to always size it to the end of the editor.

} else {
styles[draggingDirection].top = `${window.scrollY + tableRect.top}px`;
styles[draggingDirection].left = `${
Expand Down