Repository navigation
Deleting multiple elements - #2519
Merged
Merged
Conversation
Tab labels could only be looked up via translation keys derived from the tab name, which does not allow interpolating values like a count into the label. An optional label now takes precedence over the translation lookup.
The contentElement option of renderEntry is meant for specs that need a single content element and do not care about the rest of the entry. Appending it to seeded content elements made the resulting ids and order implicit. renderEntry now raises an error instead, so specs seed all of their content elements explicitly.
The helper for building editable text values lived among the storybook helpers, which made it unavailable via the support module used by specs. It now lives in its own support module and also builds blocks of other types and multiple blocks at once.
Deleting a series of elements meant deleting them one by one so far. Holding Ctrl/Meta while clicking a content element now adds it to or removes it from a new multi selection, which holds a list of items instead of a single id. Items always refer to whole content elements. Modifier clicks do not place the caret in editable texts of the content element, and an editable text that has focus loses it once its content element becomes part of a multi selection. Otherwise typing would change a content element of the multi selection. Since the controls of the selection rect all act on a single element, elements that are part of a multi selection only display a plain border.
Text blocks render their own selection rect and handle clicks inside the editable text, so clicking them while holding Ctrl/Meta placed the cursor instead of extending the selection. The modifier click now adds the text block as a whole to the multi selection without moving the cursor into the text. A text block that is being edited loses focus once it becomes part of a multi selection, so typing cannot change it. A plain click into the text of a multi selected text block selects it on its own. When a multi selection shrinks to a single text block, the text block regains focus, since a selected text block without cursor would display no selection rect.
Deleting the content elements of a multi selection one by one would send a request per element and could not merge the elements which become adjacent along the way. The new method records all deletions of a section in a single batch, moving the content elements to the trash, and merges content elements that become adjacent. Since a multi selection can span sections, one request per section is performed. Deleting a single content element is now the special case of deleting a selection of one.
Selecting multiple content elements in the preview navigated the sidebar back to the outline since the editor did not know the new selection type. It now shows a view with a tab that lists the type of each selected element and offers deleting them via its actions menu. The back link resets the selection, which makes the preview navigate the sidebar back to the outline. The configuration of multiple content elements cannot be edited at once, so the view deliberately only offers actions that apply to the selection as a whole.
Spelling out the block structure of editable text values made specs and stories harder to read than the texts they care about. Values that consist of blocks of a single type with plain text use the helper now. Values with marks or block attributes, children of list blocks and expected values in assertions keep spelling out their structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.