Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lexical-playground] Feature: columns resizing in layouts plugin #6787

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

harshmetkel24
Copy link

[lexical-playground] Feature: support to add new columns side by side and column resize

Description

  • Currently when adding Columns Layout promt asks to chose number of columns. But once added there is no way to add more columns or even resizing already added columns. If someone wants to change something they have to start fresh. Also there is no way to free resize columns, can only chose from predefined options.
  • After this change users will be able to add more columns to end by clicking on + button. This behaviour is adapted from lexical-table only. Also user's can resize columns according to their need.

Closes #6740

Before

image

No option to add new columns or resize existing ones

After

Screen.Recording.2024-11-01.at.9.17.05.PM.mov

Now users can add more columns and resize them as well according to their need

Copy link

vercel bot commented Nov 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 4:45am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 4:45am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 1, 2024
Copy link

github-actions bot commented Nov 1, 2024

size-limit report 📦

Path Size
lexical - cjs 29.94 KB (0%)
lexical - esm 29.78 KB (0%)
@lexical/rich-text - cjs 38.59 KB (0%)
@lexical/rich-text - esm 31.63 KB (0%)
@lexical/plain-text - cjs 37.22 KB (0%)
@lexical/plain-text - esm 28.94 KB (0%)
@lexical/react - cjs 40.32 KB (0%)
@lexical/react - esm 33.01 KB (+0.01% 🔺)

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

Ideally there would be more usage of the theme rather than hard-coded classes, although perhaps a data attribute or some other identifier should be used for the cases where someone wants to use utility classes in their theme. It seems to work well enough in the cases that I tried

<div ref={resizerRef}>
{activeCell != null && !isMouseDown && (
<div
className="PlaygroundEditorTheme__resizer"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should ideally come from the theme rather than be hard-coded here, at least according to the coding conventions elsewhere in the playground

Comment on lines +45 to +60
if (target && target instanceof HTMLElement) {
const layoutContainerNode = target.closest<HTMLElement>(
'.PlaygroundEditorTheme__layoutContainer',
);
const layoutItemNode = target.closest<HTMLElement>(
'.PlaygroundEditorTheme__layoutItem',
);

const isOutside = !(
layoutContainerNode ||
layoutItemNode ||
target.closest<HTMLElement>(
'button.PlaygroundEditorTheme__layoutAddColumns',
) ||
target.closest<HTMLElement>('div.PlaygroundEditorTheme__resizer')
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

These classes should come from the theme rather than be hard-coded here, at least according to the coding conventions elsewhere in the playground


return (
<button
className="PlaygroundEditorTheme__layoutAddColumns"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This class should come from the theme rather than be hard-coded here, at least according to the coding conventions elsewhere in the playground

@ivailop7
Copy link
Collaborator

ivailop7 commented Nov 5, 2024

I don't want to discourage the development of this plugin, but I think it might make more sense to have this one in a separate repo, vs inside the playground and we can list a number of other plugins people have built in the documentation.

@potatowagon
Copy link
Contributor

there seems to be a regression for this test: packages/lexical-playground/tests/e2e/Tables.spec.mjs:3743:3 › Tables › Paste and insert new lines after unmerging cells
https://github.com/facebook/lexical/actions/runs/11691145148/job/32797500364?pr=6787

@harshmetkel24
Copy link
Author

there seems to be a regression for this test: packages/lexical-playground/tests/e2e/Tables.spec.mjs:3743:3 › Tables › Paste and insert new lines after unmerging cells https://github.com/facebook/lexical/actions/runs/11691145148/job/32797500364?pr=6787

will look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants