You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
996 B
TypeScript
28 lines
996 B
TypeScript
import { LexicalCommand, createCommand, TextFormatType } from 'lexical';
|
|
|
|
export interface CopiedFormat {
|
|
textFormatFlags: number; // 从node.getFormat()
|
|
style: string; // 从node.getStyle()
|
|
// todo: p 标签的样式
|
|
}
|
|
|
|
export interface ActivateFormatPainterPayload {
|
|
sticky: boolean;
|
|
}
|
|
|
|
// activate the format painter and copy the current selection's format
|
|
export const ACTIVATE_FORMAT_PAINTER_COMMAND: LexicalCommand<ActivateFormatPainterPayload> =
|
|
createCommand('ACTIVATE_FORMAT_PAINTER_COMMAND');
|
|
|
|
// deactivate the format painter
|
|
export const DEACTIVATE_FORMAT_PAINTER_COMMAND: LexicalCommand<void> =
|
|
createCommand('DEACTIVATE_FORMAT_PAINTER_COMMAND');
|
|
|
|
// dispatched by the plugin to inform UI about state changes
|
|
export interface FormatPainterState {
|
|
isActive: boolean;
|
|
isSticky: boolean;
|
|
}
|
|
export const FORMAT_PAINTER_STATE_UPDATE_COMMAND: LexicalCommand<FormatPainterState> =
|
|
createCommand('FORMAT_PAINTER_STATE_UPDATE_COMMAND');
|