/** * Copyright 2023-present DreamNum Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { IDocumentData } from '@univerjs/core'; import type { CSSProperties, ReactNode, RefObject } from 'react'; import type { Editor, IEditorCanvasStyle } from '../services/editor/editor'; import type { IEditorRuntimeConfig } from '../services/editor/editor-runtime-config'; import type { IKeyboardEventConfig } from './rich-text-editor/hooks/use-keyboard-event'; export interface IRichTextEditorProps { /** Instance-only layout and interaction settings, never persisted in the document. */ renderConfig?: IEditorRuntimeConfig; className?: string; autoFocus?: boolean; onFocusChange?: (isFocus: boolean, newValue?: string) => void; initialValue?: IDocumentData | string; onClickOutside?: () => void; /** Keep the globally focused unit on the editor's host while this editor receives input focus. */ preserveHostFocus?: boolean; /** Let the host own engine sizing, including a fixed backing-store ratio. */ cancelDefaultResizeListener?: boolean; /** Fixed canvas backing-store ratio used with a host-managed layout. */ pixelRatio?: number; /** Use an untransformed layout size when the editor DOM is displayed through a CSS transform. */ layoutSize?: Readonly>; /** Keep document reflow independent from an oversized host-managed canvas. */ documentLayoutSize?: Readonly>; /** Keep the editor viewport anchored while a host expands it to fit content. */ autoScroll?: boolean; /** Let the editor create scrollbars when its content exceeds the current layout size. */ autoScrollbar?: boolean; /** Publish transient drag ranges to the host. Defaults to false. */ emitSelectionWhileDragging?: boolean; /** Keep host keyboard handlers active for non-collapsed selections. Defaults to false. */ keyboardEventsOnSelection?: boolean; keyboardEventConfig?: IKeyboardEventConfig; moveCursor?: boolean; style?: CSSProperties; isSingle?: boolean; placeholder?: string; editorId?: string; onHeightChange?: (height: number) => void; onChange?: (data: IDocumentData, str: string) => void; maxHeight?: number; defaultHeight?: number; icon?: ReactNode; editorRef?: RefObject | ((editor: Editor | null) => void); noStyle?: boolean; canvasStyle?: IEditorCanvasStyle; } export declare const RichTextEditor: (props: IRichTextEditorProps) => import("react").JSX.Element;