-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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][lexical-react] Feature: Push Draggable Element to Parent #7338
[lexical-playground][lexical-react] Feature: Push Draggable Element to Parent #7338
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on Bob's comment for "insert after" I'd even go as far and say it even makes sense to render the component picker menu for the user to select any widget, not just a paragraph. |
I just pushed an update based on your comment. I replicated Notion's behavior: by default, the new node is inserted after the current one. If you press the Cmd (or Ctrl) key while clicking, it inserts the new node before the current one.
I completely agree! However, there isn't a ready-to-use "component picker" at the moment. The existing one is tightly coupled with the typeahead plugin, so extracting it or duplicating some of its code would be necessary. I'm not sure how to easily create a "menu" within the playground next to my button. Maybe we could tackle this in a separate PR? |
I agree that it makes sense to handle the dialog in a separate PR. It is basically the same interface as the Any reason why you chose cmd-click instead of opt-click like Notion? |
I just used the same as in FloatingLinkEditorPlugin: https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/FloatingLinkEditorPlugin/index.tsx#L369 |
Option is the Mac equivalent of the Alt key https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/altKey |
Can I pitch shift+click on Windows, which always made more sense to me for such actions. |
We should maybe do whatever notion does by default since that UI is inspired by it. I don’t have a windows machine around to see what the keybinding is there |
packages/lexical-playground/src/plugins/FloatingLinkEditorPlugin/index.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/plugins/DraggableBlockPlugin/index.tsx
Outdated
Show resolved
Hide resolved
@etrepum Sorry... careless mistake. Thanks for the correction! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice job
Description
Allows passing a function to receive the DOM element identified by the DraggableBlockPlugin.
An example application of this is the addition of a "+" button that allows the creation of a block above the identified one. This feature is particularly useful in the playground, as it allows adding a new block at the top of the page without having to drag and drop, for example.
Test plan
Before
After