/// /// /// import type { CSSProperties, FocusEvent } from 'react'; import { Component } from 'react'; import Editor from 'draft-js-plugins-editor'; import type { BoundingRect, ContentRect } from 'react-measure'; import type { ContentBlock, EditorProps } from '@wix/draft-js'; import type { SelectionState } from 'wix-rich-content-editor-common'; import { EditorState, TOOLBARS } from 'wix-rich-content-editor-common'; import type { EditorProps as DraftEditorProps, DraftHandleValue } from 'draft-js'; import type { AvailableExperiments, RicosContent, RichContentTheme, Helpers, TranslationFunction, CreatePluginFunction, onAtomicBlockFocus, OnErrorFunction, NormalizeConfig, ModalStyles, LegacyEditorPluginConfig, BICallbacks, AnchorTarget, RelValue, CustomAnchorScroll, EditorContextType, PluginButton, PluginTextButtons, ToolbarButtonProps, TextToolbarType, Pubsub, GetEditorState, SetEditorState, TextDirection, CreatePluginsDataMap, EditorCommands, PluginKeyBindings, CommandHandler, KeyCommand, EditorStyleClasses } from 'wix-rich-content-common'; import type { TextAlignment } from 'ricos-types'; declare type PartialDraftEditorProps = Pick, 'tabIndex' | 'placeholder' | 'stripPastedStyles' | 'autoCapitalize' | 'autoComplete' | 'autoCorrect' | 'ariaActiveDescendantID' | 'ariaAutoComplete' | 'ariaControls' | 'ariaDescribedBy' | 'ariaExpanded' | 'ariaLabel' | 'ariaMultiline' | 'onBlur' | 'onFocus' | 'handleBeforeInput' | 'handlePastedText' | 'readOnly'> & Pick, 'spellCheck' | 'customStyleFn'>; declare type ToolbarsToIgnore = ('InlineTextToolbar' | 'InlineToolbar' | 'SideToolbar' | 'FooterToolbar' | 'MobileToolbar' | 'StaticTextToolbar' | 'StaticToolbar' | 'InlinePluginToolbar')[]; export interface RichContentEditorProps extends PartialDraftEditorProps { /** This is a legacy API, chagnes should be made also in the new Ricos Editor API **/ onLoad?: (any: any) => void; editorKey?: string; editorState?: EditorState; initialState?: RicosContent; theme?: RichContentTheme; isMobile?: boolean; helpers?: Helpers; t: TranslationFunction; textToolbarType?: TextToolbarType; plugins: CreatePluginFunction[]; createPluginsDataMap: CreatePluginsDataMap; config: LegacyEditorPluginConfig; anchorTarget?: AnchorTarget; relValue?: RelValue; customAnchorScroll?: CustomAnchorScroll; style?: CSSProperties; editorStyleClasses?: EditorStyleClasses; locale: string; localeContent?: string; shouldRenderOptimizedImages?: boolean; onChange?(editorState: EditorState): void; onAtomicBlockFocus?: onAtomicBlockFocus; siteDomain?: string; iframeSandboxDomain?: string; onError: OnErrorFunction; toolbarsToIgnore?: ToolbarsToIgnore; showToolbars?: boolean; normalize: NormalizeConfig; isInnerRCE?: boolean; innerRCERenderedIn?: string; direction?: TextDirection; onBackspace?(editorState: EditorState): void; setEditorToolbars?(ref: RichContentEditor): void; handleReturn?: (updateEditorStateCallback: (editorState: EditorState) => void) => DraftEditorProps['handleReturn']; handleUndoCommand?: (editorState?: EditorState) => EditorState; handleRedoCommand?: (editorState?: EditorState) => EditorState; tablePluginMenu?: boolean; callOnChangeOnNewEditorState?: boolean; localeResource?: Record; maxTextLength?: number; experiments?: AvailableExperiments; disableKeyboardEvents?: (shouldEnable: boolean) => void; textWrap: boolean; textAlignment: TextAlignment; getDocumentStyle?: EditorCommands['getDocumentStyle']; updateDocumentStyle?: EditorCommands['updateDocumentStyle']; } interface RichContentEditorState { editorState: EditorState; editorBounds?: BoundingRect; innerModal: { modalProps: Record; modalStyles?: ModalStyles; } | null; toolbarsToIgnore: ToolbarsToIgnore; theme?: RichContentTheme; textToolbarType?: TextToolbarType; error?: string; readOnly: boolean; context: { experiments: AvailableExperiments; isMobile: boolean; t?: TranslationFunction; }; undoRedoStackChanged: boolean; } declare class RichContentEditor extends Component { refId: number; commonPubsub: Pubsub; handleCallbacks: (newState: EditorState, biCallbacks?: BICallbacks) => void | undefined; contextualData: EditorContextType; editor: Editor & { setMode: (mode: 'render' | 'edit') => void; }; editorWrapper: Element; lastFocusedAtomicPlugin?: ContentBlock; updateBounds: (editorBounds?: BoundingRect) => void; plugins: any; focusedBlockKey: string; pluginKeyBindings: PluginKeyBindings; customStyleFn: DraftEditorProps['customStyleFn']; toolbars: any; innerRCECustomStyleFn: any; EditorCommands: EditorCommands; getSelectedText: (editorState: EditorState) => string; static defaultProps: Partial; static getDerivedStateFromError(error: string): { error: string; }; componentDidCatch(error: any, errorInfo: any): void; constructor(props: RichContentEditorProps); fixDraftSelectionExtend: () => void; componentDidUpdate(): void; componentDidMount(): void; componentWillMount(): void; componentWillUnmount(): void; preventDefaultKeyCommands: (event: any) => void; preloadLibs(): void; reportDebuggingInfo(): void; handleBlockFocus(editorState: EditorState): void; deprecateSiteDomain: () => void; onChangedFocusedBlock: (blockKey: string) => void; getEditorState: GetEditorState; setEditorState: SetEditorState; initContext: () => void; disableKeyboardEvents: (shouldDisable: any) => void; getEditorBounds: () => BoundingRect | undefined; initPlugins(): void; initEditorCommands: () => void; initEditorToolbars(pluginButtons: PluginButton[], pluginTextButtons: PluginTextButtons[], pluginButtonProps: ToolbarButtonProps[]): void; getToolbars: () => { MobileToolbar: any; TextToolbar: any; }; isInnerRCERenderedInTable: () => boolean; getInitialEditorState(): any; forceRender: () => void; componentWillReceiveProps(nextProps: RichContentEditorProps): void; fixHelpers(helpers: any): void; findFocusableChildForElement(id: string): HTMLElement | null; getContentId: () => string | undefined; createContentMutationEvents: (initialEditorState: EditorState, version: string) => (newState: EditorState, { onPluginDelete }?: BICallbacks) => void | undefined; didUndoRedoStackChange: (newEditorState: EditorState) => boolean; preserveNonDraftProperties: (editorState: EditorState) => void; updateEditorState: (editorState: EditorState) => void; handleTabCommand: () => void; focusOnToolbar: () => void; openPluginMenu: () => void; getHeadings: (config: any) => any; createPluginFromBlobs: (blobs: Blob[]) => DraftHandleValue; handlePastedFiles: (blobs: Blob[]) => DraftHandleValue; handleDroppedFiles: (_selection: SelectionState, blobs: Blob[]) => DraftHandleValue; isPluginInstalled: (pluginType: string) => any; handlePastedText: DraftEditorProps['handlePastedText']; handleEscCommand: (_: any, event: any) => void; handleUndoCommand: CommandHandler; handleRedoCommand: CommandHandler; getTabCommands: () => KeyCommand[]; customCommands: KeyCommand[]; customCommandHandlers: Record; getCustomCommandHandlers: () => { commands: KeyCommand[]; commandHandlers: Record; }; focus: () => NodeJS.Timeout; blur: () => void; getToolbarProps: (type?: TOOLBARS) => { buttons: any; context: EditorContextType; pubsub: Pubsub; }; getT: () => TranslationFunction; getContainer: () => Element; getPlugins: () => any; getEditorCommands: () => EditorCommands; setEditor: (ref: Editor) => any; inPluginEditingMode: boolean; setInPluginEditingMode: (shouldEnable: boolean) => void; handleSideToolbar: (shouldEnable: boolean) => void; getInPluginEditingMode: () => boolean; removeToolbarFocus: () => void; renderToolbars: () => any; renderInlineModals: () => any; handleBeforeInput: DraftEditorProps['handleBeforeInput']; onKeyboardShortcutClick: ({ buttonName, pluginId, }: { buttonName: string; pluginId?: string | undefined; }) => void; toDraftTextAlignment(textAlignment: TextAlignment): EditorProps['textAlignment']; renderEditor: () => JSX.Element; renderInnerRCE: ({ editorState, setRef, onChange, renderedIn, onBackspaceAtBeginningOfContent, direction, additionalProps, toolbarsToIgnore, tablePluginMenu, onFocus, onBlur, }: { editorState: any; setRef: any; onChange: any; renderedIn: any; onBackspaceAtBeginningOfContent: any; direction: any; additionalProps: any; toolbarsToIgnore: any; tablePluginMenu: any; onFocus: any; onBlur: any; }) => JSX.Element; renderAccessibilityListener: () => JSX.Element; styleToClass: ([key, val]: [any, any]) => string; styleToCss: ([key, val]: [any, any]) => string; objectToCss: (obj: any) => string; renderStyleTag: (editorState?: EditorState) => JSX.Element; onResize: import("lodash").DebouncedFunc<({ bounds }: ContentRect) => void>; openInnerModal: (data: any) => void; closeInnerModal: () => void; renderErrorToast: () => JSX.Element; onFocus: (e: FocusEvent) => void; disableFocusInSelection: (editorState: EditorState) => void; onBlur: (e: any) => void; setEditorWrapper: (ref: any) => any; render(): JSX.Element | null; } export default RichContentEditor; declare global { interface Window { __RICOS_INFO__: { getContent: any; getConfig: any; }; } } //# sourceMappingURL=RichContentEditor.d.ts.map