import type { GetPMNodeHeight } from '@atlaskit/editor-common/extensibility'; import type { Fragment, Mark, Node } from '@atlaskit/editor-prosemirror/model'; import type { AnalyticsEventPayload } from '../analytics/events'; import type { Serializer } from '../serializer'; import type { HeadingAnchorLinksProps, NodeComponentsProps, RendererAppearance, RendererContentMode, StickyHeaderConfig } from '../ui/Renderer/types'; import type { ExtensionHandlers, ExtensionParams, Parameters } from '@atlaskit/editor-common/extensions'; import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory'; import type { EventHandlers } from '@atlaskit/editor-common/ui'; import type { EmojiResourceConfig } from '@atlaskit/emoji/resource'; import type { MediaOptions } from '../types/mediaOptions'; import type { SmartLinksOptions } from '../types/smartLinksOptions'; import type { ExtensionViewportSize, RendererContext, TextHighlighter } from './types'; export interface ReactSerializerInit { allowAltTextOnImages?: boolean; allowAnnotations?: boolean; allowColumnSorting?: boolean; allowCopyToClipboard?: boolean; allowCustomPanels?: boolean; allowFixedColumnWidthOption?: boolean; allowHeadingAnchorLinks?: HeadingAnchorLinksProps; allowMediaLinking?: boolean; allowPlaceholderText?: boolean; allowSelectAllTrap?: boolean; allowTableAlignment?: boolean; allowTableResizing?: boolean; allowWindowedCodeBlock?: boolean; allowWrapCodeBlock?: boolean; appearance?: RendererAppearance; contentMode?: RendererContentMode; disableActions?: boolean; disableHeadingIDs?: boolean; disableTableOverflowShadow?: boolean; emojiResourceConfig?: EmojiResourceConfig; eventHandlers?: EventHandlers; extensionHandlers?: ExtensionHandlers; extensionViewportSizes?: ExtensionViewportSize[]; fireAnalyticsEvent?: (event: AnalyticsEventPayload) => void; getExtensionHeight?: GetPMNodeHeight; isInsideOfInlineExtension?: boolean; isPresentational?: boolean; media?: MediaOptions; nodeComponents?: NodeComponentsProps; objectContext?: RendererContext; onSetLinkTarget?: (url: string) => '_blank' | undefined; portal?: HTMLElement; providers?: ProviderFactory; shouldDisplayExtensionAsInline?: (extensionParams: ExtensionParams) => boolean; shouldOpenMediaViewer?: boolean; smartLinks?: SmartLinksOptions; /** * Used for to set positions on nodes for annotations. * * When not provided defaults to 1. */ startPos?: number; stickyHeaders?: StickyHeaderConfig; surroundTextNodesWithTextWrapper?: boolean; textHighlighter?: TextHighlighter; } interface ParentInfo { parentIsIncompleteTask: boolean; path: Array; pos: number; } export default class ReactSerializer implements Serializer { private providers?; private eventHandlers?; private extensionHandlers?; private portal?; private rendererContext?; private appearance?; private contentMode?; private disableHeadingIDs?; private disableActions?; private headingIds; /** * The reason we have this extra array here is because we need to generate the same unique * heading id for 2 different nodes: headers and expands (check the implementation of * `getUniqueHeadingId` for more info). * * We will eventually need to refactor the current approach to generate unique ids * for headers under this ticket -> https://product-fabric.atlassian.net/browse/ED-9668 */ private expandHeadingIds; private allowHeadingAnchorLinks?; private allowColumnSorting?; private allowCopyToClipboard?; private allowWrapCodeBlock?; private allowPlaceholderText?; private allowCustomPanels?; private fireAnalyticsEvent?; private shouldOpenMediaViewer?; private allowAltTextOnImages?; private stickyHeaders?; private allowMediaLinking?; private initStartPos; private startPos; private surroundTextNodesWithTextWrapper; private media?; private emojiResourceConfig?; private smartLinks?; private extensionViewportSizes?; private getExtensionHeight?; private allowAnnotations; private allowSelectAllTrap?; private nodeComponents?; private allowWindowedCodeBlock?; private isInsideOfInlineExtension?; private textHighlighter?; private allowTableAlignment?; private allowTableResizing?; private allowFixedColumnWidthOption?; private isPresentational?; private disableTableOverflowShadow?; private standaloneBackgroundColorMarks; private onSetLinkTarget?; private shouldDisplayExtensionAsInline?; private inlinePositions; constructor(init: ReactSerializerInit); private resetState; private getNodeProps; serializeFragment(fragment: Fragment, props?: any, target?: any, key?: string, parentInfo?: ParentInfo): JSX.Element | null; private serializeFragmentChild; private withMediaMarkProps; private serializeTextWrapper; private serializeMark; private renderNode; private renderMark; private getTableChildrenProps; private getTableProps; private getDateProps; private getMediaSingleProps; private getMediaProps; private getExtensionProps; private getEmojiProps; private getEmbedCardProps; private getBlockCardProps; private getInlineCardProps; private getMediaGroupProps; private getMediaInlineProps; private getTaskItemProps; private getHardBreakProps; private getCodeBlockProps; private getPanelProps; private getUnsupportedContentProps; private getProps; private headingAnchorSupported; private getHeadingProps; private getExpandProps; private getHeadingId; private getUniqueHeadingId; private getAnnotationMarkProps; private getMarkProps; private getChildNodes; static getMarks(node: Node): Mark[]; static buildMarkStructure(content: Node[]): Mark[]; } export {};