Repository navigation
feat(rust): the node packages' DOM parts, checked by property/documents' HTML and html/import-nodes - #160
Open
tmm wants to merge 1 commit into
Open
feat(rust): the node packages' DOM parts, checked by property/documents' HTML and html/import-nodes#160tmm wants to merge 1 commit into
tmm wants to merge 1 commit into
Conversation
…ts' HTML and html/import-nodes ## Description With `html` on, the Rust port rendered and imported only the core nodes: every other node threw from `createDOM`, so `property/documents`' HTML couldn't be checked, and no import vector registered a node package. With `html` and a package's feature both on, its nodes now have `createDOM`, `exportDOM` and `importDOM`, ported from upstream: - `@lexical/rich-text`: `HeadingNode` (with the Google Docs title) and `QuoteNode`. - `@lexical/list`: `ListNode` and `ListItemNode`, with their theme class names, check lists, `HTMLOListElement.start`, the nested item's `after` and the GitHub, Joplin and Google Docs check list and alignment imports. - `@lexical/link`: `LinkNode` (with `sanitizeUrl`, whose `new URL` check follows Swift's model of the WHATWG parser) and `AutoLinkNode`. - `@lexical/code-core`: `CodeNode` (`<code>`, exported as `<pre>`; the `pre`, multi-line `code`, monospace `div` and GitHub table importers) and `CodeHighlightNode`. - `OverflowNode`, `HashtagNode`, `HorizontalRuleNode` and `DecoratorTextNode`, with `applyFormatFromStyle` and `applyFormatToDom`. The `property/documents` suite now also checks `$generateHtmlFromNodes`. A new JS-recorded vector, `html/import-nodes`, imports curated HTML for those importers plus every `property/documents` HTML export with the `property/documents` nodes and `HorizontalRuleNode`; the Rust and Swift runners both replay it, and Swift already matched. ## Test plan ### Before ``` $ cargo run -q -p lexical-conformance --release -- property/documents | `property/documents` (JSON and text) | 121 | 9 | 0 | 0 | 112 | **FAIL** | - `property/documents`: seed 20261105 #1: html: Rust None, JS Some("<ul start=\"0\" dir=\"ltr\"><li value=\"0\" style=\"text-align: start;\" dir=\"ltr\">...") ``` (with the HTML check added and the nodes' DOM parts not yet ported) ### After ``` $ cargo run -q -p lexical-conformance --release | `html/import-nodes` | 140 | 140 | 0 | 0 | 0 | pass | | `property/documents` (JSON, text and HTML) | 121 | 121 | 0 | 0 | 0 | pass | | **Total** | 3783 | 3783 | 0 | 0 | 0 | | $ swift test --skip-build --filter ConformanceTests.HTMLImportTests ✔ Test run with 3 tests in 1 suite passed after 0.067 seconds. $ npx vitest run src/html.test.ts # packages/lexical-conformance Tests 3 passed (3) ``` `cargo fmt --all --check`, `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`, `cargo test --workspace --all-features --locked`, `cargo doc` with `-D warnings`, and `cargo check -p lexical-editor --no-default-features` with each feature alone and with `html` are clean. Swift was run on Linux only. Amp-Thread-ID: https://ampcode.com/threads/T-506c8fa1-4309-40f1-9810-732b311eaeab
This branch has not been deployed
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
With
htmlon, the Rust port rendered and imported only the core nodes:every other node threw from
createDOM, soproperty/documents' HTMLcouldn't be checked, and no import vector registered a node package.
With
htmland a package's feature both on, its nodes now havecreateDOM,exportDOMandimportDOM, ported from upstream:@lexical/rich-text:HeadingNode(with the Google Docs title) andQuoteNode.@lexical/list:ListNodeandListItemNode, with their theme classnames, check lists,
HTMLOListElement.start, the nested item'safterand the GitHub, Joplin and Google Docs check list and alignment imports.
@lexical/link:LinkNode(withsanitizeUrl, whosenew URLcheck follows Swift's model of the WHATWG parser) and
AutoLinkNode.@lexical/code-core:CodeNode(<code>, exported as<pre>; thepre, multi-linecode, monospacedivand GitHub table importers)and
CodeHighlightNode.OverflowNode,HashtagNode,HorizontalRuleNodeandDecoratorTextNode, withapplyFormatFromStyleandapplyFormatToDom.The
property/documentssuite now also checks$generateHtmlFromNodes.A new JS-recorded vector,
html/import-nodes, imports curated HTML forthose importers plus every
property/documentsHTML export with theproperty/documentsnodes andHorizontalRuleNode; the Rust and Swiftrunners both replay it, and Swift already matched.
Test plan
Before
(with the HTML check added and the nodes' DOM parts not yet ported)
After
cargo fmt --all --check,cargo clippy --workspace --all-targets --all-features --locked -- -D warnings,cargo test --workspace --all-features --locked,cargo docwith-D warnings, andcargo check -p lexical-editor --no-default-featureswith each featurealone and with
htmlare clean. Swift was run on Linux only.