UNPKG

1.12 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module paste-from-office/filters/parse
7 */
8import { type StylesProcessor, type ViewDocumentFragment } from 'ckeditor5/src/engine.js';
9/**
10 * Parses the provided HTML extracting contents of `<body>` and `<style>` tags.
11 *
12 * @param htmlString HTML string to be parsed.
13 */
14export declare function parseHtml(htmlString: string, stylesProcessor: StylesProcessor): ParseHtmlResult;
15/**
16 * The result of {@link ~parseHtml}.
17 */
18export interface ParseHtmlResult {
19 /**
20 * Parsed body content as a traversable structure.
21 */
22 body: ViewDocumentFragment;
23 /**
24 * Entire body content as a string.
25 */
26 bodyString: string;
27 /**
28 * Array of native `CSSStyleSheet` objects, each representing separate `style` tag from the source HTML.
29 */
30 styles: Array<CSSStyleSheet>;
31 /**
32 * All `style` tags contents combined in the order of occurrence into one string.
33 */
34 stylesString: string;
35}