Skip to content

feat: provide word style list creation#634

Merged
chrischrischris merged 10 commits intoadobe:mainfrom
shsteimer:list-handling
Feb 13, 2026
Merged

feat: provide word style list creation#634
chrischrischris merged 10 commits intoadobe:mainfrom
shsteimer:list-handling

Conversation

@shsteimer
Copy link
Copy Markdown
Contributor

Description

  • If the user types "* " or "- " at the start of a line, create a UL
  • if they type "1." or "1) " create an OL

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Comment thread blocks/edit/prose/plugins/keyHandlers.js Outdated

// Returns an inputRules plugin for list formatting (bullet and ordered lists)
export function getListInputRulesPlugin(schema) {
const rules = [getBulletListInputRule(schema), getOrderedListInputRule(schema)].filter(Boolean);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 });
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 chrischrischris merged commit 37e8873 into adobe:main Feb 13, 2026
3 of 5 checks passed
@shsteimer shsteimer deleted the list-handling branch February 20, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants