UNPKG

@atlaskit/editor-plugin-card

Version:

Card plugin for @atlaskit/editor-core

42 lines (41 loc) 3.59 kB
import type { CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next'; import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics'; import { ACTION } from '@atlaskit/editor-common/analytics'; import type { CardReplacementInputMethod, EmbedCardNodeTransformer } from '@atlaskit/editor-common/card'; import type { CardAppearance } from '@atlaskit/editor-common/provider-factory'; import type { Command } from '@atlaskit/editor-common/types'; import type { Attrs, Node, NodeType } from '@atlaskit/editor-prosemirror/model'; import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state'; import type { EditorView } from '@atlaskit/editor-prosemirror/view'; import type { CardAdf, DatasourceAdf, InlineCardAdf } from '@atlaskit/linking-common'; import type { Request } from '../types'; export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent, embedCardNodeTransformer?: EmbedCardNodeTransformer) => Command; export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command; export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, appearance?: CardAppearance) => Transaction; export declare const queueCardFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, previousAppearance?: CardAppearance | "url") => Transaction; export declare const convertHyperlinkToSmartCard: (state: EditorState, source: CardReplacementInputMethod, appearance: CardAppearance, normalizeLinkText?: boolean) => Transaction; export declare const changeSelectedCardToLink: (text?: string, href?: string, sendAnalytics?: boolean, node?: Node, pos?: number, editorAnalyticsApi?: EditorAnalyticsAPI) => Command; export declare const changeSelectedCardToLinkFallback: (text?: string, href?: string, sendAnalytics?: boolean, node?: Node, pos?: number, editorAnalyticsApi?: EditorAnalyticsAPI) => Command; export declare const updateCard: (href: string, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command; export declare const changeSelectedCardToText: (text: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command; export declare const setSelectedCardAppearance: (appearance: CardAppearance, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command; export type LinkNodes = { [key in 'inlineCard' | 'blockCard' | 'embedCard']: NodeType; }; export declare const getLinkNodeType: (appearance: CardAppearance, linkNodes: LinkNodes) => NodeType; type UpdateCardArgs = { inputMethod?: string; isDeletingConfig?: boolean; newAdf: DatasourceAdf | InlineCardAdf; node: Node; sourceEvent?: UIAnalyticsEvent; state: EditorState; view: EditorView; }; export declare const updateCardViaDatasource: (args: UpdateCardArgs) => void; export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void; /** * Get attributes for new Card Appearance */ export declare const getAttrsForAppearance: (appearance: CardAppearance, selectedNode: Node, isInsideBodiedSyncBlock?: boolean) => Attrs; export {};