import React from 'react'; import type { ADFEntity } from '@atlaskit/adf-utils/types'; import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model'; import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view'; import type { EventDispatcher } from '../event-dispatcher'; import type { ExtensionHandlers } from '../extensions'; import type { PortalProviderAPI } from '../portal'; import type { ProviderFactory } from '../provider-factory'; import type { ForwardRef, getPosHandler } from '../react-node-view'; import ReactNodeView from '../react-node-view'; import type { EditorAppearance } from '../types'; import type { ExtensionsPluginInjectionAPI, MacroInteractionDesignFeatureFlags, GetPMNodeHeight } from './types'; interface ExtensionNodeViewOptions { appearance?: EditorAppearance; getExtensionHeight?: GetPMNodeHeight; } interface ReactExtensionNodeProps { extensionHandlers: ExtensionHandlers; extensionNodeViewOptions?: ExtensionNodeViewOptions; macroInteractionDesignFeatureFlags?: MacroInteractionDesignFeatureFlags; pluginInjectionApi: ExtensionsPluginInjectionAPI; providerFactory: ProviderFactory; rendererExtensionHandlers?: ExtensionHandlers; showLivePagesBodiedMacrosRendererView?: (node: ADFEntity) => boolean; showUpdatedLivePages1PBodiedExtensionUI?: (node: ADFEntity) => boolean; } export declare class ExtensionNode extends ReactNodeView { /** * Track whether we found and are reusing SSR'd DOM. * When true, we skip React Portal rendering on first init to preserve SSR content. */ private didReuseSsrDom; /** * Track whether this is the first init call. * SSR content preservation only happens on the very first init. */ private isFirstInit; ignoreMutation(mutation: MutationRecord | { target: Node; type: 'selection'; }): boolean; createDomRef(): HTMLElement; /** * Cache for SSR element lookup to avoid repeated DOM queries. * undefined = not yet searched, null = searched but not found, HTMLElement = found */ private cachedSsrElement; /** * Attempts to find an existing SSR'd DOM element for this extension node by extensionKey and localId * which should uniquely identify the * extension node within the editor content. * * @returns The SSR'd element if found, otherwise null */ private findSSRElement; /** * Override init() to skip React Portal rendering on first init if we're reusing SSR'd DOM. * This preserves the SSR content without React unnecessarily re-rendering it. */ init(): this; update(node: PmNode, decorations: ReadonlyArray, _innerDecorations?: DecorationSource, validUpdate?: (currentNode: PmNode, newNode: PmNode) => boolean): boolean; /** * When interacting with input elements inside an extension's body, the events * bubble up to the editor and get handled by it. This almost always gets in the way * of being able to actually interact with said input in the extension, i.e. * typing inside a text field (in an extension body) will print the text in the editor * content area instead. This change prevents the editor view from trying to handle these events, * when the target of the event is an input element, so the extension can. */ stopEvent(event: Event): boolean; getContentDOM(): { contentDOM: HTMLDivElement; dom: HTMLDivElement; } | { contentDOM?: undefined; dom: HTMLDivElement; } | undefined; render(props: { extensionHandlers: ExtensionHandlers; extensionNodeViewOptions?: ExtensionNodeViewOptions; macroInteractionDesignFeatureFlags?: MacroInteractionDesignFeatureFlags; pluginInjectionApi: ExtensionsPluginInjectionAPI; providerFactory: ProviderFactory; rendererExtensionHandlers?: ExtensionHandlers; showLivePagesBodiedMacrosRendererView?: (node: ADFEntity) => boolean; showUpdatedLivePages1PBodiedExtensionUI?: (node: ADFEntity) => boolean; }, forwardRef: ForwardRef): React.JSX.Element; } export default function ExtensionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: ExtensionsPluginInjectionAPI, macroInteractionDesignFeatureFlags?: MacroInteractionDesignFeatureFlags, showLivePagesBodiedMacrosRendererView?: (node: ADFEntity) => boolean, showUpdatedLivePages1PBodiedExtensionUI?: (node: ADFEntity) => boolean, rendererExtensionHandlers?: ExtensionHandlers): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView; export {};