UNPKG

@textbus/core

Version:

Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.

39 lines (38 loc) 1.38 kB
import { Component, ComponentLiteral } from './component'; /** * Textbus 内容管理类 * Content 属于 Slot 的私有属性,在实际场景中,开发者不需在关注此类,也不需要访问或操作此类 */ export declare class Content { private static get segmenter(); static _segmenter: Intl.Segmenter | null; private data; /** * 内容的长度 */ get length(): number; /** * 修复 index,由于 emoji 长度不固定,当 index 在 emoji 中时,操作数据会产生意外的数据 * @param index 当前的 index * @param toEnd 当需要变更 index 时,是向后还是向前移动 */ correctIndex(index: number, toEnd: boolean): number; /** * 在指定下标位置插入内容 * @param index * @param content */ insert(index: number, content: string | Component): void; /** * 把内容添加到最后 * @param content */ append(content: Component | string): void; cut(startIndex?: number, endIndex?: number): Array<string | Component>; slice(startIndex?: number, endIndex?: number): Array<string | Component>; toJSON(): Array<string | ComponentLiteral>; indexOf(element: Component): number; getContentAtIndex(index: number): string | Component<import("./types").State>; toGrid(): number[]; toString(): string; }