@atlaskit/editor-plugin-card 2.13.5 → 2.14.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 +20 -0
- package/dist/cjs/plugin.js +38 -2
- package/dist/cjs/pm-plugins/keymap.js +5 -5
- package/dist/cjs/pm-plugins/main.js +4 -2
- package/dist/cjs/toolbar.js +2 -1
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +211 -68
- package/dist/cjs/ui/Pulse/index.js +2 -2
- package/dist/cjs/ui/ToolbarViewedEvent.js +2 -2
- package/dist/es2019/plugin.js +14 -1
- package/dist/es2019/pm-plugins/keymap.js +1 -1
- package/dist/es2019/pm-plugins/main.js +4 -2
- package/dist/es2019/toolbar.js +2 -1
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +94 -13
- package/dist/es2019/ui/Pulse/index.js +1 -1
- package/dist/es2019/ui/ToolbarViewedEvent.js +1 -1
- package/dist/esm/plugin.js +39 -3
- package/dist/esm/pm-plugins/keymap.js +1 -1
- package/dist/esm/pm-plugins/main.js +4 -2
- package/dist/esm/toolbar.js +2 -1
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +214 -71
- package/dist/esm/ui/Pulse/index.js +1 -1
- package/dist/esm/ui/ToolbarViewedEvent.js +1 -1
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +6 -11
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +6 -11
- package/package.json +4 -5
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
3
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
@@ -6,24 +5,170 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import
|
|
8
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
9
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
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() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
-
import
|
|
12
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
|
+
import React, { Component, useEffect, useRef, useState } from 'react';
|
|
13
14
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
15
|
import { FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
15
|
-
import { fg
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { Flex } from '@atlaskit/primitives';
|
|
17
18
|
import { DatasourceAppearanceButton } from './DatasourceAppearanceButton';
|
|
18
19
|
import { EditDatasourceButton } from './EditDatasourceButton';
|
|
19
20
|
import { LinkToolbarAppearance } from './LinkToolbarAppearance';
|
|
21
|
+
function HyperlinkToolbarAppearanceFunctional(props) {
|
|
22
|
+
var _props$cardOptions3;
|
|
23
|
+
var _useState = useState(new Map()),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
supportedUrlsMap = _useState2[0],
|
|
26
|
+
setSupportedUrlsMap = _useState2[1];
|
|
27
|
+
var cardProvider = useRef(undefined);
|
|
28
|
+
var url = props.url,
|
|
29
|
+
intl = props.intl,
|
|
30
|
+
editorView = props.editorView,
|
|
31
|
+
editorState = props.editorState,
|
|
32
|
+
cardOptions = props.cardOptions,
|
|
33
|
+
platform = props.platform,
|
|
34
|
+
editorAnalyticsApi = props.editorAnalyticsApi;
|
|
35
|
+
var getProvider = /*#__PURE__*/function () {
|
|
36
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
37
|
+
var _props$cardOptions;
|
|
38
|
+
var _props$cardOptions2;
|
|
39
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
if (!((_props$cardOptions = props.cardOptions) !== null && _props$cardOptions !== void 0 && _props$cardOptions.provider)) {
|
|
43
|
+
_context.next = 2;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return _context.abrupt("return", (_props$cardOptions2 = props.cardOptions) === null || _props$cardOptions2 === void 0 ? void 0 : _props$cardOptions2.provider);
|
|
47
|
+
case 2:
|
|
48
|
+
if (!cardProvider.current) {
|
|
49
|
+
_context.next = 4;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return _context.abrupt("return", cardProvider.current);
|
|
53
|
+
case 4:
|
|
54
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
55
|
+
var _props$editorPluginAp;
|
|
56
|
+
var cardProvider = (_props$editorPluginAp = props.editorPluginApi) === null || _props$editorPluginAp === void 0 || (_props$editorPluginAp = _props$editorPluginAp.card) === null || _props$editorPluginAp === void 0 || (_props$editorPluginAp = _props$editorPluginAp.sharedState) === null || _props$editorPluginAp === void 0 || (_props$editorPluginAp = _props$editorPluginAp.currentState()) === null || _props$editorPluginAp === void 0 ? void 0 : _props$editorPluginAp.provider;
|
|
57
|
+
if (cardProvider) {
|
|
58
|
+
resolve(cardProvider);
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
case 5:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
return function getProvider() {
|
|
68
|
+
return _ref.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
}();
|
|
71
|
+
var resolveUrl = /*#__PURE__*/function () {
|
|
72
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
|
|
73
|
+
var isUrlSupported, _yield$provider$findP, provider, newMap;
|
|
74
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
75
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
if (!supportedUrlsMap.has(url)) {
|
|
78
|
+
_context2.next = 2;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
return _context2.abrupt("return");
|
|
82
|
+
case 2:
|
|
83
|
+
isUrlSupported = false;
|
|
84
|
+
_context2.prev = 3;
|
|
85
|
+
_context2.next = 6;
|
|
86
|
+
return getProvider();
|
|
87
|
+
case 6:
|
|
88
|
+
provider = _context2.sent;
|
|
89
|
+
_context2.next = 9;
|
|
90
|
+
return provider === null || provider === void 0 ? void 0 : provider.findPattern(url);
|
|
91
|
+
case 9:
|
|
92
|
+
_context2.t1 = _yield$provider$findP = _context2.sent;
|
|
93
|
+
_context2.t0 = _context2.t1 !== null;
|
|
94
|
+
if (!_context2.t0) {
|
|
95
|
+
_context2.next = 13;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
_context2.t0 = _yield$provider$findP !== void 0;
|
|
99
|
+
case 13:
|
|
100
|
+
if (!_context2.t0) {
|
|
101
|
+
_context2.next = 17;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
_context2.t2 = _yield$provider$findP;
|
|
105
|
+
_context2.next = 18;
|
|
106
|
+
break;
|
|
107
|
+
case 17:
|
|
108
|
+
_context2.t2 = false;
|
|
109
|
+
case 18:
|
|
110
|
+
isUrlSupported = _context2.t2;
|
|
111
|
+
_context2.next = 24;
|
|
112
|
+
break;
|
|
113
|
+
case 21:
|
|
114
|
+
_context2.prev = 21;
|
|
115
|
+
_context2.t3 = _context2["catch"](3);
|
|
116
|
+
isUrlSupported = false;
|
|
117
|
+
case 24:
|
|
118
|
+
newMap = new Map(supportedUrlsMap);
|
|
119
|
+
newMap.set(url, isUrlSupported);
|
|
120
|
+
setSupportedUrlsMap(newMap);
|
|
121
|
+
case 27:
|
|
122
|
+
case "end":
|
|
123
|
+
return _context2.stop();
|
|
124
|
+
}
|
|
125
|
+
}, _callee2, null, [[3, 21]]);
|
|
126
|
+
}));
|
|
127
|
+
return function resolveUrl(_x) {
|
|
128
|
+
return _ref2.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}();
|
|
131
|
+
useEffect(function () {
|
|
132
|
+
resolveUrl(url);
|
|
133
|
+
// before migrating from a class to a functional component, we were only reacting to changes in the url
|
|
134
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
|
+
}, [url, (_props$cardOptions3 = props.cardOptions) === null || _props$cardOptions3 === void 0 ? void 0 : _props$cardOptions3.provider, props.editorPluginApi]);
|
|
136
|
+
if (!supportedUrlsMap.get(url)) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
return /*#__PURE__*/React.createElement(Flex, null, !fg('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') && /*#__PURE__*/React.createElement(EditDatasourceButton, {
|
|
140
|
+
url: url,
|
|
141
|
+
intl: intl,
|
|
142
|
+
editorView: editorView,
|
|
143
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
144
|
+
currentAppearance: "url"
|
|
145
|
+
}), /*#__PURE__*/React.createElement(LinkToolbarAppearance, {
|
|
146
|
+
key: "link-appearance",
|
|
147
|
+
url: url,
|
|
148
|
+
intl: intl,
|
|
149
|
+
editorView: editorView,
|
|
150
|
+
editorState: editorState,
|
|
151
|
+
allowEmbeds: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowEmbeds,
|
|
152
|
+
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
153
|
+
platform: platform,
|
|
154
|
+
editorAnalyticsApi: editorAnalyticsApi
|
|
155
|
+
}), (cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowDatasource) && fg('platform.linking-platform.enable-datasource-appearance-toolbar') && /*#__PURE__*/React.createElement(DatasourceAppearanceButton, {
|
|
156
|
+
intl: intl,
|
|
157
|
+
url: url,
|
|
158
|
+
editorState: editorState,
|
|
159
|
+
editorView: editorView,
|
|
160
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
161
|
+
inputMethod: INPUT_METHOD.FLOATING_TB
|
|
162
|
+
}), /*#__PURE__*/React.createElement(Separator, null));
|
|
163
|
+
}
|
|
164
|
+
|
|
20
165
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
21
|
-
|
|
22
|
-
_inherits(
|
|
23
|
-
var _super = _createSuper(
|
|
24
|
-
function
|
|
166
|
+
var HyperlinkToolbarAppearanceClass = /*#__PURE__*/function (_Component) {
|
|
167
|
+
_inherits(HyperlinkToolbarAppearanceClass, _Component);
|
|
168
|
+
var _super = _createSuper(HyperlinkToolbarAppearanceClass);
|
|
169
|
+
function HyperlinkToolbarAppearanceClass() {
|
|
25
170
|
var _this;
|
|
26
|
-
_classCallCheck(this,
|
|
171
|
+
_classCallCheck(this, HyperlinkToolbarAppearanceClass);
|
|
27
172
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
173
|
args[_key] = arguments[_key];
|
|
29
174
|
}
|
|
@@ -31,105 +176,97 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
31
176
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
32
177
|
supportedUrlsMap: new Map()
|
|
33
178
|
});
|
|
34
|
-
_defineProperty(_assertThisInitialized(_this), "getProvider", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
38
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
179
|
+
_defineProperty(_assertThisInitialized(_this), "getProvider", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
180
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
181
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
39
182
|
case 0:
|
|
40
|
-
if (!((_this$props$cardOptio = _this.props.cardOptions) !== null && _this$props$cardOptio !== void 0 && _this$props$cardOptio.provider && fg('platform_editor_get_card_provider_from_config'))) {
|
|
41
|
-
_context2.next = 2;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
return _context2.abrupt("return", (_this$props$cardOptio2 = _this.props.cardOptions) === null || _this$props$cardOptio2 === void 0 ? void 0 : _this$props$cardOptio2.provider);
|
|
45
|
-
case 2:
|
|
46
183
|
if (!_this.cardProvider) {
|
|
47
|
-
|
|
184
|
+
_context4.next = 2;
|
|
48
185
|
break;
|
|
49
186
|
}
|
|
50
|
-
return
|
|
51
|
-
case
|
|
52
|
-
return
|
|
187
|
+
return _context4.abrupt("return", _this.cardProvider);
|
|
188
|
+
case 2:
|
|
189
|
+
return _context4.abrupt("return", new Promise(function (resolve) {
|
|
53
190
|
var providerFactory = _this.props.providerFactory;
|
|
54
191
|
providerFactory.subscribe('cardProvider', /*#__PURE__*/function () {
|
|
55
|
-
var
|
|
56
|
-
return _regeneratorRuntime.wrap(function
|
|
57
|
-
while (1) switch (
|
|
192
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_, cardProvider) {
|
|
193
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
194
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
58
195
|
case 0:
|
|
59
196
|
if (cardProvider) {
|
|
60
|
-
|
|
197
|
+
_context3.next = 2;
|
|
61
198
|
break;
|
|
62
199
|
}
|
|
63
|
-
return
|
|
200
|
+
return _context3.abrupt("return");
|
|
64
201
|
case 2:
|
|
65
|
-
|
|
202
|
+
_context3.next = 4;
|
|
66
203
|
return cardProvider;
|
|
67
204
|
case 4:
|
|
68
|
-
_this.cardProvider =
|
|
205
|
+
_this.cardProvider = _context3.sent;
|
|
69
206
|
resolve(_this.cardProvider);
|
|
70
207
|
case 6:
|
|
71
208
|
case "end":
|
|
72
|
-
return
|
|
209
|
+
return _context3.stop();
|
|
73
210
|
}
|
|
74
|
-
},
|
|
211
|
+
}, _callee3);
|
|
75
212
|
}));
|
|
76
|
-
return function (
|
|
77
|
-
return
|
|
213
|
+
return function (_x2, _x3) {
|
|
214
|
+
return _ref4.apply(this, arguments);
|
|
78
215
|
};
|
|
79
216
|
}());
|
|
80
217
|
}));
|
|
81
|
-
case
|
|
218
|
+
case 3:
|
|
82
219
|
case "end":
|
|
83
|
-
return
|
|
220
|
+
return _context4.stop();
|
|
84
221
|
}
|
|
85
|
-
},
|
|
222
|
+
}, _callee4);
|
|
86
223
|
})));
|
|
87
224
|
_defineProperty(_assertThisInitialized(_this), "resolveUrl", /*#__PURE__*/function () {
|
|
88
|
-
var
|
|
89
|
-
var supportedUrlsMap, isUrlSupported, _yield$provider$
|
|
90
|
-
return _regeneratorRuntime.wrap(function
|
|
91
|
-
while (1) switch (
|
|
225
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(url) {
|
|
226
|
+
var supportedUrlsMap, isUrlSupported, _yield$provider$findP2, provider, newMap;
|
|
227
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
228
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
92
229
|
case 0:
|
|
93
230
|
supportedUrlsMap = _this.state.supportedUrlsMap;
|
|
94
231
|
if (!supportedUrlsMap.has(url)) {
|
|
95
|
-
|
|
232
|
+
_context5.next = 3;
|
|
96
233
|
break;
|
|
97
234
|
}
|
|
98
|
-
return
|
|
235
|
+
return _context5.abrupt("return");
|
|
99
236
|
case 3:
|
|
100
237
|
isUrlSupported = false;
|
|
101
|
-
|
|
102
|
-
|
|
238
|
+
_context5.prev = 4;
|
|
239
|
+
_context5.next = 7;
|
|
103
240
|
return _this.getProvider();
|
|
104
241
|
case 7:
|
|
105
|
-
provider =
|
|
106
|
-
|
|
242
|
+
provider = _context5.sent;
|
|
243
|
+
_context5.next = 10;
|
|
107
244
|
return provider === null || provider === void 0 ? void 0 : provider.findPattern(url);
|
|
108
245
|
case 10:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (!
|
|
112
|
-
|
|
246
|
+
_context5.t1 = _yield$provider$findP2 = _context5.sent;
|
|
247
|
+
_context5.t0 = _context5.t1 !== null;
|
|
248
|
+
if (!_context5.t0) {
|
|
249
|
+
_context5.next = 14;
|
|
113
250
|
break;
|
|
114
251
|
}
|
|
115
|
-
|
|
252
|
+
_context5.t0 = _yield$provider$findP2 !== void 0;
|
|
116
253
|
case 14:
|
|
117
|
-
if (!
|
|
118
|
-
|
|
254
|
+
if (!_context5.t0) {
|
|
255
|
+
_context5.next = 18;
|
|
119
256
|
break;
|
|
120
257
|
}
|
|
121
|
-
|
|
122
|
-
|
|
258
|
+
_context5.t2 = _yield$provider$findP2;
|
|
259
|
+
_context5.next = 19;
|
|
123
260
|
break;
|
|
124
261
|
case 18:
|
|
125
|
-
|
|
262
|
+
_context5.t2 = false;
|
|
126
263
|
case 19:
|
|
127
|
-
isUrlSupported =
|
|
128
|
-
|
|
264
|
+
isUrlSupported = _context5.t2;
|
|
265
|
+
_context5.next = 25;
|
|
129
266
|
break;
|
|
130
267
|
case 22:
|
|
131
|
-
|
|
132
|
-
|
|
268
|
+
_context5.prev = 22;
|
|
269
|
+
_context5.t3 = _context5["catch"](4);
|
|
133
270
|
isUrlSupported = false;
|
|
134
271
|
case 25:
|
|
135
272
|
newMap = new Map(supportedUrlsMap);
|
|
@@ -139,12 +276,12 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
139
276
|
});
|
|
140
277
|
case 28:
|
|
141
278
|
case "end":
|
|
142
|
-
return
|
|
279
|
+
return _context5.stop();
|
|
143
280
|
}
|
|
144
|
-
},
|
|
281
|
+
}, _callee5, null, [[4, 22]]);
|
|
145
282
|
}));
|
|
146
|
-
return function (
|
|
147
|
-
return
|
|
283
|
+
return function (_x4) {
|
|
284
|
+
return _ref5.apply(this, arguments);
|
|
148
285
|
};
|
|
149
286
|
}());
|
|
150
287
|
_defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
|
|
@@ -152,7 +289,7 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
152
289
|
});
|
|
153
290
|
return _this;
|
|
154
291
|
}
|
|
155
|
-
_createClass(
|
|
292
|
+
_createClass(HyperlinkToolbarAppearanceClass, [{
|
|
156
293
|
key: "UNSAFE_componentWillReceiveProps",
|
|
157
294
|
value:
|
|
158
295
|
// needed so we display the right state on the Toolbar while the same Toolbar
|
|
@@ -177,7 +314,7 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
177
314
|
if (!supportedUrlsMap.get(url)) {
|
|
178
315
|
return null;
|
|
179
316
|
}
|
|
180
|
-
return /*#__PURE__*/React.createElement(Flex, null, !
|
|
317
|
+
return /*#__PURE__*/React.createElement(Flex, null, !fg('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') && /*#__PURE__*/React.createElement(EditDatasourceButton, {
|
|
181
318
|
url: url,
|
|
182
319
|
intl: intl,
|
|
183
320
|
editorView: editorView,
|
|
@@ -193,7 +330,7 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
193
330
|
allowBlockCards: cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowBlockCards,
|
|
194
331
|
platform: platform,
|
|
195
332
|
editorAnalyticsApi: editorAnalyticsApi
|
|
196
|
-
}),
|
|
333
|
+
}), (cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowDatasource) && fg('platform.linking-platform.enable-datasource-appearance-toolbar') && /*#__PURE__*/React.createElement(DatasourceAppearanceButton, {
|
|
197
334
|
intl: intl,
|
|
198
335
|
url: url,
|
|
199
336
|
editorState: editorState,
|
|
@@ -203,5 +340,11 @@ export var HyperlinkToolbarAppearance = /*#__PURE__*/function (_Component) {
|
|
|
203
340
|
}), /*#__PURE__*/React.createElement(Separator, null));
|
|
204
341
|
}
|
|
205
342
|
}]);
|
|
206
|
-
return
|
|
207
|
-
}(Component);
|
|
343
|
+
return HyperlinkToolbarAppearanceClass;
|
|
344
|
+
}(Component);
|
|
345
|
+
export var HyperlinkToolbarAppearance = function HyperlinkToolbarAppearance(props) {
|
|
346
|
+
if (fg('platform_editor_get_card_provider_from_config')) {
|
|
347
|
+
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearanceFunctional, props);
|
|
348
|
+
}
|
|
349
|
+
return /*#__PURE__*/React.createElement(HyperlinkToolbarAppearanceClass, props);
|
|
350
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useEffect } from 'react';
|
|
2
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
2
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
3
3
|
import { Pulse } from '@atlaskit/linking-common';
|
|
4
4
|
import { isLocalStorageKeyDiscovered, markLocalStorageKeyDiscovered } from '../../common/local-storage';
|
|
5
5
|
export var DiscoveryPulse = function DiscoveryPulse(_ref) {
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
5
|
+
import { useAnalyticsEvents } from '@atlaskit/analytics-next/useAnalyticsEvents';
|
|
6
6
|
import { getResolvedAttributesFromStore } from '../utils';
|
|
7
7
|
import { CardContextProvider } from './CardContextProvider';
|
|
8
8
|
import { EditorAnalyticsContext } from './EditorAnalyticsContext';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
9
|
import type { CardPlatform } from '@atlaskit/smart-card';
|
|
10
|
+
import { type CardPlugin } from '../plugin';
|
|
9
11
|
export interface HyperlinkToolbarAppearanceProps {
|
|
10
12
|
intl: IntlShape;
|
|
11
13
|
editorState: EditorState;
|
|
@@ -15,16 +17,9 @@ export interface HyperlinkToolbarAppearanceProps {
|
|
|
15
17
|
platform?: CardPlatform;
|
|
16
18
|
cardOptions?: CardOptions;
|
|
17
19
|
editorAnalyticsApi: EditorAnalyticsAPI | undefined;
|
|
20
|
+
editorPluginApi: ExtractInjectionAPI<CardPlugin> | undefined;
|
|
18
21
|
}
|
|
19
22
|
export interface HyperlinkToolbarAppearanceState {
|
|
20
23
|
supportedUrlsMap: Map<string, boolean>;
|
|
21
24
|
}
|
|
22
|
-
export declare
|
|
23
|
-
state: HyperlinkToolbarAppearanceState;
|
|
24
|
-
cardProvider?: CardProvider;
|
|
25
|
-
private getProvider;
|
|
26
|
-
private resolveUrl;
|
|
27
|
-
componentDidMount: () => Promise<void>;
|
|
28
|
-
UNSAFE_componentWillReceiveProps(nextProps: HyperlinkToolbarAppearanceProps): void;
|
|
29
|
-
render(): JSX.Element | null;
|
|
30
|
-
}
|
|
25
|
+
export declare const HyperlinkToolbarAppearance: (props: HyperlinkToolbarAppearanceProps) => JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import type { IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
9
|
import type { CardPlatform } from '@atlaskit/smart-card';
|
|
10
|
+
import { type CardPlugin } from '../plugin';
|
|
9
11
|
export interface HyperlinkToolbarAppearanceProps {
|
|
10
12
|
intl: IntlShape;
|
|
11
13
|
editorState: EditorState;
|
|
@@ -15,16 +17,9 @@ export interface HyperlinkToolbarAppearanceProps {
|
|
|
15
17
|
platform?: CardPlatform;
|
|
16
18
|
cardOptions?: CardOptions;
|
|
17
19
|
editorAnalyticsApi: EditorAnalyticsAPI | undefined;
|
|
20
|
+
editorPluginApi: ExtractInjectionAPI<CardPlugin> | undefined;
|
|
18
21
|
}
|
|
19
22
|
export interface HyperlinkToolbarAppearanceState {
|
|
20
23
|
supportedUrlsMap: Map<string, boolean>;
|
|
21
24
|
}
|
|
22
|
-
export declare
|
|
23
|
-
state: HyperlinkToolbarAppearanceState;
|
|
24
|
-
cardProvider?: CardProvider;
|
|
25
|
-
private getProvider;
|
|
26
|
-
private resolveUrl;
|
|
27
|
-
componentDidMount: () => Promise<void>;
|
|
28
|
-
UNSAFE_componentWillReceiveProps(nextProps: HyperlinkToolbarAppearanceProps): void;
|
|
29
|
-
render(): JSX.Element | null;
|
|
30
|
-
}
|
|
25
|
+
export declare const HyperlinkToolbarAppearance: (props: HyperlinkToolbarAppearanceProps) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"atlassian": {
|
|
11
11
|
"team": "Linking Platform",
|
|
12
12
|
"singleton": true,
|
|
13
|
-
"releaseModel": "continuous",
|
|
14
13
|
"runReact18": true
|
|
15
14
|
},
|
|
16
15
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
@@ -35,7 +34,7 @@
|
|
|
35
34
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
36
35
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
37
36
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
38
|
-
"@atlaskit/editor-common": "^88.
|
|
37
|
+
"@atlaskit/editor-common": "^88.8.0",
|
|
39
38
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
40
39
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
41
40
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
@@ -49,13 +48,13 @@
|
|
|
49
48
|
"@atlaskit/frontend-utilities": "^2.7.0",
|
|
50
49
|
"@atlaskit/icon": "^22.15.0",
|
|
51
50
|
"@atlaskit/link-analytics": "^8.5.0",
|
|
52
|
-
"@atlaskit/link-client-extension": "^2.
|
|
51
|
+
"@atlaskit/link-client-extension": "^2.3.0",
|
|
53
52
|
"@atlaskit/link-datasource": "^2.11.0",
|
|
54
53
|
"@atlaskit/linking-common": "^5.11.0",
|
|
55
54
|
"@atlaskit/linking-types": "^9.0.0",
|
|
56
55
|
"@atlaskit/menu": "2.12.2",
|
|
57
56
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
58
|
-
"@atlaskit/primitives": "^12.
|
|
57
|
+
"@atlaskit/primitives": "^12.1.0",
|
|
59
58
|
"@atlaskit/smart-card": "^27.19.0",
|
|
60
59
|
"@atlaskit/theme": "^13.0.0",
|
|
61
60
|
"@atlaskit/tokens": "^1.59.0",
|