chore: update lexical and rebuild patches (#2864)

This commit is contained in:
Aman Harwara
2024-04-15 20:11:19 +05:30
committed by GitHub
parent eb90005939
commit 896d346c27
59 changed files with 400 additions and 1189 deletions

View File

@@ -28,7 +28,6 @@
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@babel/preset-env": "*",
"@babel/preset-typescript": "^7.21.5",
"@lexical/react": "0.13.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@simplewebauthn/browser": "^8.0.2",
"@standardnotes/authenticator": "^2.4.0",
@@ -76,7 +75,6 @@
"identity-obj-proxy": "^3.0.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"lexical": "0.13.1",
"lint-staged": ">=13",
"mini-css-extract-plugin": "^2.7.2",
"minimatch": "^5.1.1",
@@ -109,14 +107,17 @@
},
"dependencies": {
"@ariakit/react": "^0.3.9",
"@lexical/headless": "0.13.1",
"@lexical/link": "0.13.1",
"@lexical/list": "0.13.1",
"@lexical/rich-text": "0.13.1",
"@lexical/utils": "0.13.1",
"@lexical/clipboard": "0.14.3",
"@lexical/headless": "0.14.3",
"@lexical/link": "0.14.3",
"@lexical/list": "0.14.3",
"@lexical/react": "0.14.3",
"@lexical/rich-text": "0.14.3",
"@lexical/utils": "0.14.3",
"@radix-ui/react-slot": "^1.0.1",
"@react-pdf/renderer": "^3.3.2",
"comlink": "^4.4.1",
"fast-diff": "^1.3.0"
"fast-diff": "^1.3.0",
"lexical": "0.14.3"
}
}

View File

@@ -35,7 +35,6 @@ import { SearchPlugin } from './Plugins/SearchPlugin/SearchPlugin'
import AutoLinkPlugin from './Plugins/AutoLinkPlugin/AutoLinkPlugin'
import DatetimePlugin from './Plugins/DateTimePlugin/DateTimePlugin'
import PasswordPlugin from './Plugins/PasswordPlugin/PasswordPlugin'
import { MergeSiblingListsPlugin } from './Plugins/MergeSiblingListsPlugin'
type BlocksEditorProps = {
onChange?: (value: string, preview: string) => void
@@ -117,7 +116,6 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
</div>
{isMobile && <ToolbarPlugin />}
<ListPlugin />
<MergeSiblingListsPlugin />
<MarkdownShortcutPlugin transformers={MarkdownTransformers} />
<TablePlugin hasCellMerge />
<OnChangePlugin onChange={handleChange} ignoreSelectionChange={true} />

View File

@@ -1,23 +0,0 @@
import { ListNode, $isListNode } from '@lexical/list'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { useEffect } from 'react'
function mergeListNodesTransform(node: ListNode) {
const nextSibling = node.getNextSibling()
if ($isListNode(nextSibling) && $isListNode(node) && nextSibling.getListType() === node.getListType()) {
node.append(...nextSibling.getChildren())
nextSibling.remove()
}
}
// https://github.com/facebook/lexical/issues/4618
export function MergeSiblingListsPlugin() {
const [editor] = useLexicalComposerContext()
useEffect(() => {
return editor.registerNodeTransform(ListNode, mergeListNodesTransform)
}, [editor])
return null
}