feat(web): text alignment#654
Open
kacperzolkiewski wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds web-only text alignment support to the enriched editor by integrating TipTap’s text-align extension, exposing an imperative alignment API, and ensuring alignment survives common block/list transformations.
Changes:
- Add
@tiptap/extension-text-alignand a customEnrichedTextAlignextension to apply alignment to list wrappers (<ol>/<ul>) when appropriate. - Preserve alignment through block-style toggles and list operations via
withPreservedAlignment+ state reporting viagetCurrentAlignment. - Extend the example web toolbar + add Playwright coverage for HTML round-tripping, interactions, and a visual regression screenshot.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Adds TipTap text-align dependency. |
yarn.lock |
Locks the new TipTap dependency. |
src/web/formats/EnrichedTextAlign.ts |
Introduces custom text-align behavior (notably for lists) + keyboard shortcut handling. |
src/web/EnrichedTextInput.tsx |
Registers EnrichedTextAlign and implements setTextAlignment on the web imperative handle. |
src/web/useOnChangeState.ts |
Reports current alignment in onChangeState and includes it in the state hash. |
src/web/formats/formatRules.ts |
Adds alignment helpers and preserves alignment when toggling paragraph formats. |
src/web/formats/applyWrappingListToSelection.ts |
Preserves alignment when wrapping a selection into a list. |
src/web/formats/listKeyboard.ts |
Preserves alignment when lifting list items via backspace behavior. |
src/web/formats/EnrichedOrderedList.ts |
Preserves alignment when toggling ordered lists on/off. |
src/web/formats/EnrichedUnorderedList.ts |
Preserves alignment when toggling unordered lists on/off. |
src/web/formats/EnrichedCheckboxList.ts |
Preserves alignment when toggling checkbox lists on/off. |
src/web/formats/EnrichedHeading.ts |
Updates paragraph-format toggling to preserve alignment. |
src/web/formats/EnrichedBlockquote.ts |
Updates paragraph-format toggling to preserve alignment. |
src/web/formats/EnrichedCodeBlock.ts |
Updates paragraph-format toggling to preserve alignment. |
src/web/normalization/tiptapHtmlNormalizer.ts |
Makes list <li><p…> stripping more robust to whitespace/attrs. |
apps/example-web/src/components/Toolbar.tsx |
Adds alignment buttons to the example toolbar. |
.playwright/tests/textAlignment.spec.ts |
Adds E2E coverage for alignment behavior and rendering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Screen.Recording.2026-06-24.at.16.28.18.movWhen we select all content with |
Collaborator
Screen.Recording.2026-06-24.at.17.35.47.movIt looks like the issue is still there - again when using |
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.
Summary
Text alignment for Web
Test Plan
textAlignmentwhen different styles are toggled.textAlignmentthanautoare properly parsed and containstyle="text-align:center|right|justify"inside HTMLScreenshots / Videos
Screen.Recording.2026-06-24.at.12.15.03.mov
Compatibility
Checklist