@types/slate-html-serializer
TypeScript icon, indicating that this package has built-in type declarations

0.6.8 • Public • Published

Installation

npm install --save @types/slate-html-serializer

Summary

This package contains type definitions for slate-html-serializer (https://github.com/ianstormtaylor/slate).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/slate-html-serializer.

index.d.ts

import * as React from "react";
import { BlockProperties, Leaf, Mark, Node as SlateNode, Value, ValueJSON } from "slate";

export interface Rule {
    deserialize?:
        | ((el: Element, next: (elements: Element[] | NodeList | Array<Node & ChildNode>) => any) => any)
        | undefined;
    serialize?: ((obj: any, children: string) => React.ReactNode) | undefined;
}

export interface HtmlOptions {
    rules?: Rule[] | undefined;
    defaultBlock?: BlockProperties | string | undefined;
    parseHtml?: ((html: string) => HTMLElement) | undefined;
}

export default class Html {
    constructor(options?: HtmlOptions);

    deserialize(html: string, options: { toJSON: true }): ValueJSON;
    deserialize(html: string, options?: { toJSON?: false | undefined }): Value;

    serialize(value: Value, options?: { render?: true | undefined }): string;
    serialize(value: Value, options: { render: false }): Element[];

    protected rules: Rule[];
    protected defaultBlock: BlockProperties;
    protected parseHtml: (html: string) => HTMLElement;

    protected deserializeElements: (elements: HTMLElement[]) => SlateNode[];
    protected deserializeElement: (element: HTMLElement) => any;
    protected deserializeMark: (mark: Mark) => SlateNode[];

    protected serializeNode: (node: SlateNode) => string;
    protected serializeLeaf: (leaf: Leaf) => string;
    protected serializeString: (string: string) => string;
}

Additional Details

Credits

These definitions were written by Brandon Shelton.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/slate-html-serializer

Weekly Downloads

6,688

Version

0.6.8

License

MIT

Unpacked Size

5.67 kB

Total Files

5

Last publish

Collaborators

  • types