[lexical-playground] Feature: Add PagesExtension#8322
[lexical-playground] Feature: Add PagesExtension#8322ibastawisi wants to merge 27 commits intofacebook:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
left a comment
There was a problem hiding this comment.
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.
packages/lexical-playground/src/plugins/PagesExtension/PageContentNode.ts
Show resolved
Hide resolved
packages/lexical-playground/src/nodes/PageNode/PageSetupNode.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/plugins/PagesExtension/PageSetupDropdown.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/plugins/PagesExtension/PagesPlugin.tsx
Outdated
Show resolved
Hide resolved
…nfig method for type definition
…from PageSetupNode
… PageBreakPlugin to PageBreakExtension
packages/lexical-playground/src/plugins/PagesExtension/PageSetupDropdown.tsx
Outdated
Show resolved
Hide resolved
packages/lexical-playground/src/plugins/PagesExtension/index.ts
Outdated
Show resolved
Hide resolved
…etupDropdown to use the new function.
…s and update item labels for clarity.
…handling, removing unused functions and improving comments for clarity.
…from the node and extension output
etrepum
left a comment
There was a problem hiding this comment.
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)
|
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. |
…dated consistently
…roving page navigation logic. Removed unnecessary dataset checks and refined selection handling for page breaks and previous siblings.
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:
PageNode,PageContentNode, andPageSetupNode, 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]PagesExtensioninto the main playground app, enabling the new pages functionality in the editor. [1] [2]Print and UI enhancements:
These changes lay the foundation for multi-page document editing and WYSIWYG print output in the Lexical Playground.