UNPKG

@atlaskit/editor-plugin-paste

Version:

Paste plugin for @atlaskit/editor-core

46 lines (45 loc) 4.59 kB
import type { AnalyticsEventPayload, EditorAnalyticsAPI, PasteContent, PasteType } from '@atlaskit/editor-common/analytics'; import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types'; import type { FindRootParentListNode } from '@atlaskit/editor-plugin-list'; import type { InsertMediaAsMediaSingle } from '@atlaskit/editor-plugin-media/types'; import type { Fragment, Schema, Slice } from '@atlaskit/editor-prosemirror/model'; import type { EditorView } from '@atlaskit/editor-prosemirror/view'; import type { PastePlugin } from '../index'; type PasteContext = { asPlain?: boolean; /** Has the hyperlink been pasted while text is selected, making the text into a link? */ hyperlinkPasteOnText?: boolean; /** Did this paste action split a list in half? */ pasteSplitList?: boolean; type: PasteType; }; type GetContentProps = { schema: Schema; slice: Slice; }; export declare function getContent({ schema, slice }: GetContentProps): PasteContent; export declare function getMediaTraceId(slice: Slice): undefined; export declare function createPasteAnalyticsPayload(view: EditorView, event: ClipboardEvent, slice: Slice, pasteContext: PasteContext): AnalyticsEventPayload; export declare const sendPasteAnalyticsEvent: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, pasteContext: PasteContext) => void; export declare const handlePasteAsPlainTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command; export declare const handlePasteIntoTaskAndDecisionWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined) => Command; export declare const handlePasteIntoCaptionWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command; export declare const handleCodeBlockWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, text: string) => Command; export declare const handleMediaSingleWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined) => Command; export declare const handlePastePreservingMarksWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined) => Command; export declare const handleMarkdownWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined) => Command; export declare const handleRichTextWithAnalytics: (view: EditorView, event: ClipboardEvent, slice: Slice, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined) => Command; export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command; export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command; export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command; export declare const handleNestedTablePasteWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingTablesSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command; export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command; export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command; export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: { content: Array<string>; distortedDuration: boolean; duration: number; view: EditorView; }) => AnalyticsEventPayload; export declare const getContentNodeTypes: (content: Fragment) => string[]; export {};