@atlaskit/editor-plugin-card 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +15 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE.md +13 -0
- package/README.md +7 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/messages.js +20 -0
- package/dist/cjs/nodeviews/blockCard.js +164 -0
- package/dist/cjs/nodeviews/datasource.js +173 -0
- package/dist/cjs/nodeviews/embedCard.js +398 -0
- package/dist/cjs/nodeviews/genericCard.js +118 -0
- package/dist/cjs/nodeviews/inlineCard.js +132 -0
- package/dist/cjs/plugin.js +138 -0
- package/dist/cjs/pm-plugins/actions.js +122 -0
- package/dist/cjs/pm-plugins/analytics/create-analytics-queue.js +48 -0
- package/dist/cjs/pm-plugins/analytics/events-from-tr.js +359 -0
- package/dist/cjs/pm-plugins/analytics/index.js +19 -0
- package/dist/cjs/pm-plugins/analytics/types.js +5 -0
- package/dist/cjs/pm-plugins/analytics/utils.js +178 -0
- package/dist/cjs/pm-plugins/doc.js +479 -0
- package/dist/cjs/pm-plugins/keymap.js +64 -0
- package/dist/cjs/pm-plugins/main.js +212 -0
- package/dist/cjs/pm-plugins/mountHyperlink.js +47 -0
- package/dist/cjs/pm-plugins/plugin-key.js +9 -0
- package/dist/cjs/pm-plugins/reducers.js +111 -0
- package/dist/cjs/pm-plugins/shouldReplaceLink.js +35 -0
- package/dist/cjs/pm-plugins/util/resolve.js +59 -0
- package/dist/cjs/pm-plugins/util/state.js +49 -0
- package/dist/cjs/toolbar.js +364 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +25 -0
- package/dist/cjs/ui/DatasourceModal/index.js +60 -0
- package/dist/cjs/ui/EditLinkToolbar.js +258 -0
- package/dist/cjs/ui/EditorSmartCardEvents.js +21 -0
- package/dist/cjs/ui/EditorSmartCardEventsNext.js +215 -0
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +174 -0
- package/dist/cjs/ui/LayoutButton/index.js +121 -0
- package/dist/cjs/ui/LayoutButton/types.js +5 -0
- package/dist/cjs/ui/LayoutButton/utils.js +19 -0
- package/dist/cjs/ui/LinkToolbarAppearance.js +152 -0
- package/dist/cjs/ui/ResizableEmbedCard.js +364 -0
- package/dist/cjs/ui/SmallerEditIcon.js +22 -0
- package/dist/cjs/utils.js +60 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/messages.js +13 -0
- package/dist/es2019/nodeviews/blockCard.js +131 -0
- package/dist/es2019/nodeviews/datasource.js +137 -0
- package/dist/es2019/nodeviews/embedCard.js +370 -0
- package/dist/es2019/nodeviews/genericCard.js +92 -0
- package/dist/es2019/nodeviews/inlineCard.js +113 -0
- package/dist/es2019/plugin.js +129 -0
- package/dist/es2019/pm-plugins/actions.js +57 -0
- package/dist/es2019/pm-plugins/analytics/create-analytics-queue.js +38 -0
- package/dist/es2019/pm-plugins/analytics/events-from-tr.js +339 -0
- package/dist/es2019/pm-plugins/analytics/index.js +2 -0
- package/dist/es2019/pm-plugins/analytics/types.js +1 -0
- package/dist/es2019/pm-plugins/analytics/utils.js +160 -0
- package/dist/es2019/pm-plugins/doc.js +451 -0
- package/dist/es2019/pm-plugins/keymap.js +59 -0
- package/dist/es2019/pm-plugins/main.js +208 -0
- package/dist/es2019/pm-plugins/mountHyperlink.js +37 -0
- package/dist/es2019/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/reducers.js +110 -0
- package/dist/es2019/pm-plugins/shouldReplaceLink.js +25 -0
- package/dist/es2019/pm-plugins/util/resolve.js +50 -0
- package/dist/es2019/pm-plugins/util/state.js +26 -0
- package/dist/es2019/toolbar.js +359 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +19 -0
- package/dist/es2019/ui/DatasourceModal/index.js +48 -0
- package/dist/es2019/ui/EditLinkToolbar.js +226 -0
- package/dist/es2019/ui/EditorSmartCardEvents.js +15 -0
- package/dist/es2019/ui/EditorSmartCardEventsNext.js +199 -0
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +86 -0
- package/dist/es2019/ui/LayoutButton/index.js +114 -0
- package/dist/es2019/ui/LayoutButton/types.js +1 -0
- package/dist/es2019/ui/LayoutButton/utils.js +15 -0
- package/dist/es2019/ui/LinkToolbarAppearance.js +118 -0
- package/dist/es2019/ui/ResizableEmbedCard.js +335 -0
- package/dist/es2019/ui/SmallerEditIcon.js +14 -0
- package/dist/es2019/utils.js +46 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/messages.js +13 -0
- package/dist/esm/nodeviews/blockCard.js +156 -0
- package/dist/esm/nodeviews/datasource.js +165 -0
- package/dist/esm/nodeviews/embedCard.js +389 -0
- package/dist/esm/nodeviews/genericCard.js +111 -0
- package/dist/esm/nodeviews/inlineCard.js +124 -0
- package/dist/esm/plugin.js +130 -0
- package/dist/esm/pm-plugins/actions.js +102 -0
- package/dist/esm/pm-plugins/analytics/create-analytics-queue.js +41 -0
- package/dist/esm/pm-plugins/analytics/events-from-tr.js +350 -0
- package/dist/esm/pm-plugins/analytics/index.js +2 -0
- package/dist/esm/pm-plugins/analytics/types.js +1 -0
- package/dist/esm/pm-plugins/analytics/utils.js +160 -0
- package/dist/esm/pm-plugins/doc.js +460 -0
- package/dist/esm/pm-plugins/keymap.js +58 -0
- package/dist/esm/pm-plugins/main.js +199 -0
- package/dist/esm/pm-plugins/mountHyperlink.js +39 -0
- package/dist/esm/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/reducers.js +103 -0
- package/dist/esm/pm-plugins/shouldReplaceLink.js +29 -0
- package/dist/esm/pm-plugins/util/resolve.js +52 -0
- package/dist/esm/pm-plugins/util/state.js +40 -0
- package/dist/esm/toolbar.js +350 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +17 -0
- package/dist/esm/ui/DatasourceModal/index.js +49 -0
- package/dist/esm/ui/EditLinkToolbar.js +244 -0
- package/dist/esm/ui/EditorSmartCardEvents.js +14 -0
- package/dist/esm/ui/EditorSmartCardEventsNext.js +203 -0
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +163 -0
- package/dist/esm/ui/LayoutButton/index.js +110 -0
- package/dist/esm/ui/LayoutButton/types.js +1 -0
- package/dist/esm/ui/LayoutButton/utils.js +12 -0
- package/dist/esm/ui/LinkToolbarAppearance.js +141 -0
- package/dist/esm/ui/ResizableEmbedCard.js +358 -0
- package/dist/esm/ui/SmallerEditIcon.js +14 -0
- package/dist/esm/utils.js +48 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/messages.d.ts +12 -0
- package/dist/types/nodeviews/blockCard.d.ts +26 -0
- package/dist/types/nodeviews/datasource.d.ts +42 -0
- package/dist/types/nodeviews/embedCard.d.ts +46 -0
- package/dist/types/nodeviews/genericCard.d.ts +37 -0
- package/dist/types/nodeviews/inlineCard.d.ts +23 -0
- package/dist/types/plugin.d.ts +24 -0
- package/dist/types/pm-plugins/actions.d.ts +23 -0
- package/dist/types/pm-plugins/analytics/create-analytics-queue.d.ts +10 -0
- package/dist/types/pm-plugins/analytics/events-from-tr.d.ts +17 -0
- package/dist/types/pm-plugins/analytics/index.d.ts +2 -0
- package/dist/types/pm-plugins/analytics/types.d.ts +12 -0
- package/dist/types/pm-plugins/analytics/utils.d.ts +32 -0
- package/dist/types/pm-plugins/doc.d.ts +22 -0
- package/dist/types/pm-plugins/keymap.d.ts +3 -0
- package/dist/types/pm-plugins/main.d.ts +6 -0
- package/dist/types/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/reducers.d.ts +3 -0
- package/dist/types/pm-plugins/shouldReplaceLink.d.ts +2 -0
- package/dist/types/pm-plugins/util/resolve.d.ts +8 -0
- package/dist/types/pm-plugins/util/state.d.ts +31 -0
- package/dist/types/toolbar.d.ts +9 -0
- package/dist/types/types.d.ts +163 -0
- package/dist/types/ui/DatasourceModal/ModalWithState.d.ts +9 -0
- package/dist/types/ui/DatasourceModal/index.d.ts +11 -0
- package/dist/types/ui/EditLinkToolbar.d.ts +47 -0
- package/dist/types/ui/EditorSmartCardEvents.d.ts +5 -0
- package/dist/types/ui/EditorSmartCardEventsNext.d.ts +18 -0
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +32 -0
- package/dist/types/ui/LayoutButton/index.d.ts +9 -0
- package/dist/types/ui/LayoutButton/types.d.ts +19 -0
- package/dist/types/ui/LayoutButton/utils.d.ts +5 -0
- package/dist/types/ui/LinkToolbarAppearance.d.ts +29 -0
- package/dist/types/ui/ResizableEmbedCard.d.ts +61 -0
- package/dist/types/ui/SmallerEditIcon.d.ts +3 -0
- package/dist/types/utils.d.ts +19 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/messages.d.ts +12 -0
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +26 -0
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +42 -0
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +46 -0
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +37 -0
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +23 -0
- package/dist/types-ts4.5/plugin.d.ts +24 -0
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +23 -0
- package/dist/types-ts4.5/pm-plugins/analytics/create-analytics-queue.d.ts +10 -0
- package/dist/types-ts4.5/pm-plugins/analytics/events-from-tr.d.ts +17 -0
- package/dist/types-ts4.5/pm-plugins/analytics/index.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/analytics/types.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/analytics/utils.d.ts +32 -0
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +22 -0
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +6 -0
- package/dist/types-ts4.5/pm-plugins/mountHyperlink.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/reducers.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/shouldReplaceLink.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/util/resolve.d.ts +8 -0
- package/dist/types-ts4.5/pm-plugins/util/state.d.ts +31 -0
- package/dist/types-ts4.5/toolbar.d.ts +9 -0
- package/dist/types-ts4.5/types.d.ts +163 -0
- package/dist/types-ts4.5/ui/DatasourceModal/ModalWithState.d.ts +9 -0
- package/dist/types-ts4.5/ui/DatasourceModal/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +47 -0
- package/dist/types-ts4.5/ui/EditorSmartCardEvents.d.ts +5 -0
- package/dist/types-ts4.5/ui/EditorSmartCardEventsNext.d.ts +18 -0
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +32 -0
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/LayoutButton/types.d.ts +19 -0
- package/dist/types-ts4.5/ui/LayoutButton/utils.d.ts +5 -0
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +29 -0
- package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +61 -0
- package/dist/types-ts4.5/ui/SmallerEditIcon.d.ts +3 -0
- package/dist/types-ts4.5/utils.d.ts +19 -0
- package/package.json +126 -0
- package/report.api.md +146 -0
- package/tmp/api-report-tmp.d.ts +117 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import { SmartCardProps } from './genericCard';
|
|
5
|
+
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps> {
|
|
6
|
+
private scrollContainer?;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
static contextTypes: {
|
|
9
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
10
|
+
};
|
|
11
|
+
UNSAFE_componentWillMount(): void;
|
|
12
|
+
onResolve: (data: {
|
|
13
|
+
url?: string | undefined;
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
}) => void;
|
|
16
|
+
gapCursorSpan: () => JSX.Element | undefined;
|
|
17
|
+
onError: ({ err }: {
|
|
18
|
+
err?: Error | undefined;
|
|
19
|
+
}) => void;
|
|
20
|
+
render(): JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'platform' | 'showServerActions'>;
|
|
23
|
+
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
24
|
+
createDomRef(): HTMLElement;
|
|
25
|
+
render(): JSX.Element;
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
6
|
+
import { EditorView } from 'prosemirror-view';
|
|
7
|
+
import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
8
|
+
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
9
|
+
import ReactNodeView, { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
10
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
11
|
+
import type { cardPlugin } from '../index';
|
|
12
|
+
import { DatasourceTableLayout } from '../ui/LayoutButton/types';
|
|
13
|
+
interface DatasourceProps extends ReactComponentProps {
|
|
14
|
+
node: PMNode;
|
|
15
|
+
view: EditorView;
|
|
16
|
+
getPos: getPosHandler;
|
|
17
|
+
portalProviderAPI: PortalProviderAPI;
|
|
18
|
+
eventDispatcher: EventDispatcher;
|
|
19
|
+
hasIntlContext: boolean;
|
|
20
|
+
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
21
|
+
}
|
|
22
|
+
interface DatasourceComponentProps extends ReactComponentProps, Pick<DatasourceProps, 'node' | 'view' | 'getPos'> {
|
|
23
|
+
}
|
|
24
|
+
export declare class DatasourceComponent extends React.PureComponent<DatasourceComponentProps> {
|
|
25
|
+
static contextTypes: {
|
|
26
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
27
|
+
};
|
|
28
|
+
constructor(props: DatasourceComponentProps);
|
|
29
|
+
private getPosSafely;
|
|
30
|
+
private getDatasource;
|
|
31
|
+
private getTableView;
|
|
32
|
+
handleColumnChange: (columnKeys: string[]) => void;
|
|
33
|
+
render(): jsx.JSX.Element | null;
|
|
34
|
+
}
|
|
35
|
+
export declare class Datasource extends ReactNodeView<DatasourceProps> {
|
|
36
|
+
private tableWidth;
|
|
37
|
+
constructor(props: DatasourceProps);
|
|
38
|
+
createDomRef(): HTMLElement;
|
|
39
|
+
calcTableWidth: (layout: DatasourceTableLayout, containerWidth?: number) => number | 'inherit';
|
|
40
|
+
render(): jsx.JSX.Element;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
+
import { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
5
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
6
|
+
import { SmartCardProps } from './genericCard';
|
|
7
|
+
export type EmbedCardState = {
|
|
8
|
+
hasPreview: boolean;
|
|
9
|
+
liveHeight?: number;
|
|
10
|
+
initialAspectRatio?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare class EmbedCardComponent extends React.PureComponent<SmartCardProps, EmbedCardState> {
|
|
13
|
+
private scrollContainer?;
|
|
14
|
+
private embedIframeRef;
|
|
15
|
+
onClick: () => void;
|
|
16
|
+
static contextTypes: {
|
|
17
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
18
|
+
};
|
|
19
|
+
state: EmbedCardState;
|
|
20
|
+
UNSAFE_componentWillMount(): void;
|
|
21
|
+
private getPosSafely;
|
|
22
|
+
onResolve: (data: {
|
|
23
|
+
url?: string | undefined;
|
|
24
|
+
title?: string | undefined;
|
|
25
|
+
aspectRatio?: number | undefined;
|
|
26
|
+
}) => void;
|
|
27
|
+
updateSize: (pctWidth: number | null, layout: RichMediaLayout) => true | undefined;
|
|
28
|
+
private getLineLength;
|
|
29
|
+
/**
|
|
30
|
+
* Even though render is capable of listening and reacting to iframely wrapper iframe sent `resize` events
|
|
31
|
+
* it's good idea to store latest actual height in ADF, so that when renderer (well, editor as well) is loading
|
|
32
|
+
* we will show embed window of appropriate size and avoid unnecessary content jumping.
|
|
33
|
+
*/
|
|
34
|
+
saveOriginalDimensionsAttributes: (height: number, width: number | undefined) => void;
|
|
35
|
+
onHeightUpdate: (height: number) => void;
|
|
36
|
+
onError: ({ err }: {
|
|
37
|
+
err?: Error | undefined;
|
|
38
|
+
}) => void;
|
|
39
|
+
render(): JSX.Element;
|
|
40
|
+
}
|
|
41
|
+
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'platform' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi'>;
|
|
42
|
+
export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
|
|
43
|
+
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
44
|
+
createDomRef(): HTMLElement;
|
|
45
|
+
render(): JSX.Element;
|
|
46
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
6
|
+
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
7
|
+
import { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
8
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
|
+
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
10
|
+
import { CardPlatform } from '@atlaskit/smart-card';
|
|
11
|
+
import type { cardPlugin } from '../index';
|
|
12
|
+
export type EditorContext<T> = React.Context<T> & {
|
|
13
|
+
value: T;
|
|
14
|
+
};
|
|
15
|
+
export interface CardNodeViewProps extends ReactComponentProps {
|
|
16
|
+
providerFactory?: ProviderFactory;
|
|
17
|
+
platform?: CardPlatform;
|
|
18
|
+
eventDispatcher?: EventDispatcher;
|
|
19
|
+
}
|
|
20
|
+
export interface CardProps extends CardNodeViewProps {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
node: PMNode;
|
|
23
|
+
view: EditorView;
|
|
24
|
+
getPos: getPosHandler;
|
|
25
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
26
|
+
isMobile?: boolean;
|
|
27
|
+
eventDispatcher?: EventDispatcher;
|
|
28
|
+
allowResizing?: boolean;
|
|
29
|
+
fullWidthMode?: boolean;
|
|
30
|
+
useAlternativePreloader?: boolean;
|
|
31
|
+
showServerActions?: boolean;
|
|
32
|
+
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
33
|
+
}
|
|
34
|
+
export interface SmartCardProps extends CardProps {
|
|
35
|
+
cardContext?: EditorContext<typeof SmartCardContext>;
|
|
36
|
+
}
|
|
37
|
+
export declare function Card(SmartCardComponent: React.ComponentType<SmartCardProps>, UnsupportedComponent: React.ComponentType): React.ComponentType<CardProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import { SmartCardProps } from './genericCard';
|
|
5
|
+
export declare class InlineCardComponent extends React.PureComponent<SmartCardProps> {
|
|
6
|
+
private scrollContainer?;
|
|
7
|
+
private onClick;
|
|
8
|
+
static contextTypes: {
|
|
9
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
10
|
+
};
|
|
11
|
+
UNSAFE_componentWillMount(): void;
|
|
12
|
+
onResolve: (data: {
|
|
13
|
+
url?: string | undefined;
|
|
14
|
+
title?: string | undefined;
|
|
15
|
+
}) => void;
|
|
16
|
+
onError: (data: {
|
|
17
|
+
url?: string | undefined;
|
|
18
|
+
err?: Error | undefined;
|
|
19
|
+
}) => void;
|
|
20
|
+
render(): JSX.Element | null;
|
|
21
|
+
}
|
|
22
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'showServerActions'>;
|
|
23
|
+
export declare function InlineCardNodeView(props: InlineNodeViewComponentProps & InlineCardNodeViewProps): JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CardPluginActions } from '@atlaskit/editor-common/card';
|
|
2
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
6
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
7
|
+
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
8
|
+
import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
9
|
+
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
|
+
import type { CardPluginOptions, CardPluginState } from './types';
|
|
11
|
+
export declare const cardPlugin: NextEditorPlugin<'card', {
|
|
12
|
+
pluginConfiguration: CardPluginOptions;
|
|
13
|
+
dependencies: [
|
|
14
|
+
typeof featureFlagsPlugin,
|
|
15
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
16
|
+
typeof widthPlugin,
|
|
17
|
+
typeof decorationsPlugin,
|
|
18
|
+
typeof gridPlugin,
|
|
19
|
+
FloatingToolbarPlugin,
|
|
20
|
+
typeof hyperlinkPlugin
|
|
21
|
+
];
|
|
22
|
+
sharedState: CardPluginState | null;
|
|
23
|
+
actions: CardPluginActions;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Transaction } from 'prosemirror-state';
|
|
2
|
+
import { CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import type { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
5
|
+
import { CardInfo, CardPluginAction, Request, SmartLinkEventsNext } from '../types';
|
|
6
|
+
import { DatasourceTableLayout } from '../ui/LayoutButton/types';
|
|
7
|
+
export declare const cardAction: (tr: Transaction, action: CardPluginAction) => Transaction;
|
|
8
|
+
export declare const resolveCard: (url: string) => (tr: Transaction) => Transaction;
|
|
9
|
+
export declare const queueCards: (requests: Request[]) => (tr: Transaction) => Transaction;
|
|
10
|
+
export declare const registerCard: (info: CardInfo) => (tr: Transaction) => Transaction;
|
|
11
|
+
export declare const registerSmartCardEvents: (smartLinkEvents: SmartLinkEvents) => (tr: Transaction) => Transaction;
|
|
12
|
+
export declare const registerSmartCardEventsNext: (smartLinkEvents: SmartLinkEventsNext) => (tr: Transaction) => Transaction;
|
|
13
|
+
export declare const setProvider: (cardProvider: CardProvider | null) => (tr: Transaction) => Transaction;
|
|
14
|
+
export declare const setDatasourceTableRef: (datasourceTableRef?: HTMLElement) => (tr: Transaction) => Transaction;
|
|
15
|
+
export declare const setCardLayout: (layout: DatasourceTableLayout) => (tr: Transaction) => Transaction;
|
|
16
|
+
export declare const setCardLayoutAndDatasourceTableRef: ({ layout, datasourceTableRef, }: {
|
|
17
|
+
layout: DatasourceTableLayout;
|
|
18
|
+
datasourceTableRef?: HTMLElement | undefined;
|
|
19
|
+
}) => (tr: Transaction) => Transaction;
|
|
20
|
+
export declare const showLinkToolbar: (tr: Transaction) => Transaction;
|
|
21
|
+
export declare const hideLinkToolbar: (tr: Transaction) => Transaction;
|
|
22
|
+
export declare const showDatasourceModal: (modalType: DatasourceModalType) => (tr: Transaction) => Transaction;
|
|
23
|
+
export declare const hideDatasourceModal: (tr: Transaction) => Transaction;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LifecycleEvent, SmartLinkEventsNext } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Simple mechanism to defer analytics related callbacks
|
|
4
|
+
*/
|
|
5
|
+
export declare const createAnalyticsQueue: (enabled?: boolean) => {
|
|
6
|
+
push: (...events: LifecycleEvent[]) => void;
|
|
7
|
+
flush: () => void;
|
|
8
|
+
setCallbacks: (callbacks: SmartLinkEventsNext) => void;
|
|
9
|
+
getSize: () => number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EditorState, ReadonlyTransaction, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { LifecycleEvent } from '../../types';
|
|
3
|
+
import { Link } from './types';
|
|
4
|
+
export declare const findChangedLinks: (tr: Transaction | ReadonlyTransaction, state: EditorState) => {
|
|
5
|
+
removed: Link[];
|
|
6
|
+
inserted: Link[];
|
|
7
|
+
updated: ({
|
|
8
|
+
removed: Link;
|
|
9
|
+
inserted: Link;
|
|
10
|
+
} | {
|
|
11
|
+
inserted: Link;
|
|
12
|
+
previous: {
|
|
13
|
+
display?: string;
|
|
14
|
+
};
|
|
15
|
+
})[];
|
|
16
|
+
};
|
|
17
|
+
export declare function eventsFromTransaction(tr: ReadonlyTransaction, state: EditorState): LifecycleEvent[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Node, Schema } from 'prosemirror-model';
|
|
2
|
+
import { ReadonlyTransaction, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { Link } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Whether a node is a "link" node, ie inline card, block card, embed card
|
|
6
|
+
* (but not a text node with a link mark)
|
|
7
|
+
*/
|
|
8
|
+
export declare function isLinkNode(node: Node): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Analytics appearance for link object
|
|
11
|
+
*/
|
|
12
|
+
export declare function appearanceForLink(link: Link): "url" | import("@atlaskit/editor-common/provider-factory").CardAppearance;
|
|
13
|
+
/**
|
|
14
|
+
* Determine if a node is considered to be a link
|
|
15
|
+
*/
|
|
16
|
+
export declare const isLink: (schema: Schema, node: Node) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Given a node, find all nodes and marks that are considered "links"
|
|
19
|
+
* @param state EditorState
|
|
20
|
+
* @param fragment Fragment to search
|
|
21
|
+
* @returns Array of nodes and marks found in the fragment that are "links"
|
|
22
|
+
*/
|
|
23
|
+
export declare function findLinksInNode(doc: Node, schema: Schema, node: Node, offset: number): Link[];
|
|
24
|
+
export declare function getLinkUrl(link: Link): string | undefined;
|
|
25
|
+
export declare const getLinkNodeContext: (doc: Node, pos: number) => string;
|
|
26
|
+
export declare const linkObjectFromNode: (doc: Node, schema: Schema, node: Node, pos: number) => Link | undefined;
|
|
27
|
+
export declare const findLinksAtPositions: (tr: Transaction | ReadonlyTransaction, positions: number[]) => Link[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether or not two sets of links appear to likely be the same set of links
|
|
30
|
+
* That they are in the same order and that both their hrefs and appearances match
|
|
31
|
+
*/
|
|
32
|
+
export declare const areSameLinks: (linksA: Link[], linksB: Link[]) => boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import type { CreateUIAnalyticsEvent, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
|
+
import { ACTION, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
7
|
+
import { CardAdf, CardAppearance, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
8
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
9
|
+
import type { InlineCardAdf } from '@atlaskit/smart-card';
|
|
10
|
+
import { Request } from '../types';
|
|
11
|
+
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent) => Command;
|
|
12
|
+
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
13
|
+
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined) => Transaction;
|
|
14
|
+
export declare const queueCardFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, previousAppearance?: CardAppearance | 'url') => Transaction;
|
|
15
|
+
export declare const convertHyperlinkToSmartCard: (state: EditorState, source: CardReplacementInputMethod, appearance: CardAppearance, normalizeLinkText?: boolean) => Transaction;
|
|
16
|
+
export declare const changeSelectedCardToLink: (text?: string, href?: string, sendAnalytics?: boolean, node?: Node, pos?: number, editorAnalyticsApi?: EditorAnalyticsAPI) => Command;
|
|
17
|
+
export declare const changeSelectedCardToLinkFallback: (text?: string, href?: string, sendAnalytics?: boolean, node?: Node, pos?: number, editorAnalyticsApi?: EditorAnalyticsAPI) => Command;
|
|
18
|
+
export declare const updateCard: (href: string, sourceEvent?: UIAnalyticsEvent | null | undefined) => Command;
|
|
19
|
+
export declare const changeSelectedCardToText: (text: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
20
|
+
export declare const setSelectedCardAppearance: (appearance: CardAppearance, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
21
|
+
export declare const updateExistingDatasource: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
22
|
+
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { cardPlugin } from '../index';
|
|
4
|
+
import { CardPluginOptions, CardPluginState } from '../types';
|
|
5
|
+
export { pluginKey } from './plugin-key';
|
|
6
|
+
export declare const createPlugin: (options: CardPluginOptions, pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined) => (pmPluginFactoryParams: PMPluginFactoryParams) => SafePlugin<CardPluginState>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { cardPlugin } from '../index';
|
|
4
|
+
import { CardPluginOptions } from '../types';
|
|
5
|
+
export declare const mountHyperlinkPlugin: (pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined, options: CardPluginOptions) => SafePlugin<any>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
5
|
+
import { CardProvider, DatasourceAdf } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import { Request } from '../../types';
|
|
7
|
+
export declare const resolveWithProvider: (view: EditorView, provider: CardProvider, request: Request, options: CardOptions, editorAnalyticsApi: EditorAnalyticsAPI | undefined, createAnalyticsEvent: CreateUIAnalyticsEvent | undefined) => Promise<void | import("@atlaskit/linking-common").InlineCardAdf | import("@atlaskit/linking-common").BlockCardAdf | import("@atlaskit/linking-common").EmbedCardAdf | DatasourceAdf>;
|
|
8
|
+
export declare const handleProvider: (_: 'cardProvider', provider: Promise<CardProvider> | undefined, view: EditorView) => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EditorState, ReadonlyTransaction } from 'prosemirror-state';
|
|
2
|
+
import { CardPluginState, Request } from '../../types';
|
|
3
|
+
export declare const getPluginState: (editorState: EditorState) => CardPluginState | undefined;
|
|
4
|
+
export declare const getPluginStateWithUpdatedPos: (pluginState: CardPluginState, tr: ReadonlyTransaction) => {
|
|
5
|
+
requests: {
|
|
6
|
+
pos: number;
|
|
7
|
+
url: string;
|
|
8
|
+
appearance: import("@atlaskit/editor-common/provider-factory").CardAppearance;
|
|
9
|
+
compareLinkText: boolean;
|
|
10
|
+
source: import("@atlaskit/editor-common/card").CardReplacementInputMethod;
|
|
11
|
+
previousAppearance?: "url" | import("@atlaskit/editor-common/provider-factory").CardAppearance | undefined;
|
|
12
|
+
analyticsAction?: import("@atlaskit/editor-common/analytics").ACTION | undefined;
|
|
13
|
+
shouldReplaceLink?: boolean | undefined;
|
|
14
|
+
sourceEvent?: import("@atlaskit/analytics-next").UIAnalyticsEvent | null | undefined;
|
|
15
|
+
}[];
|
|
16
|
+
cards: {
|
|
17
|
+
pos: number;
|
|
18
|
+
title?: string | undefined;
|
|
19
|
+
url?: string | undefined;
|
|
20
|
+
}[];
|
|
21
|
+
provider: import("@atlaskit/editor-common/provider-factory").CardProvider | null;
|
|
22
|
+
showLinkingToolbar: boolean;
|
|
23
|
+
smartLinkEvents?: import("@atlaskit/smart-card").SmartLinkEvents | undefined;
|
|
24
|
+
smartLinkEventsNext?: import("../../types").SmartLinkEventsNext | undefined;
|
|
25
|
+
editorAppearance?: import("@atlaskit/editor-common/types").EditorAppearance | undefined;
|
|
26
|
+
showDatasourceModal: boolean;
|
|
27
|
+
datasourceModalType?: "jira" | undefined;
|
|
28
|
+
datasourceTableRef?: HTMLElement | undefined;
|
|
29
|
+
layout?: import("../../ui/LayoutButton/types").DatasourceTableLayout | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare const getNewRequests: (oldState: CardPluginState | undefined, currentState: CardPluginState) => Request[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
3
|
+
import type { Command, ExtractInjectionAPI, FeatureFlags, FloatingToolbarHandler, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { CardPlatform } from '@atlaskit/smart-card';
|
|
5
|
+
import type { cardPlugin } from './index';
|
|
6
|
+
export declare const removeCard: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
7
|
+
export declare const visitCardLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
8
|
+
export declare const openLinkSettings: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
9
|
+
export declare const floatingToolbar: (cardOptions: CardOptions, featureFlags: FeatureFlags, platform?: CardPlatform, linkPickerOptions?: LinkPickerOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>) => FloatingToolbarHandler;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { CardOptions, CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
4
|
+
import { CardAppearance, CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { DatasourceModalType, EditorAppearance, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
6
|
+
import { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
7
|
+
import { DatasourceTableLayout } from './ui/LayoutButton/types';
|
|
8
|
+
export type CardInfo = {
|
|
9
|
+
title?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
pos: number;
|
|
12
|
+
};
|
|
13
|
+
export type Request = {
|
|
14
|
+
/**
|
|
15
|
+
* The position of the link in the doc this request for upgrade is for
|
|
16
|
+
*/
|
|
17
|
+
pos: number;
|
|
18
|
+
/**
|
|
19
|
+
* The URL of the link being upgraded/resolved
|
|
20
|
+
*/
|
|
21
|
+
url: string;
|
|
22
|
+
/**
|
|
23
|
+
* The requested appearance to upgrade to
|
|
24
|
+
*/
|
|
25
|
+
appearance: CardAppearance;
|
|
26
|
+
/**
|
|
27
|
+
* Determines if the link should only be replaced after successful
|
|
28
|
+
* resolution if the link's text content still matches its href
|
|
29
|
+
* (ie has not been changed by the user since the resolve request).
|
|
30
|
+
*/
|
|
31
|
+
compareLinkText: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Analytics input method which preserves "how" the change
|
|
34
|
+
* has occured. Used when analytics are dispatched after the link
|
|
35
|
+
* is successfully/unsuccessfully resolved.
|
|
36
|
+
*/
|
|
37
|
+
source: CardReplacementInputMethod;
|
|
38
|
+
/**
|
|
39
|
+
* The previous appearance of the link
|
|
40
|
+
* This is necessary when tracking an update of a link
|
|
41
|
+
* where the link begins as a smart card, then is updated by
|
|
42
|
+
* replacing with a hyperlink and queueing it for upgrade
|
|
43
|
+
*/
|
|
44
|
+
previousAppearance?: CardAppearance | 'url';
|
|
45
|
+
/**
|
|
46
|
+
* Analytics action to be used when disaptching
|
|
47
|
+
* analytics events once the link is successfully/unsuccessfully
|
|
48
|
+
* resolved. Preserves the users "intent" ie was this a link
|
|
49
|
+
* being inserted or updated?
|
|
50
|
+
*/
|
|
51
|
+
analyticsAction?: ACTION;
|
|
52
|
+
/**
|
|
53
|
+
* Describes if the requested `appearance` MUST be returned by the card provider
|
|
54
|
+
* when resolving the link, because the request is associated with the user intent
|
|
55
|
+
* to explicitly change the link appearance to the target appearance (view switcher), and therefore
|
|
56
|
+
* should not be affected by "default appearances" or "user preferences"
|
|
57
|
+
*/
|
|
58
|
+
shouldReplaceLink?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Source UI that triggered this step if relevant
|
|
61
|
+
* Primarily for transfering link picker UI event from initial UI action
|
|
62
|
+
* through to the end of the link queue/request saga
|
|
63
|
+
*/
|
|
64
|
+
sourceEvent?: UIAnalyticsEvent | null | undefined;
|
|
65
|
+
};
|
|
66
|
+
export type Metadata<T = {}> = {
|
|
67
|
+
url: string;
|
|
68
|
+
display: string;
|
|
69
|
+
isUndo?: boolean;
|
|
70
|
+
isRedo?: boolean;
|
|
71
|
+
action?: string;
|
|
72
|
+
inputMethod?: string;
|
|
73
|
+
sourceEvent?: unknown;
|
|
74
|
+
nodeContext?: string;
|
|
75
|
+
} & T;
|
|
76
|
+
export type UpdateMetadata = {
|
|
77
|
+
previousDisplay?: string;
|
|
78
|
+
};
|
|
79
|
+
export type SmartLinkEventsNext = {
|
|
80
|
+
created: (metadata: Metadata) => void;
|
|
81
|
+
updated: (metadata: Metadata<UpdateMetadata>) => void;
|
|
82
|
+
deleted: (metadata: Metadata) => void;
|
|
83
|
+
};
|
|
84
|
+
export type LifecycleEventType = keyof SmartLinkEventsNext;
|
|
85
|
+
/**
|
|
86
|
+
* Describes the shape of an event that will be stored
|
|
87
|
+
* in the Card state until it can be dispatched
|
|
88
|
+
* as a side-effect in a view update
|
|
89
|
+
*/
|
|
90
|
+
export type LifecycleEvent<Type extends keyof SmartLinkEventsNext = keyof SmartLinkEventsNext> = {
|
|
91
|
+
type: Type;
|
|
92
|
+
data: Parameters<SmartLinkEventsNext[Type]>[0];
|
|
93
|
+
};
|
|
94
|
+
export type CardPluginState = {
|
|
95
|
+
requests: Request[];
|
|
96
|
+
provider: CardProvider | null;
|
|
97
|
+
cards: CardInfo[];
|
|
98
|
+
showLinkingToolbar: boolean;
|
|
99
|
+
smartLinkEvents?: SmartLinkEvents;
|
|
100
|
+
smartLinkEventsNext?: SmartLinkEventsNext;
|
|
101
|
+
editorAppearance?: EditorAppearance;
|
|
102
|
+
showDatasourceModal: boolean;
|
|
103
|
+
datasourceModalType?: DatasourceModalType;
|
|
104
|
+
datasourceTableRef?: HTMLElement;
|
|
105
|
+
layout?: DatasourceTableLayout;
|
|
106
|
+
};
|
|
107
|
+
export type CardPluginOptions = CardOptions & {
|
|
108
|
+
editorAppearance?: EditorAppearance;
|
|
109
|
+
platform: 'mobile' | 'web';
|
|
110
|
+
fullWidthMode?: boolean;
|
|
111
|
+
linkPicker?: LinkPickerOptions;
|
|
112
|
+
};
|
|
113
|
+
export type SetProvider = {
|
|
114
|
+
type: 'SET_PROVIDER';
|
|
115
|
+
provider: CardProvider | null;
|
|
116
|
+
};
|
|
117
|
+
export type Queue = {
|
|
118
|
+
type: 'QUEUE';
|
|
119
|
+
requests: Request[];
|
|
120
|
+
};
|
|
121
|
+
export type Resolve = {
|
|
122
|
+
type: 'RESOLVE';
|
|
123
|
+
url: string;
|
|
124
|
+
};
|
|
125
|
+
export type Register = {
|
|
126
|
+
type: 'REGISTER';
|
|
127
|
+
info: CardInfo;
|
|
128
|
+
};
|
|
129
|
+
export type ShowLinkToolbar = {
|
|
130
|
+
type: 'SHOW_LINK_TOOLBAR';
|
|
131
|
+
};
|
|
132
|
+
export type HideLinkToolbar = {
|
|
133
|
+
type: 'HIDE_LINK_TOOLBAR';
|
|
134
|
+
};
|
|
135
|
+
export type ShowDatasourceModal = {
|
|
136
|
+
type: 'SHOW_DATASOURCE_MODAL';
|
|
137
|
+
modalType: DatasourceModalType;
|
|
138
|
+
};
|
|
139
|
+
export type HideDatasourceModal = {
|
|
140
|
+
type: 'HIDE_DATASOURCE_MODAL';
|
|
141
|
+
};
|
|
142
|
+
export type RegisterSmartCardEvents = {
|
|
143
|
+
type: 'REGISTER_EVENTS';
|
|
144
|
+
smartLinkEvents: SmartLinkEvents;
|
|
145
|
+
};
|
|
146
|
+
export type RegisterSmartCardEventsNext = {
|
|
147
|
+
type: 'REGISTER_EVENTS_NEXT';
|
|
148
|
+
smartLinkEvents: SmartLinkEventsNext;
|
|
149
|
+
};
|
|
150
|
+
export type SetDatasourceTableRef = {
|
|
151
|
+
type: 'SET_DATASOURCE_TABLE_REF';
|
|
152
|
+
datasourceTableRef?: HTMLElement;
|
|
153
|
+
};
|
|
154
|
+
export type SetCardLayout = {
|
|
155
|
+
type: 'SET_CARD_LAYOUT';
|
|
156
|
+
layout: DatasourceTableLayout;
|
|
157
|
+
};
|
|
158
|
+
export type SetCardLayoutAndDatasourceTableRef = {
|
|
159
|
+
type: 'SET_CARD_LAYOUT_AND_DATASOURCE_TABLE_REF';
|
|
160
|
+
layout: DatasourceTableLayout;
|
|
161
|
+
datasourceTableRef?: HTMLElement;
|
|
162
|
+
};
|
|
163
|
+
export type CardPluginAction = SetProvider | Queue | Resolve | Register | ShowLinkToolbar | HideLinkToolbar | ShowDatasourceModal | HideDatasourceModal | RegisterSmartCardEvents | RegisterSmartCardEventsNext | SetDatasourceTableRef | SetCardLayout | SetCardLayoutAndDatasourceTableRef;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { cardPlugin } from '../../plugin';
|
|
5
|
+
declare const ModalWithState: ({ api, editorView, }: {
|
|
6
|
+
api: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
7
|
+
editorView: EditorView;
|
|
8
|
+
}) => JSX.Element | null;
|
|
9
|
+
export default ModalWithState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
5
|
+
type DatasourceModalProps = {
|
|
6
|
+
view: EditorView;
|
|
7
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
8
|
+
modalType?: DatasourceModalType;
|
|
9
|
+
};
|
|
10
|
+
export declare const DatasourceModal: ({ view, modalType }: DatasourceModalProps) => JSX.Element | null;
|
|
11
|
+
export {};
|