UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

23 lines (22 loc) 1.18 kB
import type { EditorState } from '@atlaskit/editor-prosemirror/state'; export declare const DISPLAY_AS_OPTIONS: readonly ['url', 'inline', 'block', 'embed']; export type DisplayAsOption = (typeof DISPLAY_AS_OPTIONS)[number]; export type CardAtPasteRange = { appearance: Exclude<DisplayAsOption, 'url'>; /** * True when the node is a native embed rather than a card node. It displays as an * embed, but the card commands cannot operate on it — see `nativeEmbedNode.ts`. */ isNativeEmbed?: boolean; pos: number; }; /** * Finds the card that a paste produced. * * The paste range is recorded when the paste happens and then mapped through every later * transaction, so by the time the link has resolved into a card the range can point just * past that card. `pastedUrl` resolves the ambiguity: when it is known, a candidate * holding that URL wins over one that merely sits in the range, which stops a pre-existing * neighbouring card from being reported as the pasted one. */ export declare const getCardAtPasteRange: (state: EditorState, pasteStartPos: number, pasteEndPos: number, pastedUrl?: string) => CardAtPasteRange | undefined;