@atlaskit/editor-plugin-card 0.6.0 → 0.7.1
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/blockCard.js +20 -0
- package/dist/cjs/pm-plugins/doc.js +33 -28
- package/dist/cjs/toolbar.js +24 -6
- package/dist/cjs/ui/DatasourceModal/index.js +15 -3
- package/dist/cjs/ui/EditDatasourceButton.js +144 -0
- package/dist/cjs/ui/EditLinkToolbar.js +4 -27
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +5 -3
- package/dist/es2019/nodeviews/blockCard.js +15 -0
- package/dist/es2019/pm-plugins/doc.js +27 -22
- package/dist/es2019/toolbar.js +22 -6
- package/dist/es2019/ui/DatasourceModal/index.js +13 -4
- package/dist/es2019/ui/EditDatasourceButton.js +101 -0
- package/dist/es2019/ui/EditLinkToolbar.js +1 -23
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +5 -3
- package/dist/esm/nodeviews/blockCard.js +20 -0
- package/dist/esm/pm-plugins/doc.js +31 -26
- package/dist/esm/toolbar.js +24 -6
- package/dist/esm/ui/DatasourceModal/index.js +16 -4
- package/dist/esm/ui/EditDatasourceButton.js +134 -0
- package/dist/esm/ui/EditLinkToolbar.js +1 -23
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +5 -3
- package/dist/types/nodeviews/blockCard.d.ts +5 -1
- package/dist/types/pm-plugins/doc.d.ts +1 -1
- package/dist/types/ui/EditDatasourceButton.d.ts +17 -0
- package/dist/types/ui/EditLinkToolbar.d.ts +0 -1
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +5 -1
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +17 -0
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +0 -1
- package/package.json +3 -3
- package/dist/cjs/ui/SmallerEditIcon.js +0 -22
- package/dist/es2019/ui/SmallerEditIcon.js +0 -14
- package/dist/esm/ui/SmallerEditIcon.js +0 -14
- package/dist/types/ui/SmallerEditIcon.d.ts +0 -3
- package/dist/types-ts4.5/ui/SmallerEditIcon.d.ts +0 -3
|
@@ -12,9 +12,8 @@ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
|
12
12
|
import { HyperlinkAddToolbar as HyperlinkToolbar } from '@atlaskit/editor-common/link';
|
|
13
13
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { LINKPICKER_HEIGHT_IN_PX, RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '@atlaskit/editor-common/ui';
|
|
15
|
-
import { getDatasourceType } from '@atlaskit/editor-common/utils';
|
|
16
15
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
17
|
-
import { hideLinkToolbar as _hideLinkToolbar,
|
|
16
|
+
import { hideLinkToolbar as _hideLinkToolbar, showLinkToolbar } from '../pm-plugins/actions';
|
|
18
17
|
import { changeSelectedCardToLink, updateCard } from '../pm-plugins/doc';
|
|
19
18
|
import { displayInfoForCard, findCardInfo } from '../utils';
|
|
20
19
|
export function HyperlinkAddToolbarWithState(_ref) {
|
|
@@ -206,25 +205,4 @@ export var editLinkToolbarConfig = function editLinkToolbarConfig(showLinkingToo
|
|
|
206
205
|
width: RECENT_SEARCH_WIDTH_IN_PX,
|
|
207
206
|
forcePlacement: true
|
|
208
207
|
} : {};
|
|
209
|
-
};
|
|
210
|
-
export var editDatasource = function editDatasource(node, editorAnalyticsApi) {
|
|
211
|
-
return function (state, dispatch) {
|
|
212
|
-
var _node$attrs;
|
|
213
|
-
var modalType = getDatasourceType((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource.id);
|
|
214
|
-
if (dispatch && modalType) {
|
|
215
|
-
var tr = state.tr;
|
|
216
|
-
showDatasourceModal(modalType)(tr);
|
|
217
|
-
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
218
|
-
// buildEditLinkPayload(
|
|
219
|
-
// type as
|
|
220
|
-
// | ACTION_SUBJECT_ID.CARD_INLINE
|
|
221
|
-
// | ACTION_SUBJECT_ID.CARD_BLOCK
|
|
222
|
-
// | ACTION_SUBJECT_ID.EMBEDS,
|
|
223
|
-
// ),
|
|
224
|
-
// )(tr);
|
|
225
|
-
dispatch(tr);
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
return false;
|
|
229
|
-
};
|
|
230
208
|
};
|
|
@@ -22,8 +22,9 @@ function getSearchMethod(creationMethod, metadata) {
|
|
|
22
22
|
}
|
|
23
23
|
var sourceEvent = metadata.sourceEvent;
|
|
24
24
|
if (sourceEvent instanceof UIAnalyticsEvent) {
|
|
25
|
+
var _event$payload$attrib;
|
|
25
26
|
var event = sourceEvent;
|
|
26
|
-
return event.payload.searchMethod;
|
|
27
|
+
return (_event$payload$attrib = event.payload.attributes) === null || _event$payload$attrib === void 0 ? void 0 : _event$payload$attrib.searchMethod;
|
|
27
28
|
}
|
|
28
29
|
return 'unknown';
|
|
29
30
|
}
|
|
@@ -41,8 +42,9 @@ function getAnalyticAttributesFromNode(datasourceAttrs, metadata) {
|
|
|
41
42
|
inputMethod: metadata.inputMethod
|
|
42
43
|
})) !== null && _getMethod !== void 0 ? _getMethod : '';
|
|
43
44
|
} else if (metadata.sourceEvent instanceof UIAnalyticsEvent) {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
var _metadata$sourceEvent, _metadata$sourceEvent2;
|
|
46
|
+
inputMethod = (_metadata$sourceEvent = metadata.sourceEvent.payload.attributes) === null || _metadata$sourceEvent === void 0 ? void 0 : _metadata$sourceEvent.inputMethod;
|
|
47
|
+
actions = (_metadata$sourceEvent2 = metadata.sourceEvent.payload.attributes) === null || _metadata$sourceEvent2 === void 0 ? void 0 : _metadata$sourceEvent2.actions;
|
|
46
48
|
}
|
|
47
49
|
var displayedColumnCount = getDisplayedColumnCount(datasourceAttrs);
|
|
48
50
|
var searchMethod = getSearchMethod(inputMethod, metadata);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
|
-
import {
|
|
4
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { Decoration, DecorationSource } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { SmartCardProps } from './genericCard';
|
|
5
7
|
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps> {
|
|
6
8
|
private scrollContainer?;
|
|
7
9
|
onClick: () => void;
|
|
@@ -22,5 +24,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
22
24
|
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'platform' | 'showServerActions'>;
|
|
23
25
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
24
26
|
createDomRef(): HTMLElement;
|
|
27
|
+
validUpdate(currentNode: Node, newNode: Node): boolean;
|
|
28
|
+
update(node: Node, decorations: ReadonlyArray<Decoration>, _innerDecorations?: DecorationSource): boolean;
|
|
25
29
|
render(): JSX.Element;
|
|
26
30
|
}
|
|
@@ -23,5 +23,5 @@ export type LinkNodes = {
|
|
|
23
23
|
[key in 'inlineCard' | 'blockCard' | 'embedCard']: NodeType;
|
|
24
24
|
};
|
|
25
25
|
export declare const getLinkNodeType: (appearance: CardAppearance, linkNodes: LinkNodes) => NodeType;
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const updateCardFromDatasourceModal: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
27
27
|
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
8
|
+
export interface EditDatasourceButtonProps {
|
|
9
|
+
intl: IntlShape;
|
|
10
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
11
|
+
url?: string;
|
|
12
|
+
editorView?: EditorView;
|
|
13
|
+
editorState: EditorState;
|
|
14
|
+
cardContext?: CardContext;
|
|
15
|
+
}
|
|
16
|
+
export declare const EditDatasourceButton: ({ intl, editorAnalyticsApi, url, editorView, editorState, }: EditDatasourceButtonProps) => jsx.JSX.Element;
|
|
17
|
+
export declare const editDatasource: (datasourceId: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -38,5 +38,4 @@ export declare const buildEditLinkToolbar: ({ providerFactory, node, linkPicker,
|
|
|
38
38
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
39
39
|
}) => FloatingToolbarItem<Command>;
|
|
40
40
|
export declare const editLinkToolbarConfig: (showLinkingToolbar: boolean, lpLinkPicker: boolean) => Partial<FloatingToolbarConfig>;
|
|
41
|
-
export declare const editDatasource: (node: Node, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
42
41
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
4
|
-
import {
|
|
4
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { Decoration, DecorationSource } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { SmartCardProps } from './genericCard';
|
|
5
7
|
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps> {
|
|
6
8
|
private scrollContainer?;
|
|
7
9
|
onClick: () => void;
|
|
@@ -22,5 +24,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
22
24
|
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'platform' | 'showServerActions'>;
|
|
23
25
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
24
26
|
createDomRef(): HTMLElement;
|
|
27
|
+
validUpdate(currentNode: Node, newNode: Node): boolean;
|
|
28
|
+
update(node: Node, decorations: ReadonlyArray<Decoration>, _innerDecorations?: DecorationSource): boolean;
|
|
25
29
|
render(): JSX.Element;
|
|
26
30
|
}
|
|
@@ -23,5 +23,5 @@ export type LinkNodes = {
|
|
|
23
23
|
[key in 'inlineCard' | 'blockCard' | 'embedCard']: NodeType;
|
|
24
24
|
};
|
|
25
25
|
export declare const getLinkNodeType: (appearance: CardAppearance, linkNodes: LinkNodes) => NodeType;
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const updateCardFromDatasourceModal: (state: EditorState, node: Node, newAdf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
27
27
|
export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf | InlineCardAdf, view: EditorView, sourceEvent?: UIAnalyticsEvent) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
8
|
+
export interface EditDatasourceButtonProps {
|
|
9
|
+
intl: IntlShape;
|
|
10
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
11
|
+
url?: string;
|
|
12
|
+
editorView?: EditorView;
|
|
13
|
+
editorState: EditorState;
|
|
14
|
+
cardContext?: CardContext;
|
|
15
|
+
}
|
|
16
|
+
export declare const EditDatasourceButton: ({ intl, editorAnalyticsApi, url, editorView, editorState, }: EditDatasourceButtonProps) => jsx.JSX.Element;
|
|
17
|
+
export declare const editDatasource: (datasourceId: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -38,5 +38,4 @@ export declare const buildEditLinkToolbar: ({ providerFactory, node, linkPicker,
|
|
|
38
38
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
39
39
|
}) => FloatingToolbarItem<Command>;
|
|
40
40
|
export declare const editLinkToolbarConfig: (showLinkingToolbar: boolean, lpLinkPicker: boolean) => Partial<FloatingToolbarConfig>;
|
|
41
|
-
export declare const editDatasource: (node: Node, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
42
41
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^29.1.0",
|
|
35
35
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
36
|
-
"@atlaskit/editor-common": "^75.
|
|
36
|
+
"@atlaskit/editor-common": "^75.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
46
46
|
"@atlaskit/icon": "^21.12.0",
|
|
47
47
|
"@atlaskit/link-analytics": "^8.3.0",
|
|
48
|
-
"@atlaskit/link-datasource": "^1.
|
|
48
|
+
"@atlaskit/link-datasource": "^1.2.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
50
50
|
"@atlaskit/smart-card": "^26.26.0",
|
|
51
51
|
"@atlaskit/theme": "^12.6.0",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.SmallerEditIcon = void 0;
|
|
8
|
-
var _react = require("@emotion/react");
|
|
9
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
|
-
var _edit = _interopRequireDefault(require("@atlaskit/icon/glyph/edit"));
|
|
11
|
-
/** @jsx jsx */
|
|
12
|
-
|
|
13
|
-
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
14
|
-
var SmallerEditIcon = function SmallerEditIcon() {
|
|
15
|
-
return (0, _react.jsx)("div", {
|
|
16
|
-
css: _styles.editIconStyles
|
|
17
|
-
}, (0, _react.jsx)(_edit.default, {
|
|
18
|
-
label: "edit"
|
|
19
|
-
}));
|
|
20
|
-
};
|
|
21
|
-
/* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
|
|
22
|
-
exports.SmallerEditIcon = SmallerEditIcon;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
-
import { editIconStyles } from '@atlaskit/editor-common/styles';
|
|
4
|
-
import EditIcon from '@atlaskit/icon/glyph/edit';
|
|
5
|
-
|
|
6
|
-
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
7
|
-
export const SmallerEditIcon = () => {
|
|
8
|
-
return jsx("div", {
|
|
9
|
-
css: editIconStyles
|
|
10
|
-
}, jsx(EditIcon, {
|
|
11
|
-
label: "edit"
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
/* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
-
import { editIconStyles } from '@atlaskit/editor-common/styles';
|
|
4
|
-
import EditIcon from '@atlaskit/icon/glyph/edit';
|
|
5
|
-
|
|
6
|
-
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
7
|
-
export var SmallerEditIcon = function SmallerEditIcon() {
|
|
8
|
-
return jsx("div", {
|
|
9
|
-
css: editIconStyles
|
|
10
|
-
}, jsx(EditIcon, {
|
|
11
|
-
label: "edit"
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
/* eslint-enable @atlaskit/design-system/consistent-css-prop-usage */
|