[lexical-playground] [lexical-list] add ability to change ordered list start number#7638
[lexical-playground] [lexical-list] add ability to change ordered list start number#7638ivailop7 merged 12 commits intofacebook:mainfrom achaljhawar:ordered-list-start-number
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/lexical-list/src/index.ts
Outdated
| UPDATE_LIST_START_COMMAND, | ||
| (payload) => { | ||
| const {listNodeKey, newStart} = payload; | ||
| $handleUpdateListStart(editor, listNodeKey, newStart); |
There was a problem hiding this comment.
It probably makes more sense to inline the implementation of $handleUpdateListStart here since it's short, not used anywhere else, and isn't particularly useful as a public API.
There was a problem hiding this comment.
I have done the inline implementation now.
Co-authored-by: Bob Ippolito <bob@redivi.com>
etrepum
left a comment
There was a problem hiding this comment.
Looks good! Will merge once the test suite has finished running successfully
On further inspection we might want to rethink the UI for this a bit, since it causes internal scrolling of the toolbar even with a full width browser on a normal laptop screen.
|
I just had a closer look and perhaps we might want to reconsider this UI since it causes internal scrolling in the toolbar, even with a full width browser on a laptop screen. The code and implementation is otherwise clean, it's really just a UI concern. numbered-list-toolbar.mov |
yeah I initially tried to fix this problem by decreasing the size of buttons on the toolbar when a ordered list is clicked so that it could accommodate a new field, but the scroll was still persistent. |
|
@etrepum Is this okay if I increase the size of the playground by 40px and center align the toolbar the scroll doesn't come Lexical.Playground.3.mp4should I commit this? |
|
@ivailop7 do you have any opinions on this UI? |
Not a fan of the UI change. I'd keep only the changes to the plugin, but skip the toolbar one. If people want to make use of the new functionality, it should be documented how to use 'UPDATE_LIST_START_COMMAND' and skip the UI part altogether. |
Let's just scope the changes in this PR to the command for now and skip the toolbar and UI changes for now altogether. |
|
@ivailop7 I have removed all the ui changes as you asked |
|
@ivailop7 would you mind if I made another issue to surface the command in the UI? I am imagining something like the table feature where right-clicking on the list item/s brings up a menu with "change list numbering" which then opens a modal with the number input. If that seems out of scope, I'll leave it alone. |
…t start number (#7638) Co-authored-by: Bob Ippolito <bob@redivi.com>
Description
This PR introduces a feature allowing users to modify the starting number of an existing ordered list directly through the toolbar in the playground.
Closes #7621
Test plan
Before
Currently, Lexical allows starting an ordered list with an arbitrary number only by creating a new list with that specific starting number. There is no UI mechanism to change the start number of an existing ordered list.
After
Lexical.Playground.1.mp4