@atlaskit/editor-plugin-card 2.3.3 → 2.3.5
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 +17 -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/plugin.js +2 -2
- 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/plugin.js +3 -3
- 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/plugin.js +3 -3
- 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 +2 -2
package/dist/esm/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { getResolvedAttributes } from '@atlaskit/link-analytics/resolved-attributes';
|
|
5
5
|
import { ASSETS_LIST_OF_LINKS_DATASOURCE_ID, CONFLUENCE_SEARCH_DATASOURCE_ID, JIRA_LIST_OF_LINKS_DATASOURCE_ID } from '@atlaskit/link-datasource';
|
|
6
|
-
import {
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
8
8
|
export var appearanceForNodeType = function appearanceForNodeType(spec) {
|
|
9
9
|
if (spec.name === 'inlineCard') {
|
|
@@ -75,7 +75,7 @@ export var getResolvedAttributesFromStore = function getResolvedAttributesFromSt
|
|
|
75
75
|
};
|
|
76
76
|
export var isDatasourceConfigEditable = function isDatasourceConfigEditable(datasourceId) {
|
|
77
77
|
var datasourcesWithConfigModal = [JIRA_LIST_OF_LINKS_DATASOURCE_ID, ASSETS_LIST_OF_LINKS_DATASOURCE_ID];
|
|
78
|
-
if (
|
|
78
|
+
if (fg('platform.linking-platform.datasource.enable-confluence-search-modal')) {
|
|
79
79
|
datasourcesWithConfigModal.push(CONFLUENCE_SEARCH_DATASOURCE_ID);
|
|
80
80
|
}
|
|
81
81
|
return datasourcesWithConfigModal.includes(datasourceId);
|
|
@@ -125,4 +125,17 @@ export var focusEditorView = function focusEditorView(editorView) {
|
|
|
125
125
|
if (!editorView.hasFocus()) {
|
|
126
126
|
editorView.focus();
|
|
127
127
|
}
|
|
128
|
+
};
|
|
129
|
+
export var getAwarenessProps = function getAwarenessProps(editorState, getPos, allowEmbeds, allowBlockCards) {
|
|
130
|
+
var _editorState$selectio, _editorState$selectio2;
|
|
131
|
+
var getPosFunction = typeof getPos !== 'boolean' ? getPos : undefined;
|
|
132
|
+
var linkPosition = getPosFunction === null || getPosFunction === void 0 ? void 0 : getPosFunction();
|
|
133
|
+
var canBeUpgradedToEmbed = !!linkPosition && allowEmbeds ? isEmbedSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
134
|
+
var canBeUpgradedToBlock = !!linkPosition && allowBlockCards ? isBlockSupportedAtPosition(linkPosition, editorState, 'inline') : false;
|
|
135
|
+
var isSelected = editorState.selection instanceof NodeSelection && ((_editorState$selectio = editorState.selection) === null || _editorState$selectio === void 0 || (_editorState$selectio = _editorState$selectio.node) === null || _editorState$selectio === void 0 ? void 0 : _editorState$selectio.type) === editorState.schema.nodes.inlineCard && ((_editorState$selectio2 = editorState.selection) === null || _editorState$selectio2 === void 0 ? void 0 : _editorState$selectio2.from) === (getPosFunction === null || getPosFunction === void 0 ? void 0 : getPosFunction());
|
|
136
|
+
return {
|
|
137
|
+
isPulseEnabled: canBeUpgradedToEmbed,
|
|
138
|
+
isOverlayEnabled: canBeUpgradedToEmbed || canBeUpgradedToBlock,
|
|
139
|
+
isSelected: isSelected
|
|
140
|
+
};
|
|
128
141
|
};
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/button": "^18.1.0",
|
|
38
38
|
"@atlaskit/custom-steps": "^0.4.0",
|
|
39
39
|
"@atlaskit/dropdown-menu": "^12.13.0",
|
|
40
|
-
"@atlaskit/editor-common": "^
|
|
40
|
+
"@atlaskit/editor-common": "^84.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
42
42
|
"@atlaskit/editor-plugin-decorations": "^1.1.0",
|
|
43
43
|
"@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
|