@textbus/editor
Version:
Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.
52 lines (51 loc) • 1.65 kB
TypeScript
import { Injector } from '@tanbo/di';
import { Keymap, QueryState } from '@textbus/core';
import { Tool } from '../types';
/**
* Select 工具选项配置项
*/
export interface SelectOptionConfig<T = any> {
/** 当前选项被选中后,要应用的值 */
value: T;
/** 当前选项显示的文字,如为空则显示 value */
label: string;
/** 给当前选项添加一组 css class 类 */
classes?: string[];
/** 给当前选项添加 icon css class 类 */
iconClasses?: string[];
/** 当所有选项都未锚中时,显示的默认项 */
default?: boolean;
/** 当前选项应用的快捷键 */
keymap?: Keymap;
/** 是否禁用 */
disabled?: boolean;
}
/**
* 下拉选择工具配置项
*/
export interface SelectToolConfig<T = any> {
/** Select 的可选项配置 */
options: SelectOptionConfig<T>[];
/** 给 Select 控件添加一组 css class */
classes?: string[];
/** 给 select 控件添加一组 icon css class 类 */
iconClasses?: string[];
/** 设置当前 Select 是否根据内容扩展宽度 */
mini?: boolean;
/** 当鼠标放在控件上的提示文字 */
tooltip?: string;
onChecked(value: T): void;
queryState?(): QueryState<T>;
onDestroy?(): void;
}
export declare class SelectTool implements Tool {
private factory;
private config;
private viewer;
private controller;
constructor(factory: (injector: Injector) => SelectToolConfig);
setup(injector: Injector, limitElement: HTMLElement): HTMLElement;
refreshState(): void;
disabled(is: boolean): void;
onDestroy(): void;
}