UNPKG

@atlaskit/editor-plugin-media

Version:

Media plugin for @atlaskit/editor-core

64 lines (63 loc) 3.72 kB
/** @jsx jsx */ import type { MouseEvent } from 'react'; import React, { Component } from 'react'; import { jsx } from '@emotion/react'; import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema'; import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics'; import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher'; import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider'; import type { ContextIdentifierProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory'; import ReactNodeView from '@atlaskit/editor-common/react-node-view'; import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model'; import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view'; import type { CardEvent } from '@atlaskit/media-card'; import type { MediaClientConfig } from '@atlaskit/media-core'; import type { MediaNextEditorPluginType } from '../next-plugin-type'; import type { ForwardRef, getPosHandler } from '../types'; import type { MediaOptions } from '../types'; import { MediaNodeUpdater } from './mediaNodeUpdater'; import type { MediaSingleNodeProps, MediaSingleNodeViewProps } from './types'; export interface MediaSingleNodeState { width?: number; height?: number; viewMediaClientConfig?: MediaClientConfig; contextIdentifierProvider?: ContextIdentifierProvider; isCopying: boolean; } export default class MediaSingleNode extends Component<MediaSingleNodeProps, MediaSingleNodeState> { static defaultProps: Partial<MediaSingleNodeProps>; static displayName: string; mediaNodeUpdater: MediaNodeUpdater | null; state: MediaSingleNodeState; mediaSingleWrapperRef: React.RefObject<HTMLDivElement>; captionPlaceHolderRef: React.RefObject<HTMLSpanElement>; createOrUpdateMediaNodeUpdater: (props: MediaSingleNodeProps) => void; UNSAFE_componentWillReceiveProps(nextProps: MediaSingleNodeProps): void; setViewMediaClientConfig: (props: MediaSingleNodeProps) => Promise<void>; updateMediaNodeAttributes: (props: MediaSingleNodeProps) => Promise<void>; componentDidMount(): Promise<void>; selectMediaSingle: ({ event }: CardEvent) => void; updateSize: (width: number | null, layout: MediaSingleLayout) => void; onMediaSingleClicked: (event: MouseEvent) => void; render(): jsx.JSX.Element; private clickPlaceholder; } declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps> { lastOffsetLeft: number; forceViewUpdate: boolean; selectionType: number | null; createDomRef(): HTMLElement; getContentDOM(): { dom: HTMLDivElement; }; viewShouldUpdate(nextNode: PMNode): boolean; checkAndUpdateSelectionType: () => import("@atlaskit/editor-common/utils").SelectedState | null; isNodeSelected: () => boolean; getNodeMediaId(node: PMNode): string | undefined; update(node: PMNode, decorations: readonly Decoration[], _innerDecorations?: DecorationSource, isValidUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean; render(props: MediaSingleNodeViewProps, forwardRef?: ForwardRef): jsx.JSX.Element; ignoreMutation(): boolean; } export declare const ReactMediaSingleNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, mediaOptions?: MediaOptions) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaSingleNodeView; export {};