Skip to content

[lexical-playground] Feature: Add PagesExtension#8322

Open
ibastawisi wants to merge 27 commits intofacebook:mainfrom
ibastawisi:pages
Open

[lexical-playground] Feature: Add PagesExtension#8322
ibastawisi wants to merge 27 commits intofacebook:mainfrom
ibastawisi:pages

Conversation

@ibastawisi
Copy link
Copy Markdown
Contributor

Description

This pull request introduces a comprehensive "Pages" feature to the Lexical Playground, adding support for document pagination, page setup, and print-friendly styling. The main changes include new node types for representing pages and their content, a page setup node for configuring size and margins, and significant CSS updates for print output and UI enhancements.

Pages feature and node architecture:

  • Added new node types: PageNode, PageContentNode, and PageSetupNode, along with supporting types and constants, to represent document pages, their content, and page setup (size, orientation, margins). These nodes manage pagination logic, page measurement, overflow/underflow handling, and serialization. [1] [2] [3] [4] [5] [6]
  • Integrated the PagesExtension into the main playground app, enabling the new pages functionality in the editor. [1] [2]

Print and UI enhancements:

  • Added print-specific CSS rules to ensure correct page rendering, hide non-editor elements, and optimize color and layout for printing. [1] [2]
  • Updated editor and dropdown styling, including new icons for page setup and improved submenu chevrons, and slightly increased the editor shell's maximum width. [1] [2] [3]

These changes lay the foundation for multi-page document editing and WYSIWYG print output in the Lexical Playground.

image

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Apr 12, 2026 5:03am
lexical-playground Ready Ready Preview, Comment Apr 12, 2026 5:03am

Request Review

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 9, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Apr 9, 2026
Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

This is probably one of the most requested features and generally the trickiest to build! I haven't had time to do a close inspection yet, but here are some general notes on the architecture. Basically it could be made a lot less react-dependent (everything but the dropdown UI itself I think) and follow newer lexical conventions more closely to reduce boilerplate required for clone/serialization/etc.

Copy link
Copy Markdown
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

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

I think this looks great, of course the one thing missing here would be adding some e2e tests to show that it works as expected but I think it's also early enough and isolated enough from other playground functionality that we could do that later (e.g. after implementing better TextNode splitting)

@ibastawisi
Copy link
Copy Markdown
Contributor Author

I'm having a hard time getting text splitting to work as expected, I will try a different approach later today but things look harder than I thought.
If I couldn’t figure it out today, then we'd better open an issue and think about it in another day

…roving page navigation logic. Removed unnecessary dataset checks and refined selection handling for page breaks and previous siblings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants