Skip to content

Commit

Permalink
chore: upgrade lexical (#2889)
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara authored Jan 2, 2025
1 parent 5c23a11 commit 1456950
Show file tree
Hide file tree
Showing 73 changed files with 697 additions and 1,285 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
151 changes: 0 additions & 151 deletions .yarn/patches/@lexical-clipboard-npm-0.16.0-3053c4af9c.patch

This file was deleted.

134 changes: 134 additions & 0 deletions .yarn/patches/@lexical-clipboard-npm-0.22.0-e950aa6a7f.patch

Large diffs are not rendered by default.

207 changes: 0 additions & 207 deletions .yarn/patches/@lexical-list-npm-0.16.0-8f91da4ad5.patch

This file was deleted.

158 changes: 0 additions & 158 deletions .yarn/patches/@lexical-rich-text-npm-0.16.0-f484a17832.patch

This file was deleted.

49 changes: 49 additions & 0 deletions .yarn/patches/@lexical-rich-text-npm-0.22.0-1c32cc4b16.patch

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
"@types/react-native-vector-icons/@types/react": "17.0.2",
"@types/react-native/@types/react": "17.0.2",
"@types/hoist-non-react-statics/@types/react": "17.0.2",
"@lexical/[email protected]": "patch:@lexical/clipboard@npm:0.16.0#.yarn/patches/@lexical-clipboard-npm-0.16.0-3053c4af9c.patch",
"@lexical/[email protected]": "patch:@lexical/rich-text@npm:0.16.0#.yarn/patches/@lexical-rich-text-npm-0.16.0-f484a17832.patch",
"@lexical/[email protected]": "patch:@lexical/list@npm:0.16.0#.yarn/patches/@lexical-list-npm-0.16.0-8f91da4ad5.patch"
"@lexical/[email protected]": "patch:@lexical/clipboard@npm:0.22.0#.yarn/patches/@lexical-clipboard-npm-0.22.0-e950aa6a7f.patch",
"@lexical/[email protected]": "patch:@lexical/rich-text@npm:0.22.0#.yarn/patches/@lexical-rich-text-npm-0.22.0-1c32cc4b16.patch"
},
"dependencies": {
"@standardnotes/snjs": "workspace:*"
Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1800,10 +1800,10 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 4cb898d0bf20404aab1850c656dcea009429d6c1
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
FBLazyVector: 7b438dceb9f904bd85ca3c31d64cce32a035472b
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
hermes-engine: 8d2103d6c0176779aea4e25df6bb1410f9946680
MMKV: 817ba1eea17421547e01e087285606eb270a8dcb
MMKVCore: af055b00e27d88cd92fad301c5fecd1ff9b26dd9
Expand Down
16 changes: 8 additions & 8 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@
},
"dependencies": {
"@ariakit/react": "^0.3.9",
"@lexical/clipboard": "0.16.0",
"@lexical/headless": "0.16.0",
"@lexical/link": "0.16.0",
"@lexical/list": "0.16.0",
"@lexical/react": "0.16.0",
"@lexical/rich-text": "0.16.0",
"@lexical/utils": "0.16.0",
"@lexical/clipboard": "0.22.0",
"@lexical/headless": "0.22.0",
"@lexical/link": "0.22.0",
"@lexical/list": "0.22.0",
"@lexical/react": "0.22.0",
"@lexical/rich-text": "0.22.0",
"@lexical/utils": "0.22.0",
"@radix-ui/react-slot": "^1.0.1",
"@react-pdf/renderer": "^3.3.2",
"comlink": "^4.4.1",
"fast-diff": "^1.3.0",
"lexical": "0.16.0"
"lexical": "0.22.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { $createParagraphNode, $getRoot, $insertNodes, $nodesOfType, LexicalNode } from 'lexical'
import { $createParagraphNode, $getRoot, $insertNodes, LexicalNode } from 'lexical'
import { $generateNodesFromDOM } from '@lexical/html'
import { createHeadlessEditor } from '@lexical/headless'
import { BlockEditorNodes } from '../SuperEditor/Lexical/Nodes/AllNodes'
import BlocksEditorTheme from '../SuperEditor/Lexical/Theme/Theme'
import { ClipPayload } from '@standardnotes/clipper/src/types/message'
import { LinkNode } from '@lexical/link'
import { $isLinkNode } from '@lexical/link'
import { $dfs } from '@lexical/utils'

const AbsoluteLinkRegExp = new RegExp('^(?:[a-z+]+:)?//', 'i')

Expand Down Expand Up @@ -66,15 +67,18 @@ export const getSuperJSONFromClipPayload = async (clipPayload: ClipPayload) => {

await new Promise<void>((resolve) => {
editor.update(() => {
$nodesOfType(LinkNode).forEach((linkNode) => {
const url = linkNode.getURL()
for (const { node } of $dfs()) {
if (!$isLinkNode(node)) {
continue
}
const url = node.getURL()
const isAbsoluteLink = AbsoluteLinkRegExp.test(url)

if (!isAbsoluteLink) {
const fixedURL = new URL(url, clipURL)
linkNode.setURL(fixedURL.toString())
node.setURL(fixedURL.toString())
}
})
}

resolve()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DecoratorBlockNode, SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'
import { parseAndCreateZippableFileName } from '@standardnotes/utils'
import { DOMExportOutput, Spread } from 'lexical'
import { DOMExportOutput, ElementFormatType, NodeKey, Spread } from 'lexical'

type SerializedFileExportNode = Spread<
{
Expand All @@ -20,14 +20,14 @@ export class FileExportNode extends DecoratorBlockNode {
return 'file-export'
}

constructor(name: string, mimeType: string) {
super()
constructor(name: string, mimeType: string, format?: ElementFormatType, key?: NodeKey) {
super(format, key)
this.__name = name
this.__mimeType = mimeType
}

static clone(node: FileExportNode): FileExportNode {
return new FileExportNode(node.__name, node.__mimeType)
return new FileExportNode(node.__name, node.__mimeType, node.__format, node.__key)
}

static importJSON(serializedNode: SerializedFileExportNode): FileExportNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ export class TweetNode extends DecoratorBlockNode {
return 'tweet'
}

constructor(id: string, format?: ElementFormatType, key?: NodeKey) {
super(format, key)
this.__id = id
}

static override clone(node: TweetNode): TweetNode {
return new TweetNode(node.__id, node.__format, node.__key)
}
Expand Down Expand Up @@ -168,11 +173,6 @@ export class TweetNode extends DecoratorBlockNode {
return { element }
}

constructor(id: string, format?: ElementFormatType, key?: NodeKey) {
super(format, key)
this.__id = id
}

getId(): string {
return this.__id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export class YouTubeNode extends DecoratorBlockNode {
return 'youtube'
}

constructor(id: string, format?: ElementFormatType, key?: NodeKey) {
super(format, key)
this.__id = id
}

static clone(node: YouTubeNode): YouTubeNode {
return new YouTubeNode(node.__id, node.__format, node.__key)
}
Expand Down Expand Up @@ -121,11 +126,6 @@ export class YouTubeNode extends DecoratorBlockNode {
}
}

constructor(id: string, format?: ElementFormatType, key?: NodeKey) {
super(format, key)
this.__id = id
}

updateDOM(): false {
return false
}
Expand Down
Loading

0 comments on commit 1456950

Please sign in to comment.