@atlaskit/editor-plugin-card 2.3.3 → 2.3.4
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/CHANGELOG.md +8 -0
- package/dist/cjs/nodeviews/genericCard.js +1 -1
- package/dist/cjs/nodeviews/inlineCard.js +101 -16
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +40 -96
- package/dist/cjs/ui/AwarenessWrapper/index.js +2 -11
- package/dist/cjs/utils.js +15 -2
- package/dist/es2019/nodeviews/genericCard.js +2 -2
- package/dist/es2019/nodeviews/inlineCard.js +100 -17
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +39 -97
- package/dist/es2019/ui/AwarenessWrapper/index.js +2 -11
- package/dist/es2019/utils.js +15 -2
- package/dist/esm/nodeviews/genericCard.js +2 -2
- package/dist/esm/nodeviews/inlineCard.js +98 -17
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +41 -97
- package/dist/esm/ui/AwarenessWrapper/index.js +2 -11
- package/dist/esm/utils.js +15 -2
- package/dist/types/nodeviews/genericCard.d.ts +6 -4
- package/dist/types/nodeviews/inlineCard.d.ts +3 -7
- package/dist/types/nodeviews/inlineCardWithAwareness.d.ts +6 -1
- package/dist/types/ui/AwarenessWrapper/index.d.ts +4 -3
- package/dist/types/utils.d.ts +6 -0
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +6 -4
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +3 -7
- package/dist/types-ts4.5/nodeviews/inlineCardWithAwareness.d.ts +6 -1
- package/dist/types-ts4.5/ui/AwarenessWrapper/index.d.ts +4 -3
- package/dist/types-ts4.5/utils.d.ts +6 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
7
7
|
import type { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
12
|
import { type CardContext } from '@atlaskit/link-provider';
|
|
12
13
|
import type { CardProps as BaseCardProps, CardPlatform } from '@atlaskit/smart-card';
|
|
@@ -38,15 +39,16 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
38
39
|
showServerActions?: boolean;
|
|
39
40
|
actionOptions?: BaseCardProps['actionOptions'];
|
|
40
41
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
41
|
-
isOverlayEnabled?: boolean;
|
|
42
|
-
isPulseEnabled?: boolean;
|
|
43
|
-
linkPosition?: number;
|
|
44
|
-
isSelected?: boolean;
|
|
45
42
|
onClickCallback?: OnClickCallback;
|
|
46
43
|
}
|
|
47
44
|
export interface SmartCardProps extends CardProps {
|
|
48
45
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
49
46
|
cardContext?: EditorContext<CardContext | undefined>;
|
|
50
47
|
onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
|
|
48
|
+
onResolve?: (tr: Transaction, title?: string) => void;
|
|
49
|
+
isHovered?: boolean;
|
|
50
|
+
allowEmbeds?: boolean;
|
|
51
|
+
allowBlockCards?: boolean;
|
|
52
|
+
enableInlineUpgradeFeatures?: boolean;
|
|
51
53
|
}
|
|
52
54
|
export declare function Card(SmartCardComponent: React.ComponentType<React.PropsWithChildren<SmartCardProps>>, UnsupportedComponent: React.ComponentType<React.PropsWithChildren<unknown>>): React.ComponentType<React.PropsWithChildren<CardProps>>;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
3
3
|
import type { SmartCardProps } from './genericCard';
|
|
4
|
+
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
5
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, showServerActions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, }: SmartCardProps) => JSX.Element | null>;
|
|
4
6
|
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'showServerActions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback'>;
|
|
5
|
-
type InlineCardWithAwarenessProps = {
|
|
6
|
-
allowEmbeds?: boolean;
|
|
7
|
-
allowBlockCards?: boolean;
|
|
8
|
-
enableInlineUpgradeFeatures: boolean;
|
|
9
|
-
};
|
|
10
7
|
export declare function InlineCardNodeView(props: InlineNodeViewComponentProps & InlineCardNodeViewProps & InlineCardWithAwarenessProps): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SmartCardProps } from './genericCard';
|
|
3
|
-
export
|
|
3
|
+
export type InlineCardWithAwarenessProps = {
|
|
4
|
+
isPulseEnabled?: boolean;
|
|
5
|
+
isOverlayEnabled?: boolean;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, actionOptions, showServerActions, useAlternativePreloader, view, getPos, pluginInjectionApi, onClick, isPulseEnabled, isOverlayEnabled, isSelected, }: SmartCardProps & InlineCardWithAwarenessProps) => JSX.Element>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
3
|
import type { SmartCardProps } from '../../nodeviews/genericCard';
|
|
5
4
|
type AwarenessWrapperProps = {
|
|
6
5
|
isInserted?: boolean;
|
|
@@ -9,7 +8,9 @@ type AwarenessWrapperProps = {
|
|
|
9
8
|
markMostRecentlyInsertedLink: (isLinkMostRecentlyInserted: boolean) => void;
|
|
10
9
|
setOverlayHoveredStyles: (isHovered: boolean) => void;
|
|
11
10
|
url: string;
|
|
12
|
-
|
|
11
|
+
isOverlayEnabled?: boolean;
|
|
12
|
+
isPulseEnabled?: boolean;
|
|
13
|
+
isSelected?: boolean;
|
|
13
14
|
} & Partial<SmartCardProps>;
|
|
14
|
-
export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url,
|
|
15
|
+
export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url, }: AwarenessWrapperProps) => jsx.JSX.Element;
|
|
15
16
|
export {};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import { type getPosHandler } from '@atlaskit/editor-common/src/react-node-view';
|
|
2
3
|
import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -43,3 +44,8 @@ export declare const isDatasourceNode: (node?: Node) => node is DatasourceNode;
|
|
|
43
44
|
* @param editorView The editor view to focus.
|
|
44
45
|
*/
|
|
45
46
|
export declare const focusEditorView: (editorView: EditorView) => void;
|
|
47
|
+
export declare const getAwarenessProps: (editorState: EditorState, getPos: getPosHandler, allowEmbeds?: boolean, allowBlockCards?: boolean) => {
|
|
48
|
+
isPulseEnabled: boolean;
|
|
49
|
+
isOverlayEnabled: boolean;
|
|
50
|
+
isSelected: boolean;
|
|
51
|
+
};
|
|
@@ -7,6 +7,7 @@ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
7
7
|
import type { getPosHandler, ReactComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
10
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
12
|
import { type CardContext } from '@atlaskit/link-provider';
|
|
12
13
|
import type { CardProps as BaseCardProps, CardPlatform } from '@atlaskit/smart-card';
|
|
@@ -38,15 +39,16 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
38
39
|
showServerActions?: boolean;
|
|
39
40
|
actionOptions?: BaseCardProps['actionOptions'];
|
|
40
41
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
41
|
-
isOverlayEnabled?: boolean;
|
|
42
|
-
isPulseEnabled?: boolean;
|
|
43
|
-
linkPosition?: number;
|
|
44
|
-
isSelected?: boolean;
|
|
45
42
|
onClickCallback?: OnClickCallback;
|
|
46
43
|
}
|
|
47
44
|
export interface SmartCardProps extends CardProps {
|
|
48
45
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
49
46
|
cardContext?: EditorContext<CardContext | undefined>;
|
|
50
47
|
onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
|
|
48
|
+
onResolve?: (tr: Transaction, title?: string) => void;
|
|
49
|
+
isHovered?: boolean;
|
|
50
|
+
allowEmbeds?: boolean;
|
|
51
|
+
allowBlockCards?: boolean;
|
|
52
|
+
enableInlineUpgradeFeatures?: boolean;
|
|
51
53
|
}
|
|
52
54
|
export declare function Card(SmartCardComponent: React.ComponentType<React.PropsWithChildren<SmartCardProps>>, UnsupportedComponent: React.ComponentType<React.PropsWithChildren<unknown>>): React.ComponentType<React.PropsWithChildren<CardProps>>;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
3
3
|
import type { SmartCardProps } from './genericCard';
|
|
4
|
+
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
5
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, showServerActions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, }: SmartCardProps) => JSX.Element | null>;
|
|
4
6
|
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'showServerActions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback'>;
|
|
5
|
-
type InlineCardWithAwarenessProps = {
|
|
6
|
-
allowEmbeds?: boolean;
|
|
7
|
-
allowBlockCards?: boolean;
|
|
8
|
-
enableInlineUpgradeFeatures: boolean;
|
|
9
|
-
};
|
|
10
7
|
export declare function InlineCardNodeView(props: InlineNodeViewComponentProps & InlineCardNodeViewProps & InlineCardWithAwarenessProps): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SmartCardProps } from './genericCard';
|
|
3
|
-
export
|
|
3
|
+
export type InlineCardWithAwarenessProps = {
|
|
4
|
+
isPulseEnabled?: boolean;
|
|
5
|
+
isOverlayEnabled?: boolean;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, actionOptions, showServerActions, useAlternativePreloader, view, getPos, pluginInjectionApi, onClick, isPulseEnabled, isOverlayEnabled, isSelected, }: SmartCardProps & InlineCardWithAwarenessProps) => JSX.Element>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
|
-
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
3
|
import type { SmartCardProps } from '../../nodeviews/genericCard';
|
|
5
4
|
type AwarenessWrapperProps = {
|
|
6
5
|
isInserted?: boolean;
|
|
@@ -9,7 +8,9 @@ type AwarenessWrapperProps = {
|
|
|
9
8
|
markMostRecentlyInsertedLink: (isLinkMostRecentlyInserted: boolean) => void;
|
|
10
9
|
setOverlayHoveredStyles: (isHovered: boolean) => void;
|
|
11
10
|
url: string;
|
|
12
|
-
|
|
11
|
+
isOverlayEnabled?: boolean;
|
|
12
|
+
isPulseEnabled?: boolean;
|
|
13
|
+
isSelected?: boolean;
|
|
13
14
|
} & Partial<SmartCardProps>;
|
|
14
|
-
export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url,
|
|
15
|
+
export declare const AwarenessWrapper: ({ cardContext, children, getPos, isInserted, isOverlayEnabled, isSelected, isResolvedViewRendered, isPulseEnabled, markMostRecentlyInsertedLink, pluginInjectionApi, setOverlayHoveredStyles, url, }: AwarenessWrapperProps) => jsx.JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import { type getPosHandler } from '@atlaskit/editor-common/src/react-node-view';
|
|
2
3
|
import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
@@ -43,3 +44,8 @@ export declare const isDatasourceNode: (node?: Node) => node is DatasourceNode;
|
|
|
43
44
|
* @param editorView The editor view to focus.
|
|
44
45
|
*/
|
|
45
46
|
export declare const focusEditorView: (editorView: EditorView) => void;
|
|
47
|
+
export declare const getAwarenessProps: (editorState: EditorState, getPos: getPosHandler, allowEmbeds?: boolean, allowBlockCards?: boolean) => {
|
|
48
|
+
isPulseEnabled: boolean;
|
|
49
|
+
isOverlayEnabled: boolean;
|
|
50
|
+
isSelected: boolean;
|
|
51
|
+
};
|