improve attribute type

This commit is contained in:
Philipp Kühn
2020-10-24 00:09:58 +02:00
parent 98580b2149
commit 59d6051d05

View File

@@ -6,13 +6,12 @@ export type Extensions = (Extension | NodeExtension | MarkExtension)[]
export type Attribute = { export type Attribute = {
default: any, default: any,
rendered?: boolean, rendered?: false,
renderHTML?: (attributes: { } | {
[key: string]: any, default: any,
}) => any, rendered?: true,
parseHTML?: (node: HTMLElement) => { renderHTML: (attributes: { [key: string]: any }) => any,
[key: string]: any, parseHTML: (node: HTMLElement) => { [key: string]: any },
},
} }
export type Attributes = { export type Attributes = {
@@ -22,7 +21,12 @@ export type Attributes = {
export type ExtensionAttribute = { export type ExtensionAttribute = {
type: string, type: string,
name: string, name: string,
attribute: Required<Attribute>, attribute: {
default: any,
rendered: boolean,
renderHTML: (attributes: { [key: string]: any }) => any,
parseHTML: (node: HTMLElement) => { [key: string]: any },
},
} }
export type GlobalAttributes = { export type GlobalAttributes = {