From 3e0d678a2e73c88fc0ee331df7d3c76df3c41eda Mon Sep 17 00:00:00 2001 From: johnnyjacobs Date: Mon, 29 Jul 2024 14:29:03 -0700 Subject: [PATCH 01/13] Move Transformer Groups from index to MarkdownTransformers Move transformer groups created in index.ts to MarkdownTransformers.ts, co-locating them with the member transformers and avoiding a cyclical dependency involving index.ts. --- .../lexical-markdown/src/MarkdownShortcuts.ts | 2 +- .../src/MarkdownTransformers.ts | 32 +++++++++++++++++ packages/lexical-markdown/src/index.ts | 36 +++---------------- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/packages/lexical-markdown/src/MarkdownShortcuts.ts b/packages/lexical-markdown/src/MarkdownShortcuts.ts index 0aee3292720..1ea0de02c34 100644 --- a/packages/lexical-markdown/src/MarkdownShortcuts.ts +++ b/packages/lexical-markdown/src/MarkdownShortcuts.ts @@ -26,7 +26,7 @@ import { } from 'lexical'; import invariant from 'shared/invariant'; -import {TRANSFORMERS} from '.'; +import {TRANSFORMERS} from './MarkdownTransformers'; import {indexBy, PUNCTUATION_OR_SPACE, transformersByType} from './utils'; function runElementTransformers( diff --git a/packages/lexical-markdown/src/MarkdownTransformers.ts b/packages/lexical-markdown/src/MarkdownTransformers.ts index ebc1b448dbc..11cd0ee0060 100644 --- a/packages/lexical-markdown/src/MarkdownTransformers.ts +++ b/packages/lexical-markdown/src/MarkdownTransformers.ts @@ -350,6 +350,14 @@ export const ITALIC_UNDERSCORE: TextFormatTransformer = { type: 'text-format', }; +export const ELEMENT_TRANSFORMERS: Array = [ + HEADING, + QUOTE, + CODE, + UNORDERED_LIST, + ORDERED_LIST, +]; + // Order of text transformers matters: // // - code should go first as it prevents any transformations inside @@ -388,3 +396,27 @@ export const LINK: TextMatchTransformer = { trigger: ')', type: 'text-match', }; + +// Order of text format transformers matters: +// +// - code should go first as it prevents any transformations inside +// - then longer tags match (e.g. ** or __ should go before * or _) +export const TEXT_FORMAT_TRANSFORMERS: Array = [ + INLINE_CODE, + BOLD_ITALIC_STAR, + BOLD_ITALIC_UNDERSCORE, + BOLD_STAR, + BOLD_UNDERSCORE, + HIGHLIGHT, + ITALIC_STAR, + ITALIC_UNDERSCORE, + STRIKETHROUGH, +]; + +export const TEXT_MATCH_TRANSFORMERS: Array = [LINK]; + +export const TRANSFORMERS: Array = [ + ...ELEMENT_TRANSFORMERS, + ...TEXT_FORMAT_TRANSFORMERS, + ...TEXT_MATCH_TRANSFORMERS, +]; diff --git a/packages/lexical-markdown/src/index.ts b/packages/lexical-markdown/src/index.ts index 32864bed542..1cb0c302a22 100644 --- a/packages/lexical-markdown/src/index.ts +++ b/packages/lexical-markdown/src/index.ts @@ -24,6 +24,7 @@ import { BOLD_UNDERSCORE, CHECK_LIST, CODE, + ELEMENT_TRANSFORMERS, HEADING, HIGHLIGHT, INLINE_CODE, @@ -33,41 +34,12 @@ import { ORDERED_LIST, QUOTE, STRIKETHROUGH, + TEXT_FORMAT_TRANSFORMERS, + TEXT_MATCH_TRANSFORMERS, + TRANSFORMERS, UNORDERED_LIST, } from './MarkdownTransformers'; -const ELEMENT_TRANSFORMERS: Array = [ - HEADING, - QUOTE, - CODE, - UNORDERED_LIST, - ORDERED_LIST, -]; - -// Order of text format transformers matters: -// -// - code should go first as it prevents any transformations inside -// - then longer tags match (e.g. ** or __ should go before * or _) -const TEXT_FORMAT_TRANSFORMERS: Array = [ - INLINE_CODE, - BOLD_ITALIC_STAR, - BOLD_ITALIC_UNDERSCORE, - BOLD_STAR, - BOLD_UNDERSCORE, - HIGHLIGHT, - ITALIC_STAR, - ITALIC_UNDERSCORE, - STRIKETHROUGH, -]; - -const TEXT_MATCH_TRANSFORMERS: Array = [LINK]; - -const TRANSFORMERS: Array = [ - ...ELEMENT_TRANSFORMERS, - ...TEXT_FORMAT_TRANSFORMERS, - ...TEXT_MATCH_TRANSFORMERS, -]; - /** * Renders markdown from a string. The selection is moved to the start after the operation. */ From 1f6a9b54f348fcfc69ccb7ab4d374de66a3e1747 Mon Sep 17 00:00:00 2001 From: Sherry Date: Wed, 31 Jul 2024 11:48:23 +0800 Subject: [PATCH 02/13] be in sync with www (#6478) --- packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow b/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow index 27cde072690..c04a612054f 100644 --- a/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow +++ b/packages/lexical-react/flow/LexicalDraggableBlockPlugin.js.flow @@ -10,7 +10,7 @@ import * as React from 'react'; type Props = $ReadOnly<{ - anchorElem?: HTMLElement, + anchorElem?: ?HTMLElement, menuRef: React.RefObject, targetLineRef: React.RefObject, menuComponent: React.Node, From ccdf27b142157149cc88f8d60664f48d4c779765 Mon Sep 17 00:00:00 2001 From: Sherry Date: Fri, 2 Aug 2024 00:19:52 +0800 Subject: [PATCH 03/13] v0.17.0 (#6487) Co-authored-by: Lexical GitHub Actions Bot <> --- CHANGELOG.md | 60 +++ examples/react-plain-text/package.json | 6 +- examples/react-rich-collab/package.json | 8 +- examples/react-rich/package.json | 6 +- examples/react-table/package.json | 6 +- examples/vanilla-js-plugin/package.json | 12 +- examples/vanilla-js/package.json | 12 +- package-lock.json | 434 ++++++++++---------- package.json | 2 +- packages/lexical-clipboard/package.json | 12 +- packages/lexical-code/package.json | 6 +- packages/lexical-devtools-core/package.json | 14 +- packages/lexical-devtools/package.json | 6 +- packages/lexical-dragon/package.json | 4 +- packages/lexical-eslint-plugin/package.json | 2 +- packages/lexical-file/package.json | 4 +- packages/lexical-hashtag/package.json | 6 +- packages/lexical-headless/package.json | 4 +- packages/lexical-history/package.json | 6 +- packages/lexical-html/package.json | 8 +- packages/lexical-link/package.json | 6 +- packages/lexical-list/package.json | 6 +- packages/lexical-mark/package.json | 6 +- packages/lexical-markdown/package.json | 16 +- packages/lexical-offset/package.json | 4 +- packages/lexical-overflow/package.json | 4 +- packages/lexical-plain-text/package.json | 10 +- packages/lexical-playground/package.json | 32 +- packages/lexical-react/package.json | 40 +- packages/lexical-rich-text/package.json | 10 +- packages/lexical-selection/package.json | 4 +- packages/lexical-table/package.json | 6 +- packages/lexical-text/package.json | 4 +- packages/lexical-utils/package.json | 10 +- packages/lexical-website/package.json | 2 +- packages/lexical-yjs/package.json | 6 +- packages/lexical/package.json | 2 +- packages/shared/package.json | 4 +- scripts/error-codes/codes.json | 8 +- 39 files changed, 432 insertions(+), 366 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7078f65936..975c9b20eb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,63 @@ +## v0.17.0 (2024-07-31) + +- LexicaCI run extended tests for safari in mac-os and chromefirefox in linuxwindows (#6466) Sahejkm +- lexical-table Bug Fix cannot delete content when a table inside selection (#6412) placeba +- LexicalCI Update canary e2e test os (#6465) Sahejkm +- CI tag flaky tests (#6462) Sherry +- lexical Bug Fix Allow getTopLevelElement to return a DecoratorNode (#6458) Bob Ippolito +- CI dont cancel other test runs if e2e flaky job fails (#6460) Sherry +- Flow add tags type to OnChange plugin (#6457) Gerard Rovira +- lexical-rich-text Bug Fix HeadingNode.insertNewAfter (#6435) Germn Jabloski +- lexical-react sync format in flow file (#6448) Sherry +- lexical Bug Fix getCachedTypeToNodeMap should handle a empty and writable EditorState (#6444) Bob Ippolito +- lexical lexical-selection Preserve paragraph styles between lines (#6437) Ivaylo Pavlov +- LexicalGallery Add tableplugin example to gallery (#6447) Sahejkm +- LexicalCI ignore running unitintegeritye2e tests on examples folder code (#6446) Sahejkm +- LexicalGallery Create Simple Tableplugin example (#6445) Sahejkm +- lexicalauto-link Fix auto link crash editor (#6433) Maksym Plavinskyi +- lexicallexical-selection Bug Fix Respect mode when patching text style (#6428) Adrian Busse +- lexical-historylexical-selectionlexical-react Fix #6409 TextNode change detection (#6420) Bob Ippolito +- lexical-playground Refactor run prettier to fix CI (#6436) Germn Jabloski +- fix(LexicalNode) fix inline decorator isSelected (#5948) Xuan +- lexical-playgroundTableCellResizer Bug Fix Register event handlers on root element (#6416) JBWereRuss +- lexical-react update flow typing for draggable block plugin (#6426) Sherry +- docs fix typo in editor.registerCommand() usage (#6429) Yangshun Tay +- fix(docs) correct typo in Lexical collaboration guide (#6421) Francois Polo +- Fix discrete nested updates (#6419) Gerard Rovira +- CI fix build failure on astro integration tests (#6414) wnhlee +- CI run flaky tests on firefox browsers (#6411) Sherry +- CI tag flaky tests (#6405) Sherry +- lexical-reactlexical-playground sync draggable block plugin to www (#6397) Sherry +- Fix transpile nodesOfType (#6408) Gerard Rovira +- Restore registerRootListener null call (#6403) Gerard Rovira +- Add ref to contenteditable (#6381) Gerard Rovira +- lexical Feature registerMutationListener should initialize its existing nodes (#6357) Bob Ippolito +- lexical Feature Implement Editor.read and EditorState.read with editor argument (#6347) Bob Ippolito +- lexical Bug Fix more accurate line break pasting (#6395) Sherry +- lexical-html Feature support pasting empty block nodes (#6392) Sherry +- lexical-playgroundlexical-table Bug Fix Fix Shift Down Arrow regression for table sequence. (#6393) Serey Roth +- Gallery Add option to filter plugins based on tags (#6391) Sahejkm +- Fix clear rootElement on React (#6389) Gerard Rovira +- CI tag flaky tests (#6388) Sherry +- Prettier sort test attributes (#6384) Gerard Rovira +- Fix integrity test (#6385) Gerard Rovira +- LexicalGallery Convert files to follow typescript (#6383) Sahejkm +- lexicallexical-playground Bug Fix Create line break on paste of content type texthtml (#6376) Janna Wieneke +- examples Chore Use named export of LexicalErrorBoundary in the examples (#6378) Bob Ippolito +- LexicalGallery Add option to search examples in the gallery (#6379) Sahejkm +- lexical-playground Fix Table Hover Actions Noclick Bug (#6375) Ivaylo Pavlov +- Lexical Fix flow errors on syncing build to meta intern (#6373) Sahejkm +- rexical-react Bug Fix Headings inside collapsible sections are lost when Table of Contents is re-initialized (#6371) Katsia +- LexicalGallery Add description in the card, option to render preview card at run time if no image (#6372) Sahejkm +- Lexical Create initial Gallery View with Emoji Plugin Example (#6369) Sahejkm +- CI run e2e flaky tests in a separate job (#6365) Sherry +- Make placeholder accessible (#6171) Gerard Rovira +- lexical-playground Table Hover Action Buttons (#6355) Ivaylo Pavlov +- lexicallexical-table Chore Replace references to old GridSelection with TableSelection (#6366) Bob Ippolito +- lexical-markdown Feature Change Dont trim whitespaces on convertFromMarkdownString (#6360) Sherry +- v0.16.1 (#6363) Ivaylo Pavlov +- v0.16.1 Lexical GitHub Actions Bot + ## v0.16.1 (2024-07-01) - lexical-playgroundlexical-poll Bug Fix Fixes undefined context inside Poll add option (#6361) Roman Lyubimov diff --git a/examples/react-plain-text/package.json b/examples/react-plain-text/package.json index 0a4ca6ae021..fc31de898a8 100644 --- a/examples/react-plain-text/package.json +++ b/examples/react-plain-text/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/react-plain-text-example", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "vite", @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "@lexical/react": "0.16.1", - "lexical": "0.16.1", + "@lexical/react": "0.17.0", + "lexical": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/examples/react-rich-collab/package.json b/examples/react-rich-collab/package.json index 9d828758c6f..b9a8b8cde8f 100644 --- a/examples/react-rich-collab/package.json +++ b/examples/react-rich-collab/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/react-rich-collab-example", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "vite", @@ -12,9 +12,9 @@ "server:webrtc": "cross-env HOST=localhost PORT=1235 npx y-webrtc" }, "dependencies": { - "@lexical/react": "0.16.1", - "@lexical/yjs": "0.16.1", - "lexical": "0.16.1", + "@lexical/react": "0.17.0", + "@lexical/yjs": "0.17.0", + "lexical": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0", "y-webrtc": "^10.3.0", diff --git a/examples/react-rich/package.json b/examples/react-rich/package.json index 768c8220e4e..5dbda0fd5db 100644 --- a/examples/react-rich/package.json +++ b/examples/react-rich/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/react-rich-example", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "vite", @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "@lexical/react": "0.16.1", - "lexical": "0.16.1", + "@lexical/react": "0.17.0", + "lexical": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/examples/react-table/package.json b/examples/react-table/package.json index edc114ec39d..20deb65f206 100644 --- a/examples/react-table/package.json +++ b/examples/react-table/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/react-table-example", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "vite", @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "@lexical/react": "0.16.1", - "lexical": "0.16.1", + "@lexical/react": "0.17.0", + "lexical": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/examples/vanilla-js-plugin/package.json b/examples/vanilla-js-plugin/package.json index d1a2b25c728..370684b5f36 100644 --- a/examples/vanilla-js-plugin/package.json +++ b/examples/vanilla-js-plugin/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/vanilla-js-plugin-example", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "vite", @@ -9,12 +9,12 @@ "preview": "vite preview" }, "dependencies": { - "@lexical/dragon": "0.16.1", - "@lexical/history": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/utils": "0.16.1", + "@lexical/dragon": "0.17.0", + "@lexical/history": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/utils": "0.17.0", "emoji-datasource-facebook": "15.1.2", - "lexical": "0.16.1" + "lexical": "0.17.0" }, "devDependencies": { "typescript": "^5.2.2", diff --git a/examples/vanilla-js/package.json b/examples/vanilla-js/package.json index e6a15cc5e1d..871e5fd7aa8 100644 --- a/examples/vanilla-js/package.json +++ b/examples/vanilla-js/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/vanilla-js-example", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "vite", @@ -9,11 +9,11 @@ "preview": "vite preview" }, "dependencies": { - "@lexical/dragon": "0.16.1", - "@lexical/history": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/dragon": "0.17.0", + "@lexical/history": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "devDependencies": { "typescript": "^5.2.2", diff --git a/package-lock.json b/package-lock.json index 03a6d93a2ce..4f248e3ac2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lexical/monorepo", - "version": "0.16.1", + "version": "0.17.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lexical/monorepo", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "workspaces": [ "packages/*" @@ -36267,28 +36267,28 @@ } }, "packages/lexical": { - "version": "0.16.1", + "version": "0.17.0", "license": "MIT" }, "packages/lexical-clipboard": { "name": "@lexical/clipboard", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/html": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/html": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-code": { "name": "@lexical/code", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0", "prismjs": "^1.27.0" }, "devDependencies": { @@ -36297,7 +36297,7 @@ }, "packages/lexical-devtools": { "name": "@lexical/devtools", - "version": "0.16.1", + "version": "0.17.0", "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^2.8.2", @@ -36314,12 +36314,12 @@ "devDependencies": { "@babel/plugin-transform-flow-strip-types": "^7.24.7", "@babel/preset-react": "^7.24.7", - "@lexical/devtools-core": "0.16.1", + "@lexical/devtools-core": "0.17.0", "@rollup/plugin-babel": "^6.0.4", "@types/react": "^18.2.46", "@types/react-dom": "^18.2.18", "@vitejs/plugin-react": "^4.2.1", - "lexical": "0.16.1", + "lexical": "0.17.0", "typescript": "^5.4.5", "vite": "^5.2.2", "wxt": "^0.17.0" @@ -36327,15 +36327,15 @@ }, "packages/lexical-devtools-core": { "name": "@lexical/devtools-core", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/html": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/html": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "peerDependencies": { "react": ">=17.x", @@ -36344,15 +36344,15 @@ }, "packages/lexical-dragon": { "name": "@lexical/dragon", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-eslint-plugin": { "name": "@lexical/eslint-plugin", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "devDependencies": { "@types/eslint": "^8.56.9" @@ -36363,136 +36363,136 @@ }, "packages/lexical-file": { "name": "@lexical/file", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-hashtag": { "name": "@lexical/hashtag", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-headless": { "name": "@lexical/headless", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-history": { "name": "@lexical/history", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-html": { "name": "@lexical/html", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-link": { "name": "@lexical/link", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-list": { "name": "@lexical/list", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-mark": { "name": "@lexical/mark", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-markdown": { "name": "@lexical/markdown", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/code": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/text": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/code": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/text": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-offset": { "name": "@lexical/offset", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-overflow": { "name": "@lexical/overflow", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-plain-text": { "name": "@lexical/plain-text", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/clipboard": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/clipboard": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-playground": { - "version": "0.16.1", + "version": "0.17.0", "dependencies": { "@excalidraw/excalidraw": "^0.17.0", - "@lexical/clipboard": "0.16.1", - "@lexical/code": "0.16.1", - "@lexical/file": "0.16.1", - "@lexical/hashtag": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/overflow": "0.16.1", - "@lexical/plain-text": "0.16.1", - "@lexical/react": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/utils": "0.16.1", + "@lexical/clipboard": "0.17.0", + "@lexical/code": "0.17.0", + "@lexical/file": "0.17.0", + "@lexical/hashtag": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/overflow": "0.17.0", + "@lexical/plain-text": "0.17.0", + "@lexical/react": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/utils": "0.17.0", "katex": "^0.16.10", - "lexical": "0.16.1", + "lexical": "0.17.0", "lodash-es": "^4.17.21", "prettier": "^2.3.2", "react": "^18.2.0", @@ -36515,28 +36515,28 @@ }, "packages/lexical-react": { "name": "@lexical/react", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/clipboard": "0.16.1", - "@lexical/code": "0.16.1", - "@lexical/devtools-core": "0.16.1", - "@lexical/dragon": "0.16.1", - "@lexical/hashtag": "0.16.1", - "@lexical/history": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/markdown": "0.16.1", - "@lexical/overflow": "0.16.1", - "@lexical/plain-text": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/text": "0.16.1", - "@lexical/utils": "0.16.1", - "@lexical/yjs": "0.16.1", - "lexical": "0.16.1", + "@lexical/clipboard": "0.17.0", + "@lexical/code": "0.17.0", + "@lexical/devtools-core": "0.17.0", + "@lexical/dragon": "0.17.0", + "@lexical/hashtag": "0.17.0", + "@lexical/history": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/markdown": "0.17.0", + "@lexical/overflow": "0.17.0", + "@lexical/plain-text": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/text": "0.17.0", + "@lexical/utils": "0.17.0", + "@lexical/yjs": "0.17.0", + "lexical": "0.17.0", "react-error-boundary": "^3.1.4" }, "peerDependencies": { @@ -36546,54 +36546,54 @@ }, "packages/lexical-rich-text": { "name": "@lexical/rich-text", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/clipboard": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/clipboard": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-selection": { "name": "@lexical/selection", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-table": { "name": "@lexical/table", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-text": { "name": "@lexical/text", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "packages/lexical-utils": { "name": "@lexical/utils", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/list": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "lexical": "0.16.1" + "@lexical/list": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "lexical": "0.17.0" } }, "packages/lexical-website": { "name": "@lexical/website", - "version": "0.16.1", + "version": "0.17.0", "dependencies": { "@docusaurus/core": "^3.3.2", "@docusaurus/preset-classic": "^3.3.2", @@ -36622,11 +36622,11 @@ }, "packages/lexical-yjs": { "name": "@lexical/yjs", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "@lexical/offset": "0.16.1", - "lexical": "0.16.1" + "@lexical/offset": "0.17.0", + "lexical": "0.17.0" }, "peerDependencies": { "yjs": ">=13.5.22" @@ -36659,10 +36659,10 @@ } }, "packages/shared": { - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } }, @@ -40987,19 +40987,19 @@ "@lexical/clipboard": { "version": "file:packages/lexical-clipboard", "requires": { - "@lexical/html": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/html": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/code": { "version": "file:packages/lexical-code", "requires": { - "@lexical/utils": "0.16.1", + "@lexical/utils": "0.17.0", "@types/prismjs": "^1.26.0", - "lexical": "0.16.1", + "lexical": "0.17.0", "prismjs": "^1.27.0" } }, @@ -41011,7 +41011,7 @@ "@chakra-ui/react": "^2.8.2", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", - "@lexical/devtools-core": "0.16.1", + "@lexical/devtools-core": "0.17.0", "@rollup/plugin-babel": "^6.0.4", "@types/react": "^18.2.46", "@types/react-dom": "^18.2.18", @@ -41020,7 +41020,7 @@ "@webext-pegasus/store-zustand": "^0.3.0", "@webext-pegasus/transport": "^0.3.0", "framer-motion": "^11.1.5", - "lexical": "0.16.1", + "lexical": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0", "typescript": "^5.4.5", @@ -41032,18 +41032,18 @@ "@lexical/devtools-core": { "version": "file:packages/lexical-devtools-core", "requires": { - "@lexical/html": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/html": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/dragon": { "version": "file:packages/lexical-dragon", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/eslint-plugin": { @@ -41055,151 +41055,151 @@ "@lexical/file": { "version": "file:packages/lexical-file", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/hashtag": { "version": "file:packages/lexical-hashtag", "requires": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/headless": { "version": "file:packages/lexical-headless", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/history": { "version": "file:packages/lexical-history", "requires": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/html": { "version": "file:packages/lexical-html", "requires": { - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/link": { "version": "file:packages/lexical-link", "requires": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/list": { "version": "file:packages/lexical-list", "requires": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/mark": { "version": "file:packages/lexical-mark", "requires": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/markdown": { "version": "file:packages/lexical-markdown", "requires": { - "@lexical/code": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/text": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/code": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/text": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/offset": { "version": "file:packages/lexical-offset", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/overflow": { "version": "file:packages/lexical-overflow", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/plain-text": { "version": "file:packages/lexical-plain-text", "requires": { - "@lexical/clipboard": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/clipboard": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/react": { "version": "file:packages/lexical-react", "requires": { - "@lexical/clipboard": "0.16.1", - "@lexical/code": "0.16.1", - "@lexical/devtools-core": "0.16.1", - "@lexical/dragon": "0.16.1", - "@lexical/hashtag": "0.16.1", - "@lexical/history": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/markdown": "0.16.1", - "@lexical/overflow": "0.16.1", - "@lexical/plain-text": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/text": "0.16.1", - "@lexical/utils": "0.16.1", - "@lexical/yjs": "0.16.1", - "lexical": "0.16.1", + "@lexical/clipboard": "0.17.0", + "@lexical/code": "0.17.0", + "@lexical/devtools-core": "0.17.0", + "@lexical/dragon": "0.17.0", + "@lexical/hashtag": "0.17.0", + "@lexical/history": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/markdown": "0.17.0", + "@lexical/overflow": "0.17.0", + "@lexical/plain-text": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/text": "0.17.0", + "@lexical/utils": "0.17.0", + "@lexical/yjs": "0.17.0", + "lexical": "0.17.0", "react-error-boundary": "^3.1.4" } }, "@lexical/rich-text": { "version": "file:packages/lexical-rich-text", "requires": { - "@lexical/clipboard": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/clipboard": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/selection": { "version": "file:packages/lexical-selection", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/table": { "version": "file:packages/lexical-table", "requires": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/text": { "version": "file:packages/lexical-text", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "@lexical/utils": { "version": "file:packages/lexical-utils", "requires": { - "@lexical/list": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "lexical": "0.16.1" + "@lexical/list": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "lexical": "0.17.0" } }, "@lexical/website": { @@ -41231,8 +41231,8 @@ "@lexical/yjs": { "version": "file:packages/lexical-yjs", "requires": { - "@lexical/offset": "0.16.1", - "lexical": "0.16.1" + "@lexical/offset": "0.17.0", + "lexical": "0.17.0" } }, "@mdx-js/mdx": { @@ -52952,26 +52952,26 @@ "@babel/plugin-transform-flow-strip-types": "^7.24.7", "@babel/preset-react": "^7.24.7", "@excalidraw/excalidraw": "^0.17.0", - "@lexical/clipboard": "0.16.1", - "@lexical/code": "0.16.1", - "@lexical/file": "0.16.1", - "@lexical/hashtag": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/overflow": "0.16.1", - "@lexical/plain-text": "0.16.1", - "@lexical/react": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/utils": "0.16.1", + "@lexical/clipboard": "0.17.0", + "@lexical/code": "0.17.0", + "@lexical/file": "0.17.0", + "@lexical/hashtag": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/overflow": "0.17.0", + "@lexical/plain-text": "0.17.0", + "@lexical/react": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/utils": "0.17.0", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-commonjs": "^25.0.7", "@types/lodash-es": "^4.14.182", "@vitejs/plugin-react": "^4.2.1", "katex": "^0.16.10", - "lexical": "0.16.1", + "lexical": "0.17.0", "lodash-es": "^4.17.21", "prettier": "^2.3.2", "react": "^18.2.0", @@ -58853,7 +58853,7 @@ "shared": { "version": "file:packages/shared", "requires": { - "lexical": "0.16.1" + "lexical": "0.17.0" } }, "shebang-command": { diff --git a/package.json b/package.json index 064d5d288d6..0a60a5f1659 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@lexical/monorepo", "description": "Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.", - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "private": true, "workspaces": [ diff --git a/packages/lexical-clipboard/package.json b/packages/lexical-clipboard/package.json index 9acd6f83dc8..6a79bbcfdf6 100644 --- a/packages/lexical-clipboard/package.json +++ b/packages/lexical-clipboard/package.json @@ -9,15 +9,15 @@ "paste" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalClipboard.js", "types": "index.d.ts", "dependencies": { - "@lexical/html": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/html": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-code/package.json b/packages/lexical-code/package.json index f46d9103de8..8e27fd6547f 100644 --- a/packages/lexical-code/package.json +++ b/packages/lexical-code/package.json @@ -8,12 +8,12 @@ "code" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalCode.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0", "prismjs": "^1.27.0" }, "repository": { diff --git a/packages/lexical-devtools-core/package.json b/packages/lexical-devtools-core/package.json index de4f9ddada5..a0eb2c427db 100644 --- a/packages/lexical-devtools-core/package.json +++ b/packages/lexical-devtools-core/package.json @@ -8,16 +8,16 @@ "utils" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalDevtoolsCore.js", "types": "index.d.ts", "dependencies": { - "@lexical/html": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/html": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "peerDependencies": { "react": ">=17.x", diff --git a/packages/lexical-devtools/package.json b/packages/lexical-devtools/package.json index d7b03ecc1a8..b2bb5da5af0 100644 --- a/packages/lexical-devtools/package.json +++ b/packages/lexical-devtools/package.json @@ -2,7 +2,7 @@ "name": "@lexical/devtools", "description": "Lexical DevTools browser extension", "private": true, - "version": "0.16.1", + "version": "0.17.0", "type": "module", "scripts": { "dev": "wxt", @@ -41,12 +41,12 @@ "devDependencies": { "@babel/plugin-transform-flow-strip-types": "^7.24.7", "@babel/preset-react": "^7.24.7", - "@lexical/devtools-core": "0.16.1", + "@lexical/devtools-core": "0.17.0", "@rollup/plugin-babel": "^6.0.4", "@types/react": "^18.2.46", "@types/react-dom": "^18.2.18", "@vitejs/plugin-react": "^4.2.1", - "lexical": "0.16.1", + "lexical": "0.17.0", "typescript": "^5.4.5", "vite": "^5.2.2", "wxt": "^0.17.0" diff --git a/packages/lexical-dragon/package.json b/packages/lexical-dragon/package.json index e14971d7469..e9e276358b1 100644 --- a/packages/lexical-dragon/package.json +++ b/packages/lexical-dragon/package.json @@ -9,7 +9,7 @@ "accessibility" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalDragon.js", "types": "index.d.ts", "repository": { @@ -37,6 +37,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-eslint-plugin/package.json b/packages/lexical-eslint-plugin/package.json index 43b5b7a4421..265dabcafe3 100644 --- a/packages/lexical-eslint-plugin/package.json +++ b/packages/lexical-eslint-plugin/package.json @@ -8,7 +8,7 @@ "lexical", "editor" ], - "version": "0.16.1", + "version": "0.17.0", "license": "MIT", "repository": { "type": "git", diff --git a/packages/lexical-file/package.json b/packages/lexical-file/package.json index 5c1a005785b..1cbc2b4d8d8 100644 --- a/packages/lexical-file/package.json +++ b/packages/lexical-file/package.json @@ -10,7 +10,7 @@ "export" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalFile.js", "types": "index.d.ts", "repository": { @@ -38,6 +38,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-hashtag/package.json b/packages/lexical-hashtag/package.json index 6889fb2a4dd..784622d7830 100644 --- a/packages/lexical-hashtag/package.json +++ b/packages/lexical-hashtag/package.json @@ -8,12 +8,12 @@ "hashtag" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalHashtag.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-headless/package.json b/packages/lexical-headless/package.json index 33f8d3a145b..4b651029d17 100644 --- a/packages/lexical-headless/package.json +++ b/packages/lexical-headless/package.json @@ -8,7 +8,7 @@ "headless" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalHeadless.js", "types": "index.d.ts", "repository": { @@ -36,6 +36,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-history/package.json b/packages/lexical-history/package.json index 880e13410b8..acb4e60bed2 100644 --- a/packages/lexical-history/package.json +++ b/packages/lexical-history/package.json @@ -8,12 +8,12 @@ "history" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalHistory.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-html/package.json b/packages/lexical-html/package.json index a5b415592a8..14c5da6f845 100644 --- a/packages/lexical-html/package.json +++ b/packages/lexical-html/package.json @@ -8,7 +8,7 @@ "html" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalHtml.js", "types": "index.d.ts", "repository": { @@ -17,9 +17,9 @@ "directory": "packages/lexical-html" }, "dependencies": { - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "module": "LexicalHtml.mjs", "sideEffects": false, diff --git a/packages/lexical-link/package.json b/packages/lexical-link/package.json index a39f3055338..34730f514a9 100644 --- a/packages/lexical-link/package.json +++ b/packages/lexical-link/package.json @@ -8,12 +8,12 @@ "link" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalLink.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-list/package.json b/packages/lexical-list/package.json index 3f7cfd2f323..b2b085f279b 100644 --- a/packages/lexical-list/package.json +++ b/packages/lexical-list/package.json @@ -8,12 +8,12 @@ "list" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalList.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-mark/package.json b/packages/lexical-mark/package.json index 95e5c2d938d..f3705f4274f 100644 --- a/packages/lexical-mark/package.json +++ b/packages/lexical-mark/package.json @@ -8,12 +8,12 @@ "mark" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalMark.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-markdown/package.json b/packages/lexical-markdown/package.json index 2fbdf7c53d0..b866034b957 100644 --- a/packages/lexical-markdown/package.json +++ b/packages/lexical-markdown/package.json @@ -8,17 +8,17 @@ "markdown" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalMarkdown.js", "types": "index.d.ts", "dependencies": { - "@lexical/code": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/text": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/code": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/text": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-offset/package.json b/packages/lexical-offset/package.json index 7e757fc2e6f..d7ef4445bb0 100644 --- a/packages/lexical-offset/package.json +++ b/packages/lexical-offset/package.json @@ -8,7 +8,7 @@ "offset" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalOffset.js", "types": "index.d.ts", "repository": { @@ -36,6 +36,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-overflow/package.json b/packages/lexical-overflow/package.json index c3702bf3497..d908bead1f2 100644 --- a/packages/lexical-overflow/package.json +++ b/packages/lexical-overflow/package.json @@ -8,7 +8,7 @@ "overflow" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalOverflow.js", "types": "index.d.ts", "repository": { @@ -36,6 +36,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-plain-text/package.json b/packages/lexical-plain-text/package.json index c828fb5e8e7..554107f5bd5 100644 --- a/packages/lexical-plain-text/package.json +++ b/packages/lexical-plain-text/package.json @@ -7,7 +7,7 @@ "plain-text" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalPlainText.js", "types": "index.d.ts", "repository": { @@ -35,9 +35,9 @@ } }, "dependencies": { - "@lexical/clipboard": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/clipboard": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } } diff --git a/packages/lexical-playground/package.json b/packages/lexical-playground/package.json index 9efce56f468..066a66037f5 100644 --- a/packages/lexical-playground/package.json +++ b/packages/lexical-playground/package.json @@ -1,6 +1,6 @@ { "name": "lexical-playground", - "version": "0.16.1", + "version": "0.17.0", "private": true, "type": "module", "scripts": { @@ -12,22 +12,22 @@ }, "dependencies": { "@excalidraw/excalidraw": "^0.17.0", - "@lexical/clipboard": "0.16.1", - "@lexical/code": "0.16.1", - "@lexical/file": "0.16.1", - "@lexical/hashtag": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/overflow": "0.16.1", - "@lexical/plain-text": "0.16.1", - "@lexical/react": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/utils": "0.16.1", + "@lexical/clipboard": "0.17.0", + "@lexical/code": "0.17.0", + "@lexical/file": "0.17.0", + "@lexical/hashtag": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/overflow": "0.17.0", + "@lexical/plain-text": "0.17.0", + "@lexical/react": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/utils": "0.17.0", "katex": "^0.16.10", - "lexical": "0.16.1", + "lexical": "0.17.0", "lodash-es": "^4.17.21", "prettier": "^2.3.2", "react": "^18.2.0", diff --git a/packages/lexical-react/package.json b/packages/lexical-react/package.json index a95ba4ed46a..7afe294bcac 100644 --- a/packages/lexical-react/package.json +++ b/packages/lexical-react/package.json @@ -8,27 +8,27 @@ "rich-text" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "dependencies": { - "@lexical/clipboard": "0.16.1", - "@lexical/code": "0.16.1", - "@lexical/devtools-core": "0.16.1", - "@lexical/dragon": "0.16.1", - "@lexical/hashtag": "0.16.1", - "@lexical/history": "0.16.1", - "@lexical/link": "0.16.1", - "@lexical/list": "0.16.1", - "@lexical/mark": "0.16.1", - "@lexical/markdown": "0.16.1", - "@lexical/overflow": "0.16.1", - "@lexical/plain-text": "0.16.1", - "@lexical/rich-text": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "@lexical/text": "0.16.1", - "@lexical/utils": "0.16.1", - "@lexical/yjs": "0.16.1", - "lexical": "0.16.1", + "@lexical/clipboard": "0.17.0", + "@lexical/code": "0.17.0", + "@lexical/devtools-core": "0.17.0", + "@lexical/dragon": "0.17.0", + "@lexical/hashtag": "0.17.0", + "@lexical/history": "0.17.0", + "@lexical/link": "0.17.0", + "@lexical/list": "0.17.0", + "@lexical/mark": "0.17.0", + "@lexical/markdown": "0.17.0", + "@lexical/overflow": "0.17.0", + "@lexical/plain-text": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "@lexical/text": "0.17.0", + "@lexical/utils": "0.17.0", + "@lexical/yjs": "0.17.0", + "lexical": "0.17.0", "react-error-boundary": "^3.1.4" }, "peerDependencies": { diff --git a/packages/lexical-rich-text/package.json b/packages/lexical-rich-text/package.json index 974ac9ac271..64efaa0958b 100644 --- a/packages/lexical-rich-text/package.json +++ b/packages/lexical-rich-text/package.json @@ -7,7 +7,7 @@ "rich-text" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalRichText.js", "types": "index.d.ts", "repository": { @@ -35,9 +35,9 @@ } }, "dependencies": { - "@lexical/clipboard": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/clipboard": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" } } diff --git a/packages/lexical-selection/package.json b/packages/lexical-selection/package.json index 9bb166ca69f..6a797221998 100644 --- a/packages/lexical-selection/package.json +++ b/packages/lexical-selection/package.json @@ -9,7 +9,7 @@ "selection" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalSelection.js", "types": "index.d.ts", "repository": { @@ -37,6 +37,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-table/package.json b/packages/lexical-table/package.json index 15130de8f14..fdef1dd4887 100644 --- a/packages/lexical-table/package.json +++ b/packages/lexical-table/package.json @@ -8,12 +8,12 @@ "table" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalTable.js", "types": "index.d.ts", "dependencies": { - "@lexical/utils": "0.16.1", - "lexical": "0.16.1" + "@lexical/utils": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-text/package.json b/packages/lexical-text/package.json index 4af8eda68f0..09aa1528aa9 100644 --- a/packages/lexical-text/package.json +++ b/packages/lexical-text/package.json @@ -9,7 +9,7 @@ "text" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalText.js", "types": "index.d.ts", "repository": { @@ -37,6 +37,6 @@ } }, "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" } } diff --git a/packages/lexical-utils/package.json b/packages/lexical-utils/package.json index 7e9be44f97f..4f3f899ef2f 100644 --- a/packages/lexical-utils/package.json +++ b/packages/lexical-utils/package.json @@ -8,14 +8,14 @@ "utils" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalUtils.js", "types": "index.d.ts", "dependencies": { - "@lexical/list": "0.16.1", - "@lexical/selection": "0.16.1", - "@lexical/table": "0.16.1", - "lexical": "0.16.1" + "@lexical/list": "0.17.0", + "@lexical/selection": "0.17.0", + "@lexical/table": "0.17.0", + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/packages/lexical-website/package.json b/packages/lexical-website/package.json index faa240ad640..568e8e44931 100644 --- a/packages/lexical-website/package.json +++ b/packages/lexical-website/package.json @@ -1,6 +1,6 @@ { "name": "@lexical/website", - "version": "0.16.1", + "version": "0.17.0", "private": true, "scripts": { "docusaurus": "docusaurus", diff --git a/packages/lexical-yjs/package.json b/packages/lexical-yjs/package.json index b331a442e2c..2df54014c08 100644 --- a/packages/lexical-yjs/package.json +++ b/packages/lexical-yjs/package.json @@ -11,12 +11,12 @@ "crdt" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "LexicalYjs.js", "types": "index.d.ts", "dependencies": { - "@lexical/offset": "0.16.1", - "lexical": "0.16.1" + "@lexical/offset": "0.17.0", + "lexical": "0.17.0" }, "peerDependencies": { "yjs": ">=13.5.22" diff --git a/packages/lexical/package.json b/packages/lexical/package.json index c6381e0cead..f3ca77bb732 100644 --- a/packages/lexical/package.json +++ b/packages/lexical/package.json @@ -9,7 +9,7 @@ "rich-text" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "main": "Lexical.js", "types": "index.d.ts", "repository": { diff --git a/packages/shared/package.json b/packages/shared/package.json index 0e83cbd6d06..e1acff658d3 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -8,9 +8,9 @@ "rich-text" ], "license": "MIT", - "version": "0.16.1", + "version": "0.17.0", "dependencies": { - "lexical": "0.16.1" + "lexical": "0.17.0" }, "repository": { "type": "git", diff --git a/scripts/error-codes/codes.json b/scripts/error-codes/codes.json index 9663b42e464..74daa5f1314 100644 --- a/scripts/error-codes/codes.json +++ b/scripts/error-codes/codes.json @@ -187,5 +187,11 @@ "185": "%s doesn't extend the %s", "186": "Lexical node with constructor %s attempted to re-use key from node in active editor state with constructor %s. Keys must not be re-used when the type is changed.", "187": "Lexical node with constructor %s attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.", - "188": "Expected a RangeSelection or TableSelection" + "188": "Expected a RangeSelection or TableSelection", + "189": "Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update(), editor.read(), or editorState.read().", + "190": "Unable to find an active editor. This method can only be used synchronously during the callback of editor.update() or editor.read().", + "191": "Unexpected empty pending editor state on discrete nested update", + "192": "getCachedTypeToNodeMap called with a writable EditorState", + "193": "$cloneWithProperties: %s.clone(node) (with type '%s') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor", + "194": "Children of root nodes must be elements or decorators" } From 4888de2a71d0628fd65c066c1b27ceb1f56589a6 Mon Sep 17 00:00:00 2001 From: Evgeny Vorobyev Date: Thu, 1 Aug 2024 18:20:07 -0500 Subject: [PATCH 04/13] [lexical-table] Bug Fix: Enable observer updates on table elements attributes change (#6479) --- packages/lexical-table/src/LexicalTableObserver.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/lexical-table/src/LexicalTableObserver.ts b/packages/lexical-table/src/LexicalTableObserver.ts index 33a0a6f427e..4b917e090a0 100644 --- a/packages/lexical-table/src/LexicalTableObserver.ts +++ b/packages/lexical-table/src/LexicalTableObserver.ts @@ -151,6 +151,7 @@ export class TableObserver { this.table = getTable(tableElement); observer.observe(tableElement, { + attributes: true, childList: true, subtree: true, }); From e0d66b15f0635f40b0976329c5aeefdf41063074 Mon Sep 17 00:00:00 2001 From: wnhlee <40269597+2wheeh@users.noreply.github.com> Date: Sat, 3 Aug 2024 04:06:45 +0900 Subject: [PATCH 05/13] [lexical] Bug Fix: Merge pasted paragraph into empty quote (#6367) Co-authored-by: Bob Ippolito --- .../lexical-list/src/LexicalListItemNode.ts | 4 +++ .../lexical/CopyAndPaste.spec.mjs | 33 +++++++++++++++++++ packages/lexical-rich-text/src/index.ts | 4 +++ packages/lexical/src/LexicalSelection.ts | 6 ++-- .../lexical/src/nodes/LexicalElementNode.ts | 17 ++++++++++ 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/packages/lexical-list/src/LexicalListItemNode.ts b/packages/lexical-list/src/LexicalListItemNode.ts index d07e6ac2f7f..72b9ac1b612 100644 --- a/packages/lexical-list/src/LexicalListItemNode.ts +++ b/packages/lexical-list/src/LexicalListItemNode.ts @@ -404,6 +404,10 @@ export class ListItemNode extends ElementNode { createParentElementNode(): ElementNode { return $createListNode('bullet'); } + + canMergeWhenEmpty(): true { + return true; + } } function $setListItemThemeClassNames( diff --git a/packages/lexical-playground/__tests__/e2e/CopyAndPaste/lexical/CopyAndPaste.spec.mjs b/packages/lexical-playground/__tests__/e2e/CopyAndPaste/lexical/CopyAndPaste.spec.mjs index aa05e3a0a18..161d5792eb2 100644 --- a/packages/lexical-playground/__tests__/e2e/CopyAndPaste/lexical/CopyAndPaste.spec.mjs +++ b/packages/lexical-playground/__tests__/e2e/CopyAndPaste/lexical/CopyAndPaste.spec.mjs @@ -914,4 +914,37 @@ test.describe('CopyAndPaste', () => { `, ); }); + + test('Copy and paste paragraph into quote', async ({page, isPlainText}) => { + test.skip(isPlainText); + await focusEditor(page); + + await page.keyboard.type('Hello world'); + await page.keyboard.press('Enter'); + await page.keyboard.type('Some text'); + + await selectAll(page); + + const clipboard = await copyToClipboard(page); + + await page.keyboard.type('> '); + + await pasteFromClipboard(page, clipboard); + + await assertHTML( + page, + html` +
+ Hello world +
+

+ Some text +

+ `, + ); + }); }); diff --git a/packages/lexical-rich-text/src/index.ts b/packages/lexical-rich-text/src/index.ts index 9bbbc18d46b..fbf9f53b0ec 100644 --- a/packages/lexical-rich-text/src/index.ts +++ b/packages/lexical-rich-text/src/index.ts @@ -202,6 +202,10 @@ export class QuoteNode extends ElementNode { this.replace(paragraph); return true; } + + canMergeWhenEmpty(): true { + return true; + } } export function $createQuoteNode(): QuoteNode { diff --git a/packages/lexical/src/LexicalSelection.ts b/packages/lexical/src/LexicalSelection.ts index 64fe30607f4..8ffe35923c3 100644 --- a/packages/lexical/src/LexicalSelection.ts +++ b/packages/lexical/src/LexicalSelection.ts @@ -1255,14 +1255,12 @@ export class RangeSelection implements BaseSelection { const blocksParent = $wrapInlineNodes(nodes); const nodeToSelect = blocksParent.getLastDescendant()!; const blocks = blocksParent.getChildren(); - const isLI = (node: LexicalNode) => - '__value' in node && '__checked' in node; const isMergeable = (node: LexicalNode): node is ElementNode => $isElementNode(node) && INTERNAL_$isBlock(node) && !node.isEmpty() && $isElementNode(firstBlock) && - (!firstBlock.isEmpty() || isLI(firstBlock)); + (!firstBlock.isEmpty() || firstBlock.canMergeWhenEmpty()); const shouldInsert = !$isElementNode(firstBlock) || !firstBlock.isEmpty(); const insertedParagraph = shouldInsert ? this.insertParagraph() : null; @@ -1284,7 +1282,7 @@ export class RangeSelection implements BaseSelection { if ( insertedParagraph && $isElementNode(lastInsertedBlock) && - (isLI(insertedParagraph) || INTERNAL_$isBlock(lastToInsert)) + (insertedParagraph.canMergeWhenEmpty() || INTERNAL_$isBlock(lastToInsert)) ) { lastInsertedBlock.append(...insertedParagraph.getChildren()); insertedParagraph.remove(); diff --git a/packages/lexical/src/nodes/LexicalElementNode.ts b/packages/lexical/src/nodes/LexicalElementNode.ts index bacb0113299..83c33c9776c 100644 --- a/packages/lexical/src/nodes/LexicalElementNode.ts +++ b/packages/lexical/src/nodes/LexicalElementNode.ts @@ -582,6 +582,23 @@ export class ElementNode extends LexicalNode { ): boolean { return false; } + + /** + * Determines whether this node, when empty, can merge with a first block + * of nodes being inserted. + * + * This method is specifically called in {@link RangeSelection.insertNodes} + * to determine merging behavior during nodes insertion. + * + * @example + * // In a ListItemNode or QuoteNode implementation: + * canMergeWhenEmpty(): true { + * return true; + * } + */ + canMergeWhenEmpty(): boolean { + return false; + } } export function $isElementNode( From ac607d5d2d12c623ca825f1e4acb426fc8560d9b Mon Sep 17 00:00:00 2001 From: keiseiTi Date: Sat, 3 Aug 2024 23:04:56 +0800 Subject: [PATCH 06/13] [@lexical/playground] fix: block cursor show horizontal (#6486) --- packages/lexical-playground/src/index.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lexical-playground/src/index.css b/packages/lexical-playground/src/index.css index a6c9d65c267..d21a384bcf1 100644 --- a/packages/lexical-playground/src/index.css +++ b/packages/lexical-playground/src/index.css @@ -1753,8 +1753,8 @@ button.item.dropdown-item-active i { display: block; position: absolute; top: -2px; - width: 20px; - border-top: 1px solid black; + height: 18px; + border-left: 1px solid black; animation: CursorBlink 1.1s steps(2, start) infinite; } From dbb901f731a8bfb33dd81a2e9d6b4bd16016530c Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Sun, 4 Aug 2024 08:57:46 +0530 Subject: [PATCH 07/13] When creating a new check list, set the `checked` value of the list item to `false` instead of `undefined` (#5978) --- packages/lexical-list/src/LexicalListItemNode.ts | 11 +++++++++-- packages/lexical-list/src/formatList.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/lexical-list/src/LexicalListItemNode.ts b/packages/lexical-list/src/LexicalListItemNode.ts index 72b9ac1b612..d2091e2c10a 100644 --- a/packages/lexical-list/src/LexicalListItemNode.ts +++ b/packages/lexical-list/src/LexicalListItemNode.ts @@ -6,7 +6,7 @@ * */ -import type {ListNode} from './'; +import type {ListNode, ListType} from './'; import type { BaseSelection, DOMConversionMap, @@ -320,7 +320,14 @@ export class ListItemNode extends ElementNode { getChecked(): boolean | undefined { const self = this.getLatest(); - return self.__checked; + let listType: ListType | undefined; + + const parent = this.getParent(); + if ($isListNode(parent)) { + listType = parent.getListType(); + } + + return listType === 'check' ? Boolean(self.__checked) : undefined; } setChecked(checked?: boolean): void { diff --git a/packages/lexical-list/src/formatList.ts b/packages/lexical-list/src/formatList.ts index 565887c57d5..6d4a5cb41b5 100644 --- a/packages/lexical-list/src/formatList.ts +++ b/packages/lexical-list/src/formatList.ts @@ -297,7 +297,7 @@ export function updateChildrenListItemValue(list: ListNode): void { if (child.getValue() !== value) { child.setValue(value); } - if (isNotChecklist && child.getChecked() != null) { + if (isNotChecklist && child.getLatest().__checked != null) { child.setChecked(undefined); } if (!$isListNode(child.getFirstChild())) { From de13aa64e7c3fc830cdaec3e1257a36a22d5cc32 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Sun, 4 Aug 2024 10:45:06 -0700 Subject: [PATCH 08/13] Revert "[@lexical/playground] fix: block cursor show horizontal" (#6490) --- packages/lexical-playground/src/index.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lexical-playground/src/index.css b/packages/lexical-playground/src/index.css index d21a384bcf1..a6c9d65c267 100644 --- a/packages/lexical-playground/src/index.css +++ b/packages/lexical-playground/src/index.css @@ -1753,8 +1753,8 @@ button.item.dropdown-item-active i { display: block; position: absolute; top: -2px; - height: 18px; - border-left: 1px solid black; + width: 20px; + border-top: 1px solid black; animation: CursorBlink 1.1s steps(2, start) infinite; } From 124bcd41934d152014fc46649573b81b868ff499 Mon Sep 17 00:00:00 2001 From: Devy <168729019+devy-bee@users.noreply.github.com> Date: Tue, 6 Aug 2024 00:45:26 +0900 Subject: [PATCH 09/13] docs: prevent automatic

tag wrapping (#6491) --- packages/lexical-website/docs/react/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexical-website/docs/react/index.md b/packages/lexical-website/docs/react/index.md index 2462763c9a1..b0150b10116 100644 --- a/packages/lexical-website/docs/react/index.md +++ b/packages/lexical-website/docs/react/index.md @@ -13,7 +13,7 @@ To make it easier for React users to implement rich-text editors, Lexical expose - Getting Started Guide + {`Getting Started Guide`} ## Supported Versions From 1783019d4adc87e4d1be5659b1a0ba0caa5be323 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Tue, 6 Aug 2024 11:19:28 -0700 Subject: [PATCH 10/13] [lexical] Feature: Add version identifier to LexicalEditor constructor (#6488) --- .../src/generateContent.ts | 4 +- .../src/utils/isLexicalNode.ts | 4 +- packages/lexical-playground/vite.config.ts | 4 ++ .../lexical-playground/vite.prod.config.ts | 4 ++ .../src/LexicalCheckListPlugin.tsx | 31 +++------- .../docs/concepts/listeners.md | 2 +- packages/lexical/src/LexicalEditor.ts | 5 ++ packages/lexical/src/LexicalEvents.ts | 12 +++- packages/lexical/src/LexicalUpdates.ts | 60 +++++++++++++++---- packages/lexical/src/LexicalUtils.ts | 22 +++++-- packages/lexical/src/index.ts | 2 + .../lexical-esm-astro-react/package.json | 13 ++-- .../fixtures/lexical-esm-nextjs/package.json | 8 +-- .../package.json | 59 +++++++++--------- .../tests/test.ts | 11 ++++ scripts/__tests__/integration/setup.js | 3 + scripts/build.js | 17 +++++- scripts/updateVersion.js | 5 +- 18 files changed, 177 insertions(+), 89 deletions(-) diff --git a/packages/lexical-devtools-core/src/generateContent.ts b/packages/lexical-devtools-core/src/generateContent.ts index fcb6bf253b5..b08eb2ec777 100644 --- a/packages/lexical-devtools-core/src/generateContent.ts +++ b/packages/lexical-devtools-core/src/generateContent.ts @@ -161,8 +161,8 @@ export function generateContent( } else { res += '\n └ None dispatched.'; } - - res += '\n\n editor:'; + const {version} = editor.constructor; + res += `\n\n editor${version ? ` (v${version})` : ''}:`; res += `\n └ namespace ${editorConfig.namespace}`; if (compositionKey !== null) { res += `\n └ compositionKey ${compositionKey}`; diff --git a/packages/lexical-devtools/src/utils/isLexicalNode.ts b/packages/lexical-devtools/src/utils/isLexicalNode.ts index f3c3b52f6c9..f4969532012 100644 --- a/packages/lexical-devtools/src/utils/isLexicalNode.ts +++ b/packages/lexical-devtools/src/utils/isLexicalNode.ts @@ -6,10 +6,12 @@ * */ +import {getEditorPropertyFromDOMNode} from 'lexical'; + import {LexicalHTMLElement} from '../types'; export function isLexicalNode( node: LexicalHTMLElement | Element, ): node is LexicalHTMLElement { - return (node as LexicalHTMLElement).__lexicalEditor !== undefined; + return getEditorPropertyFromDOMNode(node) !== undefined; } diff --git a/packages/lexical-playground/vite.config.ts b/packages/lexical-playground/vite.config.ts index d7d0d3b5c48..12490da5cf2 100644 --- a/packages/lexical-playground/vite.config.ts +++ b/packages/lexical-playground/vite.config.ts @@ -52,6 +52,10 @@ export default defineConfig(({command}) => { from: /__DEV__/g, to: 'true', }, + { + from: 'process.env.LEXICAL_VERSION', + to: JSON.stringify(`${process.env.npm_package_version}+git`), + }, ], }), babel({ diff --git a/packages/lexical-playground/vite.prod.config.ts b/packages/lexical-playground/vite.prod.config.ts index 083f4697032..97fc5a760cd 100644 --- a/packages/lexical-playground/vite.prod.config.ts +++ b/packages/lexical-playground/vite.prod.config.ts @@ -53,6 +53,10 @@ export default defineConfig({ from: /__DEV__/g, to: 'false', }, + { + from: 'process.env.LEXICAL_VERSION', + to: JSON.stringify(`${process.env.npm_package_version}+git`), + }, ], }), babel({ diff --git a/packages/lexical-react/src/LexicalCheckListPlugin.tsx b/packages/lexical-react/src/LexicalCheckListPlugin.tsx index 50bffdbc033..6125a7b2077 100644 --- a/packages/lexical-react/src/LexicalCheckListPlugin.tsx +++ b/packages/lexical-react/src/LexicalCheckListPlugin.tsx @@ -28,6 +28,7 @@ import { $isElementNode, $isRangeSelection, COMMAND_PRIORITY_LOW, + getNearestEditorFromDOMNode, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_UP_COMMAND, @@ -199,20 +200,20 @@ function handleCheckItemEvent(event: PointerEvent, callback: () => void) { function handleClick(event: Event) { handleCheckItemEvent(event as PointerEvent, () => { - const domNode = event.target as HTMLElement; - const editor = findEditor(domNode); + if (event.target instanceof HTMLElement) { + const domNode = event.target; + const editor = getNearestEditorFromDOMNode(domNode); - if (editor != null && editor.isEditable()) { - editor.update(() => { - if (event.target) { + if (editor != null && editor.isEditable()) { + editor.update(() => { const node = $getNearestNodeFromDOMNode(domNode); if ($isListItemNode(node)) { domNode.focus(); node.toggleChecked(); } - } - }); + }); + } } }); } @@ -224,22 +225,6 @@ function handlePointerDown(event: PointerEvent) { }); } -function findEditor(target: Node) { - let node: ParentNode | Node | null = target; - - while (node) { - // @ts-ignore internal field - if (node.__lexicalEditor) { - // @ts-ignore internal field - return node.__lexicalEditor; - } - - node = node.parentNode; - } - - return null; -} - function getActiveCheckListItem(): HTMLElement | null { const activeElement = document.activeElement as HTMLElement; diff --git a/packages/lexical-website/docs/concepts/listeners.md b/packages/lexical-website/docs/concepts/listeners.md index fb5036223b0..834db37c0bf 100644 --- a/packages/lexical-website/docs/concepts/listeners.md +++ b/packages/lexical-website/docs/concepts/listeners.md @@ -84,7 +84,7 @@ handle external UI state and UI features relating to specific types of node. If any existing nodes are in the DOM, and skipInitialization is not true, the listener will be called immediately with an updateTag of 'registerMutationListener' where all nodes have the 'created' NodeMutation. This can be controlled with the skipInitialization option -(default is currently true for backwards compatibility in 0.16.x but will change to false in 0.17.0). +(default is currently true for backwards compatibility in 0.17.x but will change to false in 0.18.0). ```js const removeMutationListener = editor.registerMutationListener( diff --git a/packages/lexical/src/LexicalEditor.ts b/packages/lexical/src/LexicalEditor.ts index e08665f1c02..44ae24f4b6b 100644 --- a/packages/lexical/src/LexicalEditor.ts +++ b/packages/lexical/src/LexicalEditor.ts @@ -562,6 +562,9 @@ export function createEditor(editorConfig?: CreateEditorArgs): LexicalEditor { export class LexicalEditor { ['constructor']!: KlassConstructor; + /** The version with build identifiers for this editor (since 0.17.1) */ + static version: string | undefined; + /** @internal */ _headless: boolean; /** @internal */ @@ -1284,3 +1287,5 @@ export class LexicalEditor { }; } } + +LexicalEditor.version = process.env.LEXICAL_VERSION; diff --git a/packages/lexical/src/LexicalEvents.ts b/packages/lexical/src/LexicalEvents.ts index 2836f924cf6..4a177d19498 100644 --- a/packages/lexical/src/LexicalEvents.ts +++ b/packages/lexical/src/LexicalEvents.ts @@ -94,6 +94,7 @@ import { getAnchorTextFromDOM, getDOMSelection, getDOMTextNode, + getEditorPropertyFromDOMNode, getEditorsToPropagate, getNearestEditorFromDOMNode, getWindow, @@ -111,6 +112,7 @@ import { isEscape, isFirefoxClipboardEvents, isItalic, + isLexicalEditor, isLineBreak, isModifier, isMoveBackward, @@ -1329,13 +1331,17 @@ export function removeRootElementEvents(rootElement: HTMLElement): void { doc.removeEventListener('selectionchange', onDocumentSelectionChange); } - // @ts-expect-error: internal field - const editor: LexicalEditor | null | undefined = rootElement.__lexicalEditor; + const editor = getEditorPropertyFromDOMNode(rootElement); - if (editor !== null && editor !== undefined) { + if (isLexicalEditor(editor)) { cleanActiveNestedEditorsMap(editor); // @ts-expect-error: internal field rootElement.__lexicalEditor = null; + } else if (editor) { + invariant( + false, + 'Attempted to remove event handlers from a node that does not belong to this build of Lexical', + ); } const removeHandles = getRootElementRemoveHandles(rootElement); diff --git a/packages/lexical/src/LexicalUpdates.ts b/packages/lexical/src/LexicalUpdates.ts index 45f01b7815a..38e83cc56e8 100644 --- a/packages/lexical/src/LexicalUpdates.ts +++ b/packages/lexical/src/LexicalUpdates.ts @@ -6,7 +6,14 @@ * */ -import type { +import type {SerializedEditorState} from './LexicalEditorState'; +import type {LexicalNode, SerializedLexicalNode} from './LexicalNode'; + +import invariant from 'shared/invariant'; + +import {$isElementNode, $isTextNode, SELECTION_CHANGE_COMMAND} from '.'; +import {FULL_RECONCILE, NO_DIRTY_NODES} from './LexicalConstants'; +import { CommandPayloadType, EditorUpdateOptions, LexicalCommand, @@ -14,16 +21,9 @@ import type { Listener, MutatedNodes, RegisteredNodes, + resetEditor, Transform, } from './LexicalEditor'; -import type {SerializedEditorState} from './LexicalEditorState'; -import type {LexicalNode, SerializedLexicalNode} from './LexicalNode'; - -import invariant from 'shared/invariant'; - -import {$isElementNode, $isTextNode, SELECTION_CHANGE_COMMAND} from '.'; -import {FULL_RECONCILE, NO_DIRTY_NODES} from './LexicalConstants'; -import {resetEditor} from './LexicalEditor'; import { cloneEditorState, createEmptyEditorState, @@ -47,9 +47,11 @@ import { import { $getCompositionKey, getDOMSelection, + getEditorPropertyFromDOMNode, getEditorStateTextContent, getEditorsToPropagate, getRegisteredNodeOrThrow, + isLexicalEditor, removeDOMBlockCursorElement, scheduleMicroTask, updateDOMBlockCursorElement, @@ -96,7 +98,8 @@ export function getActiveEditorState(): EditorState { 'Unable to find an active editor state. ' + 'State helpers or node methods can only be used ' + 'synchronously during the callback of ' + - 'editor.update(), editor.read(), or editorState.read().', + 'editor.update(), editor.read(), or editorState.read().%s', + collectBuildInformation(), ); } @@ -110,13 +113,46 @@ export function getActiveEditor(): LexicalEditor { 'Unable to find an active editor. ' + 'This method can only be used ' + 'synchronously during the callback of ' + - 'editor.update() or editor.read().', + 'editor.update() or editor.read().%s', + collectBuildInformation(), ); } - return activeEditor; } +function collectBuildInformation(): string { + let compatibleEditors = 0; + const incompatibleEditors = new Set(); + const thisVersion = LexicalEditor.version; + if (typeof window !== 'undefined') { + for (const node of document.querySelectorAll('[contenteditable]')) { + const editor = getEditorPropertyFromDOMNode(node); + if (isLexicalEditor(editor)) { + compatibleEditors++; + } else if (editor) { + let version = String( + ( + editor.constructor as typeof editor['constructor'] & + Record + ).version || '<0.17.1', + ); + if (version === thisVersion) { + version += + ' (separately built, likely a bundler configuration issue)'; + } + incompatibleEditors.add(version); + } + } + } + let output = ` Detected on the page: ${compatibleEditors} compatible editor(s) with version ${thisVersion}`; + if (incompatibleEditors.size) { + output += ` and incompatible editors with versions ${Array.from( + incompatibleEditors, + ).join(', ')}`; + } + return output; +} + export function internalGetActiveEditor(): LexicalEditor | null { return activeEditor; } diff --git a/packages/lexical/src/LexicalUtils.ts b/packages/lexical/src/LexicalUtils.ts index 9a4880b1dc4..f735aba2306 100644 --- a/packages/lexical/src/LexicalUtils.ts +++ b/packages/lexical/src/LexicalUtils.ts @@ -123,8 +123,7 @@ export function isSelectionCapturedInDecoratorInput(anchorDOM: Node): boolean { (nodeName === 'INPUT' || nodeName === 'TEXTAREA' || (activeElement.contentEditable === 'true' && - // @ts-ignore internal field - activeElement.__lexicalEditor == null)) + getEditorPropertyFromDOMNode(activeElement) == null)) ); } @@ -149,14 +148,21 @@ export function isSelectionWithinEditor( } } +/** + * @returns true if the given argument is a LexicalEditor instance from this build of Lexical + */ +export function isLexicalEditor(editor: unknown): editor is LexicalEditor { + // Check instanceof to prevent issues with multiple embedded Lexical installations + return editor instanceof LexicalEditor; +} + export function getNearestEditorFromDOMNode( node: Node | null, ): LexicalEditor | null { let currentNode = node; while (currentNode != null) { - // @ts-expect-error: internal field - const editor: LexicalEditor = currentNode.__lexicalEditor; - if (editor != null) { + const editor = getEditorPropertyFromDOMNode(currentNode); + if (isLexicalEditor(editor)) { return editor; } currentNode = getParentElement(currentNode); @@ -164,6 +170,12 @@ export function getNearestEditorFromDOMNode( return null; } +/** @internal */ +export function getEditorPropertyFromDOMNode(node: Node | null): unknown { + // @ts-expect-error: internal field + return node ? node.__lexicalEditor : null; +} + export function getTextDirection(text: string): 'ltr' | 'rtl' | null { if (RTL_REGEX.test(text)) { return 'rtl'; diff --git a/packages/lexical/src/index.ts b/packages/lexical/src/index.ts index de3a78ff645..5ef926b5afc 100644 --- a/packages/lexical/src/index.ts +++ b/packages/lexical/src/index.ts @@ -176,11 +176,13 @@ export { $setCompositionKey, $setSelection, $splitNode, + getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, + isLexicalEditor, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, resetRandomKey, diff --git a/scripts/__tests__/integration/fixtures/lexical-esm-astro-react/package.json b/scripts/__tests__/integration/fixtures/lexical-esm-astro-react/package.json index 7fdab6d467c..0f2d6f14d19 100644 --- a/scripts/__tests__/integration/fixtures/lexical-esm-astro-react/package.json +++ b/scripts/__tests__/integration/fixtures/lexical-esm-astro-react/package.json @@ -1,29 +1,30 @@ { "name": "lexical-esm-astro-react", "type": "module", - "version": "0.0.1", + "version": "0.17.0", "scripts": { "dev": "astro dev", "start": "astro dev", "build": "astro check && astro build", "preview": "astro preview", - "astro": "astro", + "astro": "astro", "test": "playwright test" }, "dependencies": { "@astrojs/check": "^0.5.9", "@astrojs/react": "^3.1.0", - "@lexical/react": "^0.14.3", - "@lexical/utils": "^0.14.3", + "@lexical/react": "0.17.0", + "@lexical/utils": "0.17.0", "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", "astro": "^4.5.4", - "lexical": "^0.14.3", + "lexical": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0", "typescript": "^5.4.2" }, "devDependencies": { "@playwright/test": "^1.43.1" - } + }, + "sideEffects": false } diff --git a/scripts/__tests__/integration/fixtures/lexical-esm-nextjs/package.json b/scripts/__tests__/integration/fixtures/lexical-esm-nextjs/package.json index efd4626d5aa..4c3d8394e12 100644 --- a/scripts/__tests__/integration/fixtures/lexical-esm-nextjs/package.json +++ b/scripts/__tests__/integration/fixtures/lexical-esm-nextjs/package.json @@ -1,6 +1,6 @@ { "name": "lexical-esm-nextjs", - "version": "0.1.0", + "version": "0.17.0", "private": true, "scripts": { "dev": "next dev", @@ -9,9 +9,9 @@ "test": "playwright test" }, "dependencies": { - "@lexical/plain-text": "^0.14.5", - "@lexical/react": "^0.14.5", - "lexical": "^0.14.5", + "@lexical/plain-text": "0.17.0", + "@lexical/react": "0.17.0", + "lexical": "0.17.0", "next": "^14.2.1", "react": "^18", "react-dom": "^18" diff --git a/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/package.json b/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/package.json index b9fa88eb595..249b430f3b2 100644 --- a/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/package.json +++ b/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/package.json @@ -1,32 +1,31 @@ { - "name": "lexical-sveltekit-vanilla-js", - "version": "0.0.1", - "private": true, - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "test": "playwright test" - }, - "devDependencies": { - "@playwright/test": "^1.28.1", - "@sveltejs/adapter-auto": "^3.0.0", - "@sveltejs/adapter-node": "^5.0.1", - "@sveltejs/adapter-static": "^3.0.1", - "@sveltejs/kit": "^2.0.0", - "@sveltejs/vite-plugin-svelte": "^3.0.0", - "lexical": "^0.14.5", - "@lexical/dragon": "^0.14.5", - "@lexical/history": "^0.14.5", - "@lexical/rich-text": "^0.14.5", - "@lexical/utils": "^0.14.5", - "prettier": "^3.1.1", - "prettier-plugin-svelte": "^3.1.2", - "svelte": "^4.2.7", - "tslib": "^2.4.1", - "typescript": "^5.0.0", - "vite": "^5.1.7" - }, - "type": "module", - "dependencies": {} + "name": "lexical-sveltekit-vanilla-js", + "version": "0.17.0", + "private": true, + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "test": "playwright test" + }, + "devDependencies": { + "@lexical/dragon": "0.17.0", + "@lexical/history": "0.17.0", + "@lexical/rich-text": "0.17.0", + "@lexical/utils": "0.17.0", + "@playwright/test": "^1.28.1", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/adapter-node": "^5.0.1", + "@sveltejs/adapter-static": "^3.0.1", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "lexical": "0.17.0", + "prettier": "^3.1.1", + "prettier-plugin-svelte": "^3.1.2", + "svelte": "^4.2.7", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^5.1.7" + }, + "type": "module" } diff --git a/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/tests/test.ts b/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/tests/test.ts index a2a1b26aa8a..f265d9e85b3 100644 --- a/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/tests/test.ts +++ b/scripts/__tests__/integration/fixtures/lexical-esm-sveltekit-vanilla-js/tests/test.ts @@ -17,3 +17,14 @@ test('index page has expected h1 and lexical state', async ({ page }) => { /"text": "Welcome to the Vanilla JS Lexical Demo!"/ ); }); + +test('lexical editor has an accessible numeric version', async ({ page }) => { + await page.goto('/'); + await expect( + page.getByRole('heading', { name: 'SvelteKit Lexical Basic - Vanilla JS' }) + ).toBeVisible(); + expect(await page.evaluate(() => + // @ts-expect-error + document.querySelector('[contenteditable]')!.__lexicalEditor.constructor.version + )).toMatch(/^\d+\.\d+\.\d+/); +}); diff --git a/scripts/__tests__/integration/setup.js b/scripts/__tests__/integration/setup.js index 2213a78ccb8..a921a8e31f2 100644 --- a/scripts/__tests__/integration/setup.js +++ b/scripts/__tests__/integration/setup.js @@ -28,6 +28,9 @@ module.exports = async function (globalConfig, projectConfig) { ), ); if (!needsBuild) { + console.log( + '\nWARNING: Running integration tests with cached build artifacts from a previous `npm run prepare-release`.', + ); return; } await exec('npm run prepare-release'); diff --git a/scripts/build.js b/scripts/build.js index d8b0897dc96..14bc48af584 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -125,9 +125,18 @@ function getExtension(format) { * @param {string} outputFile * @param {boolean} isProd * @param {'cjs'|'esm'} format + * @param {string} version * @returns {Promise>} the exports of the built module */ -async function build(name, inputFile, outputPath, outputFile, isProd, format) { +async function build( + name, + inputFile, + outputPath, + outputFile, + isProd, + format, + version, +) { const extensions = ['.js', '.jsx', '.ts', '.tsx']; const inputOptions = { external(modulePath, src) { @@ -214,6 +223,9 @@ async function build(name, inputFile, outputPath, outputFile, isProd, format) { __DEV__: isProd ? 'false' : 'true', delimiters: ['', ''], preventAssignment: true, + 'process.env.LEXICAL_VERSION': JSON.stringify( + `${version}+${isProd ? 'prod' : 'dev'}.${format}`, + ), }, isWWW && strictWWWMappings, ), @@ -393,6 +405,7 @@ async function buildAll() { for (const pkg of packagesManager.getPublicPackages()) { const {name, sourcePath, outputPath, packageName, modules} = pkg.getPackageBuildDefinition(); + const {version} = pkg.packageJson; for (const module of modules) { for (const format of formats) { const {sourceFileName, outputFileName} = module; @@ -408,6 +421,7 @@ async function buildAll() { ), isProduction, format, + version, ); if (isRelease) { @@ -421,6 +435,7 @@ async function buildAll() { ), false, format, + version, ); buildForkModules(outputPath, outputFileName, format, exports); } diff --git a/scripts/updateVersion.js b/scripts/updateVersion.js index ffcdb5e529d..5ec3cd8840b 100644 --- a/scripts/updateVersion.js +++ b/scripts/updateVersion.js @@ -47,7 +47,10 @@ function updatePackage(pkg) { function updateVersion() { packagesManager.getPackages().forEach(updatePackage); glob - .sync('./examples/*/package.json') + .sync([ + './examples/*/package.json', + './scripts/__tests__/integration/fixtures/*/package.json', + ]) .forEach((packageJsonPath) => updatePackage(new PackageMetadata(packageJsonPath)), ); From 18539c1b06ca3c88c185c6bd924c19f61316b590 Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Tue, 6 Aug 2024 13:15:29 -0700 Subject: [PATCH 11/13] [lexical-playground] Bug Fix: Update tooltip for redo button with correct macOS shortcut (#6497) --- packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx b/packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx index 333a1f02bbd..b32d841c7ec 100644 --- a/packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx +++ b/packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx @@ -879,7 +879,7 @@ export default function ToolbarPlugin({ onClick={() => { activeEditor.dispatchCommand(REDO_COMMAND, undefined); }} - title={IS_APPLE ? 'Redo (⌘Y)' : 'Redo (Ctrl+Y)'} + title={IS_APPLE ? 'Redo (⇧⌘Z)' : 'Redo (Ctrl+Y)'} type="button" className="toolbar-item" aria-label="Redo"> From ab9d694676b8d25d3f12f40806dcfbb592ad500c Mon Sep 17 00:00:00 2001 From: Gerard Rovira Date: Wed, 7 Aug 2024 20:27:03 +0100 Subject: [PATCH 12/13] Flow: add more HTMLDivElementDOMProps (#6500) --- packages/lexical-react/flow/LexicalContentEditable.js.flow | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/lexical-react/flow/LexicalContentEditable.js.flow b/packages/lexical-react/flow/LexicalContentEditable.js.flow index 99004d8b137..917abd8de49 100644 --- a/packages/lexical-react/flow/LexicalContentEditable.js.flow +++ b/packages/lexical-react/flow/LexicalContentEditable.js.flow @@ -22,6 +22,9 @@ type InlineStyle = { type HTMLDivElementDOMProps = $ReadOnly<{ 'aria-label'?: void | string, 'aria-labeledby'?: void | string, + 'aria-activedescendant'?: void | string, + 'aria-autocomplete'?: void | string, + 'aria-owns'?: void | string, 'title'?: void | string, onClick?: void | (e: SyntheticEvent) => mixed, autoCapitalize?: void | boolean, From 568dc9a23d3fe9268a4a1415a479aa4c5c18961a Mon Sep 17 00:00:00 2001 From: Gerard Rovira Date: Thu, 8 Aug 2024 13:13:43 +0100 Subject: [PATCH 13/13] Fix splitText when detached (#6501) --- packages/lexical/src/nodes/LexicalTextNode.ts | 36 ++++++++++--------- .../__tests__/unit/LexicalTextNode.test.tsx | 12 +++++++ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/packages/lexical/src/nodes/LexicalTextNode.ts b/packages/lexical/src/nodes/LexicalTextNode.ts index c735a945099..03568abe7e5 100644 --- a/packages/lexical/src/nodes/LexicalTextNode.ts +++ b/packages/lexical/src/nodes/LexicalTextNode.ts @@ -935,7 +935,7 @@ export class TextNode extends LexicalNode { return [self]; } const firstPart = parts[0]; - const parent = self.getParentOrThrow(); + const parent = self.getParent(); let writableNode; const format = self.getFormat(); const style = self.getStyle(); @@ -1005,23 +1005,25 @@ export class TextNode extends LexicalNode { } // Insert the nodes into the parent's children - internalMarkSiblingsAsDirty(this); - const writableParent = parent.getWritable(); - const insertionIndex = this.getIndexWithinParent(); - if (hasReplacedSelf) { - writableParent.splice(insertionIndex, 0, splitNodes); - this.remove(); - } else { - writableParent.splice(insertionIndex, 1, splitNodes); - } + if (parent !== null) { + internalMarkSiblingsAsDirty(this); + const writableParent = parent.getWritable(); + const insertionIndex = this.getIndexWithinParent(); + if (hasReplacedSelf) { + writableParent.splice(insertionIndex, 0, splitNodes); + this.remove(); + } else { + writableParent.splice(insertionIndex, 1, splitNodes); + } - if ($isRangeSelection(selection)) { - $updateElementSelectionOnCreateDeleteNode( - selection, - parent, - insertionIndex, - partsLength - 1, - ); + if ($isRangeSelection(selection)) { + $updateElementSelectionOnCreateDeleteNode( + selection, + parent, + insertionIndex, + partsLength - 1, + ); + } } return splitNodes; diff --git a/packages/lexical/src/nodes/__tests__/unit/LexicalTextNode.test.tsx b/packages/lexical/src/nodes/__tests__/unit/LexicalTextNode.test.tsx index b034c96814a..37191abc831 100644 --- a/packages/lexical/src/nodes/__tests__/unit/LexicalTextNode.test.tsx +++ b/packages/lexical/src/nodes/__tests__/unit/LexicalTextNode.test.tsx @@ -582,6 +582,18 @@ describe('LexicalTextNode tests', () => { }); }, ); + + test('with detached parent', async () => { + await update(() => { + const textNode = $createTextNode('foo'); + const splits = textNode.splitText(1, 2); + expect(splits.map((split) => split.getTextContent())).toEqual([ + 'f', + 'o', + 'o', + ]); + }); + }); }); describe('createDOM()', () => {