@atlaskit/editor-plugin-paste
Version:
Paste plugin for @atlaskit/editor-core
26 lines (25 loc) • 1.37 kB
TypeScript
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
import type { Selection } from '@atlaskit/editor-prosemirror/state';
import type { PastePlugin } from '../pastePluginType';
/**
* Ensure correct layout in nested mode
*
* TODO: ED-26959 - this func is only used in handlePaste, so layout update won't work for drop event
*/
export declare function transformSliceForMedia(slice: Slice, schema: Schema, api?: ExtractInjectionAPI<PastePlugin>): (selection: Selection) => Slice;
export declare const isImage: (fileType?: string) => boolean;
export declare const transformSliceToCorrectMediaWrapper: (slice: Slice, schema: Schema) => Slice;
/**
* This func will be called when copy & paste, drag & drop external html with media, media files, and slices from editor
* Because width may not be available when transform, DEFAULT_IMAGE_WIDTH is used as a fallback
*
*/
export declare const transformSliceToMediaSingleWithNewExperience: (slice: Slice, schema: Schema, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
/**
* Given a html string, we attempt to hoist any nested `<img>` tags,
* not directly wrapped by a `<div>` as ProseMirror no-op's
* on those scenarios.
* @param html
*/
export declare const unwrapNestedMediaElements: (html: string) => string;