UNPKG

@yuntijs/ui

Version:

☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps

40 lines (39 loc) 2.04 kB
import { HeadingTagType } from '@lexical/rich-text'; import { LexicalEditor, LexicalNode } from 'lexical'; export declare enum UpdateFontSizeType { increment = 1, decrement = 2 } export declare enum BLOCK_TYPE { PARAGRAPH = "paragraph", H1 = "h1", H2 = "h2", H3 = "h3", BULLET = "bullet", NUMBER = "number", CHECK = "check", QUOTE = "quote", CODE = "code" } export type BLOCK_TYPE_VALUE = 'number' | 'paragraph' | 'bullet' | 'check' | 'code' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'quote'; /** * Calculates the new font size based on the update type. * @param currentFontSize - The current font size * @param updateType - The type of change, either increment or decrement * @returns the next font size */ export declare const calculateNextFontSize: (currentFontSize: number, updateType: UpdateFontSizeType | null) => number; /** * Patches the selection with the updated font size. */ export declare const updateFontSizeInSelection: (editor: LexicalEditor, newFontSize: string | null, updateType: UpdateFontSizeType | null) => void; export declare const updateFontSize: (editor: LexicalEditor, updateType: UpdateFontSizeType, inputValue: number) => void; export declare const formatParagraph: (editor: LexicalEditor) => void; export declare const formatHeading: (editor: LexicalEditor, blockType: BLOCK_TYPE_VALUE, headingSize: HeadingTagType) => void; export declare const formatBulletList: (editor: LexicalEditor, blockType: BLOCK_TYPE_VALUE) => void; export declare const formatCheckList: (editor: LexicalEditor, blockType: BLOCK_TYPE_VALUE) => void; export declare const formatNumberedList: (editor: LexicalEditor, blockType: string) => void; export declare const formatQuote: (editor: LexicalEditor, blockType: BLOCK_TYPE_VALUE) => void; export declare const formatCode: (editor: LexicalEditor, blockType: BLOCK_TYPE_VALUE) => void; export declare const clearFormatting: (editor: LexicalEditor) => void; export declare function $findTopLevelElement(node: LexicalNode): LexicalNode;