@atlaskit/editor-plugin-card 16.10.2 → 16.11.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 +17 -0
- package/dist/cjs/cardPlugin.js +50 -33
- package/dist/cjs/pm-plugins/doc.js +2 -2
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +37 -37
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +37 -37
- package/dist/cjs/ui/PasteDisplayAsMenu.compiled.css +31 -0
- package/dist/cjs/ui/PasteDisplayAsMenu.js +368 -0
- package/dist/cjs/ui/currentPastedSmartLink.js +52 -0
- package/dist/cjs/ui/pasteDisplayAsUtils.js +30 -0
- package/dist/cjs/ui/useFetchDatasourceDataInfo.js +13 -13
- package/dist/cjs/ui/useFetchDatasourceInfo.js +12 -12
- package/dist/es2019/cardPlugin.js +17 -2
- package/dist/es2019/pm-plugins/doc.js +2 -2
- package/dist/es2019/ui/PasteDisplayAsMenu.compiled.css +31 -0
- package/dist/es2019/ui/PasteDisplayAsMenu.js +366 -0
- package/dist/es2019/ui/currentPastedSmartLink.js +46 -0
- package/dist/es2019/ui/pasteDisplayAsUtils.js +24 -0
- package/dist/esm/cardPlugin.js +50 -33
- package/dist/esm/pm-plugins/doc.js +2 -2
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +36 -36
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +36 -36
- package/dist/esm/ui/PasteDisplayAsMenu.compiled.css +31 -0
- package/dist/esm/ui/PasteDisplayAsMenu.js +359 -0
- package/dist/esm/ui/currentPastedSmartLink.js +46 -0
- package/dist/esm/ui/pasteDisplayAsUtils.js +24 -0
- package/dist/esm/ui/useFetchDatasourceDataInfo.js +13 -13
- package/dist/esm/ui/useFetchDatasourceInfo.js +12 -12
- package/dist/types/cardPluginType.d.ts +3 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/ui/PasteDisplayAsMenu.d.ts +25 -0
- package/dist/types/ui/currentPastedSmartLink.d.ts +2 -0
- package/dist/types/ui/pasteDisplayAsUtils.d.ts +7 -0
- package/dist/types-ts4.5/cardPluginType.d.ts +3 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/PasteDisplayAsMenu.d.ts +25 -0
- package/dist/types-ts4.5/ui/currentPastedSmartLink.d.ts +2 -0
- package/dist/types-ts4.5/ui/pasteDisplayAsUtils.d.ts +12 -0
- package/package.json +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 16.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d2be5b45b39b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d2be5b45b39b0) -
|
|
8
|
+
Add Smart Link-aware paste actions for the paste actions menu V2 experiment.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 16.10.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 16.10.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/cardPlugin.js
CHANGED
|
@@ -15,6 +15,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _linkDatasource = require("@atlaskit/link-datasource");
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
18
19
|
var _blockCard = require("./nodeviews/toDOM-fixes/blockCard");
|
|
19
20
|
var _embedCard = require("./nodeviews/toDOM-fixes/embedCard");
|
|
20
21
|
var _inlineCard = require("./nodeviews/toDOM-fixes/inlineCard");
|
|
@@ -29,6 +30,7 @@ var _ModalWithState = _interopRequireDefault(require("./ui/DatasourceModal/Modal
|
|
|
29
30
|
var _EditorLinkingPlatformAnalytics = require("./ui/EditorLinkingPlatformAnalytics");
|
|
30
31
|
var _EditorSmartCardEvents = require("./ui/EditorSmartCardEvents");
|
|
31
32
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
33
|
+
var _PasteDisplayAsMenu = require("./ui/PasteDisplayAsMenu");
|
|
32
34
|
var _toolbar = require("./ui/toolbar");
|
|
33
35
|
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; }
|
|
34
36
|
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) { (0, _defineProperty2.default)(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; } // Ignored via go/ees005
|
|
@@ -41,6 +43,20 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
41
43
|
var previousCardProvider;
|
|
42
44
|
var cardPluginEvents = (0, _createEventsQueue.createEventsQueue)();
|
|
43
45
|
var instanceEmbedCardTransformers = options.embedCardTransformers;
|
|
46
|
+
var editorViewForPasteMenu;
|
|
47
|
+
var pasteMenuVariant = (0, _expVal.expValNoExposure)('platform_editor_paste_actions_menu_v2', 'variant', 'control');
|
|
48
|
+
var shouldRegisterPasteDisplayAsMenu = options.enablePasteDisplayAsMenu && ['hasSpellingAndGrammar', 'hasAltAiActions'].includes(pasteMenuVariant);
|
|
49
|
+
if (shouldRegisterPasteDisplayAsMenu) {
|
|
50
|
+
var _api$uiControlRegistr, _options$allowBlockCa;
|
|
51
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _PasteDisplayAsMenu.getPasteDisplayAsMenuComponents)({
|
|
52
|
+
api: api,
|
|
53
|
+
allowBlockCards: options.onlyInlineCards ? false : (_options$allowBlockCa = options.allowBlockCards) !== null && _options$allowBlockCa !== void 0 ? _options$allowBlockCa : true,
|
|
54
|
+
allowEmbeds: options.onlyInlineCards ? false : options.allowEmbeds,
|
|
55
|
+
getEditorView: function getEditorView() {
|
|
56
|
+
return editorViewForPasteMenu;
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
44
60
|
api === null || api === void 0 || (_api$base = api.base) === null || _api$base === void 0 || _api$base.actions.registerMarks(function (_ref2) {
|
|
45
61
|
var tr = _ref2.tr,
|
|
46
62
|
node = _ref2.node,
|
|
@@ -86,10 +102,10 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
86
102
|
return nodes;
|
|
87
103
|
},
|
|
88
104
|
pmPlugins: function pmPlugins() {
|
|
89
|
-
var _options$
|
|
105
|
+
var _options$allowBlockCa2, _options$allowResizin, _options$useAlternati, _options$allowWrappin, _options$allowAlignme, _options$allowDatasou, _options$showUpgradeD;
|
|
90
106
|
// onlyInlineCards forces block/embed off regardless of caller-passed flags,
|
|
91
107
|
// keeping the schema gate (in nodes()) and the runtime gate in sync.
|
|
92
|
-
var allowBlockCards = options.onlyInlineCards ? false : (_options$
|
|
108
|
+
var allowBlockCards = options.onlyInlineCards ? false : (_options$allowBlockCa2 = options.allowBlockCards) !== null && _options$allowBlockCa2 !== void 0 ? _options$allowBlockCa2 : true;
|
|
93
109
|
var allowEmbeds = options.onlyInlineCards ? false : options.allowEmbeds;
|
|
94
110
|
var allowResizing = (_options$allowResizin = options.allowResizing) !== null && _options$allowResizin !== void 0 ? _options$allowResizin : true;
|
|
95
111
|
var useAlternativePreloader = (_options$useAlternati = options.useAlternativePreloader) !== null && _options$useAlternati !== void 0 ? _options$useAlternati : true;
|
|
@@ -129,6 +145,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
129
145
|
if (!editorView) {
|
|
130
146
|
return null;
|
|
131
147
|
}
|
|
148
|
+
editorViewForPasteMenu = editorView;
|
|
132
149
|
var breakoutEnabled = options.editorAppearance === 'full-page';
|
|
133
150
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_EditorSmartCardEvents.EditorSmartCardEvents, {
|
|
134
151
|
editorView: editorView
|
|
@@ -164,25 +181,25 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
164
181
|
var _setProvider2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
|
|
165
182
|
var _api$core$actions$exe;
|
|
166
183
|
var provider;
|
|
167
|
-
return _regenerator.default.wrap(function
|
|
184
|
+
return _regenerator.default.wrap(function (_context) {
|
|
168
185
|
while (1) switch (_context.prev = _context.next) {
|
|
169
186
|
case 0:
|
|
170
|
-
_context.next =
|
|
187
|
+
_context.next = 1;
|
|
171
188
|
return providerPromise;
|
|
172
|
-
case
|
|
189
|
+
case 1:
|
|
173
190
|
provider = _context.sent;
|
|
174
191
|
if (!(previousCardProvider === provider || (options === null || options === void 0 ? void 0 : options.provider) === providerPromise)) {
|
|
175
|
-
_context.next =
|
|
192
|
+
_context.next = 2;
|
|
176
193
|
break;
|
|
177
194
|
}
|
|
178
195
|
return _context.abrupt("return", false);
|
|
179
|
-
case
|
|
196
|
+
case 2:
|
|
180
197
|
previousCardProvider = provider;
|
|
181
198
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref6) {
|
|
182
199
|
var tr = _ref6.tr;
|
|
183
200
|
return (0, _actions.setProvider)(provider)(tr);
|
|
184
201
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
185
|
-
case
|
|
202
|
+
case 3:
|
|
186
203
|
case "end":
|
|
187
204
|
return _context.stop();
|
|
188
205
|
}
|
|
@@ -201,20 +218,20 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
201
218
|
},
|
|
202
219
|
resolveShortLinkUrl: function () {
|
|
203
220
|
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
|
|
221
|
+
var provider, clientHolder, client, response, data, urlField, _linkObj$Id, linkObj, id, _t;
|
|
222
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
206
223
|
while (1) switch (_context2.prev = _context2.next) {
|
|
207
224
|
case 0:
|
|
208
225
|
if (options.provider) {
|
|
209
|
-
_context2.next =
|
|
226
|
+
_context2.next = 1;
|
|
210
227
|
break;
|
|
211
228
|
}
|
|
212
229
|
return _context2.abrupt("return", undefined);
|
|
213
|
-
case
|
|
214
|
-
_context2.prev =
|
|
215
|
-
_context2.next =
|
|
230
|
+
case 1:
|
|
231
|
+
_context2.prev = 1;
|
|
232
|
+
_context2.next = 2;
|
|
216
233
|
return options.provider;
|
|
217
|
-
case
|
|
234
|
+
case 2:
|
|
218
235
|
provider = _context2.sent;
|
|
219
236
|
// EditorCardProvider holds a CardClient instance internally. We access it
|
|
220
237
|
// directly to call fetchData, which gives us the raw ORS JSON-LD response
|
|
@@ -224,14 +241,14 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
224
241
|
clientHolder = provider;
|
|
225
242
|
client = clientHolder.cardClient;
|
|
226
243
|
if (client) {
|
|
227
|
-
_context2.next =
|
|
244
|
+
_context2.next = 3;
|
|
228
245
|
break;
|
|
229
246
|
}
|
|
230
247
|
return _context2.abrupt("return", undefined);
|
|
231
|
-
case
|
|
232
|
-
_context2.next =
|
|
248
|
+
case 3:
|
|
249
|
+
_context2.next = 4;
|
|
233
250
|
return client.fetchData(url);
|
|
234
|
-
case
|
|
251
|
+
case 4:
|
|
235
252
|
response = _context2.sent;
|
|
236
253
|
// ORS returns a JsonLd.Response whose data union includes BaseData,
|
|
237
254
|
// BaseCollectionData, and BaseCollectionPage. We only care about the
|
|
@@ -239,43 +256,43 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref) {
|
|
|
239
256
|
// to a minimal shape rather than accessing through the full union type.
|
|
240
257
|
data = response === null || response === void 0 ? void 0 : response.data;
|
|
241
258
|
if (data) {
|
|
242
|
-
_context2.next =
|
|
259
|
+
_context2.next = 5;
|
|
243
260
|
break;
|
|
244
261
|
}
|
|
245
262
|
return _context2.abrupt("return", undefined);
|
|
246
|
-
case
|
|
263
|
+
case 5:
|
|
247
264
|
urlField = data.url; // Property<string | Link> can be a string, a Link object, or an array.
|
|
248
265
|
// Short-link responses always return a plain string URL.
|
|
249
266
|
if (!(typeof urlField === 'string' && urlField !== url)) {
|
|
250
|
-
_context2.next =
|
|
267
|
+
_context2.next = 6;
|
|
251
268
|
break;
|
|
252
269
|
}
|
|
253
270
|
return _context2.abrupt("return", urlField);
|
|
254
|
-
case
|
|
271
|
+
case 6:
|
|
255
272
|
if (!(urlField && (0, _typeof2.default)(urlField) === 'object' && !Array.isArray(urlField))) {
|
|
256
|
-
_context2.next =
|
|
273
|
+
_context2.next = 7;
|
|
257
274
|
break;
|
|
258
275
|
}
|
|
259
276
|
linkObj = urlField;
|
|
260
277
|
id = (_linkObj$Id = linkObj['@id']) !== null && _linkObj$Id !== void 0 ? _linkObj$Id : linkObj['href'];
|
|
261
278
|
if (!(typeof id === 'string' && id !== url)) {
|
|
262
|
-
_context2.next =
|
|
279
|
+
_context2.next = 7;
|
|
263
280
|
break;
|
|
264
281
|
}
|
|
265
282
|
return _context2.abrupt("return", id);
|
|
266
|
-
case
|
|
267
|
-
_context2.next =
|
|
283
|
+
case 7:
|
|
284
|
+
_context2.next = 9;
|
|
268
285
|
break;
|
|
269
|
-
case
|
|
270
|
-
_context2.prev =
|
|
271
|
-
|
|
272
|
-
case
|
|
286
|
+
case 8:
|
|
287
|
+
_context2.prev = 8;
|
|
288
|
+
_t = _context2["catch"](1);
|
|
289
|
+
case 9:
|
|
273
290
|
return _context2.abrupt("return", undefined);
|
|
274
|
-
case
|
|
291
|
+
case 10:
|
|
275
292
|
case "end":
|
|
276
293
|
return _context2.stop();
|
|
277
294
|
}
|
|
278
|
-
}, _callee2, null, [[
|
|
295
|
+
}, _callee2, null, [[1, 8]]);
|
|
279
296
|
}));
|
|
280
297
|
function resolveShortLinkUrl(_x2) {
|
|
281
298
|
return _resolveShortLinkUrl.apply(this, arguments);
|
|
@@ -383,7 +383,7 @@ var changeSelectedCardToLink = exports.changeSelectedCardToLink = function chang
|
|
|
383
383
|
return function (state, dispatch) {
|
|
384
384
|
var selectedNode = state.selection instanceof _state.NodeSelection ? state.selection.node : undefined;
|
|
385
385
|
var tr;
|
|
386
|
-
if (node && pos) {
|
|
386
|
+
if (node && pos !== undefined) {
|
|
387
387
|
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
388
388
|
} else {
|
|
389
389
|
tr = cardToLinkWithTransaction(state, text, href);
|
|
@@ -411,7 +411,7 @@ var changeSelectedCardToLink = exports.changeSelectedCardToLink = function chang
|
|
|
411
411
|
var changeSelectedCardToLinkFallback = exports.changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
412
412
|
return function (state, dispatch) {
|
|
413
413
|
var tr;
|
|
414
|
-
if (node && pos) {
|
|
414
|
+
if (node && pos !== undefined) {
|
|
415
415
|
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
416
416
|
} else {
|
|
417
417
|
tr = cardToLinkWithTransaction(state, text, href);
|
|
@@ -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);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}._189ee4h9{border-width:var(--ds-border-width,1px)}
|
|
3
|
+
._1dqonqa1{border-style:solid}
|
|
4
|
+
._1h6d1l7x{border-color:var(--ds-border,#0b120e24)}
|
|
5
|
+
._1h6dbk0g{border-color:var(--ds-border-disabled,#0515240f)}
|
|
6
|
+
._1h6dq98m{border-color:var(--ds-border-selected,#1868db)}
|
|
7
|
+
._18u0u2gc{margin-left:var(--ds-space-100,8px)}
|
|
8
|
+
._19bv1b66{padding-left:var(--ds-space-050,4px)}
|
|
9
|
+
._19pku2gc{margin-top:var(--ds-space-100,8px)}
|
|
10
|
+
._1bah1b1v{justify-content:space-around}
|
|
11
|
+
._1bah1h6o{justify-content:center}
|
|
12
|
+
._1bsb1osq{width:100%}
|
|
13
|
+
._1e0c1txw{display:flex}
|
|
14
|
+
._2hwxu2gc{margin-right:var(--ds-space-100,8px)}
|
|
15
|
+
._4cvr1h6o{align-items:center}
|
|
16
|
+
._4t3izwfg{height:2pc}
|
|
17
|
+
._bfhk15s3{background-color:var(--ds-background-selected,#e9f2fe)}
|
|
18
|
+
._bfhk187o{background-color:var(--ds-background-disabled,#0515240f)}
|
|
19
|
+
._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
|
|
20
|
+
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
21
|
+
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
22
|
+
._ca0q1b66{padding-top:var(--ds-space-050,4px)}
|
|
23
|
+
._n3td1b66{padding-bottom:var(--ds-space-050,4px)}
|
|
24
|
+
._otyru2gc{margin-bottom:var(--ds-space-100,8px)}
|
|
25
|
+
._syaz1gmx{color:var(--ds-text-disabled,#080f214a)}
|
|
26
|
+
._syazi7uo{color:var(--ds-text,#292a2e)}
|
|
27
|
+
._u5f31b66{padding-right:var(--ds-space-050,4px)}
|
|
28
|
+
._irr31dpa:hover{background-color:var(--ds-background-neutral-subtle-hovered,#0515240f)}
|
|
29
|
+
._irr3ufnl:hover{background-color:var(--ds-background-selected-hovered,#cfe1fd)}
|
|
30
|
+
._1di6fcek:active{background-color:var(--ds-background-neutral-subtle-pressed,#0b120e24)}
|
|
31
|
+
._1di6nozp:active{background-color:var(--ds-background-selected-pressed,#8fb8f6)}
|