WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.35k stars 4.13k forks source link

Auto continuity of a subsequent ordered list #38251

Open ghost opened 2 years ago

ghost commented 2 years ago

What problem does this address?

When we need to break the list into separate lists for any reason (like adding a table or image or note), the starting number of the subsequent list is not automatically incremented or decremented.

What is your proposed solution?

We need an option by which the subsequent list block should be auto-incremented or decremented based on the list items changed in the previous list block. Similar to the "continue numbering" option in Word.

For example:

  1. List Item 1
  2. List Item 2

(Break List)

  1. List Item 3 (Currently, this number requires to be manually adjusted inside the Ordered List Settings option. This number should be automatically adjusted according to the changes in the above list.)
  2. List Item 4
annezazu commented 2 years ago

Hey there! I agree. I think this issue might be a duplicate though of this earlier one: https://github.com/WordPress/gutenberg/issues/6394 Do you agree? If so, I can close this out :)

ellatrix commented 2 years ago

@annezazu Nothing to do with nested blocks.

For now you'll need to manually change the start number of the list unfortunately. No plans to automatically update it based on a previous list, unless there's someone who wants to work on that.

annezazu commented 2 years ago

Got it! Let's leave this open as now in that case.

ghost commented 2 years ago

FYI

From: Ella @.> Sent: 27 July 2022 12:01 AM To: WordPress/gutenberg @.> Cc: quickdraft @.>; Author @.> Subject: Re: [WordPress/gutenberg] Auto continuity of a subsequent ordered list (Issue #38251)

@annezazu https://github.com/annezazu Nothing to do with nested blocks.

For now you'll need to manually change the start number of the list unfortunately. No plans to automatically update it based on a previous list, unless there's someone who wants to work on that.

— Reply to this email directly, view it on GitHub https://github.com/WordPress/gutenberg/issues/38251#issuecomment-1195839040 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ATG32FHIS6RF3KWW7V3UIALVWAVFLANCNFSM5M3SOM2Q . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ATG32FGRNDQ22KRGOOYU2G3VWAVFLA5CNFSM5M3SOM22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOI5DQ4QA.gif Message ID: @.***>

oliv-j commented 1 year ago

I will add to this that manually specifying the start attribute of the list item breaks the editor when you try to go back to visual editing. So there is no good work around right now. I get: "This block contains unexpected or invalid content."

If I attempt recovery then all hell breaks loose with duplicated content and/or list items with strange line breaks in between them. I've been trying to get round this for 30 minutes but each time I end up ctrl-z'ing like crazy to try and get the list back to how it was.

For the moment I've implemented a CSS change to hide the first level ordered list items' numbers and then written the numbers in by hand.

For background context: I have a number of pages which are laid out as legal documents and they often require a table or other content in between list items.

ellatrix commented 1 year ago

So you want to keep the numbering when you split a let in two, is that correct?

We can adjust the number on split, but the problem is that this "start" number doesn't update when you add items to the first list. Automatically updating the start number is very difficult, because we need to know which list the count is based off, so that means keeping track of the previous list. I'm afraid this is beyond what we can do in core, but I'm not opposed to it if someone wants to try it in a PR.

A better solution might be allowing other blocks to be added to the list? #17999