Skip to content

Commit

Permalink
chore: upgrade lexical to 0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Jan 6, 2025
1 parent 8bf9e14 commit c3c0e5c
Show file tree
Hide file tree
Showing 54 changed files with 289 additions and 332 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.
49 changes: 0 additions & 49 deletions .yarn/patches/@lexical-rich-text-npm-0.22.0-1c32cc4b16.patch

This file was deleted.

49 changes: 49 additions & 0 deletions .yarn/patches/@lexical-rich-text-npm-0.23.0-eb1ed2e152.patch

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +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/clipboard@0.22.0": "patch:@lexical/clipboard@npm:0.22.0#.yarn/patches/@lexical-clipboard-npm-0.22.0-e950aa6a7f.patch",
"@lexical/rich-text@0.22.0": "patch:@lexical/rich-text@npm:0.22.0#.yarn/patches/@lexical-rich-text-npm-0.22.0-1c32cc4b16.patch"
"@lexical/clipboard@0.23.0": "patch:@lexical/clipboard@npm:0.23.0#.yarn/patches/@lexical-clipboard-npm-0.23.0-7e1a45a997.patch",
"@lexical/rich-text@0.23.0": "patch:@lexical/rich-text@npm:0.23.0#.yarn/patches/@lexical-rich-text-npm-0.23.0-eb1ed2e152.patch"
},
"dependencies": {
"@standardnotes/snjs": "workspace:*"
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.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",
"@lexical/clipboard": "0.23.0",
"@lexical/headless": "0.23.0",
"@lexical/link": "0.23.0",
"@lexical/list": "0.23.0",
"@lexical/react": "0.23.0",
"@lexical/rich-text": "0.23.0",
"@lexical/utils": "0.23.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.22.0"
"lexical": "0.23.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { DOMExportOutput, ElementFormatType, NodeKey, Spread } from 'lexical'

type SerializedFileExportNode = Spread<
{
version: 1
type: 'file-export'
name: string
mimeType: string
},
Expand All @@ -31,7 +29,7 @@ export class FileExportNode extends DecoratorBlockNode {
}

static importJSON(serializedNode: SerializedFileExportNode): FileExportNode {
const node = new FileExportNode(serializedNode.name, serializedNode.mimeType)
const node = $createFileExportNode(serializedNode.name, serializedNode.mimeType).updateFromJSON(serializedNode)
return node
}

Expand All @@ -40,8 +38,6 @@ export class FileExportNode extends DecoratorBlockNode {
...super.exportJSON(),
name: this.__name,
mimeType: this.__mimeType,
version: 1,
type: 'file-export',
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ function TweetComponent({
export type SerializedTweetNode = Spread<
{
id: string
type: 'tweet'
version: 1
},
SerializedDecoratorBlockNode
>
Expand All @@ -137,17 +135,13 @@ export class TweetNode extends DecoratorBlockNode {
}

static override importJSON(serializedNode: SerializedTweetNode): TweetNode {
const node = $createTweetNode(serializedNode.id)
node.setFormat(serializedNode.format)
return node
return $createTweetNode(serializedNode.id).updateFromJSON(serializedNode)
}

override exportJSON(): SerializedTweetNode {
return {
...super.exportJSON(),
id: this.getId(),
type: 'tweet',
version: 1,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function YouTubeComponent({ className, format, nodeKey, videoID }: YouTubeCompon
export type SerializedYouTubeNode = Spread<
{
videoID: string
type: 'youtube'
version: 1
},
SerializedDecoratorBlockNode
>
Expand Down Expand Up @@ -82,16 +80,12 @@ export class YouTubeNode extends DecoratorBlockNode {
}

static importJSON(serializedNode: SerializedYouTubeNode): YouTubeNode {
const node = $createYouTubeNode(serializedNode.videoID)
node.setFormat(serializedNode.format)
return node
return $createYouTubeNode(serializedNode.videoID).updateFromJSON(serializedNode)
}

exportJSON(): SerializedYouTubeNode {
return {
...super.exportJSON(),
type: 'youtube',
version: 1,
videoID: this.__id,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import {

type SerializedCollapsibleContainerNode = Spread<
{
type: 'collapsible-container'
version: 1
open: boolean
},
SerializedElementNode
Expand Down Expand Up @@ -85,8 +83,7 @@ export class CollapsibleContainerNode extends ElementNode {
}

static override importJSON(serializedNode: SerializedCollapsibleContainerNode): CollapsibleContainerNode {
const node = $createCollapsibleContainerNode(serializedNode.open)
return node
return $createCollapsibleContainerNode(serializedNode.open).updateFromJSON(serializedNode)
}

exportDOM(): DOMExportOutput {
Expand All @@ -100,8 +97,6 @@ export class CollapsibleContainerNode extends ElementNode {
override exportJSON(): SerializedCollapsibleContainerNode {
return {
...super.exportJSON(),
type: 'collapsible-container',
version: 1,
open: this.__open,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export class CollapsibleContentNode extends ElementNode {
}
}

static override importJSON(_serializedNode: SerializedCollapsibleContentNode): CollapsibleContentNode {
return $createCollapsibleContentNode()
static override importJSON(serializedNode: SerializedCollapsibleContentNode): CollapsibleContentNode {
return $createCollapsibleContentNode().updateFromJSON(serializedNode)
}

override isShadowRoot(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ import {
DOMConversionMap,
DOMConversionOutput,
DOMExportOutput,
ElementFormatType,
ElementNode,
LexicalNode,
NodeKey,
RangeSelection,
SerializedElementNode,
Spread,
Expand Down Expand Up @@ -44,15 +42,8 @@ export class CollapsibleTitleNode extends ElementNode {
return 'collapsible-title'
}

constructor({ formatType, key }: { formatType?: ElementFormatType; key?: NodeKey }) {
super(key)
if (formatType) {
super.setFormat(formatType)
}
}

static override clone(node: CollapsibleTitleNode): CollapsibleTitleNode {
return new CollapsibleTitleNode({ key: node.__key })
return new CollapsibleTitleNode(node.__key)
}

override createDOM(): HTMLElement {
Expand All @@ -79,22 +70,14 @@ export class CollapsibleTitleNode extends ElementNode {
}

static override importJSON(serializedNode: SerializedCollapsibleTitleNode): CollapsibleTitleNode {
return $createCollapsibleTitleNode(serializedNode.format)
return $createCollapsibleTitleNode().updateFromJSON(serializedNode)
}

exportDOM(): DOMExportOutput {
const element = document.createElement('summary')
return { element }
}

override exportJSON(): SerializedCollapsibleTitleNode {
return {
...super.exportJSON(),
type: 'collapsible-title',
version: 1,
}
}

override collapseAtStart(_selection: RangeSelection): boolean {
this.getParentOrThrow().insertBefore(this)
return true
Expand Down Expand Up @@ -129,10 +112,8 @@ export class CollapsibleTitleNode extends ElementNode {
}
}

export function $createCollapsibleTitleNode(formatType?: ElementFormatType): CollapsibleTitleNode {
return new CollapsibleTitleNode({
formatType,
})
export function $createCollapsibleTitleNode(): CollapsibleTitleNode {
return new CollapsibleTitleNode()
}

export function $isCollapsibleTitleNode(node: LexicalNode | null | undefined): node is CollapsibleTitleNode {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, NodeKey } from 'lexical'
import {
DOMConversionMap,
DOMExportOutput,
EditorConfig,
ElementFormatType,
LexicalEditor,
LexicalUpdateJSON,
NodeKey,
} from 'lexical'
import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'
import { $createFileNode, convertToFileElement } from './FileUtils'
import FileComponent from './FileComponent'
Expand All @@ -24,18 +32,17 @@ export class FileNode extends DecoratorBlockNode implements ItemNodeInterface {
}

static importJSON(serializedNode: SerializedFileNode): FileNode {
const node = $createFileNode(serializedNode.fileUuid)
node.setFormat(serializedNode.format)
node.setZoomLevel(serializedNode.zoomLevel)
return node
return $createFileNode(serializedNode.fileUuid).updateFromJSON(serializedNode)
}

updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedFileNode>): this {
return super.updateFromJSON(serializedNode).setZoomLevel(serializedNode.zoomLevel)
}

exportJSON(): SerializedFileNode {
return {
...super.exportJSON(),
fileUuid: this.getId(),
version: 1,
type: 'snfile',
zoomLevel: this.__zoomLevel,
}
}
Expand Down Expand Up @@ -70,9 +77,10 @@ export class FileNode extends DecoratorBlockNode implements ItemNodeInterface {
return `[File: ${this.__id}]`
}

setZoomLevel(zoomLevel: number): void {
const writable = this.getWritable()
writable.__zoomLevel = zoomLevel
setZoomLevel(zoomLevel: number): this {
const self = this.getWritable()
self.__zoomLevel = zoomLevel
return self
}

decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlo
export type SerializedFileNode = Spread<
{
fileUuid: string
version: 1
type: 'snfile'
zoomLevel: number
},
SerializedDecoratorBlockNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import InlineFileComponent from './InlineFileComponent'

type SerializedInlineFileNode = Spread<
{
version: 1
type: 'inline-file'
fileName: string | undefined
mimeType: string
src: string
Expand Down Expand Up @@ -43,7 +41,11 @@ export class InlineFileNode extends DecoratorBlockNode {
}

static importJSON(serializedNode: SerializedInlineFileNode): InlineFileNode {
const node = $createInlineFileNode(serializedNode.src, serializedNode.mimeType, serializedNode.fileName)
const node = $createInlineFileNode(
serializedNode.src,
serializedNode.mimeType,
serializedNode.fileName,
).updateFromJSON(serializedNode)
return node
}

Expand All @@ -53,8 +55,6 @@ export class InlineFileNode extends DecoratorBlockNode {
src: this.__src,
mimeType: this.__mimeType,
fileName: this.__fileName,
version: 1,
type: 'inline-file',
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ export class BubbleNode extends DecoratorNode<JSX.Element> implements ItemNodeIn
}

static importJSON(serializedNode: SerializedBubbleNode): BubbleNode {
const node = $createBubbleNode(serializedNode.itemUuid)
return node
return $createBubbleNode(serializedNode.itemUuid).updateFromJSON(serializedNode)
}

override exportJSON(): SerializedBubbleNode {
return {
...super.exportJSON(),
itemUuid: this.getId(),
version: 1,
type: 'snbubble',
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Spread, SerializedLexicalNode } from 'lexical'
export type SerializedBubbleNode = Spread<
{
itemUuid: string
version: 1
type: 'snbubble'
},
SerializedLexicalNode
>
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import RemoteImageComponent from './RemoteImageComponent'

type SerializedRemoteImageNode = Spread<
{
version: 1
type: 'unencrypted-image'
alt: string | undefined
src: string
},
Expand All @@ -40,17 +38,14 @@ export class RemoteImageNode extends DecoratorBlockNode {
}

static importJSON(serializedNode: SerializedRemoteImageNode): RemoteImageNode {
const node = $createRemoteImageNode(serializedNode.src, serializedNode.alt)
return node
return $createRemoteImageNode(serializedNode.src, serializedNode.alt).updateFromJSON(serializedNode)
}

exportJSON(): SerializedRemoteImageNode {
return {
...super.exportJSON(),
src: this.__src,
alt: this.__alt,
version: 1,
type: 'unencrypted-image',
}
}

Expand Down
Loading

0 comments on commit c3c0e5c

Please sign in to comment.