@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,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Node } from 'prosemirror-model';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { HyperlinkAddToolbarProps } from '@atlaskit/editor-common/link';
|
|
7
|
+
import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
8
|
+
import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem, LinkInputType, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
9
|
+
import { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
10
|
+
import type { ForceFocusSelector } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
11
|
+
import type { cardPlugin } from '../plugin';
|
|
12
|
+
interface InjectionAPI {
|
|
13
|
+
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
14
|
+
}
|
|
15
|
+
export type EditLinkToolbarProps = InjectionAPI & {
|
|
16
|
+
view: EditorView;
|
|
17
|
+
providerFactory: ProviderFactory;
|
|
18
|
+
url: string | undefined;
|
|
19
|
+
text: string;
|
|
20
|
+
node: Node;
|
|
21
|
+
onSubmit?: (href: string, text?: string, inputMethod?: LinkInputType, analytic?: UIAnalyticsEvent | null | undefined) => void;
|
|
22
|
+
linkPickerOptions?: LinkPickerOptions;
|
|
23
|
+
featureFlags: FeatureFlags;
|
|
24
|
+
forceFocusSelector: ForceFocusSelector | undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare function HyperlinkAddToolbarWithState({ linkPickerOptions, onSubmit, displayText, displayUrl, providerFactory, view, onCancel, invokeMethod, featureFlags, onClose, onEscapeCallback, onClickAwayCallback, pluginInjectionApi, }: HyperlinkAddToolbarProps & InjectionAPI): JSX.Element;
|
|
27
|
+
export declare class EditLinkToolbar extends React.Component<EditLinkToolbarProps> {
|
|
28
|
+
componentDidUpdate(prevProps: EditLinkToolbarProps): void;
|
|
29
|
+
componentWillUnmount(): void;
|
|
30
|
+
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
31
|
+
* and not close the floating toolbar.
|
|
32
|
+
*/
|
|
33
|
+
private handleEsc;
|
|
34
|
+
private hideLinkToolbar;
|
|
35
|
+
render(): JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
export declare const editLink: (editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
38
|
+
export declare const buildEditLinkToolbar: ({ providerFactory, node, linkPicker, featureFlags, pluginInjectionApi, }: {
|
|
39
|
+
providerFactory: ProviderFactory;
|
|
40
|
+
node: Node;
|
|
41
|
+
linkPicker?: LinkPickerOptions | undefined;
|
|
42
|
+
featureFlags: FeatureFlags;
|
|
43
|
+
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
44
|
+
}) => FloatingToolbarItem<Command>;
|
|
45
|
+
export declare const editLinkToolbarConfig: (showLinkingToolbar: boolean, lpLinkPicker: boolean) => Partial<FloatingToolbarConfig>;
|
|
46
|
+
export declare const editDatasource: (node: Node, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
type AnalyticsBindingsProps = {
|
|
5
|
+
editorView: EditorView;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Binds the @atlaskit/link-analytics callbacks
|
|
9
|
+
* to the editor card plugin state events callbacks interfaces
|
|
10
|
+
*/
|
|
11
|
+
export declare const EventsBinding: ({ editorView }: AnalyticsBindingsProps) => null;
|
|
12
|
+
export declare class EditorSmartCardEventsNext extends React.PureComponent<AnalyticsBindingsProps> {
|
|
13
|
+
static contextTypes: {
|
|
14
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
15
|
+
};
|
|
16
|
+
render(): JSX.Element | null;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { EditorState } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { IntlShape } from 'react-intl-next';
|
|
5
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
7
|
+
import type { CardPluginActions } from '@atlaskit/editor-common/card';
|
|
8
|
+
import { CardProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
import { CardPlatform } from '@atlaskit/smart-card';
|
|
10
|
+
export interface HyperlinkToolbarAppearanceProps {
|
|
11
|
+
intl: IntlShape;
|
|
12
|
+
editorState: EditorState;
|
|
13
|
+
providerFactory: ProviderFactory;
|
|
14
|
+
url: string;
|
|
15
|
+
editorView?: EditorView;
|
|
16
|
+
platform?: CardPlatform;
|
|
17
|
+
cardOptions?: CardOptions;
|
|
18
|
+
editorAnalyticsApi: EditorAnalyticsAPI | undefined;
|
|
19
|
+
cardActions: CardPluginActions | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface HyperlinkToolbarAppearanceState {
|
|
22
|
+
supportedUrlsMap: Map<string, boolean>;
|
|
23
|
+
}
|
|
24
|
+
export declare class HyperlinkToolbarAppearance extends Component<HyperlinkToolbarAppearanceProps, HyperlinkToolbarAppearanceState> {
|
|
25
|
+
state: HyperlinkToolbarAppearanceState;
|
|
26
|
+
cardProvider?: CardProvider;
|
|
27
|
+
private getProvider;
|
|
28
|
+
private resolveUrl;
|
|
29
|
+
componentDidMount: () => Promise<void>;
|
|
30
|
+
UNSAFE_componentWillReceiveProps(nextProps: HyperlinkToolbarAppearanceProps): void;
|
|
31
|
+
render(): JSX.Element | null;
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
4
|
+
import { LayoutButtonProps, LayoutButtonWrapperProps } from './types';
|
|
5
|
+
export declare const LayoutButton: React.FC<LayoutButtonProps>;
|
|
6
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<LayoutButtonWrapperProps & WrappedComponentProps<"intl">>> & {
|
|
7
|
+
WrappedComponent: React.ComponentType<LayoutButtonWrapperProps & WrappedComponentProps<"intl">>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { IntlShape } from 'react-intl-next';
|
|
3
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { cardPlugin } from '../../index';
|
|
5
|
+
export type DatasourceTableLayout = 'full-width' | 'center' | 'wide';
|
|
6
|
+
export type LayoutButtonProps = {
|
|
7
|
+
mountPoint?: HTMLElement;
|
|
8
|
+
boundariesElement?: HTMLElement;
|
|
9
|
+
scrollableElement?: HTMLElement;
|
|
10
|
+
targetElement?: HTMLElement;
|
|
11
|
+
layout: DatasourceTableLayout;
|
|
12
|
+
onLayoutChange?: (layout: DatasourceTableLayout) => void;
|
|
13
|
+
testId?: string;
|
|
14
|
+
intl: IntlShape;
|
|
15
|
+
};
|
|
16
|
+
export interface LayoutButtonWrapperProps extends Pick<LayoutButtonProps, 'mountPoint' | 'boundariesElement' | 'scrollableElement'> {
|
|
17
|
+
api: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
18
|
+
editorView: EditorView;
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { EditorState } from 'prosemirror-state';
|
|
4
|
+
import { EditorView } from 'prosemirror-view';
|
|
5
|
+
import { IntlShape } from 'react-intl-next';
|
|
6
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { CardPluginActions } from '@atlaskit/editor-common/card';
|
|
8
|
+
import { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
9
|
+
import { CardContext } from '@atlaskit/link-provider';
|
|
10
|
+
import { CardPlatform } from '@atlaskit/smart-card';
|
|
11
|
+
export interface LinkToolbarAppearanceProps {
|
|
12
|
+
intl: IntlShape;
|
|
13
|
+
editorAnalyticsApi: EditorAnalyticsAPI | undefined;
|
|
14
|
+
currentAppearance?: CardAppearance;
|
|
15
|
+
editorState: EditorState;
|
|
16
|
+
editorView?: EditorView;
|
|
17
|
+
url?: string;
|
|
18
|
+
allowEmbeds?: boolean;
|
|
19
|
+
allowBlockCards?: boolean;
|
|
20
|
+
platform?: CardPlatform;
|
|
21
|
+
cardActions: CardPluginActions | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare class LinkToolbarAppearance extends React.Component<LinkToolbarAppearanceProps, {}> {
|
|
24
|
+
static contextTypes: {
|
|
25
|
+
contextAdapter: PropTypes.Requireable<object>;
|
|
26
|
+
};
|
|
27
|
+
renderDropdown: (view?: EditorView, cardContext?: CardContext) => JSX.Element | null;
|
|
28
|
+
render(): JSX.Element | null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference path="../../../../../../typings/prosemirror.d.ts" />
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
5
|
+
import { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
6
|
+
import { ResizerProps } from '@atlaskit/editor-common/ui';
|
|
7
|
+
type State = {
|
|
8
|
+
offsetLeft: number;
|
|
9
|
+
resizedPctWidth?: number;
|
|
10
|
+
};
|
|
11
|
+
export type Props = Omit<ResizerProps, 'height' | 'width'> & {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
aspectRatio: number;
|
|
15
|
+
};
|
|
16
|
+
export default class ResizableEmbedCard extends React.Component<Props, State> {
|
|
17
|
+
static defaultProps: {
|
|
18
|
+
aspectRatio: number;
|
|
19
|
+
};
|
|
20
|
+
state: State;
|
|
21
|
+
componentDidUpdate(): void;
|
|
22
|
+
get wrappedLayout(): boolean;
|
|
23
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
24
|
+
/**
|
|
25
|
+
* When returning to center layout from a wrapped/aligned layout, it might actually
|
|
26
|
+
* be wide or full-width
|
|
27
|
+
*/
|
|
28
|
+
checkLayout(oldLayout: RichMediaLayout, newLayout: RichMediaLayout): void;
|
|
29
|
+
calcNewSize: (newWidth: number, stop: boolean) => {
|
|
30
|
+
width: number | null;
|
|
31
|
+
layout: RichMediaLayout;
|
|
32
|
+
};
|
|
33
|
+
calcUnwrappedLayout: (pct: number, width: number) => 'center' | 'wide' | 'full-width';
|
|
34
|
+
get $pos(): import("prosemirror-model").ResolvedPos | null;
|
|
35
|
+
/**
|
|
36
|
+
* The maxmimum number of grid columns this node can resize to.
|
|
37
|
+
*/
|
|
38
|
+
get gridWidth(): number;
|
|
39
|
+
calcOffsetLeft(): number;
|
|
40
|
+
calcColumnLeftOffset: () => number;
|
|
41
|
+
wrapper?: HTMLElement;
|
|
42
|
+
get wideLayoutWidth(): number;
|
|
43
|
+
calcSnapPoints(): number[];
|
|
44
|
+
calcPxWidth: (useLayout?: RichMediaLayout) => number;
|
|
45
|
+
get insideInlineLike(): boolean;
|
|
46
|
+
highlights: (newWidth: number, snapPoints: number[]) => string[] | number[];
|
|
47
|
+
/**
|
|
48
|
+
* Previously height of the box was controlled with paddingTop/paddingBottom trick inside Wrapper.
|
|
49
|
+
* It allowed height to be defined by a given percent ratio and so absolute value was defined by actual width.
|
|
50
|
+
* Also, it was part of styled component, which was fine because it was static through out life time of component.
|
|
51
|
+
*
|
|
52
|
+
* Now, two things changed:
|
|
53
|
+
* 1. If `height` is present we take it as actual height of the box, and hence we don't need
|
|
54
|
+
* (or even can't have, due to lack of width value) paddingTop trick.
|
|
55
|
+
* 2. Since `height` can be changing through out life time of a component, we can't have it as part of styled component,
|
|
56
|
+
* and hence we use `style` prop.
|
|
57
|
+
*/
|
|
58
|
+
private getHeightDefiningComponent;
|
|
59
|
+
render(): jsx.JSX.Element;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node, NodeType } from 'prosemirror-model';
|
|
2
|
+
import { EditorState } from 'prosemirror-state';
|
|
3
|
+
import { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { CardInfo } from './types';
|
|
5
|
+
export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
|
|
6
|
+
export declare const selectedCardAppearance: (state: EditorState) => CardAppearance | undefined;
|
|
7
|
+
export type TitleUrlPair = {
|
|
8
|
+
title?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const titleUrlPairFromNode: (node: Node) => TitleUrlPair;
|
|
12
|
+
/**
|
|
13
|
+
* Merges the title and url from attributes and CardInfo from the resolved view, preferring the CardInfo.
|
|
14
|
+
* @param titleUrlPair title and url information from the node attributes
|
|
15
|
+
* @param info information stored in state from the resolved UI component view
|
|
16
|
+
*/
|
|
17
|
+
export declare const mergeCardInfo: (titleUrlPair: TitleUrlPair, info?: CardInfo) => TitleUrlPair;
|
|
18
|
+
export declare const displayInfoForCard: (node: Node, info?: CardInfo) => TitleUrlPair;
|
|
19
|
+
export declare const findCardInfo: (state: EditorState) => CardInfo | undefined;
|
package/package.json
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Editor",
|
|
12
|
+
"singleton": true,
|
|
13
|
+
"releaseModel": "continuous"
|
|
14
|
+
},
|
|
15
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
16
|
+
"main": "dist/cjs/index.js",
|
|
17
|
+
"module": "dist/esm/index.js",
|
|
18
|
+
"module:es2019": "dist/es2019/index.js",
|
|
19
|
+
"types": "dist/types/index.d.ts",
|
|
20
|
+
"typesVersions": {
|
|
21
|
+
">=4.5 <4.9": {
|
|
22
|
+
"*": [
|
|
23
|
+
"dist/types-ts4.5/*",
|
|
24
|
+
"dist/types-ts4.5/index.d.ts"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"atlaskit:src": "src/index.ts",
|
|
30
|
+
"af:exports": {
|
|
31
|
+
".": "./src/index.ts"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@atlaskit/adf-schema": "^26.1.0",
|
|
35
|
+
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
+
"@atlaskit/editor-common": "^74.17.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-decorations": "^0.1.0",
|
|
39
|
+
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
40
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^0.2.0",
|
|
41
|
+
"@atlaskit/editor-plugin-grid": "^0.1.0",
|
|
42
|
+
"@atlaskit/editor-plugin-hyperlink": "^0.1.0",
|
|
43
|
+
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
44
|
+
"@atlaskit/editor-shared-styles": "^2.4.0",
|
|
45
|
+
"@atlaskit/icon": "^21.12.0",
|
|
46
|
+
"@atlaskit/link-analytics": "^8.2.0",
|
|
47
|
+
"@atlaskit/link-datasource": "^0.28.0",
|
|
48
|
+
"@atlaskit/smart-card": "^26.9.0",
|
|
49
|
+
"@atlaskit/theme": "^12.5.0",
|
|
50
|
+
"@atlaskit/tokens": "^1.11.0",
|
|
51
|
+
"@babel/runtime": "^7.0.0",
|
|
52
|
+
"@emotion/react": "^11.7.1",
|
|
53
|
+
"lodash": "^4.17.21",
|
|
54
|
+
"prop-types": "^15.5.10",
|
|
55
|
+
"prosemirror-history": "^1.1.3",
|
|
56
|
+
"prosemirror-keymap": "1.1.4",
|
|
57
|
+
"prosemirror-model": "1.16.0",
|
|
58
|
+
"prosemirror-state": "1.3.4",
|
|
59
|
+
"prosemirror-transform": "1.3.2",
|
|
60
|
+
"prosemirror-utils": "^1.0.0-0",
|
|
61
|
+
"prosemirror-view": "1.23.7",
|
|
62
|
+
"raf-schd": "^4.0.3"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@atlaskit/link-provider": "^1.6.2",
|
|
66
|
+
"react": "^16.8.0",
|
|
67
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@atlaskit/activity-provider": "^2.4.0",
|
|
71
|
+
"@atlaskit/editor-test-helpers": "^18.9.0",
|
|
72
|
+
"@atlaskit/link-test-helpers": "^4.1.0",
|
|
73
|
+
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
74
|
+
"@atlaskit/ssr": "*",
|
|
75
|
+
"@atlaskit/util-data-test": "^17.8.0",
|
|
76
|
+
"@atlaskit/visual-regression": "*",
|
|
77
|
+
"@atlaskit/webdriver-runner": "*",
|
|
78
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
79
|
+
"@atlassian/feature-flags-test-utils": "*",
|
|
80
|
+
"@testing-library/dom": "^8.17.1",
|
|
81
|
+
"@testing-library/react": "^12.1.5",
|
|
82
|
+
"@testing-library/user-event": "^14.4.3",
|
|
83
|
+
"raf-stub": "^2.0.1",
|
|
84
|
+
"react-dom": "^16.8.0",
|
|
85
|
+
"typescript": "~4.9.5",
|
|
86
|
+
"wait-for-expect": "^1.2.0"
|
|
87
|
+
},
|
|
88
|
+
"techstack": {
|
|
89
|
+
"@atlassian/frontend": {
|
|
90
|
+
"import-structure": [
|
|
91
|
+
"atlassian-conventions"
|
|
92
|
+
],
|
|
93
|
+
"circular-dependencies": [
|
|
94
|
+
"file-and-folder-level"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"@repo/internal": {
|
|
98
|
+
"dom-events": "use-bind-event-listener",
|
|
99
|
+
"analytics": [
|
|
100
|
+
"analytics-next"
|
|
101
|
+
],
|
|
102
|
+
"design-tokens": [
|
|
103
|
+
"color"
|
|
104
|
+
],
|
|
105
|
+
"theming": [
|
|
106
|
+
"react-context"
|
|
107
|
+
],
|
|
108
|
+
"ui-components": [
|
|
109
|
+
"lite-mode"
|
|
110
|
+
],
|
|
111
|
+
"deprecation": [
|
|
112
|
+
"no-deprecated-imports"
|
|
113
|
+
],
|
|
114
|
+
"styling": [
|
|
115
|
+
"static",
|
|
116
|
+
"emotion"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
121
|
+
"platform-feature-flags": {
|
|
122
|
+
"platform.linking-platform.datasource-jira_issues": {
|
|
123
|
+
"type": "boolean"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
package/report.api.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
|
+
|
|
3
|
+
## API Report File for "@atlaskit/editor-plugin-card"
|
|
4
|
+
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
12
|
+
|
|
13
|
+
### Main Entry Types
|
|
14
|
+
|
|
15
|
+
<!--SECTION START: Main Entry Types-->
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
19
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
20
|
+
import { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
21
|
+
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
22
|
+
import type { CardPluginActions } from '@atlaskit/editor-common/card';
|
|
23
|
+
import { CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
24
|
+
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
25
|
+
import type { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
26
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
27
|
+
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
28
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
29
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
30
|
+
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
31
|
+
import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
32
|
+
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
33
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
34
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
35
|
+
import { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
36
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
37
|
+
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
38
|
+
|
|
39
|
+
// @public (undocumented)
|
|
40
|
+
type CardInfo = {
|
|
41
|
+
title?: string;
|
|
42
|
+
url?: string;
|
|
43
|
+
pos: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// @public (undocumented)
|
|
47
|
+
export const cardPlugin: NextEditorPlugin<
|
|
48
|
+
'card',
|
|
49
|
+
{
|
|
50
|
+
pluginConfiguration: CardPluginOptions;
|
|
51
|
+
dependencies: [
|
|
52
|
+
typeof featureFlagsPlugin,
|
|
53
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
54
|
+
typeof widthPlugin,
|
|
55
|
+
typeof decorationsPlugin,
|
|
56
|
+
typeof gridPlugin,
|
|
57
|
+
FloatingToolbarPlugin,
|
|
58
|
+
typeof hyperlinkPlugin,
|
|
59
|
+
];
|
|
60
|
+
sharedState: CardPluginState | null;
|
|
61
|
+
actions: CardPluginActions;
|
|
62
|
+
}
|
|
63
|
+
>;
|
|
64
|
+
|
|
65
|
+
// @public (undocumented)
|
|
66
|
+
type CardPluginOptions = CardOptions & {
|
|
67
|
+
editorAppearance?: EditorAppearance;
|
|
68
|
+
platform: 'mobile' | 'web';
|
|
69
|
+
fullWidthMode?: boolean;
|
|
70
|
+
linkPicker?: LinkPickerOptions;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// @public (undocumented)
|
|
74
|
+
type CardPluginState = {
|
|
75
|
+
requests: Request_2[];
|
|
76
|
+
provider: CardProvider | null;
|
|
77
|
+
cards: CardInfo[];
|
|
78
|
+
showLinkingToolbar: boolean;
|
|
79
|
+
smartLinkEvents?: SmartLinkEvents;
|
|
80
|
+
smartLinkEventsNext?: SmartLinkEventsNext;
|
|
81
|
+
editorAppearance?: EditorAppearance;
|
|
82
|
+
showDatasourceModal: boolean;
|
|
83
|
+
datasourceModalType?: DatasourceModalType;
|
|
84
|
+
datasourceTableRef?: HTMLElement;
|
|
85
|
+
layout?: DatasourceTableLayout;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// @public (undocumented)
|
|
89
|
+
type DatasourceTableLayout = 'center' | 'full-width' | 'wide';
|
|
90
|
+
|
|
91
|
+
// @public (undocumented)
|
|
92
|
+
type Metadata_2<T = {}> = {
|
|
93
|
+
url: string;
|
|
94
|
+
display: string;
|
|
95
|
+
isUndo?: boolean;
|
|
96
|
+
isRedo?: boolean;
|
|
97
|
+
action?: string;
|
|
98
|
+
inputMethod?: string;
|
|
99
|
+
sourceEvent?: unknown;
|
|
100
|
+
nodeContext?: string;
|
|
101
|
+
} & T;
|
|
102
|
+
|
|
103
|
+
// @public (undocumented)
|
|
104
|
+
type Request_2 = {
|
|
105
|
+
pos: number;
|
|
106
|
+
url: string;
|
|
107
|
+
appearance: CardAppearance;
|
|
108
|
+
compareLinkText: boolean;
|
|
109
|
+
source: CardReplacementInputMethod;
|
|
110
|
+
previousAppearance?: 'url' | CardAppearance;
|
|
111
|
+
analyticsAction?: ACTION;
|
|
112
|
+
shouldReplaceLink?: boolean;
|
|
113
|
+
sourceEvent?: UIAnalyticsEvent | null | undefined;
|
|
114
|
+
};
|
|
115
|
+
export { Request_2 as Request };
|
|
116
|
+
|
|
117
|
+
// @public (undocumented)
|
|
118
|
+
type SmartLinkEventsNext = {
|
|
119
|
+
created: (metadata: Metadata_2) => void;
|
|
120
|
+
updated: (metadata: Metadata_2<UpdateMetadata>) => void;
|
|
121
|
+
deleted: (metadata: Metadata_2) => void;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// @public (undocumented)
|
|
125
|
+
type UpdateMetadata = {
|
|
126
|
+
previousDisplay?: string;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// (No @packageDocumentation comment for this package)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<!--SECTION END: Main Entry Types-->
|
|
133
|
+
|
|
134
|
+
### Peer Dependencies
|
|
135
|
+
|
|
136
|
+
<!--SECTION START: Peer Dependencies-->
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"@atlaskit/link-provider": "^1.6.2",
|
|
141
|
+
"react": "^16.8.0",
|
|
142
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
<!--SECTION END: Peer Dependencies-->
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/editor-plugin-card"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
9
|
+
import { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
10
|
+
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
11
|
+
import type { CardPluginActions } from '@atlaskit/editor-common/card';
|
|
12
|
+
import { CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
13
|
+
import type { CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
14
|
+
import type { DatasourceModalType } from '@atlaskit/editor-common/types';
|
|
15
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
16
|
+
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
17
|
+
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
18
|
+
import type { FloatingToolbarPlugin } from '@atlaskit/editor-plugin-floating-toolbar';
|
|
19
|
+
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
20
|
+
import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
21
|
+
import type { LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
22
|
+
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
23
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
24
|
+
import { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
25
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
26
|
+
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
27
|
+
|
|
28
|
+
// @public (undocumented)
|
|
29
|
+
type CardInfo = {
|
|
30
|
+
title?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
pos: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// @public (undocumented)
|
|
36
|
+
export const cardPlugin: NextEditorPlugin<'card', {
|
|
37
|
+
pluginConfiguration: CardPluginOptions;
|
|
38
|
+
dependencies: [
|
|
39
|
+
typeof featureFlagsPlugin,
|
|
40
|
+
OptionalPlugin<typeof analyticsPlugin>,
|
|
41
|
+
typeof widthPlugin,
|
|
42
|
+
typeof decorationsPlugin,
|
|
43
|
+
typeof gridPlugin,
|
|
44
|
+
FloatingToolbarPlugin,
|
|
45
|
+
typeof hyperlinkPlugin
|
|
46
|
+
];
|
|
47
|
+
sharedState: CardPluginState | null;
|
|
48
|
+
actions: CardPluginActions;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
// @public (undocumented)
|
|
52
|
+
type CardPluginOptions = CardOptions & {
|
|
53
|
+
editorAppearance?: EditorAppearance;
|
|
54
|
+
platform: 'mobile' | 'web';
|
|
55
|
+
fullWidthMode?: boolean;
|
|
56
|
+
linkPicker?: LinkPickerOptions;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// @public (undocumented)
|
|
60
|
+
type CardPluginState = {
|
|
61
|
+
requests: Request_2[];
|
|
62
|
+
provider: CardProvider | null;
|
|
63
|
+
cards: CardInfo[];
|
|
64
|
+
showLinkingToolbar: boolean;
|
|
65
|
+
smartLinkEvents?: SmartLinkEvents;
|
|
66
|
+
smartLinkEventsNext?: SmartLinkEventsNext;
|
|
67
|
+
editorAppearance?: EditorAppearance;
|
|
68
|
+
showDatasourceModal: boolean;
|
|
69
|
+
datasourceModalType?: DatasourceModalType;
|
|
70
|
+
datasourceTableRef?: HTMLElement;
|
|
71
|
+
layout?: DatasourceTableLayout;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// @public (undocumented)
|
|
75
|
+
type DatasourceTableLayout = 'center' | 'full-width' | 'wide';
|
|
76
|
+
|
|
77
|
+
// @public (undocumented)
|
|
78
|
+
type Metadata_2<T = {}> = {
|
|
79
|
+
url: string;
|
|
80
|
+
display: string;
|
|
81
|
+
isUndo?: boolean;
|
|
82
|
+
isRedo?: boolean;
|
|
83
|
+
action?: string;
|
|
84
|
+
inputMethod?: string;
|
|
85
|
+
sourceEvent?: unknown;
|
|
86
|
+
nodeContext?: string;
|
|
87
|
+
} & T;
|
|
88
|
+
|
|
89
|
+
// @public (undocumented)
|
|
90
|
+
type Request_2 = {
|
|
91
|
+
pos: number;
|
|
92
|
+
url: string;
|
|
93
|
+
appearance: CardAppearance;
|
|
94
|
+
compareLinkText: boolean;
|
|
95
|
+
source: CardReplacementInputMethod;
|
|
96
|
+
previousAppearance?: 'url' | CardAppearance;
|
|
97
|
+
analyticsAction?: ACTION;
|
|
98
|
+
shouldReplaceLink?: boolean;
|
|
99
|
+
sourceEvent?: UIAnalyticsEvent | null | undefined;
|
|
100
|
+
};
|
|
101
|
+
export { Request_2 as Request }
|
|
102
|
+
|
|
103
|
+
// @public (undocumented)
|
|
104
|
+
type SmartLinkEventsNext = {
|
|
105
|
+
created: (metadata: Metadata_2) => void;
|
|
106
|
+
updated: (metadata: Metadata_2<UpdateMetadata>) => void;
|
|
107
|
+
deleted: (metadata: Metadata_2) => void;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// @public (undocumented)
|
|
111
|
+
type UpdateMetadata = {
|
|
112
|
+
previousDisplay?: string;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// (No @packageDocumentation comment for this package)
|
|
116
|
+
|
|
117
|
+
```
|