@atlaskit/editor-plugin-card 16.10.1 → 16.10.3
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 +12 -0
- package/dist/cjs/cardPlugin.js +31 -31
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +37 -37
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +37 -37
- package/dist/cjs/ui/useFetchDatasourceDataInfo.js +13 -13
- package/dist/cjs/ui/useFetchDatasourceInfo.js +12 -12
- package/dist/esm/cardPlugin.js +31 -31
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +36 -36
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +36 -36
- package/dist/esm/ui/useFetchDatasourceDataInfo.js +13 -13
- package/dist/esm/ui/useFetchDatasourceInfo.js +12 -12
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
package/dist/cjs/cardPlugin.js
CHANGED
|
@@ -164,25 +164,25 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
164
164
|
var _setProvider2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
|
|
165
165
|
var _api$core$actions$exe;
|
|
166
166
|
var provider;
|
|
167
|
-
return _regenerator.default.wrap(function
|
|
167
|
+
return _regenerator.default.wrap(function (_context) {
|
|
168
168
|
while (1) switch (_context.prev = _context.next) {
|
|
169
169
|
case 0:
|
|
170
|
-
_context.next =
|
|
170
|
+
_context.next = 1;
|
|
171
171
|
return providerPromise;
|
|
172
|
-
case
|
|
172
|
+
case 1:
|
|
173
173
|
provider = _context.sent;
|
|
174
174
|
if (!(previousCardProvider === provider || (options === null || options === void 0 ? void 0 : options.provider) === providerPromise)) {
|
|
175
|
-
_context.next =
|
|
175
|
+
_context.next = 2;
|
|
176
176
|
break;
|
|
177
177
|
}
|
|
178
178
|
return _context.abrupt("return", false);
|
|
179
|
-
case
|
|
179
|
+
case 2:
|
|
180
180
|
previousCardProvider = provider;
|
|
181
181
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref6) {
|
|
182
182
|
var tr = _ref6.tr;
|
|
183
183
|
return (0, _actions.setProvider)(provider)(tr);
|
|
184
184
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
185
|
-
case
|
|
185
|
+
case 3:
|
|
186
186
|
case "end":
|
|
187
187
|
return _context.stop();
|
|
188
188
|
}
|
|
@@ -201,20 +201,20 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
201
201
|
},
|
|
202
202
|
resolveShortLinkUrl: function () {
|
|
203
203
|
var _resolveShortLinkUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
|
|
204
|
-
var provider, clientHolder, client, response, data, urlField, _linkObj$Id, linkObj, id;
|
|
205
|
-
return _regenerator.default.wrap(function
|
|
204
|
+
var provider, clientHolder, client, response, data, urlField, _linkObj$Id, linkObj, id, _t;
|
|
205
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
206
206
|
while (1) switch (_context2.prev = _context2.next) {
|
|
207
207
|
case 0:
|
|
208
208
|
if (options.provider) {
|
|
209
|
-
_context2.next =
|
|
209
|
+
_context2.next = 1;
|
|
210
210
|
break;
|
|
211
211
|
}
|
|
212
212
|
return _context2.abrupt("return", undefined);
|
|
213
|
-
case
|
|
214
|
-
_context2.prev =
|
|
215
|
-
_context2.next =
|
|
213
|
+
case 1:
|
|
214
|
+
_context2.prev = 1;
|
|
215
|
+
_context2.next = 2;
|
|
216
216
|
return options.provider;
|
|
217
|
-
case
|
|
217
|
+
case 2:
|
|
218
218
|
provider = _context2.sent;
|
|
219
219
|
// EditorCardProvider holds a CardClient instance internally. We access it
|
|
220
220
|
// directly to call fetchData, which gives us the raw ORS JSON-LD response
|
|
@@ -224,14 +224,14 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
224
224
|
clientHolder = provider;
|
|
225
225
|
client = clientHolder.cardClient;
|
|
226
226
|
if (client) {
|
|
227
|
-
_context2.next =
|
|
227
|
+
_context2.next = 3;
|
|
228
228
|
break;
|
|
229
229
|
}
|
|
230
230
|
return _context2.abrupt("return", undefined);
|
|
231
|
-
case
|
|
232
|
-
_context2.next =
|
|
231
|
+
case 3:
|
|
232
|
+
_context2.next = 4;
|
|
233
233
|
return client.fetchData(url);
|
|
234
|
-
case
|
|
234
|
+
case 4:
|
|
235
235
|
response = _context2.sent;
|
|
236
236
|
// ORS returns a JsonLd.Response whose data union includes BaseData,
|
|
237
237
|
// BaseCollectionData, and BaseCollectionPage. We only care about the
|
|
@@ -239,43 +239,43 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
239
239
|
// to a minimal shape rather than accessing through the full union type.
|
|
240
240
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
241
241
|
if (data) {
|
|
242
|
-
_context2.next =
|
|
242
|
+
_context2.next = 5;
|
|
243
243
|
break;
|
|
244
244
|
}
|
|
245
245
|
return _context2.abrupt("return", undefined);
|
|
246
|
-
case
|
|
246
|
+
case 5:
|
|
247
247
|
urlField = data.url; // Property<string | Link> can be a string, a Link object, or an array.
|
|
248
248
|
// Short-link responses always return a plain string URL.
|
|
249
249
|
if (!(typeof urlField === 'string' && urlField !== url)) {
|
|
250
|
-
_context2.next =
|
|
250
|
+
_context2.next = 6;
|
|
251
251
|
break;
|
|
252
252
|
}
|
|
253
253
|
return _context2.abrupt("return", urlField);
|
|
254
|
-
case
|
|
254
|
+
case 6:
|
|
255
255
|
if (!(urlField && (0, _typeof2.default)(urlField) === 'object' && !Array.isArray(urlField))) {
|
|
256
|
-
_context2.next =
|
|
256
|
+
_context2.next = 7;
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
259
|
linkObj = urlField;
|
|
260
260
|
id = (_linkObj$Id = linkObj['@id']) !== null && _linkObj$Id !== void 0 ? _linkObj$Id : linkObj['href'];
|
|
261
261
|
if (!(typeof id === 'string' && id !== url)) {
|
|
262
|
-
_context2.next =
|
|
262
|
+
_context2.next = 7;
|
|
263
263
|
break;
|
|
264
264
|
}
|
|
265
265
|
return _context2.abrupt("return", id);
|
|
266
|
-
case
|
|
267
|
-
_context2.next =
|
|
266
|
+
case 7:
|
|
267
|
+
_context2.next = 9;
|
|
268
268
|
break;
|
|
269
|
-
case
|
|
270
|
-
_context2.prev =
|
|
271
|
-
|
|
272
|
-
case
|
|
269
|
+
case 8:
|
|
270
|
+
_context2.prev = 8;
|
|
271
|
+
_t = _context2["catch"](1);
|
|
272
|
+
case 9:
|
|
273
273
|
return _context2.abrupt("return", undefined);
|
|
274
|
-
case
|
|
274
|
+
case 10:
|
|
275
275
|
case "end":
|
|
276
276
|
return _context2.stop();
|
|
277
277
|
}
|
|
278
|
-
}, _callee2, null, [[
|
|
278
|
+
}, _callee2, null, [[1, 8]]);
|
|
279
279
|
}));
|
|
280
280
|
function resolveShortLinkUrl(_x2) {
|
|
281
281
|
return _resolveShortLinkUrl.apply(this, arguments);
|
|
@@ -16,7 +16,7 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
16
16
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
17
|
var _DatasourceAppearanceButton = require("./DatasourceAppearanceButton");
|
|
18
18
|
var _LinkToolbarAppearance = require("./LinkToolbarAppearance");
|
|
19
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
|
|
20
20
|
function HyperlinkToolbarAppearance(props) {
|
|
21
21
|
var _props$cardOptions3, _props$editorPluginAp2;
|
|
22
22
|
var _useState = (0, _react.useState)(new Map()),
|
|
@@ -37,21 +37,21 @@ function HyperlinkToolbarAppearance(props) {
|
|
|
37
37
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
38
38
|
var _props$cardOptions;
|
|
39
39
|
var _props$cardOptions2;
|
|
40
|
-
return _regenerator.default.wrap(function
|
|
40
|
+
return _regenerator.default.wrap(function (_context) {
|
|
41
41
|
while (1) switch (_context.prev = _context.next) {
|
|
42
42
|
case 0:
|
|
43
43
|
if (!((_props$cardOptions = props.cardOptions) !== null && _props$cardOptions !== void 0 && _props$cardOptions.provider)) {
|
|
44
|
-
_context.next =
|
|
44
|
+
_context.next = 1;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
return _context.abrupt("return", (_props$cardOptions2 = props.cardOptions) === null || _props$cardOptions2 === void 0 ? void 0 : _props$cardOptions2.provider);
|
|
48
|
-
case
|
|
48
|
+
case 1:
|
|
49
49
|
if (!cardProvider.current) {
|
|
50
|
-
_context.next =
|
|
50
|
+
_context.next = 2;
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
return _context.abrupt("return", cardProvider.current);
|
|
54
|
-
case
|
|
54
|
+
case 2:
|
|
55
55
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
56
56
|
var _props$editorPluginAp;
|
|
57
57
|
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;
|
|
@@ -59,7 +59,7 @@ function HyperlinkToolbarAppearance(props) {
|
|
|
59
59
|
resolve(cardProvider);
|
|
60
60
|
}
|
|
61
61
|
}));
|
|
62
|
-
case
|
|
62
|
+
case 3:
|
|
63
63
|
case "end":
|
|
64
64
|
return _context.stop();
|
|
65
65
|
}
|
|
@@ -71,59 +71,59 @@ function HyperlinkToolbarAppearance(props) {
|
|
|
71
71
|
}();
|
|
72
72
|
var resolveUrl = /*#__PURE__*/function () {
|
|
73
73
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
|
|
74
|
-
var isUrlSupported, _yield$provider$findP, provider, newMap;
|
|
75
|
-
return _regenerator.default.wrap(function
|
|
74
|
+
var isUrlSupported, _yield$provider$findP, provider, newMap, _t, _t2, _t3, _t4;
|
|
75
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
76
76
|
while (1) switch (_context2.prev = _context2.next) {
|
|
77
77
|
case 0:
|
|
78
78
|
if (!supportedUrlsMap.has(url)) {
|
|
79
|
-
_context2.next =
|
|
79
|
+
_context2.next = 1;
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
return _context2.abrupt("return");
|
|
83
|
-
case
|
|
83
|
+
case 1:
|
|
84
84
|
isUrlSupported = false;
|
|
85
|
-
_context2.prev =
|
|
86
|
-
_context2.next =
|
|
85
|
+
_context2.prev = 2;
|
|
86
|
+
_context2.next = 3;
|
|
87
87
|
return getProvider();
|
|
88
|
-
case
|
|
88
|
+
case 3:
|
|
89
89
|
provider = _context2.sent;
|
|
90
|
-
_context2.next =
|
|
90
|
+
_context2.next = 4;
|
|
91
91
|
return provider === null || provider === void 0 ? void 0 : provider.findPattern(url);
|
|
92
|
-
case
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!
|
|
96
|
-
_context2.next =
|
|
92
|
+
case 4:
|
|
93
|
+
_t2 = _yield$provider$findP = _context2.sent;
|
|
94
|
+
_t = _t2 !== null;
|
|
95
|
+
if (!_t) {
|
|
96
|
+
_context2.next = 5;
|
|
97
97
|
break;
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
case
|
|
101
|
-
if (!
|
|
102
|
-
_context2.next =
|
|
99
|
+
_t = _yield$provider$findP !== void 0;
|
|
100
|
+
case 5:
|
|
101
|
+
if (!_t) {
|
|
102
|
+
_context2.next = 6;
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
_context2.next =
|
|
105
|
+
_t3 = _yield$provider$findP;
|
|
106
|
+
_context2.next = 7;
|
|
107
107
|
break;
|
|
108
|
-
case
|
|
109
|
-
|
|
110
|
-
case
|
|
111
|
-
isUrlSupported =
|
|
112
|
-
_context2.next =
|
|
108
|
+
case 6:
|
|
109
|
+
_t3 = false;
|
|
110
|
+
case 7:
|
|
111
|
+
isUrlSupported = _t3;
|
|
112
|
+
_context2.next = 9;
|
|
113
113
|
break;
|
|
114
|
-
case
|
|
115
|
-
_context2.prev =
|
|
116
|
-
|
|
114
|
+
case 8:
|
|
115
|
+
_context2.prev = 8;
|
|
116
|
+
_t4 = _context2["catch"](2);
|
|
117
117
|
isUrlSupported = false;
|
|
118
|
-
case
|
|
118
|
+
case 9:
|
|
119
119
|
newMap = new Map(supportedUrlsMap);
|
|
120
120
|
newMap.set(url, isUrlSupported);
|
|
121
121
|
setSupportedUrlsMap(newMap);
|
|
122
|
-
case
|
|
122
|
+
case 10:
|
|
123
123
|
case "end":
|
|
124
124
|
return _context2.stop();
|
|
125
125
|
}
|
|
126
|
-
}, _callee2, null, [[
|
|
126
|
+
}, _callee2, null, [[2, 8]]);
|
|
127
127
|
}));
|
|
128
128
|
return function resolveUrl(_x) {
|
|
129
129
|
return _ref2.apply(this, arguments);
|
|
@@ -17,7 +17,7 @@ var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
|
17
17
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
18
18
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
19
19
|
var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
|
|
20
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t5 in e) "default" !== _t5 && {}.hasOwnProperty.call(e, _t5) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t5)) && (i.get || i.set) ? o(f, _t5, i) : f[_t5] = e[_t5]); return f; })(e, t); }
|
|
21
21
|
var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
22
22
|
var _props$editorPluginAp, _props$cardOptions3, _props$editorPluginAp3, _props$editorPluginAp4;
|
|
23
23
|
var _useState = (0, _react.useState)(new Map()),
|
|
@@ -45,21 +45,21 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
45
45
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
46
46
|
var _props$cardOptions;
|
|
47
47
|
var _props$cardOptions2;
|
|
48
|
-
return _regenerator.default.wrap(function
|
|
48
|
+
return _regenerator.default.wrap(function (_context) {
|
|
49
49
|
while (1) switch (_context.prev = _context.next) {
|
|
50
50
|
case 0:
|
|
51
51
|
if (!((_props$cardOptions = props.cardOptions) !== null && _props$cardOptions !== void 0 && _props$cardOptions.provider)) {
|
|
52
|
-
_context.next =
|
|
52
|
+
_context.next = 1;
|
|
53
53
|
break;
|
|
54
54
|
}
|
|
55
55
|
return _context.abrupt("return", (_props$cardOptions2 = props.cardOptions) === null || _props$cardOptions2 === void 0 ? void 0 : _props$cardOptions2.provider);
|
|
56
|
-
case
|
|
56
|
+
case 1:
|
|
57
57
|
if (!cardProvider.current) {
|
|
58
|
-
_context.next =
|
|
58
|
+
_context.next = 2;
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
return _context.abrupt("return", cardProvider.current);
|
|
62
|
-
case
|
|
62
|
+
case 2:
|
|
63
63
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
64
64
|
var _props$editorPluginAp2;
|
|
65
65
|
var cardProvider = (_props$editorPluginAp2 = props.editorPluginApi) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.card) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.sharedState) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.currentState()) === null || _props$editorPluginAp2 === void 0 ? void 0 : _props$editorPluginAp2.provider;
|
|
@@ -67,7 +67,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
67
67
|
resolve(cardProvider);
|
|
68
68
|
}
|
|
69
69
|
}));
|
|
70
|
-
case
|
|
70
|
+
case 3:
|
|
71
71
|
case "end":
|
|
72
72
|
return _context.stop();
|
|
73
73
|
}
|
|
@@ -79,60 +79,60 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
79
79
|
}();
|
|
80
80
|
var resolveUrl = /*#__PURE__*/function () {
|
|
81
81
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url) {
|
|
82
|
-
var isUrlSupported, _yield$provider$findP, provider, newMap;
|
|
83
|
-
return _regenerator.default.wrap(function
|
|
82
|
+
var isUrlSupported, _yield$provider$findP, provider, newMap, _t, _t2, _t3, _t4;
|
|
83
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
84
84
|
while (1) switch (_context2.prev = _context2.next) {
|
|
85
85
|
case 0:
|
|
86
86
|
if (!supportedUrlsMap.has(url)) {
|
|
87
|
-
_context2.next =
|
|
87
|
+
_context2.next = 1;
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
return _context2.abrupt("return");
|
|
91
|
-
case
|
|
91
|
+
case 1:
|
|
92
92
|
isUrlSupported = false;
|
|
93
|
-
_context2.prev =
|
|
94
|
-
_context2.next =
|
|
93
|
+
_context2.prev = 2;
|
|
94
|
+
_context2.next = 3;
|
|
95
95
|
return getProvider();
|
|
96
|
-
case
|
|
96
|
+
case 3:
|
|
97
97
|
provider = _context2.sent;
|
|
98
|
-
_context2.next =
|
|
98
|
+
_context2.next = 4;
|
|
99
99
|
return provider === null || provider === void 0 ? void 0 : provider.findPattern(url);
|
|
100
|
-
case
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (!
|
|
104
|
-
_context2.next =
|
|
100
|
+
case 4:
|
|
101
|
+
_t2 = _yield$provider$findP = _context2.sent;
|
|
102
|
+
_t = _t2 !== null;
|
|
103
|
+
if (!_t) {
|
|
104
|
+
_context2.next = 5;
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
case
|
|
109
|
-
if (!
|
|
110
|
-
_context2.next =
|
|
107
|
+
_t = _yield$provider$findP !== void 0;
|
|
108
|
+
case 5:
|
|
109
|
+
if (!_t) {
|
|
110
|
+
_context2.next = 6;
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
_context2.next =
|
|
113
|
+
_t3 = _yield$provider$findP;
|
|
114
|
+
_context2.next = 7;
|
|
115
115
|
break;
|
|
116
|
-
case
|
|
117
|
-
|
|
118
|
-
case
|
|
119
|
-
isUrlSupported =
|
|
120
|
-
_context2.next =
|
|
116
|
+
case 6:
|
|
117
|
+
_t3 = false;
|
|
118
|
+
case 7:
|
|
119
|
+
isUrlSupported = _t3;
|
|
120
|
+
_context2.next = 9;
|
|
121
121
|
break;
|
|
122
|
-
case
|
|
123
|
-
_context2.prev =
|
|
124
|
-
|
|
122
|
+
case 8:
|
|
123
|
+
_context2.prev = 8;
|
|
124
|
+
_t4 = _context2["catch"](2);
|
|
125
125
|
// eslint-disable-line no-unused-vars
|
|
126
126
|
isUrlSupported = false;
|
|
127
|
-
case
|
|
127
|
+
case 9:
|
|
128
128
|
newMap = new Map(supportedUrlsMap);
|
|
129
129
|
newMap.set(url, isUrlSupported);
|
|
130
130
|
setSupportedUrlsMap(newMap);
|
|
131
|
-
case
|
|
131
|
+
case 10:
|
|
132
132
|
case "end":
|
|
133
133
|
return _context2.stop();
|
|
134
134
|
}
|
|
135
|
-
}, _callee2, null, [[
|
|
135
|
+
}, _callee2, null, [[2, 8]]);
|
|
136
136
|
}));
|
|
137
137
|
return function resolveUrl(_x) {
|
|
138
138
|
return _ref2.apply(this, arguments);
|
|
@@ -28,17 +28,17 @@ var useFetchDatasourceDataInfo = exports.useFetchDatasourceDataInfo = function u
|
|
|
28
28
|
(0, _react.useEffect)(function () {
|
|
29
29
|
var fetchDatasource = /*#__PURE__*/function () {
|
|
30
30
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
31
|
-
var datasourceDataRequest, _yield$getDatasourceD, meta;
|
|
32
|
-
return _regenerator.default.wrap(function
|
|
31
|
+
var datasourceDataRequest, _yield$getDatasourceD, meta, _t;
|
|
32
|
+
return _regenerator.default.wrap(function (_context) {
|
|
33
33
|
while (1) switch (_context.prev = _context.next) {
|
|
34
34
|
case 0:
|
|
35
35
|
_context.prev = 0;
|
|
36
36
|
if (!(!datasourceId || !parameters || !visibleColumnKeys)) {
|
|
37
|
-
_context.next =
|
|
37
|
+
_context.next = 1;
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
40
40
|
return _context.abrupt("return");
|
|
41
|
-
case
|
|
41
|
+
case 1:
|
|
42
42
|
datasourceDataRequest = {
|
|
43
43
|
parameters: parameters,
|
|
44
44
|
pageSize: _linkClientExtension.DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE,
|
|
@@ -46,25 +46,25 @@ var useFetchDatasourceDataInfo = exports.useFetchDatasourceDataInfo = function u
|
|
|
46
46
|
fields: visibleColumnKeys,
|
|
47
47
|
includeSchema: true
|
|
48
48
|
};
|
|
49
|
-
_context.next =
|
|
49
|
+
_context.next = 2;
|
|
50
50
|
return getDatasourceData(datasourceId, datasourceDataRequest, false);
|
|
51
|
-
case
|
|
51
|
+
case 2:
|
|
52
52
|
_yield$getDatasourceD = _context.sent;
|
|
53
53
|
meta = _yield$getDatasourceD.meta;
|
|
54
54
|
setExtensionKey(meta.extensionKey);
|
|
55
|
-
_context.next =
|
|
55
|
+
_context.next = 4;
|
|
56
56
|
break;
|
|
57
|
-
case
|
|
58
|
-
_context.prev =
|
|
59
|
-
|
|
57
|
+
case 3:
|
|
58
|
+
_context.prev = 3;
|
|
59
|
+
_t = _context["catch"](0);
|
|
60
60
|
// eslint-disable-next-line no-console
|
|
61
|
-
console.error(
|
|
61
|
+
console.error(_t);
|
|
62
62
|
setExtensionKey(undefined);
|
|
63
|
-
case
|
|
63
|
+
case 4:
|
|
64
64
|
case "end":
|
|
65
65
|
return _context.stop();
|
|
66
66
|
}
|
|
67
|
-
}, _callee, null, [[0,
|
|
67
|
+
}, _callee, null, [[0, 3]]);
|
|
68
68
|
}));
|
|
69
69
|
return function fetchDatasource() {
|
|
70
70
|
return _ref2.apply(this, arguments);
|
|
@@ -40,44 +40,44 @@ var useFetchDatasourceInfo = exports.useFetchDatasourceInfo = function useFetchD
|
|
|
40
40
|
(0, _react.useEffect)(function () {
|
|
41
41
|
var fetchDatasource = /*#__PURE__*/function () {
|
|
42
42
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
43
|
-
var _cardContext$connecti, _datasources$, _datasources$2, response, datasources;
|
|
44
|
-
return _regenerator.default.wrap(function
|
|
43
|
+
var _cardContext$connecti, _datasources$, _datasources$2, response, datasources, _t;
|
|
44
|
+
return _regenerator.default.wrap(function (_context) {
|
|
45
45
|
while (1) switch (_context.prev = _context.next) {
|
|
46
46
|
case 0:
|
|
47
47
|
_context.prev = 0;
|
|
48
48
|
if (!(!url || !cardContext)) {
|
|
49
|
-
_context.next =
|
|
49
|
+
_context.next = 1;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
// Don't block rendering of modal of somehow we don't get these two args --> just open with empty params
|
|
53
53
|
setReady(true);
|
|
54
54
|
return _context.abrupt("return");
|
|
55
|
-
case
|
|
56
|
-
_context.next =
|
|
55
|
+
case 1:
|
|
56
|
+
_context.next = 2;
|
|
57
57
|
return cardContext === null || cardContext === void 0 || (_cardContext$connecti = cardContext.connections) === null || _cardContext$connecti === void 0 || (_cardContext$connecti = _cardContext$connecti.client) === null || _cardContext$connecti === void 0 ? void 0 : _cardContext$connecti.fetchData(url);
|
|
58
|
-
case
|
|
58
|
+
case 2:
|
|
59
59
|
response = _context.sent;
|
|
60
60
|
datasources = response && response.datasources || [];
|
|
61
61
|
setExtensionKey(response === null || response === void 0 ? void 0 : response.meta.key);
|
|
62
62
|
setDatasourceId((_datasources$ = datasources[0]) === null || _datasources$ === void 0 ? void 0 : _datasources$.id);
|
|
63
63
|
setParameters((_datasources$2 = datasources[0]) === null || _datasources$2 === void 0 ? void 0 : _datasources$2.parameters);
|
|
64
64
|
setReady(true);
|
|
65
|
-
_context.next =
|
|
65
|
+
_context.next = 4;
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
68
|
-
_context.prev =
|
|
69
|
-
|
|
67
|
+
case 3:
|
|
68
|
+
_context.prev = 3;
|
|
69
|
+
_t = _context["catch"](0);
|
|
70
70
|
setDatasourceId(undefined);
|
|
71
71
|
setParameters(undefined);
|
|
72
72
|
setExtensionKey(undefined);
|
|
73
73
|
// If fetch somehow errors, still set ready as true so we don't block the rendering of the modal.
|
|
74
74
|
// It will just open with empty params.
|
|
75
75
|
setReady(true);
|
|
76
|
-
case
|
|
76
|
+
case 4:
|
|
77
77
|
case "end":
|
|
78
78
|
return _context.stop();
|
|
79
79
|
}
|
|
80
|
-
}, _callee, null, [[0,
|
|
80
|
+
}, _callee, null, [[0, 3]]);
|
|
81
81
|
}));
|
|
82
82
|
return function fetchDatasource() {
|
|
83
83
|
return _ref2.apply(this, arguments);
|
package/dist/esm/cardPlugin.js
CHANGED
|
@@ -158,25 +158,25 @@ export var cardPlugin = function cardPlugin(_ref) {
|
|
|
158
158
|
var _setProvider2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(providerPromise) {
|
|
159
159
|
var _api$core$actions$exe;
|
|
160
160
|
var provider;
|
|
161
|
-
return _regeneratorRuntime.wrap(function
|
|
161
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
162
162
|
while (1) switch (_context.prev = _context.next) {
|
|
163
163
|
case 0:
|
|
164
|
-
_context.next =
|
|
164
|
+
_context.next = 1;
|
|
165
165
|
return providerPromise;
|
|
166
|
-
case
|
|
166
|
+
case 1:
|
|
167
167
|
provider = _context.sent;
|
|
168
168
|
if (!(previousCardProvider === provider || (options === null || options === void 0 ? void 0 : options.provider) === providerPromise)) {
|
|
169
|
-
_context.next =
|
|
169
|
+
_context.next = 2;
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
return _context.abrupt("return", false);
|
|
173
|
-
case
|
|
173
|
+
case 2:
|
|
174
174
|
previousCardProvider = provider;
|
|
175
175
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref6) {
|
|
176
176
|
var tr = _ref6.tr;
|
|
177
177
|
return _setProvider(provider)(tr);
|
|
178
178
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
179
|
-
case
|
|
179
|
+
case 3:
|
|
180
180
|
case "end":
|
|
181
181
|
return _context.stop();
|
|
182
182
|
}
|
|
@@ -195,20 +195,20 @@ export var cardPlugin = function cardPlugin(_ref) {
|
|
|
195
195
|
},
|
|
196
196
|
resolveShortLinkUrl: function () {
|
|
197
197
|
var _resolveShortLinkUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
|
|
198
|
-
var provider, clientHolder, client, response, data, urlField, _linkObj$Id, linkObj, id;
|
|
199
|
-
return _regeneratorRuntime.wrap(function
|
|
198
|
+
var provider, clientHolder, client, response, data, urlField, _linkObj$Id, linkObj, id, _t;
|
|
199
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
200
200
|
while (1) switch (_context2.prev = _context2.next) {
|
|
201
201
|
case 0:
|
|
202
202
|
if (options.provider) {
|
|
203
|
-
_context2.next =
|
|
203
|
+
_context2.next = 1;
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
return _context2.abrupt("return", undefined);
|
|
207
|
-
case
|
|
208
|
-
_context2.prev =
|
|
209
|
-
_context2.next =
|
|
207
|
+
case 1:
|
|
208
|
+
_context2.prev = 1;
|
|
209
|
+
_context2.next = 2;
|
|
210
210
|
return options.provider;
|
|
211
|
-
case
|
|
211
|
+
case 2:
|
|
212
212
|
provider = _context2.sent;
|
|
213
213
|
// EditorCardProvider holds a CardClient instance internally. We access it
|
|
214
214
|
// directly to call fetchData, which gives us the raw ORS JSON-LD response
|
|
@@ -218,14 +218,14 @@ export var cardPlugin = function cardPlugin(_ref) {
|
|
|
218
218
|
clientHolder = provider;
|
|
219
219
|
client = clientHolder.cardClient;
|
|
220
220
|
if (client) {
|
|
221
|
-
_context2.next =
|
|
221
|
+
_context2.next = 3;
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
224
|
return _context2.abrupt("return", undefined);
|
|
225
|
-
case
|
|
226
|
-
_context2.next =
|
|
225
|
+
case 3:
|
|
226
|
+
_context2.next = 4;
|
|
227
227
|
return client.fetchData(url);
|
|
228
|
-
case
|
|
228
|
+
case 4:
|
|
229
229
|
response = _context2.sent;
|
|
230
230
|
// ORS returns a JsonLd.Response whose data union includes BaseData,
|
|
231
231
|
// BaseCollectionData, and BaseCollectionPage. We only care about the
|
|
@@ -233,43 +233,43 @@ export var cardPlugin = function cardPlugin(_ref) {
|
|
|
233
233
|
// to a minimal shape rather than accessing through the full union type.
|
|
234
234
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
235
235
|
if (data) {
|
|
236
|
-
_context2.next =
|
|
236
|
+
_context2.next = 5;
|
|
237
237
|
break;
|
|
238
238
|
}
|
|
239
239
|
return _context2.abrupt("return", undefined);
|
|
240
|
-
case
|
|
240
|
+
case 5:
|
|
241
241
|
urlField = data.url; // Property<string | Link> can be a string, a Link object, or an array.
|
|
242
242
|
// Short-link responses always return a plain string URL.
|
|
243
243
|
if (!(typeof urlField === 'string' && urlField !== url)) {
|
|
244
|
-
_context2.next =
|
|
244
|
+
_context2.next = 6;
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
247
|
return _context2.abrupt("return", urlField);
|
|
248
|
-
case
|
|
248
|
+
case 6:
|
|
249
249
|
if (!(urlField && _typeof(urlField) === 'object' && !Array.isArray(urlField))) {
|
|
250
|
-
_context2.next =
|
|
250
|
+
_context2.next = 7;
|
|
251
251
|
break;
|
|
252
252
|
}
|
|
253
253
|
linkObj = urlField;
|
|
254
254
|
id = (_linkObj$Id = linkObj['@id']) !== null && _linkObj$Id !== void 0 ? _linkObj$Id : linkObj['href'];
|
|
255
255
|
if (!(typeof id === 'string' && id !== url)) {
|
|
256
|
-
_context2.next =
|
|
256
|
+
_context2.next = 7;
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
259
|
return _context2.abrupt("return", id);
|
|
260
|
-
case
|
|
261
|
-
_context2.next =
|
|
260
|
+
case 7:
|
|
261
|
+
_context2.next = 9;
|
|
262
262
|
break;
|
|
263
|
-
case
|
|
264
|
-
_context2.prev =
|
|
265
|
-
|
|
266
|
-
case
|
|
263
|
+
case 8:
|
|
264
|
+
_context2.prev = 8;
|
|
265
|
+
_t = _context2["catch"](1);
|
|
266
|
+
case 9:
|
|
267
267
|
return _context2.abrupt("return", undefined);
|
|
268
|
-
case
|
|
268
|
+
case 10:
|
|
269
269
|
case "end":
|
|
270
270
|
return _context2.stop();
|
|
271
271
|
}
|
|
272
|
-
}, _callee2, null, [[
|
|
272
|
+
}, _callee2, null, [[1, 8]]);
|
|
273
273
|
}));
|
|
274
274
|
function resolveShortLinkUrl(_x2) {
|
|
275
275
|
return _resolveShortLinkUrl.apply(this, arguments);
|
|
@@ -28,21 +28,21 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
28
28
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
29
29
|
var _props$cardOptions;
|
|
30
30
|
var _props$cardOptions2;
|
|
31
|
-
return _regeneratorRuntime.wrap(function
|
|
31
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
32
32
|
while (1) switch (_context.prev = _context.next) {
|
|
33
33
|
case 0:
|
|
34
34
|
if (!((_props$cardOptions = props.cardOptions) !== null && _props$cardOptions !== void 0 && _props$cardOptions.provider)) {
|
|
35
|
-
_context.next =
|
|
35
|
+
_context.next = 1;
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
return _context.abrupt("return", (_props$cardOptions2 = props.cardOptions) === null || _props$cardOptions2 === void 0 ? void 0 : _props$cardOptions2.provider);
|
|
39
|
-
case
|
|
39
|
+
case 1:
|
|
40
40
|
if (!cardProvider.current) {
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 2;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
return _context.abrupt("return", cardProvider.current);
|
|
45
|
-
case
|
|
45
|
+
case 2:
|
|
46
46
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
47
47
|
var _props$editorPluginAp;
|
|
48
48
|
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;
|
|
@@ -50,7 +50,7 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
50
50
|
resolve(cardProvider);
|
|
51
51
|
}
|
|
52
52
|
}));
|
|
53
|
-
case
|
|
53
|
+
case 3:
|
|
54
54
|
case "end":
|
|
55
55
|
return _context.stop();
|
|
56
56
|
}
|
|
@@ -62,59 +62,59 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
62
62
|
}();
|
|
63
63
|
var resolveUrl = /*#__PURE__*/function () {
|
|
64
64
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
|
|
65
|
-
var isUrlSupported, _yield$provider$findP, provider, newMap;
|
|
66
|
-
return _regeneratorRuntime.wrap(function
|
|
65
|
+
var isUrlSupported, _yield$provider$findP, provider, newMap, _t, _t2, _t3, _t4;
|
|
66
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
67
67
|
while (1) switch (_context2.prev = _context2.next) {
|
|
68
68
|
case 0:
|
|
69
69
|
if (!supportedUrlsMap.has(url)) {
|
|
70
|
-
_context2.next =
|
|
70
|
+
_context2.next = 1;
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
return _context2.abrupt("return");
|
|
74
|
-
case
|
|
74
|
+
case 1:
|
|
75
75
|
isUrlSupported = false;
|
|
76
|
-
_context2.prev =
|
|
77
|
-
_context2.next =
|
|
76
|
+
_context2.prev = 2;
|
|
77
|
+
_context2.next = 3;
|
|
78
78
|
return getProvider();
|
|
79
|
-
case
|
|
79
|
+
case 3:
|
|
80
80
|
provider = _context2.sent;
|
|
81
|
-
_context2.next =
|
|
81
|
+
_context2.next = 4;
|
|
82
82
|
return provider === null || provider === void 0 ? void 0 : provider.findPattern(url);
|
|
83
|
-
case
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!
|
|
87
|
-
_context2.next =
|
|
83
|
+
case 4:
|
|
84
|
+
_t2 = _yield$provider$findP = _context2.sent;
|
|
85
|
+
_t = _t2 !== null;
|
|
86
|
+
if (!_t) {
|
|
87
|
+
_context2.next = 5;
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
case
|
|
92
|
-
if (!
|
|
93
|
-
_context2.next =
|
|
90
|
+
_t = _yield$provider$findP !== void 0;
|
|
91
|
+
case 5:
|
|
92
|
+
if (!_t) {
|
|
93
|
+
_context2.next = 6;
|
|
94
94
|
break;
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
_context2.next =
|
|
96
|
+
_t3 = _yield$provider$findP;
|
|
97
|
+
_context2.next = 7;
|
|
98
98
|
break;
|
|
99
|
-
case
|
|
100
|
-
|
|
101
|
-
case
|
|
102
|
-
isUrlSupported =
|
|
103
|
-
_context2.next =
|
|
99
|
+
case 6:
|
|
100
|
+
_t3 = false;
|
|
101
|
+
case 7:
|
|
102
|
+
isUrlSupported = _t3;
|
|
103
|
+
_context2.next = 9;
|
|
104
104
|
break;
|
|
105
|
-
case
|
|
106
|
-
_context2.prev =
|
|
107
|
-
|
|
105
|
+
case 8:
|
|
106
|
+
_context2.prev = 8;
|
|
107
|
+
_t4 = _context2["catch"](2);
|
|
108
108
|
isUrlSupported = false;
|
|
109
|
-
case
|
|
109
|
+
case 9:
|
|
110
110
|
newMap = new Map(supportedUrlsMap);
|
|
111
111
|
newMap.set(url, isUrlSupported);
|
|
112
112
|
setSupportedUrlsMap(newMap);
|
|
113
|
-
case
|
|
113
|
+
case 10:
|
|
114
114
|
case "end":
|
|
115
115
|
return _context2.stop();
|
|
116
116
|
}
|
|
117
|
-
}, _callee2, null, [[
|
|
117
|
+
}, _callee2, null, [[2, 8]]);
|
|
118
118
|
}));
|
|
119
119
|
return function resolveUrl(_x) {
|
|
120
120
|
return _ref2.apply(this, arguments);
|
|
@@ -36,21 +36,21 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
36
36
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
37
37
|
var _props$cardOptions;
|
|
38
38
|
var _props$cardOptions2;
|
|
39
|
-
return _regeneratorRuntime.wrap(function
|
|
39
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
40
40
|
while (1) switch (_context.prev = _context.next) {
|
|
41
41
|
case 0:
|
|
42
42
|
if (!((_props$cardOptions = props.cardOptions) !== null && _props$cardOptions !== void 0 && _props$cardOptions.provider)) {
|
|
43
|
-
_context.next =
|
|
43
|
+
_context.next = 1;
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
46
46
|
return _context.abrupt("return", (_props$cardOptions2 = props.cardOptions) === null || _props$cardOptions2 === void 0 ? void 0 : _props$cardOptions2.provider);
|
|
47
|
-
case
|
|
47
|
+
case 1:
|
|
48
48
|
if (!cardProvider.current) {
|
|
49
|
-
_context.next =
|
|
49
|
+
_context.next = 2;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
return _context.abrupt("return", cardProvider.current);
|
|
53
|
-
case
|
|
53
|
+
case 2:
|
|
54
54
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
55
55
|
var _props$editorPluginAp2;
|
|
56
56
|
var cardProvider = (_props$editorPluginAp2 = props.editorPluginApi) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.card) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.sharedState) === null || _props$editorPluginAp2 === void 0 || (_props$editorPluginAp2 = _props$editorPluginAp2.currentState()) === null || _props$editorPluginAp2 === void 0 ? void 0 : _props$editorPluginAp2.provider;
|
|
@@ -58,7 +58,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
58
58
|
resolve(cardProvider);
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
61
|
-
case
|
|
61
|
+
case 3:
|
|
62
62
|
case "end":
|
|
63
63
|
return _context.stop();
|
|
64
64
|
}
|
|
@@ -70,60 +70,60 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
70
70
|
}();
|
|
71
71
|
var resolveUrl = /*#__PURE__*/function () {
|
|
72
72
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url) {
|
|
73
|
-
var isUrlSupported, _yield$provider$findP, provider, newMap;
|
|
74
|
-
return _regeneratorRuntime.wrap(function
|
|
73
|
+
var isUrlSupported, _yield$provider$findP, provider, newMap, _t, _t2, _t3, _t4;
|
|
74
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
75
75
|
while (1) switch (_context2.prev = _context2.next) {
|
|
76
76
|
case 0:
|
|
77
77
|
if (!supportedUrlsMap.has(url)) {
|
|
78
|
-
_context2.next =
|
|
78
|
+
_context2.next = 1;
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
return _context2.abrupt("return");
|
|
82
|
-
case
|
|
82
|
+
case 1:
|
|
83
83
|
isUrlSupported = false;
|
|
84
|
-
_context2.prev =
|
|
85
|
-
_context2.next =
|
|
84
|
+
_context2.prev = 2;
|
|
85
|
+
_context2.next = 3;
|
|
86
86
|
return getProvider();
|
|
87
|
-
case
|
|
87
|
+
case 3:
|
|
88
88
|
provider = _context2.sent;
|
|
89
|
-
_context2.next =
|
|
89
|
+
_context2.next = 4;
|
|
90
90
|
return provider === null || provider === void 0 ? void 0 : provider.findPattern(url);
|
|
91
|
-
case
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (!
|
|
95
|
-
_context2.next =
|
|
91
|
+
case 4:
|
|
92
|
+
_t2 = _yield$provider$findP = _context2.sent;
|
|
93
|
+
_t = _t2 !== null;
|
|
94
|
+
if (!_t) {
|
|
95
|
+
_context2.next = 5;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
|
-
|
|
99
|
-
case
|
|
100
|
-
if (!
|
|
101
|
-
_context2.next =
|
|
98
|
+
_t = _yield$provider$findP !== void 0;
|
|
99
|
+
case 5:
|
|
100
|
+
if (!_t) {
|
|
101
|
+
_context2.next = 6;
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
_context2.next =
|
|
104
|
+
_t3 = _yield$provider$findP;
|
|
105
|
+
_context2.next = 7;
|
|
106
106
|
break;
|
|
107
|
-
case
|
|
108
|
-
|
|
109
|
-
case
|
|
110
|
-
isUrlSupported =
|
|
111
|
-
_context2.next =
|
|
107
|
+
case 6:
|
|
108
|
+
_t3 = false;
|
|
109
|
+
case 7:
|
|
110
|
+
isUrlSupported = _t3;
|
|
111
|
+
_context2.next = 9;
|
|
112
112
|
break;
|
|
113
|
-
case
|
|
114
|
-
_context2.prev =
|
|
115
|
-
|
|
113
|
+
case 8:
|
|
114
|
+
_context2.prev = 8;
|
|
115
|
+
_t4 = _context2["catch"](2);
|
|
116
116
|
// eslint-disable-line no-unused-vars
|
|
117
117
|
isUrlSupported = false;
|
|
118
|
-
case
|
|
118
|
+
case 9:
|
|
119
119
|
newMap = new Map(supportedUrlsMap);
|
|
120
120
|
newMap.set(url, isUrlSupported);
|
|
121
121
|
setSupportedUrlsMap(newMap);
|
|
122
|
-
case
|
|
122
|
+
case 10:
|
|
123
123
|
case "end":
|
|
124
124
|
return _context2.stop();
|
|
125
125
|
}
|
|
126
|
-
}, _callee2, null, [[
|
|
126
|
+
}, _callee2, null, [[2, 8]]);
|
|
127
127
|
}));
|
|
128
128
|
return function resolveUrl(_x) {
|
|
129
129
|
return _ref2.apply(this, arguments);
|
|
@@ -20,17 +20,17 @@ export var useFetchDatasourceDataInfo = function useFetchDatasourceDataInfo(_ref
|
|
|
20
20
|
useEffect(function () {
|
|
21
21
|
var fetchDatasource = /*#__PURE__*/function () {
|
|
22
22
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
23
|
-
var datasourceDataRequest, _yield$getDatasourceD, meta;
|
|
24
|
-
return _regeneratorRuntime.wrap(function
|
|
23
|
+
var datasourceDataRequest, _yield$getDatasourceD, meta, _t;
|
|
24
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
25
25
|
while (1) switch (_context.prev = _context.next) {
|
|
26
26
|
case 0:
|
|
27
27
|
_context.prev = 0;
|
|
28
28
|
if (!(!datasourceId || !parameters || !visibleColumnKeys)) {
|
|
29
|
-
_context.next =
|
|
29
|
+
_context.next = 1;
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
return _context.abrupt("return");
|
|
33
|
-
case
|
|
33
|
+
case 1:
|
|
34
34
|
datasourceDataRequest = {
|
|
35
35
|
parameters: parameters,
|
|
36
36
|
pageSize: DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE,
|
|
@@ -38,25 +38,25 @@ export var useFetchDatasourceDataInfo = function useFetchDatasourceDataInfo(_ref
|
|
|
38
38
|
fields: visibleColumnKeys,
|
|
39
39
|
includeSchema: true
|
|
40
40
|
};
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 2;
|
|
42
42
|
return getDatasourceData(datasourceId, datasourceDataRequest, false);
|
|
43
|
-
case
|
|
43
|
+
case 2:
|
|
44
44
|
_yield$getDatasourceD = _context.sent;
|
|
45
45
|
meta = _yield$getDatasourceD.meta;
|
|
46
46
|
setExtensionKey(meta.extensionKey);
|
|
47
|
-
_context.next =
|
|
47
|
+
_context.next = 4;
|
|
48
48
|
break;
|
|
49
|
-
case
|
|
50
|
-
_context.prev =
|
|
51
|
-
|
|
49
|
+
case 3:
|
|
50
|
+
_context.prev = 3;
|
|
51
|
+
_t = _context["catch"](0);
|
|
52
52
|
// eslint-disable-next-line no-console
|
|
53
|
-
console.error(
|
|
53
|
+
console.error(_t);
|
|
54
54
|
setExtensionKey(undefined);
|
|
55
|
-
case
|
|
55
|
+
case 4:
|
|
56
56
|
case "end":
|
|
57
57
|
return _context.stop();
|
|
58
58
|
}
|
|
59
|
-
}, _callee, null, [[0,
|
|
59
|
+
}, _callee, null, [[0, 3]]);
|
|
60
60
|
}));
|
|
61
61
|
return function fetchDatasource() {
|
|
62
62
|
return _ref2.apply(this, arguments);
|
|
@@ -32,44 +32,44 @@ export var useFetchDatasourceInfo = function useFetchDatasourceInfo(_ref) {
|
|
|
32
32
|
useEffect(function () {
|
|
33
33
|
var fetchDatasource = /*#__PURE__*/function () {
|
|
34
34
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
|
-
var _cardContext$connecti, _datasources$, _datasources$2, response, datasources;
|
|
36
|
-
return _regeneratorRuntime.wrap(function
|
|
35
|
+
var _cardContext$connecti, _datasources$, _datasources$2, response, datasources, _t;
|
|
36
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
37
37
|
while (1) switch (_context.prev = _context.next) {
|
|
38
38
|
case 0:
|
|
39
39
|
_context.prev = 0;
|
|
40
40
|
if (!(!url || !cardContext)) {
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 1;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
// Don't block rendering of modal of somehow we don't get these two args --> just open with empty params
|
|
45
45
|
setReady(true);
|
|
46
46
|
return _context.abrupt("return");
|
|
47
|
-
case
|
|
48
|
-
_context.next =
|
|
47
|
+
case 1:
|
|
48
|
+
_context.next = 2;
|
|
49
49
|
return cardContext === null || cardContext === void 0 || (_cardContext$connecti = cardContext.connections) === null || _cardContext$connecti === void 0 || (_cardContext$connecti = _cardContext$connecti.client) === null || _cardContext$connecti === void 0 ? void 0 : _cardContext$connecti.fetchData(url);
|
|
50
|
-
case
|
|
50
|
+
case 2:
|
|
51
51
|
response = _context.sent;
|
|
52
52
|
datasources = response && response.datasources || [];
|
|
53
53
|
setExtensionKey(response === null || response === void 0 ? void 0 : response.meta.key);
|
|
54
54
|
setDatasourceId((_datasources$ = datasources[0]) === null || _datasources$ === void 0 ? void 0 : _datasources$.id);
|
|
55
55
|
setParameters((_datasources$2 = datasources[0]) === null || _datasources$2 === void 0 ? void 0 : _datasources$2.parameters);
|
|
56
56
|
setReady(true);
|
|
57
|
-
_context.next =
|
|
57
|
+
_context.next = 4;
|
|
58
58
|
break;
|
|
59
|
-
case
|
|
60
|
-
_context.prev =
|
|
61
|
-
|
|
59
|
+
case 3:
|
|
60
|
+
_context.prev = 3;
|
|
61
|
+
_t = _context["catch"](0);
|
|
62
62
|
setDatasourceId(undefined);
|
|
63
63
|
setParameters(undefined);
|
|
64
64
|
setExtensionKey(undefined);
|
|
65
65
|
// If fetch somehow errors, still set ready as true so we don't block the rendering of the modal.
|
|
66
66
|
// It will just open with empty params.
|
|
67
67
|
setReady(true);
|
|
68
|
-
case
|
|
68
|
+
case 4:
|
|
69
69
|
case "end":
|
|
70
70
|
return _context.stop();
|
|
71
71
|
}
|
|
72
|
-
}, _callee, null, [[0,
|
|
72
|
+
}, _callee, null, [[0, 3]]);
|
|
73
73
|
}));
|
|
74
74
|
return function fetchDatasource() {
|
|
75
75
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "16.10.
|
|
3
|
+
"version": "16.10.3",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.15.0",
|
|
33
33
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.17.0",
|
|
35
35
|
"@atlaskit/editor-card-provider": "^6.8.0",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"@atlaskit/editor-shared-styles": "^3.11.0",
|
|
49
49
|
"@atlaskit/editor-smart-link-draggable": "^0.5.0",
|
|
50
50
|
"@atlaskit/frontend-utilities": "^3.3.0",
|
|
51
|
-
"@atlaskit/icon": "^35.
|
|
51
|
+
"@atlaskit/icon": "^35.3.0",
|
|
52
52
|
"@atlaskit/link": "^3.4.0",
|
|
53
53
|
"@atlaskit/link-analytics": "^11.1.0",
|
|
54
54
|
"@atlaskit/link-client-extension": "^6.1.0",
|
|
55
55
|
"@atlaskit/link-datasource": "^5.4.0",
|
|
56
56
|
"@atlaskit/link-extractors": "^2.7.0",
|
|
57
|
-
"@atlaskit/linking-common": "^9.
|
|
57
|
+
"@atlaskit/linking-common": "^9.12.0",
|
|
58
58
|
"@atlaskit/linking-types": "^14.4.0",
|
|
59
59
|
"@atlaskit/menu": "^8.5.0",
|
|
60
60
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
63
63
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
64
64
|
"@atlaskit/smart-card": "^44.16.0",
|
|
65
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
66
|
-
"@atlaskit/tokens": "^13.
|
|
65
|
+
"@atlaskit/tmp-editor-statsig": "^85.0.0",
|
|
66
|
+
"@atlaskit/tokens": "^13.1.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
|
69
69
|
"lodash": "^4.17.21",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^114.
|
|
75
|
+
"@atlaskit/editor-common": "^114.50.0",
|
|
76
76
|
"@atlaskit/link-provider": "^4.4.0",
|
|
77
77
|
"react": "^18.2.0",
|
|
78
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|