0.6.8 • Published 6 months ago

@types/slate-html-serializer v0.6.8

Weekly downloads
4,285
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for slate-html-serializer 0.6
// Project: https://github.com/ianstormtaylor/slate
// Definitions by: Brandon Shelton <https://github.com/YangusKhan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
import { BlockProperties, ValueJSON, Value, Node as SlateNode, Mark, Leaf } 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.

0.6.7

7 months ago

0.6.6

8 months ago

0.6.8

6 months ago

0.6.5

3 years ago

0.6.4

4 years ago

0.6.3

5 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago