@atlaskit/editor-plugin-clipboard
Version:
Clipboard plugin for @atlaskit/editor-core
22 lines (21 loc) • 1.45 kB
TypeScript
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
import { ACTION } from '@atlaskit/editor-common/analytics';
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
import type { Schema } from '@atlaskit/editor-prosemirror/model';
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
export declare enum ClipboardEventType {
CUT = "CUT",
COPY = "COPY"
}
export declare const createPlugin: ({ dispatchAnalyticsEvent, schema, }: PMPluginFactoryParams) => SafePlugin;
/**
* Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
* This allows us to store the original table’s attributes on the new table that the row is wrapped with when it is being copied.
* e.g. keeping the layout on a row that is copied.
* We store the default serializer in order to call it after we handle the table row case.
*/
export declare const createClipboardSerializer: (schema: Schema, getEditorView: () => EditorView) => DOMSerializer;
export declare const sendClipboardAnalytics: (view: EditorView, dispatchAnalyticsEvent: DispatchAnalyticsEvent, action: ACTION.CUT | ACTION.COPIED) => boolean;
export declare const setLastEventType: (eventType: ClipboardEventType) => ClipboardEventType;