chore: enable noImplicitOverride in all packages (#10588)
This commit is contained in:
@@ -3,6 +3,5 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../translations" }]
|
"references": [{ "path": "../payload" }, { "path": "../translations" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../translations" }]
|
"references": [{ "path": "../payload" }, { "path": "../translations" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }]
|
"references": [{ "path": "../payload" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }]
|
"references": [{ "path": "../payload" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }] // db-mongodb depends on payload
|
"references": [{ "path": "../payload" }] // db-mongodb depends on payload
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }]
|
"references": [{ "path": "../payload" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../payload" },
|
{ "path": "../payload" },
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../translations" }]
|
"references": [{ "path": "../translations" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }]
|
"references": [{ "path": "../payload" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../ui" }]
|
"references": [{ "path": "../payload" }, { "path": "../ui" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }]
|
"references": [{ "path": "../payload" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }]
|
"references": [{ "path": "../payload" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
"references": [{ "path": "../payload" }, { "path": "../ui" }, { "path": "../next" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ import { ServerBlockNode } from '../../server/nodes/BlocksNode.js'
|
|||||||
import { BlockComponent } from '../component/index.js'
|
import { BlockComponent } from '../component/index.js'
|
||||||
|
|
||||||
export class BlockNode extends ServerBlockNode {
|
export class BlockNode extends ServerBlockNode {
|
||||||
static clone(node: ServerBlockNode): ServerBlockNode {
|
static override clone(node: ServerBlockNode): ServerBlockNode {
|
||||||
return super.clone(node)
|
return super.clone(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return super.getType()
|
return super.getType()
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedBlockNode): BlockNode {
|
static override importJSON(serializedNode: SerializedBlockNode): BlockNode {
|
||||||
if (serializedNode.version === 1) {
|
if (serializedNode.version === 1) {
|
||||||
// Convert (version 1 had the fields wrapped in another, unnecessary data property)
|
// Convert (version 1 had the fields wrapped in another, unnecessary data property)
|
||||||
serializedNode = {
|
serializedNode = {
|
||||||
@@ -34,7 +34,7 @@ export class BlockNode extends ServerBlockNode {
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {
|
override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<BlockComponent
|
<BlockComponent
|
||||||
cacheBuster={this.getCacheBuster()}
|
cacheBuster={this.getCacheBuster()}
|
||||||
@@ -44,7 +44,7 @@ export class BlockNode extends ServerBlockNode {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedBlockNode {
|
override exportJSON(): SerializedBlockNode {
|
||||||
return super.exportJSON()
|
return super.exportJSON()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,20 +18,20 @@ const InlineBlockComponent = React.lazy(() =>
|
|||||||
)
|
)
|
||||||
|
|
||||||
export class InlineBlockNode extends ServerInlineBlockNode {
|
export class InlineBlockNode extends ServerInlineBlockNode {
|
||||||
static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {
|
static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {
|
||||||
return super.clone(node)
|
return super.clone(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return super.getType()
|
return super.getType()
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {
|
static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {
|
||||||
const node = $createInlineBlockNode(serializedNode.fields)
|
const node = $createInlineBlockNode(serializedNode.fields)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {
|
override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<InlineBlockComponent
|
<InlineBlockComponent
|
||||||
cacheBuster={this.getCacheBuster()}
|
cacheBuster={this.getCacheBuster()}
|
||||||
@@ -41,7 +41,7 @@ export class InlineBlockNode extends ServerInlineBlockNode {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedInlineBlockNode {
|
override exportJSON(): SerializedInlineBlockNode {
|
||||||
return super.exportJSON()
|
return super.exportJSON()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export class ServerBlockNode extends DecoratorBlockNode {
|
|||||||
this.__cacheBuster = cacheBuster || 0
|
this.__cacheBuster = cacheBuster || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: ServerBlockNode): ServerBlockNode {
|
static override clone(node: ServerBlockNode): ServerBlockNode {
|
||||||
return new this({
|
return new this({
|
||||||
cacheBuster: node.__cacheBuster,
|
cacheBuster: node.__cacheBuster,
|
||||||
fields: node.__fields,
|
fields: node.__fields,
|
||||||
@@ -67,15 +67,15 @@ export class ServerBlockNode extends DecoratorBlockNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'block'
|
return 'block'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
static override importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {
|
static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {
|
||||||
if (serializedNode.version === 1) {
|
if (serializedNode.version === 1) {
|
||||||
// Convert (version 1 had the fields wrapped in another, unnecessary data property)
|
// Convert (version 1 had the fields wrapped in another, unnecessary data property)
|
||||||
serializedNode = {
|
serializedNode = {
|
||||||
@@ -95,11 +95,11 @@ export class ServerBlockNode extends DecoratorBlockNode {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {
|
override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
exportDOM(): DOMExportOutput {
|
override exportDOM(): DOMExportOutput {
|
||||||
const element = document.createElement('div')
|
const element = document.createElement('div')
|
||||||
|
|
||||||
const text = document.createTextNode(this.getTextContent())
|
const text = document.createTextNode(this.getTextContent())
|
||||||
@@ -107,7 +107,7 @@ export class ServerBlockNode extends DecoratorBlockNode {
|
|||||||
return { element }
|
return { element }
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedBlockNode {
|
override exportJSON(): SerializedBlockNode {
|
||||||
return {
|
return {
|
||||||
...super.exportJSON(),
|
...super.exportJSON(),
|
||||||
type: 'block',
|
type: 'block',
|
||||||
@@ -124,7 +124,7 @@ export class ServerBlockNode extends DecoratorBlockNode {
|
|||||||
return this.getLatest().__fields
|
return this.getLatest().__fields
|
||||||
}
|
}
|
||||||
|
|
||||||
getTextContent(): string {
|
override getTextContent(): string {
|
||||||
return `Block Field`
|
return `Block Field`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class ServerInlineBlockNode extends DecoratorNode<null | React.ReactEleme
|
|||||||
this.__cacheBuster = cacheBuster || 0
|
this.__cacheBuster = cacheBuster || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {
|
static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {
|
||||||
return new this({
|
return new this({
|
||||||
cacheBuster: node.__cacheBuster,
|
cacheBuster: node.__cacheBuster,
|
||||||
fields: node.__fields,
|
fields: node.__fields,
|
||||||
@@ -55,15 +55,15 @@ export class ServerInlineBlockNode extends DecoratorNode<null | React.ReactEleme
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'inlineBlock'
|
return 'inlineBlock'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
static override importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {
|
static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {
|
||||||
const node = $createServerInlineBlockNode(serializedNode.fields)
|
const node = $createServerInlineBlockNode(serializedNode.fields)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
@@ -75,18 +75,18 @@ export class ServerInlineBlockNode extends DecoratorNode<null | React.ReactEleme
|
|||||||
canIndent() {
|
canIndent() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
createDOM() {
|
override createDOM() {
|
||||||
const element = document.createElement('span')
|
const element = document.createElement('span')
|
||||||
element.classList.add('inline-block-container')
|
element.classList.add('inline-block-container')
|
||||||
|
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {
|
override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
exportDOM(): DOMExportOutput {
|
override exportDOM(): DOMExportOutput {
|
||||||
const element = document.createElement('span')
|
const element = document.createElement('span')
|
||||||
element.classList.add('inline-block-container')
|
element.classList.add('inline-block-container')
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ export class ServerInlineBlockNode extends DecoratorNode<null | React.ReactEleme
|
|||||||
return { element }
|
return { element }
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedInlineBlockNode {
|
override exportJSON(): SerializedInlineBlockNode {
|
||||||
return {
|
return {
|
||||||
type: 'inlineBlock',
|
type: 'inlineBlock',
|
||||||
fields: this.getFields(),
|
fields: this.getFields(),
|
||||||
@@ -111,11 +111,11 @@ export class ServerInlineBlockNode extends DecoratorNode<null | React.ReactEleme
|
|||||||
return this.getLatest().__fields
|
return this.getLatest().__fields
|
||||||
}
|
}
|
||||||
|
|
||||||
getTextContent(): string {
|
override getTextContent(): string {
|
||||||
return `Block Field`
|
return `Block Field`
|
||||||
}
|
}
|
||||||
|
|
||||||
isInline() {
|
override isInline() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ export class ServerInlineBlockNode extends DecoratorNode<null | React.ReactEleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDOM(): boolean {
|
override updateDOM(): boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,29 +15,29 @@ const HorizontalRuleComponent = React.lazy(() =>
|
|||||||
)
|
)
|
||||||
|
|
||||||
export class HorizontalRuleNode extends HorizontalRuleServerNode {
|
export class HorizontalRuleNode extends HorizontalRuleServerNode {
|
||||||
static clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {
|
static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {
|
||||||
return super.clone(node)
|
return super.clone(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return super.getType()
|
return super.getType()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data for this node is stored serialized as JSON. This is the "load function" of that node: it takes the saved data and converts it into a node.
|
* The data for this node is stored serialized as JSON. This is the "load function" of that node: it takes the saved data and converts it into a node.
|
||||||
*/
|
*/
|
||||||
static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {
|
static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {
|
||||||
return $createHorizontalRuleNode()
|
return $createHorizontalRuleNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to render a React component within whatever createDOM returns.
|
* Allows you to render a React component within whatever createDOM returns.
|
||||||
*/
|
*/
|
||||||
decorate(): React.ReactElement {
|
override decorate(): React.ReactElement {
|
||||||
return <HorizontalRuleComponent nodeKey={this.__key} />
|
return <HorizontalRuleComponent nodeKey={this.__key} />
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedLexicalNode {
|
override exportJSON(): SerializedLexicalNode {
|
||||||
return super.exportJSON()
|
return super.exportJSON()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ export const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createComman
|
|||||||
* If we used DecoratorBlockNode instead, we would only need a decorate method
|
* If we used DecoratorBlockNode instead, we would only need a decorate method
|
||||||
*/
|
*/
|
||||||
export class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactElement> {
|
export class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactElement> {
|
||||||
static clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {
|
static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {
|
||||||
return new this(node.__key)
|
return new this(node.__key)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'horizontalrule'
|
return 'horizontalrule'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ export class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactEl
|
|||||||
*
|
*
|
||||||
* This also determines the behavior of lexical's internal HTML -> Lexical converter
|
* This also determines the behavior of lexical's internal HTML -> Lexical converter
|
||||||
*/
|
*/
|
||||||
static importDOM(): DOMConversionMap | null {
|
static override importDOM(): DOMConversionMap | null {
|
||||||
return {
|
return {
|
||||||
hr: () => ({
|
hr: () => ({
|
||||||
conversion: $convertHorizontalRuleElement,
|
conversion: $convertHorizontalRuleElement,
|
||||||
@@ -61,20 +61,22 @@ export class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactEl
|
|||||||
/**
|
/**
|
||||||
* The data for this node is stored serialized as JSON. This is the "load function" of that node: it takes the saved data and converts it into a node.
|
* The data for this node is stored serialized as JSON. This is the "load function" of that node: it takes the saved data and converts it into a node.
|
||||||
*/
|
*/
|
||||||
static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleServerNode {
|
static override importJSON(
|
||||||
|
serializedNode: SerializedHorizontalRuleNode,
|
||||||
|
): HorizontalRuleServerNode {
|
||||||
return $createHorizontalRuleServerNode()
|
return $createHorizontalRuleServerNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines how the hr element is rendered in the lexical editor. This is only the "initial" / "outer" HTML element.
|
* Determines how the hr element is rendered in the lexical editor. This is only the "initial" / "outer" HTML element.
|
||||||
*/
|
*/
|
||||||
createDOM(config: EditorConfig): HTMLElement {
|
override createDOM(config: EditorConfig): HTMLElement {
|
||||||
const element = document.createElement('hr')
|
const element = document.createElement('hr')
|
||||||
addClassNamesToElement(element, config.theme.hr)
|
addClassNamesToElement(element, config.theme.hr)
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(): null | React.ReactElement {
|
override decorate(): null | React.ReactElement {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,28 +85,28 @@ export class HorizontalRuleServerNode extends DecoratorNode<null | React.ReactEl
|
|||||||
*
|
*
|
||||||
* This also determines the behavior of lexical's internal Lexical -> HTML converter
|
* This also determines the behavior of lexical's internal Lexical -> HTML converter
|
||||||
*/
|
*/
|
||||||
exportDOM(): DOMExportOutput {
|
override exportDOM(): DOMExportOutput {
|
||||||
return { element: document.createElement('hr') }
|
return { element: document.createElement('hr') }
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.
|
* Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.
|
||||||
*/
|
*/
|
||||||
exportJSON(): SerializedLexicalNode {
|
override exportJSON(): SerializedLexicalNode {
|
||||||
return {
|
return {
|
||||||
type: 'horizontalrule',
|
type: 'horizontalrule',
|
||||||
version: 1,
|
version: 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTextContent(): string {
|
override getTextContent(): string {
|
||||||
return '\n'
|
return '\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
isInline(): false {
|
override isInline(): false {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDOM(): boolean {
|
override updateDOM(): boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,20 +10,20 @@ import { LinkNode } from './LinkNode.js'
|
|||||||
// allow typing within the link
|
// allow typing within the link
|
||||||
|
|
||||||
export class AutoLinkNode extends LinkNode {
|
export class AutoLinkNode extends LinkNode {
|
||||||
static clone(node: AutoLinkNode): AutoLinkNode {
|
static override clone(node: AutoLinkNode): AutoLinkNode {
|
||||||
return new AutoLinkNode({ id: '', fields: node.__fields, key: node.__key })
|
return new AutoLinkNode({ id: '', fields: node.__fields, key: node.__key })
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'autolink'
|
return 'autolink'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): null {
|
static override importDOM(): null {
|
||||||
// TODO: Should link node should handle the import over autolink?
|
// TODO: Should link node should handle the import over autolink?
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedAutoLinkNode): AutoLinkNode {
|
static override importJSON(serializedNode: SerializedAutoLinkNode): AutoLinkNode {
|
||||||
if (
|
if (
|
||||||
serializedNode.version === 1 &&
|
serializedNode.version === 1 &&
|
||||||
typeof serializedNode.fields?.doc?.value === 'object' &&
|
typeof serializedNode.fields?.doc?.value === 'object' &&
|
||||||
@@ -55,7 +55,7 @@ export class AutoLinkNode extends LinkNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
insertNewAfter(selection: RangeSelection, restoreSelection = true): ElementNode | null {
|
override insertNewAfter(selection: RangeSelection, restoreSelection = true): ElementNode | null {
|
||||||
const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)
|
const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)
|
||||||
if ($isElementNode(element)) {
|
if ($isElementNode(element)) {
|
||||||
const linkNode = $createAutoLinkNode({ fields: this.__fields })
|
const linkNode = $createAutoLinkNode({ fields: this.__fields })
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class LinkNode extends ElementNode {
|
|||||||
this.__id = id
|
this.__id = id
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: LinkNode): LinkNode {
|
static override clone(node: LinkNode): LinkNode {
|
||||||
return new LinkNode({
|
return new LinkNode({
|
||||||
id: node.__id,
|
id: node.__id,
|
||||||
fields: node.__fields,
|
fields: node.__fields,
|
||||||
@@ -57,11 +57,11 @@ export class LinkNode extends ElementNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'link'
|
return 'link'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap | null {
|
static override importDOM(): DOMConversionMap | null {
|
||||||
return {
|
return {
|
||||||
a: (node: Node) => ({
|
a: (node: Node) => ({
|
||||||
conversion: $convertAnchorElement,
|
conversion: $convertAnchorElement,
|
||||||
@@ -70,7 +70,7 @@ export class LinkNode extends ElementNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedLinkNode): LinkNode {
|
static override importJSON(serializedNode: SerializedLinkNode): LinkNode {
|
||||||
if (
|
if (
|
||||||
serializedNode.version === 1 &&
|
serializedNode.version === 1 &&
|
||||||
typeof serializedNode.fields?.doc?.value === 'object' &&
|
typeof serializedNode.fields?.doc?.value === 'object' &&
|
||||||
@@ -95,19 +95,19 @@ export class LinkNode extends ElementNode {
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
canBeEmpty(): false {
|
override canBeEmpty(): false {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
canInsertTextAfter(): false {
|
override canInsertTextAfter(): false {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
canInsertTextBefore(): false {
|
override canInsertTextBefore(): false {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
createDOM(config: EditorConfig): HTMLAnchorElement {
|
override createDOM(config: EditorConfig): HTMLAnchorElement {
|
||||||
const element = document.createElement('a')
|
const element = document.createElement('a')
|
||||||
if (this.__fields?.linkType === 'custom') {
|
if (this.__fields?.linkType === 'custom') {
|
||||||
element.href = this.sanitizeUrl(this.__fields.url ?? '')
|
element.href = this.sanitizeUrl(this.__fields.url ?? '')
|
||||||
@@ -124,7 +124,7 @@ export class LinkNode extends ElementNode {
|
|||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedLinkNode {
|
override exportJSON(): SerializedLinkNode {
|
||||||
const fields = this.getFields()
|
const fields = this.getFields()
|
||||||
|
|
||||||
if (fields?.linkType === 'internal') {
|
if (fields?.linkType === 'internal') {
|
||||||
@@ -146,7 +146,7 @@ export class LinkNode extends ElementNode {
|
|||||||
return returnObject
|
return returnObject
|
||||||
}
|
}
|
||||||
|
|
||||||
extractWithChild(
|
override extractWithChild(
|
||||||
child: LexicalNode,
|
child: LexicalNode,
|
||||||
selection: BaseSelection,
|
selection: BaseSelection,
|
||||||
destination: 'clone' | 'html',
|
destination: 'clone' | 'html',
|
||||||
@@ -173,7 +173,10 @@ export class LinkNode extends ElementNode {
|
|||||||
return this.getLatest().__id
|
return this.getLatest().__id
|
||||||
}
|
}
|
||||||
|
|
||||||
insertNewAfter(selection: RangeSelection, restoreSelection = true): ElementNodeType | null {
|
override insertNewAfter(
|
||||||
|
selection: RangeSelection,
|
||||||
|
restoreSelection = true,
|
||||||
|
): ElementNodeType | null {
|
||||||
const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)
|
const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)
|
||||||
if ($isElementNode(element)) {
|
if ($isElementNode(element)) {
|
||||||
const linkNode = $createLinkNode({ fields: this.__fields })
|
const linkNode = $createLinkNode({ fields: this.__fields })
|
||||||
@@ -183,7 +186,7 @@ export class LinkNode extends ElementNode {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
isInline(): true {
|
override isInline(): true {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +208,7 @@ export class LinkNode extends ElementNode {
|
|||||||
writable.__fields = fields
|
writable.__fields = fields
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDOM(prevNode: LinkNode, anchor: HTMLAnchorElement, config: EditorConfig): boolean {
|
override updateDOM(prevNode: LinkNode, anchor: HTMLAnchorElement, config: EditorConfig): boolean {
|
||||||
const url = this.__fields?.url
|
const url = this.__fields?.url
|
||||||
const newTab = this.__fields?.newTab
|
const newTab = this.__fields?.newTab
|
||||||
if (url != null && url !== prevNode.__fields?.url && this.__fields?.linkType === 'custom') {
|
if (url != null && url !== prevNode.__fields?.url && this.__fields?.linkType === 'custom') {
|
||||||
|
|||||||
@@ -32,18 +32,18 @@ export class UnknownConvertedNode extends DecoratorNode<JSX.Element> {
|
|||||||
this.__data = data
|
this.__data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: UnknownConvertedNode): UnknownConvertedNode {
|
static override clone(node: UnknownConvertedNode): UnknownConvertedNode {
|
||||||
return new UnknownConvertedNode({
|
return new UnknownConvertedNode({
|
||||||
data: node.__data,
|
data: node.__data,
|
||||||
key: node.__key,
|
key: node.__key,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'unknownConverted'
|
return 'unknownConverted'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {
|
static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {
|
||||||
const node = $createUnknownConvertedNode({ data: serializedNode.data })
|
const node = $createUnknownConvertedNode({ data: serializedNode.data })
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
@@ -56,17 +56,17 @@ export class UnknownConvertedNode extends DecoratorNode<JSX.Element> {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
createDOM(config: EditorConfig): HTMLElement {
|
override createDOM(config: EditorConfig): HTMLElement {
|
||||||
const element = document.createElement('span')
|
const element = document.createElement('span')
|
||||||
addClassNamesToElement(element, 'unknownConverted')
|
addClassNamesToElement(element, 'unknownConverted')
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(): JSX.Element {
|
override decorate(): JSX.Element {
|
||||||
return <Component data={this.__data} />
|
return <Component data={this.__data} />
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedUnknownConvertedNode {
|
override exportJSON(): SerializedUnknownConvertedNode {
|
||||||
return {
|
return {
|
||||||
type: this.getType(),
|
type: this.getType(),
|
||||||
data: this.__data,
|
data: this.__data,
|
||||||
@@ -76,11 +76,11 @@ export class UnknownConvertedNode extends DecoratorNode<JSX.Element> {
|
|||||||
|
|
||||||
// Mutation
|
// Mutation
|
||||||
|
|
||||||
isInline(): boolean {
|
override isInline(): boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean {
|
override updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,18 +32,18 @@ export class UnknownConvertedNode extends DecoratorNode<JSX.Element> {
|
|||||||
this.__data = data
|
this.__data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: UnknownConvertedNode): UnknownConvertedNode {
|
static override clone(node: UnknownConvertedNode): UnknownConvertedNode {
|
||||||
return new UnknownConvertedNode({
|
return new UnknownConvertedNode({
|
||||||
data: node.__data,
|
data: node.__data,
|
||||||
key: node.__key,
|
key: node.__key,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'unknownConverted'
|
return 'unknownConverted'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {
|
static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {
|
||||||
const node = $createUnknownConvertedNode({ data: serializedNode.data })
|
const node = $createUnknownConvertedNode({ data: serializedNode.data })
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
@@ -56,17 +56,17 @@ export class UnknownConvertedNode extends DecoratorNode<JSX.Element> {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
createDOM(config: EditorConfig): HTMLElement {
|
override createDOM(config: EditorConfig): HTMLElement {
|
||||||
const element = document.createElement('span')
|
const element = document.createElement('span')
|
||||||
addClassNamesToElement(element, 'unknownConverted')
|
addClassNamesToElement(element, 'unknownConverted')
|
||||||
return element
|
return element
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(): JSX.Element {
|
override decorate(): JSX.Element {
|
||||||
return <Component data={this.__data} />
|
return <Component data={this.__data} />
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedUnknownConvertedNode {
|
override exportJSON(): SerializedUnknownConvertedNode {
|
||||||
return {
|
return {
|
||||||
type: this.getType(),
|
type: this.getType(),
|
||||||
data: this.__data,
|
data: this.__data,
|
||||||
@@ -76,11 +76,11 @@ export class UnknownConvertedNode extends DecoratorNode<JSX.Element> {
|
|||||||
|
|
||||||
// Mutation
|
// Mutation
|
||||||
|
|
||||||
isInline(): boolean {
|
override isInline(): boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean {
|
override updateDOM(prevNode: UnknownConvertedNode, dom: HTMLElement): boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,15 +38,15 @@ function $relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class RelationshipNode extends RelationshipServerNode {
|
export class RelationshipNode extends RelationshipServerNode {
|
||||||
static clone(node: RelationshipServerNode): RelationshipServerNode {
|
static override clone(node: RelationshipServerNode): RelationshipServerNode {
|
||||||
return super.clone(node)
|
return super.clone(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return super.getType()
|
return super.getType()
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
static override importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
||||||
return {
|
return {
|
||||||
div: (domNode: HTMLDivElement) => {
|
div: (domNode: HTMLDivElement) => {
|
||||||
if (
|
if (
|
||||||
@@ -63,7 +63,7 @@ export class RelationshipNode extends RelationshipServerNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {
|
static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {
|
||||||
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
||||||
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ export class RelationshipNode extends RelationshipServerNode {
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {
|
override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<RelationshipComponent
|
<RelationshipComponent
|
||||||
className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}
|
className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}
|
||||||
@@ -88,7 +88,7 @@ export class RelationshipNode extends RelationshipServerNode {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedRelationshipNode {
|
override exportJSON(): SerializedRelationshipNode {
|
||||||
return super.exportJSON()
|
return super.exportJSON()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class RelationshipServerNode extends DecoratorBlockNode {
|
|||||||
this.__data = data
|
this.__data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: RelationshipServerNode): RelationshipServerNode {
|
static override clone(node: RelationshipServerNode): RelationshipServerNode {
|
||||||
return new this({
|
return new this({
|
||||||
data: node.__data,
|
data: node.__data,
|
||||||
format: node.__format,
|
format: node.__format,
|
||||||
@@ -65,11 +65,11 @@ export class RelationshipServerNode extends DecoratorBlockNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'relationship'
|
return 'relationship'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
static override importDOM(): DOMConversionMap<HTMLDivElement> | null {
|
||||||
return {
|
return {
|
||||||
div: (domNode: HTMLDivElement) => {
|
div: (domNode: HTMLDivElement) => {
|
||||||
if (
|
if (
|
||||||
@@ -86,7 +86,7 @@ export class RelationshipServerNode extends DecoratorBlockNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {
|
static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {
|
||||||
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
||||||
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
||||||
}
|
}
|
||||||
@@ -104,11 +104,11 @@ export class RelationshipServerNode extends DecoratorBlockNode {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element | null {
|
override decorate(_editor: LexicalEditor, _config: EditorConfig): JSX.Element | null {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
exportDOM(): DOMExportOutput {
|
override exportDOM(): DOMExportOutput {
|
||||||
const element = document.createElement('div')
|
const element = document.createElement('div')
|
||||||
element.setAttribute(
|
element.setAttribute(
|
||||||
'data-lexical-relationship-id',
|
'data-lexical-relationship-id',
|
||||||
@@ -121,7 +121,7 @@ export class RelationshipServerNode extends DecoratorBlockNode {
|
|||||||
return { element }
|
return { element }
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedRelationshipNode {
|
override exportJSON(): SerializedRelationshipNode {
|
||||||
return {
|
return {
|
||||||
...super.exportJSON(),
|
...super.exportJSON(),
|
||||||
...this.getData(),
|
...this.getData(),
|
||||||
@@ -134,7 +134,7 @@ export class RelationshipServerNode extends DecoratorBlockNode {
|
|||||||
return this.getLatest().__data
|
return this.getLatest().__data
|
||||||
}
|
}
|
||||||
|
|
||||||
getTextContent(): string {
|
override getTextContent(): string {
|
||||||
return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`
|
return `${this.__data?.relationTo} relation to ${typeof this.__data?.value === 'object' ? this.__data?.value?.id : this.__data?.value}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,15 @@ export type SerializedUploadNode = {
|
|||||||
} & Spread<UploadData, SerializedDecoratorBlockNode>
|
} & Spread<UploadData, SerializedDecoratorBlockNode>
|
||||||
|
|
||||||
export class UploadNode extends UploadServerNode {
|
export class UploadNode extends UploadServerNode {
|
||||||
static clone(node: UploadServerNode): UploadServerNode {
|
static override clone(node: UploadServerNode): UploadServerNode {
|
||||||
return super.clone(node)
|
return super.clone(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return super.getType()
|
return super.getType()
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap<HTMLImageElement> {
|
static override importDOM(): DOMConversionMap<HTMLImageElement> {
|
||||||
return {
|
return {
|
||||||
img: (node) => ({
|
img: (node) => ({
|
||||||
conversion: $convertUploadElement,
|
conversion: $convertUploadElement,
|
||||||
@@ -66,7 +66,7 @@ export class UploadNode extends UploadServerNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedUploadNode): UploadNode {
|
static override importJSON(serializedNode: SerializedUploadNode): UploadNode {
|
||||||
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
||||||
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
||||||
}
|
}
|
||||||
@@ -88,11 +88,11 @@ export class UploadNode extends UploadServerNode {
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(): JSX.Element {
|
override decorate(): JSX.Element {
|
||||||
return <RawUploadComponent data={this.__data} nodeKey={this.getKey()} />
|
return <RawUploadComponent data={this.__data} nodeKey={this.getKey()} />
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedUploadNode {
|
override exportJSON(): SerializedUploadNode {
|
||||||
return super.exportJSON()
|
return super.exportJSON()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|||||||
this.__data = data
|
this.__data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone(node: UploadServerNode): UploadServerNode {
|
static override clone(node: UploadServerNode): UploadServerNode {
|
||||||
return new this({
|
return new this({
|
||||||
data: node.__data,
|
data: node.__data,
|
||||||
format: node.__format,
|
format: node.__format,
|
||||||
@@ -93,11 +93,11 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static getType(): string {
|
static override getType(): string {
|
||||||
return 'upload'
|
return 'upload'
|
||||||
}
|
}
|
||||||
|
|
||||||
static importDOM(): DOMConversionMap<HTMLImageElement> {
|
static override importDOM(): DOMConversionMap<HTMLImageElement> {
|
||||||
return {
|
return {
|
||||||
img: (node) => ({
|
img: (node) => ({
|
||||||
conversion: $convertUploadServerElement,
|
conversion: $convertUploadServerElement,
|
||||||
@@ -106,7 +106,7 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static importJSON(serializedNode: SerializedUploadNode): UploadServerNode {
|
static override importJSON(serializedNode: SerializedUploadNode): UploadServerNode {
|
||||||
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {
|
||||||
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
serializedNode.value = (serializedNode.value as unknown as { id: string }).id
|
||||||
}
|
}
|
||||||
@@ -132,12 +132,12 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
decorate(): JSX.Element {
|
override decorate(): JSX.Element {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />
|
return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />
|
||||||
}
|
}
|
||||||
|
|
||||||
exportDOM(): DOMExportOutput {
|
override exportDOM(): DOMExportOutput {
|
||||||
const element = document.createElement('img')
|
const element = document.createElement('img')
|
||||||
element.setAttribute('data-lexical-upload-id', String(this.__data?.value))
|
element.setAttribute('data-lexical-upload-id', String(this.__data?.value))
|
||||||
element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)
|
element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)
|
||||||
@@ -145,7 +145,7 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|||||||
return { element }
|
return { element }
|
||||||
}
|
}
|
||||||
|
|
||||||
exportJSON(): SerializedUploadNode {
|
override exportJSON(): SerializedUploadNode {
|
||||||
return {
|
return {
|
||||||
...super.exportJSON(),
|
...super.exportJSON(),
|
||||||
...this.getData(),
|
...this.getData(),
|
||||||
@@ -163,7 +163,7 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|||||||
writable.__data = data
|
writable.__data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDOM(): false {
|
override updateDOM(): false {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false
|
||||||
"noImplicitOverride": false
|
|
||||||
},
|
},
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../payload" },
|
{ "path": "../payload" },
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"exclude": ["dist", "node_modules"],
|
"exclude": ["dist", "node_modules"],
|
||||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
|
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "src/**/*.json"],
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../plugin-cloud-storage" }]
|
"references": [{ "path": "../payload" }, { "path": "../plugin-cloud-storage" }]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,5 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/* TODO: remove the following lines */
|
/* TODO: remove the following lines */
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noUncheckedIndexedAccess": false,
|
"noUncheckedIndexedAccess": false,
|
||||||
"noImplicitOverride": false,
|
|
||||||
},
|
},
|
||||||
"references": [{ "path": "../payload" }, { "path": "../translations" }]
|
"references": [{ "path": "../payload" }, { "path": "../translations" }]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user