@speckle/shared
Version:
Shared code between various Speckle JS packages
30 lines • 1.12 kB
TypeScript
import type { Optional } from '../../core/helpers/utilityTypes.js';
type JSONContent = {
[key: string]: any;
type?: string | undefined;
attrs?: Record<string, any> | undefined;
content?: JSONContent[];
marks?: {
type: string;
attrs?: Record<string, any>;
[key: string]: any;
}[];
text?: string;
};
/**
* Check whether a doc is empty
*/
export declare function isDocEmpty(doc: JSONContent | null | undefined): boolean;
/**
* Convert document to a basic string without all of the formatting, HTML tags, attributes etc.
* Useful for previews or text analysis.
* @param stopAtLength If set, will stop further parsing when the resulting string length
* reaches this length. Useful when you're only interested in the first few characters of the document.
*/
export declare function documentToBasicString(doc: JSONContent | null | undefined, stopAtLength?: Optional<number>): string;
/**
* Build a rich text document out of a basic string
*/
export declare function convertBasicStringToDocument(text: string): JSONContent;
export {};
//# sourceMappingURL=index.d.ts.map