@atlaskit/editor-plugin-card 0.11.1 → 0.12.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/CHANGELOG.md +6 -0
- package/dist/cjs/ui/EditDatasourceButton.js +2 -6
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +10 -2
- package/dist/cjs/ui/useFetchDatasourceInfo.js +4 -0
- package/dist/es2019/ui/EditDatasourceButton.js +2 -6
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +10 -2
- package/dist/es2019/ui/useFetchDatasourceInfo.js +5 -0
- package/dist/esm/ui/EditDatasourceButton.js +2 -6
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +10 -2
- package/dist/esm/ui/useFetchDatasourceInfo.js +5 -0
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +6 -7
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +6 -7
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#42821](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42821) [`9ae7cc56578`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9ae7cc56578) - [ux] Adds datasource edit button to blue links that can resolve into datasources
|
|
8
|
+
|
|
3
9
|
## 0.11.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ var _react = require("@emotion/react");
|
|
|
8
8
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
9
9
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
11
12
|
var _actions = require("../pm-plugins/actions");
|
|
12
13
|
var _CardContextProvider = require("./CardContextProvider");
|
|
13
14
|
var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
|
|
@@ -16,9 +17,6 @@ var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
|
|
|
16
17
|
var buttonStyles = (0, _react.css)({
|
|
17
18
|
pointerEvents: 'auto'
|
|
18
19
|
});
|
|
19
|
-
var buttonWrapperStyles = (0, _react.css)({
|
|
20
|
-
display: 'flex'
|
|
21
|
-
});
|
|
22
20
|
|
|
23
21
|
// Edit button in toolbar to open datasource modal. This button is shown for inline, block, and embed cards
|
|
24
22
|
// if they can resolve into a datasource.
|
|
@@ -51,9 +49,7 @@ var EditDatasourceButtonWithCardContext = function EditDatasourceButtonWithCardC
|
|
|
51
49
|
editorView.focus();
|
|
52
50
|
}
|
|
53
51
|
};
|
|
54
|
-
return (0, _react.jsx)(
|
|
55
|
-
css: buttonWrapperStyles
|
|
56
|
-
}, (0, _react.jsx)(_ui.FloatingToolbarButton, {
|
|
52
|
+
return (0, _react.jsx)(_primitives.Flex, null, (0, _react.jsx)(_ui.FloatingToolbarButton, {
|
|
57
53
|
css: buttonStyles,
|
|
58
54
|
title: intl.formatMessage(_messages.cardMessages.datasourceTitle),
|
|
59
55
|
icon: (0, _react.jsx)(_ui.SmallerEditIcon, null),
|
|
@@ -16,6 +16,8 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
16
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _primitives = require("@atlaskit/primitives");
|
|
20
|
+
var _EditDatasourceButton = require("./EditDatasourceButton");
|
|
19
21
|
var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
|
|
20
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -155,7 +157,13 @@ var HyperlinkToolbarAppearance = exports.HyperlinkToolbarAppearance = /*#__PURE_
|
|
|
155
157
|
if (!supportedUrlsMap.get(url)) {
|
|
156
158
|
return null;
|
|
157
159
|
}
|
|
158
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Flex, null, /*#__PURE__*/_react.default.createElement(_EditDatasourceButton.EditDatasourceButton, {
|
|
161
|
+
url: url,
|
|
162
|
+
intl: intl,
|
|
163
|
+
editorState: editorState,
|
|
164
|
+
editorView: editorView,
|
|
165
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
166
|
+
}), /*#__PURE__*/_react.default.createElement(_LinkToolbarAppearance.LinkToolbarAppearance, {
|
|
159
167
|
key: "link-appearance",
|
|
160
168
|
url: url,
|
|
161
169
|
intl: intl,
|
|
@@ -166,7 +174,7 @@ var HyperlinkToolbarAppearance = exports.HyperlinkToolbarAppearance = /*#__PURE_
|
|
|
166
174
|
platform: platform,
|
|
167
175
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
168
176
|
cardActions: cardActions
|
|
169
|
-
});
|
|
177
|
+
}));
|
|
170
178
|
}
|
|
171
179
|
}]);
|
|
172
180
|
return HyperlinkToolbarAppearance;
|
|
@@ -11,6 +11,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
|
|
14
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
|
+
|
|
14
18
|
var useFetchDatasourceInfo = exports.useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
|
|
15
19
|
var isRegularCardNode = _ref.isRegularCardNode,
|
|
16
20
|
url = _ref.url,
|
|
@@ -3,15 +3,13 @@ import { css, jsx } from '@emotion/react';
|
|
|
3
3
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator, SmallerEditIcon } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { canRenderDatasource, getDatasourceType } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { Flex } from '@atlaskit/primitives';
|
|
6
7
|
import { showDatasourceModal } from '../pm-plugins/actions';
|
|
7
8
|
import { CardContextProvider } from './CardContextProvider';
|
|
8
9
|
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
9
10
|
const buttonStyles = css({
|
|
10
11
|
pointerEvents: 'auto'
|
|
11
12
|
});
|
|
12
|
-
const buttonWrapperStyles = css({
|
|
13
|
-
display: 'flex'
|
|
14
|
-
});
|
|
15
13
|
|
|
16
14
|
// Edit button in toolbar to open datasource modal. This button is shown for inline, block, and embed cards
|
|
17
15
|
// if they can resolve into a datasource.
|
|
@@ -46,9 +44,7 @@ const EditDatasourceButtonWithCardContext = ({
|
|
|
46
44
|
editorView.focus();
|
|
47
45
|
}
|
|
48
46
|
};
|
|
49
|
-
return jsx(
|
|
50
|
-
css: buttonWrapperStyles
|
|
51
|
-
}, jsx(Button, {
|
|
47
|
+
return jsx(Flex, null, jsx(Button, {
|
|
52
48
|
css: buttonStyles,
|
|
53
49
|
title: intl.formatMessage(messages.datasourceTitle),
|
|
54
50
|
icon: jsx(SmallerEditIcon, null),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
+
import { Flex } from '@atlaskit/primitives';
|
|
4
|
+
import { EditDatasourceButton } from './EditDatasourceButton';
|
|
3
5
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
4
6
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
5
7
|
export class HyperlinkToolbarAppearance extends Component {
|
|
@@ -70,7 +72,13 @@ export class HyperlinkToolbarAppearance extends Component {
|
|
|
70
72
|
if (!supportedUrlsMap.get(url)) {
|
|
71
73
|
return null;
|
|
72
74
|
}
|
|
73
|
-
return /*#__PURE__*/React.createElement(
|
|
75
|
+
return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(EditDatasourceButton, {
|
|
76
|
+
url: url,
|
|
77
|
+
intl: intl,
|
|
78
|
+
editorState: editorState,
|
|
79
|
+
editorView: editorView,
|
|
80
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
81
|
+
}), /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
|
|
74
82
|
key: "link-appearance",
|
|
75
83
|
url: url,
|
|
76
84
|
intl: intl,
|
|
@@ -81,6 +89,6 @@ export class HyperlinkToolbarAppearance extends Component {
|
|
|
81
89
|
platform: platform,
|
|
82
90
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
83
91
|
cardActions: cardActions
|
|
84
|
-
});
|
|
92
|
+
}));
|
|
85
93
|
}
|
|
86
94
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
|
+
|
|
3
8
|
export const useFetchDatasourceInfo = ({
|
|
4
9
|
isRegularCardNode,
|
|
5
10
|
url,
|
|
@@ -3,15 +3,13 @@ import { css, jsx } from '@emotion/react';
|
|
|
3
3
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator, SmallerEditIcon } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { canRenderDatasource, getDatasourceType } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { Flex } from '@atlaskit/primitives';
|
|
6
7
|
import { showDatasourceModal } from '../pm-plugins/actions';
|
|
7
8
|
import { CardContextProvider } from './CardContextProvider';
|
|
8
9
|
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
9
10
|
var buttonStyles = css({
|
|
10
11
|
pointerEvents: 'auto'
|
|
11
12
|
});
|
|
12
|
-
var buttonWrapperStyles = css({
|
|
13
|
-
display: 'flex'
|
|
14
|
-
});
|
|
15
13
|
|
|
16
14
|
// Edit button in toolbar to open datasource modal. This button is shown for inline, block, and embed cards
|
|
17
15
|
// if they can resolve into a datasource.
|
|
@@ -44,9 +42,7 @@ var EditDatasourceButtonWithCardContext = function EditDatasourceButtonWithCardC
|
|
|
44
42
|
editorView.focus();
|
|
45
43
|
}
|
|
46
44
|
};
|
|
47
|
-
return jsx(
|
|
48
|
-
css: buttonWrapperStyles
|
|
49
|
-
}, jsx(Button, {
|
|
45
|
+
return jsx(Flex, null, jsx(Button, {
|
|
50
46
|
css: buttonStyles,
|
|
51
47
|
title: intl.formatMessage(messages.datasourceTitle),
|
|
52
48
|
icon: jsx(SmallerEditIcon, null),
|
|
@@ -10,6 +10,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
import React, { Component } from 'react';
|
|
13
|
+
import { Flex } from '@atlaskit/primitives';
|
|
14
|
+
import { EditDatasourceButton } from './EditDatasourceButton';
|
|
13
15
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
14
16
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
15
17
|
export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
@@ -145,7 +147,13 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
145
147
|
if (!supportedUrlsMap.get(url)) {
|
|
146
148
|
return null;
|
|
147
149
|
}
|
|
148
|
-
return /*#__PURE__*/React.createElement(
|
|
150
|
+
return /*#__PURE__*/React.createElement(Flex, null, /*#__PURE__*/React.createElement(EditDatasourceButton, {
|
|
151
|
+
url: url,
|
|
152
|
+
intl: intl,
|
|
153
|
+
editorState: editorState,
|
|
154
|
+
editorView: editorView,
|
|
155
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
156
|
+
}), /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
|
|
149
157
|
key: "link-appearance",
|
|
150
158
|
url: url,
|
|
151
159
|
intl: intl,
|
|
@@ -156,7 +164,7 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
156
164
|
platform: platform,
|
|
157
165
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
158
166
|
cardActions: cardActions
|
|
159
|
-
});
|
|
167
|
+
}));
|
|
160
168
|
}
|
|
161
169
|
}]);
|
|
162
170
|
return HyperlinkToolbarAppearance;
|
|
@@ -3,6 +3,11 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
10
|
+
|
|
6
11
|
export var useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
|
|
7
12
|
var isRegularCardNode = _ref.isRegularCardNode,
|
|
8
13
|
url = _ref.url,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { CardPlatform } from '@atlaskit/smart-card';
|
|
4
|
+
import type { CardOptions, CardPluginActions } from '@atlaskit/editor-common/card';
|
|
5
|
+
import type { CardProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import type { CardPlatform } from '@atlaskit/smart-card';
|
|
10
9
|
export interface HyperlinkToolbarAppearanceProps {
|
|
11
10
|
intl: IntlShape;
|
|
12
11
|
editorState: EditorState;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import { IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { CardOptions } from '@atlaskit/editor-common/card';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { CardPlatform } from '@atlaskit/smart-card';
|
|
4
|
+
import type { CardOptions, CardPluginActions } from '@atlaskit/editor-common/card';
|
|
5
|
+
import type { CardProvider, ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import type { CardPlatform } from '@atlaskit/smart-card';
|
|
10
9
|
export interface HyperlinkToolbarAppearanceProps {
|
|
11
10
|
intl: IntlShape;
|
|
12
11
|
editorState: EditorState;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@atlaskit/link-datasource": "^1.15.0",
|
|
51
51
|
"@atlaskit/linking-common": "^4.17.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
53
|
+
"@atlaskit/primitives": "^1.9.0",
|
|
53
54
|
"@atlaskit/smart-card": "^26.42.0",
|
|
54
55
|
"@atlaskit/theme": "^12.6.0",
|
|
55
56
|
"@atlaskit/tokens": "^1.28.0",
|