feat: provide word style list creation#634
Merged
chrischrischris merged 10 commits intoadobe:mainfrom Feb 13, 2026
Merged
Conversation
|
|
||
| // Returns an inputRules plugin for list formatting (bullet and ordered lists) | ||
| export function getListInputRulesPlugin(schema) { | ||
| const rules = [getBulletListInputRule(schema), getOrderedListInputRule(schema)].filter(Boolean); |
Contributor
There was a problem hiding this comment.
I don't think there's ever a time where schema.nodes will NOT have bullet_list and ordered_list, so it should be safe to assume that they will be present.
I think that all of the listInputRule code can be consolidated into this function:
export function getListInputRulesPlugin(schema) {
const { ordered_list: orderedList, bullet_list: bulletList } = schema.nodes;
const rules = [];
if (orderedList) rules.push(wrappingInputRule(/^\s*1[.)]\s$/, orderedList));
if (bulletList) rules.push(wrappingInputRule(/^\s*([-*])\s$/, bulletList));
return inputRules({ rules });
}
Contributor
Author
There was a problem hiding this comment.
makes sense to me, but if schema.nodes.bullet_list and schema.nodes.ordered_list will always be defined, then we don't need the if statements at all right?
Assuming that's true, I simplified it to just:
export function getListInputRulesPlugin(schema) {
const rules = [
wrappingInputRule(/^\s*1[.)]\s$/, schema.nodes.ordered_list),
wrappingInputRule(/^\s*([-*])\s$/, schema.nodes.bullet_list),
];
return inputRules({ rules });
}
If you think the ifs are needed, let me know and happy to update to the suggestion your provided.
chrischrischris
approved these changes
Feb 13, 2026
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.
Description
This allows more of the muscle memory users have from word to be re-used in DA.
full disclosure, this was largely vibecoded, but looking over the code it makes sense to me and works when tested.
Related Issue
Motivation and Context
Because I get annoyed when authoring that this doesn't work :)
How Has This Been Tested?
tested locally in the editor at http://localhost:3000/edit#/aem-sandbox/block-collection/drafts/shsteimer/testing
contemplated unit tests, but no other key handlers seemed to have them, assume there is a reason for that.
Screenshots (if appropriate):
Types of changes
Checklist: