@textbus/platform-browser
Version:
Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.
50 lines (49 loc) • 1.8 kB
TypeScript
import { ComponentConstructor, Component, ComponentLiteral, Module, Textbus } from '@textbus/core';
import { Provider } from '@viewfly/core';
import { AttributeLoader, ComponentLoader, FormatLoader } from './parser';
import { DomAdapter } from './dom-adapter';
/**
* Textbus PC 端配置接口
*/
export interface ViewOptions {
/** 跨平台适配器 */
adapter: DomAdapter<any, any>;
/** 编辑器根节点 */
renderTo(): HTMLElement;
/** 自动获取焦点 */
autoFocus?: boolean;
/** 编辑区最小高度 */
minHeight?: string;
/** 组件加载器 */
componentLoaders?: ComponentLoader[];
/** 格式加载器 */
formatLoaders?: FormatLoader<any>[];
/** 属性加载器 */
attributeLoaders?: AttributeLoader<any>[];
/** 使用 contentEditable 作为编辑器控制可编辑范围 */
useContentEditable?: boolean;
}
export declare class BrowserModule implements Module {
config: ViewOptions;
providers: Provider[];
private workbench;
constructor(config: ViewOptions);
/**
* 解析 HTML 并返回一个组件实例
* @param html 要解析的 HTML
* @param rootComponentLoader 文档根组件加载器
* @param textbus
*/
readDocumentByHTML(html: string, rootComponentLoader: ComponentLoader, textbus: Textbus): Component;
/**
* 将组件数据解析到组件实例中
* @param data 要解析的 JSON 数据
* @param rootComponent 根组件
* @param textbus
*/
readDocumentByComponentLiteral(data: ComponentLiteral, rootComponent: ComponentConstructor, textbus: Textbus): Component;
setup(textbus: Textbus): Promise<() => void>;
onAfterStartup(textbus: Textbus): void;
onDestroy(textbus: Textbus): void;
private static createLayout;
}