UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

49 lines (48 loc) 1.89 kB
import { LinkResolver } from 'alinea/backend/resolver/LinkResolver'; import * as Y from 'yjs'; import { Label } from '../Label.js'; import { Shape } from '../Shape.js'; import { TextDoc } from '../TextDoc.js'; import { RecordShape } from './RecordShape.js'; export type RichTextMutator<R> = { readOnly: boolean; map: Y.Map<any>; fragment: Y.XmlFragment; insert: (id: string, block: string) => void; }; export interface TextDocStorage<Blocks> { doc: TextDoc<Blocks>; linked: Array<string>; } export interface TextDocSelected<Blocks> { doc: TextDoc<Blocks>; linked: Array<{ id: string; url: string; }>; } export declare class RichTextShape<Blocks> implements Shape<TextDoc<Blocks>, RichTextMutator<Blocks>> { label: Label; shapes?: Record<string, RecordShape<object>> | undefined; initialValue?: TextDoc<Blocks> | undefined; values: Record<string, RecordShape>; constructor(label: Label, shapes?: Record<string, RecordShape<object>> | undefined, initialValue?: TextDoc<Blocks> | undefined); innerTypes(parents: Array<string>): import("../Shape.js").ShapeInfo[]; create(): TextDoc<Blocks>; typeOfChild<C>(yValue: Y.Map<any>, child: string): Shape<C>; toXml(rows: TextDoc<Blocks>): (Y.XmlElement<{ [key: string]: string; }> | Y.XmlText)[]; toY(value: TextDoc<Blocks>): Y.Map<unknown>; fromY(value: Y.Map<any>): TextDoc<Blocks>; applyY(value: TextDoc<Blocks>, parent: Y.Map<any>, key: string): void; init(parent: Y.Map<any>, key: string): void; watch(parent: Y.Map<any>, key: string): () => () => void; mutator(parent: Y.Map<any>, key: string, readOnly: boolean): { readOnly: boolean; map: any; fragment: any; insert: (id: string, block: string) => void; }; applyLinks(doc: TextDoc<Blocks>, loader: LinkResolver): Promise<void>; }