@atlaskit/editor-plugin-media
Version:
Media plugin for @atlaskit/editor-core
46 lines (45 loc) • 2.94 kB
TypeScript
import { jsx } from '@emotion/react';
import type { IntlShape } from 'react-intl';
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';
import type { 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 { SelectedState } from '@atlaskit/editor-common/utils';
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
import type { MediaNextEditorPluginType } from '../mediaPluginType';
import type { ForwardRef, getPosHandler, MediaOptions } from '../types';
import type { MediaSingleNodeViewProps } from './types';
declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps> {
lastOffsetLeft: number;
forceViewUpdate: boolean;
selectionType: number | null;
unsubscribeToViewModeChange: (() => void) | undefined;
hasResized: boolean;
createDomRef(): HTMLElement;
getContentDOM(): {
dom: HTMLDivElement;
};
/**
* Skip rendering off-screen media in large (limited-mode) documents; the estimate is derived from
* the media's own dimensions and the renderer's width calculation. Called from both `createDomRef`
* and `update()` because limited mode can flip from disabled→enabled after the document loads.
* Takes the target element explicitly because `createDomRef` runs before `this.dom` is assigned.
*/
private updateContentVisibility;
viewShouldUpdate(nextNode: PMNode): boolean;
subscribeToViewModeChange(domRef: HTMLElement): (() => void) | undefined;
updateDomRefContentEditable(domRef: HTMLElement, editorViewMode?: 'edit' | 'view'): void;
checkAndUpdateSelectionType: () => SelectedState | null;
isNodeSelected: () => boolean;
getNodeMediaId(node: PMNode): string | undefined;
stopEvent(event: Event): boolean;
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;
destroy(): void;
}
export declare const ReactMediaSingleNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, mediaOptions?: MediaOptions, intl?: IntlShape) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaSingleNodeView;
export {};