v0.18.0

facebook/lexicalv0.18.0Sep 26, 2024by potatowagon

AI Summary

Major update introducing multiline Markdown/MDX support, iterable `$dfs` method, and table row striping. Includes several breaking changes in Markdown transformers and code node imports.

Key Highlights

  • Multiline Markdown transformers / MDX support
  • Iterable `$dfs` method for traversing nodes
  • Table row striping feature for accessibility
  • Flexible `TextMatchTransformer` API
  • `exportDOM` support for document fragments

Breaking Changes

  • Multiline markdown transformers / mdx support
  • Renamed 'multilineElement' to 'multiline-element'
  • Code node import changes to support nodejs

New Features

  • Multiline markdown transformers
  • Iterable $dfs
  • Table row striping
  • Flexible TextMatchTransformer API

Full Release Notes

## Highlights

Highlights since [0.17.1](https://github.com/facebook/lexical/releases/tag/v0.17.1)

Core editor:
- 🆕 Iterable $dfs 
https://github.com/facebook/lexical/pull/6664
- 🆕 Pass in an array of tags to EditorUpdateOptions for multiple tag update
https://github.com/facebook/lexical/pull/6507/ 
- 🆕 exportDOM function supports document fragment exports
https://github.com/facebook/lexical/pull/6641/ 

- ✅ Fix issue where cmd/ctrl + left arrow after a tab character would cause exception
https://github.com/facebook/lexical/pull/6588 


Markdown:
- 🆕  shouldMergeAdjacentLines option in $convertFromMarkdownString. If true, merges adjacent lines as per commonmark spec (`line1\nline2` -> `line1line2`). If false (default and current behavior, adjacent lines remain separated by newline, as per GFM (`line1\nline2` -> `line1\nline2`)
https://github.com/facebook/lexical/pull/6608 
https://github.com/facebook/lexical/pull/6660 
- 🆕 multiline markdown transformers / mdx support
https://github.com/facebook/lexical/pull/6530 
- 🆕 More flexible TextMatchTransformer api, more fields made optional
https://github.com/facebook/lexical/pull/6651/ 

Link: 
- ✅ Fix removing a link from nodes with children, eg. Mark Node for comments
https://github.com/facebook/lexical/pull/6656 


Table:
- ✅ Fix merged cell related edge cases
https://github.com/facebook/lexical/pull/6607 
- ✅ Fix Table formatting and styling not persisting for empty cells 
https://github.com/facebook/lexical/pull/6626 
- ✅ Fix crash in $deleteCellHandler 
https://github.com/facebook/lexical/pull/6650 
- ✅ Fix incorrect addition of empty cells on table paste 
https://github.com/facebook/lexical/pull/6578 
- ✅ Fix issue where selecting a cell then dragging outside of table would not select entire table
https://github.com/facebook/lexical/pull/6579 
- ✅ Fix Table Cut Event Handling 
https://github.com/facebook/lexical/pull/6596/ 
- 🆕 optional colWidths property to TableNode 
https://github.com/facebook/lexical/pull/6625 
- 🆕 Table row striping feature, increases tables visual accessiblity. 
https://github.com/facebook/lexical/pull/6547 


Selection:
- 🆕 Expose getStyleObjectFromCss in @lexical/selection
https://github.com/facebook/lexical/pull/6612 

Misc:
- ✅  Check undeclared dependencies in build, declare missing dependencies
https://github.com/facebook/lexical/pull/6574 
- ✅  Fix window is undefined error appears when creating a code node in a headless editor in a nodejs environment
https://github.com/facebook/lexical/pull/6562 

## What's Changed
* v0.17.1 by @ivailop7 in https://github.com/facebook/lexical/pull/6559
* [lexical-table] Bug Fix: Add @lexical/clipboard as a direct dependency of @lexical/table by @etrepum in https://github.com/facebook/lexical/pull/6571
* [lexical-react] menu positioning: Unrevert PR6510 but with gating by @potatowagon in https://github.com/facebook/lexical/pull/6566
* [*] Feature: Check undeclared dependencies in build by @etrepum in https://github.com/facebook/lexical/pull/6574
* [lexical-table] feat: Add row striping by @ivailop7 in https://github.com/facebook/lexical/pull/6547
* [lexical-react]: Fix incorrect addition of empty cells on table paste by @Shubhankerism in https://github.com/facebook/lexical/pull/6578
* [lexical-list][lexical-react] Refactor: Create registerList Function Separate from React Shared Utils by @jkjk822 in https://github.com/facebook/lexical/pull/6560
* Fix test results CI path on Windows by @moughxyz in https://github.com/facebook/lexical/pull/6585
* [lexical][lexical-overflow] Refactor: simplified removeText and insertText rewrite (part 1) by @GermanJablo in https://github.com/facebook/lexical/pull/6456
* [lexical-table] Fix Table Cut Event Handling by @ivailop7 in https://github.com/facebook/lexical/pull/6596
* [lexical-markdown][breaking change] Feature: multiline markdown transformers / mdx support by @AlessioGr in https://github.com/facebook/lexical/pull/6530
* Address svelte vulnerability by @potatowagon in https://github.com/facebook/lexical/pull/6603
* Fix issue where cmd/ctrl + left arrow after a tab character would cause exception by @moughxyz in https://github.com/facebook/lexical/pull/6588
* [lexical-table][lexical-playground] Bug Fix: Fix merged cell related edge cases by @etrepum in https://github.com/facebook/lexical/pull/6607
* [lexical-code][breaking change] Bug Fix: explicitly import instead of `window.` to support code nodes in nodejs by @nadine-nguyen in https://github.com/facebook/lexical/pull/6562
* Multiple update tags by @zurfyx in https://github.com/facebook/lexical/pull/6507
* [lexical-playground] Fix: Poll Option not clickable at some place after checked state by @iamvinayvk in https://github.com/facebook/lexical/pull/6609
* [lexical-markdown] update markdown flow api by @potatowagon in https://github.com/facebook/lexical/pull/6615
* Expose getStyleObjectFromCss in @lexical/selection by @mofoshow in https://github.com/facebook/lexical/pull/6612
* [lexical-markdown] Fix: normalize markdown in $convertFromMarkdownString to comply with CommonMark spec by @GermanJablo in https://github.com/facebook/lexical/pull/6608
* [lexical] Chore: Add more helpful invariants to $applyNodeReplacement by @etrepum in https://github.com/facebook/lexical/pull/6567
* [lexical-markdown] Breaking Change: rename 'multilineElement' to 'multiline-element' by @potatowagon in https://github.com/facebook/lexical/pull/6617
* Bug Fix: Fix issue where selecting a cell then dragging outside of table would not select entire table by @moughxyz in https://github.com/facebook/lexical/pull/6579
* address micromatch vulnerability by @potatowagon in https://github.com/facebook/lexical/pull/6616
* CI: tag flaky test by @potatowagon in https://github.com/facebook/lexical/pull/6620
* [lexical-react] Refactor: Ensure disconnect is called after connection is established in useYjsCollaboration by @smworld01 in https://github.com/facebook/lexical/pull/6619
* Revert "[lexical-markdown] Fix: normalize markdown in $convertFromMarkdownString to comply with CommonMark spec (#6608)" by @potatowagon in https://github.com/facebook/lexical/pull/6627
* [lexical-playground] Bug Fix: Fix table row/column index when resizing merged cells by @patrick-atticus in https://github.com/facebook/lexical/pull/6630
* [lexical-markdown] Fix: normalize markdown in $convertFromMarkdownString to comply with CommonMark spec (2nd try) by @GermanJablo in https://github.com/facebook/lexical/pull/6629
* [lexical-table]  Bug: Table formatting and styling not persisting for empty cells by @KatsiarynaDzibrova in https://github.com/facebook/lexical/pull/6626
* [lexical-playground][ExcalidrawNode] Bug Fix: Preserve Excalidraw image dimensions after resizing by @neysanfoo in https://github.com/facebook/lexical/pull/6634
* [lexical-table][lexical-playground] Feature: Add column widths to TableNode by @patrick-atticus in https://github.com/facebook/lexical/pull/6625
* Grammar Issue - Repeated Word by @DocAdam in https://github.com/facebook/lexical/pull/6643
* Allow exporting a document fragment from the exportDOM function by @skopz356 in https://github.com/facebook/lexical/pull/6641
* [lexical-react][lexical-playground] Bug Fix: Workaround for yjs disconnect race in React StrictMode by @etrepum in https://github.com/facebook/lexical/pull/6644
* [lexical-code] Bug Fix: Annotate @lexical/code as having side-effects for Prism by @etrepum in https://github.com/facebook/lexical/pull/6652
* [lexical-markdown] shouldMergeAdjacentLines as an option by @potatowagon in https://github.com/facebook/lexical/pull/6642
* [lexical-playground] Bug Fix: empty code block not focused by @potatowagon in https://github.com/facebook/lexical/pull/6649
* [lexical-table] Bug Fix: Fix crash in $deleteCellHandler by @etrepum in https://github.com/facebook/lexical/pull/6650
* [lexical-markdown]: Refactor: allows omitting certain properties from TextMatchTransformers, adds jsdocs by @AlessioGr in https://github.com/facebook/lexical/pull/6651
* [lexical-playground] Bug Fix: Correct ExcalidrawNode DOM handling for proper resizing by @neysanfoo in https://github.com/facebook/lexical/pull/6657
* [lexical-link] Bug Fix: Removing a link from descendants by @levensta in https://github.com/facebook/lexical/pull/6656
* [lexical-markdown] set shouldMergeAdjacentLines default to be false  by @potatowagon in https://github.com/facebook/lexical/pull/6660
* Iterable $dfs by @zurfyx in https://github.com/facebook/lexical/pull/6664

## New Contributors
* @jkjk822 made their first contribution in https://github.com/facebook/lexical/pull/6560
* @iamvinayvk made their first contribution in https://github.com/facebook/lexical/pull/6609
* @mofoshow made their first contribution in https://github.com/facebook/lexical/pull/6612
* @smworld01 made their first contribution in https://github.com/facebook/lexical/pull/6619
* @patrick-atticus made their first contribution in https://github.com/facebook/lexical/pull/6630
* @neysanfoo made their first contribution in https://github.com/facebook/lexical/pull/6634
* @DocAdam made their first contribution in https://github.com/facebook/lexical/pull/6643
* @skopz356 made their first contribution in https://github.com/facebook/lexical/pull/6641
* @levensta made their first contribution in https://github.com/facebook/lexical/pull/6656

**Full Changelog**: https://github.com/facebook/lexical/compare/v0.17.1...v0.18.0