@atlaskit/editor-plugin-card 0.9.0 → 0.9.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 +7 -0
- package/dist/cjs/analytics/create-events-queue.js +2 -3
- package/dist/cjs/analytics/events-from-tr.js +1 -2
- package/dist/cjs/analytics/types.js +3 -5
- package/dist/cjs/analytics/utils.js +8 -13
- package/dist/cjs/datasourceErrorBoundary.js +8 -6
- package/dist/cjs/messages.js +2 -3
- package/dist/cjs/nodeviews/blockCard.js +3 -5
- package/dist/cjs/nodeviews/datasource.js +7 -28
- package/dist/cjs/nodeviews/embedCard.js +4 -6
- package/dist/cjs/nodeviews/genericCard.js +1 -1
- package/dist/cjs/nodeviews/inlineCard.js +1 -2
- package/dist/cjs/plugin.js +3 -4
- package/dist/cjs/pm-plugins/actions.js +14 -27
- package/dist/cjs/pm-plugins/doc.js +23 -36
- package/dist/cjs/pm-plugins/main.js +8 -9
- package/dist/cjs/pm-plugins/mountHyperlink.js +6 -7
- package/dist/cjs/pm-plugins/plugin-key.js +1 -2
- package/dist/cjs/pm-plugins/reducers.js +2 -3
- package/dist/cjs/pm-plugins/util/resolve.js +3 -5
- package/dist/cjs/pm-plugins/util/state.js +3 -6
- package/dist/cjs/toolbar.js +12 -16
- package/dist/cjs/ui/CardContextProvider.js +1 -2
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +6 -4
- package/dist/cjs/ui/DatasourceModal/index.js +6 -7
- package/dist/cjs/ui/EditDatasourceButton.js +7 -9
- package/dist/cjs/ui/EditLinkToolbar.js +11 -15
- package/dist/cjs/ui/EditorAnalyticsContext.js +2 -3
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +7 -8
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/LinkEvents.js +2 -3
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/common.js +5 -9
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +1 -2
- package/dist/cjs/ui/EditorSmartCardEvents.js +2 -3
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +2 -3
- package/dist/cjs/ui/LayoutButton/index.js +3 -5
- package/dist/cjs/ui/LayoutButton/utils.js +2 -3
- package/dist/cjs/ui/LinkToolbarAppearance.js +3 -4
- package/dist/cjs/ui/ResizableEmbedCard.js +1 -2
- package/dist/cjs/ui/ToolbarViewedEvent.js +2 -3
- package/dist/cjs/utils.js +7 -13
- package/dist/es2019/datasourceErrorBoundary.js +7 -4
- package/dist/es2019/nodeviews/datasource.js +0 -22
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +5 -2
- package/dist/esm/analytics/utils.js +2 -2
- package/dist/esm/datasourceErrorBoundary.js +7 -4
- package/dist/esm/nodeviews/datasource.js +4 -23
- package/dist/esm/nodeviews/embedCard.js +1 -1
- package/dist/esm/nodeviews/genericCard.js +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/pm-plugins/doc.js +9 -9
- package/dist/esm/pm-plugins/main.js +6 -6
- package/dist/esm/pm-plugins/mountHyperlink.js +4 -4
- package/dist/esm/toolbar.js +8 -8
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +5 -2
- package/dist/esm/ui/DatasourceModal/index.js +4 -4
- package/dist/esm/ui/EditDatasourceButton.js +4 -4
- package/dist/esm/ui/EditLinkToolbar.js +6 -6
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.js +5 -5
- package/dist/esm/ui/LayoutButton/index.js +1 -1
- package/dist/esm/ui/LinkToolbarAppearance.js +2 -2
- package/dist/types/datasourceErrorBoundary.d.ts +2 -2
- package/dist/types/nodeviews/datasource.d.ts +0 -1
- package/dist/types/ui/DatasourceModal/ModalWithState.d.ts +2 -2
- package/package.json +4 -4
- package/dist/types-ts4.5/analytics/create-events-queue.d.ts +0 -21
- package/dist/types-ts4.5/analytics/events-from-tr.d.ts +0 -19
- package/dist/types-ts4.5/analytics/index.d.ts +0 -2
- package/dist/types-ts4.5/analytics/types.d.ts +0 -66
- package/dist/types-ts4.5/analytics/utils.d.ts +0 -22
- package/dist/types-ts4.5/datasourceErrorBoundary.d.ts +0 -18
- package/dist/types-ts4.5/index.d.ts +0 -3
- package/dist/types-ts4.5/messages.d.ts +0 -22
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +0 -30
- package/dist/types-ts4.5/nodeviews/datasource.d.ts +0 -44
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +0 -46
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +0 -37
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +0 -23
- package/dist/types-ts4.5/plugin.d.ts +0 -29
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -22
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +0 -27
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/main.d.ts +0 -6
- package/dist/types-ts4.5/pm-plugins/mountHyperlink.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/reducers.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/shouldReplaceLink.d.ts +0 -2
- package/dist/types-ts4.5/pm-plugins/util/resolve.d.ts +0 -8
- package/dist/types-ts4.5/pm-plugins/util/state.d.ts +0 -30
- package/dist/types-ts4.5/toolbar.d.ts +0 -9
- package/dist/types-ts4.5/types.d.ts +0 -133
- package/dist/types-ts4.5/ui/CardContextProvider.d.ts +0 -19
- package/dist/types-ts4.5/ui/DatasourceModal/ModalWithState.d.ts +0 -9
- package/dist/types-ts4.5/ui/DatasourceModal/index.d.ts +0 -11
- package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +0 -17
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +0 -41
- package/dist/types-ts4.5/ui/EditorAnalyticsContext.d.ts +0 -10
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +0 -6
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/LinkEvents.d.ts +0 -6
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/common.d.ts +0 -20
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/EditorSmartCardEvents.d.ts +0 -5
- package/dist/types-ts4.5/ui/HyperlinkToolbarAppearance.d.ts +0 -32
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +0 -9
- package/dist/types-ts4.5/ui/LayoutButton/types.d.ts +0 -19
- package/dist/types-ts4.5/ui/LayoutButton/utils.d.ts +0 -5
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +0 -29
- package/dist/types-ts4.5/ui/ResizableEmbedCard.d.ts +0 -61
- package/dist/types-ts4.5/ui/ToolbarViewedEvent.d.ts +0 -11
- package/dist/types-ts4.5/utils.d.ts +0 -19
- package/tmp/api-report-tmp.d.ts +0 -193
|
@@ -50,7 +50,7 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
50
50
|
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
51
51
|
return $pos.node($pos.depth - 1).type.name;
|
|
52
52
|
}
|
|
53
|
-
var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) {
|
|
53
|
+
var replaceQueuedUrlWithCard = exports.replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent) {
|
|
54
54
|
return function (editorState, dispatch) {
|
|
55
55
|
var state = _pluginKey.pluginKey.getState(editorState);
|
|
56
56
|
if (!state) {
|
|
@@ -97,7 +97,7 @@ var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData,
|
|
|
97
97
|
*/
|
|
98
98
|
var inputMethod = requests[0].source;
|
|
99
99
|
var sourceEvent = requests[0].sourceEvent;
|
|
100
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
100
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
102
|
action: analyticsAction || _analytics.ACTION.INSERTED,
|
|
103
103
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
@@ -127,8 +127,7 @@ var replaceQueuedUrlWithCard = function replaceQueuedUrlWithCard(url, cardData,
|
|
|
127
127
|
return true;
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
|
-
exports.
|
|
131
|
-
var handleFallbackWithAnalytics = function handleFallbackWithAnalytics(request, editorAnalyticsApi) {
|
|
130
|
+
var handleFallbackWithAnalytics = exports.handleFallbackWithAnalytics = function handleFallbackWithAnalytics(request, editorAnalyticsApi) {
|
|
132
131
|
return function (state, dispatch) {
|
|
133
132
|
var cardState = _pluginKey.pluginKey.getState(state);
|
|
134
133
|
if (!cardState) {
|
|
@@ -136,7 +135,7 @@ var handleFallbackWithAnalytics = function handleFallbackWithAnalytics(request,
|
|
|
136
135
|
}
|
|
137
136
|
var tr = state.tr;
|
|
138
137
|
if (request.source !== _analytics.INPUT_METHOD.FLOATING_TB) {
|
|
139
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
138
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _utils.getLinkCreationAnalyticsEvent)(request.source, request.url))(tr);
|
|
140
139
|
}
|
|
141
140
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
142
141
|
action: request.analyticsAction,
|
|
@@ -149,8 +148,7 @@ var handleFallbackWithAnalytics = function handleFallbackWithAnalytics(request,
|
|
|
149
148
|
return true;
|
|
150
149
|
};
|
|
151
150
|
};
|
|
152
|
-
exports.
|
|
153
|
-
var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr, source, analyticsAction) {
|
|
151
|
+
var queueCardsFromChangedTr = exports.queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr, source, analyticsAction) {
|
|
154
152
|
var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
155
153
|
var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
156
154
|
var schema = state.schema;
|
|
@@ -186,8 +184,7 @@ var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr, source
|
|
|
186
184
|
}
|
|
187
185
|
return (0, _actions.queueCards)(requests)(tr);
|
|
188
186
|
};
|
|
189
|
-
exports.
|
|
190
|
-
var queueCardFromChangedTr = function queueCardFromChangedTr(state, tr, source, analyticsAction) {
|
|
187
|
+
var queueCardFromChangedTr = exports.queueCardFromChangedTr = function queueCardFromChangedTr(state, tr, source, analyticsAction) {
|
|
191
188
|
var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
192
189
|
var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
193
190
|
var previousAppearance = arguments.length > 6 ? arguments[6] : undefined;
|
|
@@ -223,8 +220,7 @@ var queueCardFromChangedTr = function queueCardFromChangedTr(state, tr, source,
|
|
|
223
220
|
});
|
|
224
221
|
return (0, _actions.queueCards)(requests)(tr);
|
|
225
222
|
};
|
|
226
|
-
exports.
|
|
227
|
-
var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(state, source, appearance) {
|
|
223
|
+
var convertHyperlinkToSmartCard = exports.convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(state, source, appearance) {
|
|
228
224
|
var normalizeLinkText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
229
225
|
var schema = state.schema;
|
|
230
226
|
var link = schema.marks.link;
|
|
@@ -251,8 +247,7 @@ var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(state, so
|
|
|
251
247
|
});
|
|
252
248
|
return (0, _actions.queueCards)(requests)(state.tr);
|
|
253
249
|
};
|
|
254
|
-
exports.
|
|
255
|
-
var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
250
|
+
var changeSelectedCardToLink = exports.changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
256
251
|
return function (state, dispatch) {
|
|
257
252
|
var tr;
|
|
258
253
|
if (node && pos) {
|
|
@@ -263,7 +258,7 @@ var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sen
|
|
|
263
258
|
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node;
|
|
264
259
|
if (sendAnalytics) {
|
|
265
260
|
if (selectedNode) {
|
|
266
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
261
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
267
262
|
action: _analytics.ACTION.CHANGED_TYPE,
|
|
268
263
|
actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
|
|
269
264
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -280,8 +275,7 @@ var changeSelectedCardToLink = function changeSelectedCardToLink(text, href, sen
|
|
|
280
275
|
return true;
|
|
281
276
|
};
|
|
282
277
|
};
|
|
283
|
-
exports.
|
|
284
|
-
var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
278
|
+
var changeSelectedCardToLinkFallback = exports.changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback(text, href, sendAnalytics, node, pos, editorAnalyticsApi) {
|
|
285
279
|
return function (state, dispatch) {
|
|
286
280
|
var tr;
|
|
287
281
|
if (node && pos) {
|
|
@@ -290,7 +284,7 @@ var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback
|
|
|
290
284
|
tr = cardToLinkWithTransaction(state, text, href);
|
|
291
285
|
}
|
|
292
286
|
if (sendAnalytics) {
|
|
293
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
287
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
294
288
|
action: _analytics.ACTION.ERRORED,
|
|
295
289
|
actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
|
|
296
290
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
@@ -305,8 +299,7 @@ var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkFallback
|
|
|
305
299
|
return true;
|
|
306
300
|
};
|
|
307
301
|
};
|
|
308
|
-
exports.
|
|
309
|
-
var updateCard = function updateCard(href, sourceEvent) {
|
|
302
|
+
var updateCard = exports.updateCard = function updateCard(href, sourceEvent) {
|
|
310
303
|
return function (state, dispatch) {
|
|
311
304
|
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node;
|
|
312
305
|
if (!selectedNode) {
|
|
@@ -321,7 +314,6 @@ var updateCard = function updateCard(href, sourceEvent) {
|
|
|
321
314
|
return true;
|
|
322
315
|
};
|
|
323
316
|
};
|
|
324
|
-
exports.updateCard = updateCard;
|
|
325
317
|
function cardToLinkWithTransaction(state, text, href) {
|
|
326
318
|
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node;
|
|
327
319
|
if (!selectedNode) {
|
|
@@ -341,7 +333,7 @@ function cardNodeToLinkWithTransaction(state, text, href, node, pos) {
|
|
|
341
333
|
href: href || url
|
|
342
334
|
})]));
|
|
343
335
|
}
|
|
344
|
-
var changeSelectedCardToText = function changeSelectedCardToText(text, editorAnalyticsApi) {
|
|
336
|
+
var changeSelectedCardToText = exports.changeSelectedCardToText = function changeSelectedCardToText(text, editorAnalyticsApi) {
|
|
345
337
|
return function (state, dispatch) {
|
|
346
338
|
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node;
|
|
347
339
|
if (!selectedNode) {
|
|
@@ -353,14 +345,13 @@ var changeSelectedCardToText = function changeSelectedCardToText(text, editorAna
|
|
|
353
345
|
action: _analytics.ACTION.UNLINK
|
|
354
346
|
});
|
|
355
347
|
tr.scrollIntoView();
|
|
356
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
348
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.unlinkPayload)(_analytics.ACTION_SUBJECT_ID.CARD_INLINE))(tr);
|
|
357
349
|
dispatch(tr);
|
|
358
350
|
}
|
|
359
351
|
return true;
|
|
360
352
|
};
|
|
361
353
|
};
|
|
362
|
-
exports.
|
|
363
|
-
var setSelectedCardAppearance = function setSelectedCardAppearance(appearance, editorAnalyticsApi) {
|
|
354
|
+
var setSelectedCardAppearance = exports.setSelectedCardAppearance = function setSelectedCardAppearance(appearance, editorAnalyticsApi) {
|
|
364
355
|
return function (state, dispatch) {
|
|
365
356
|
var _previousNode$type;
|
|
366
357
|
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node;
|
|
@@ -396,10 +387,10 @@ var setSelectedCardAppearance = function setSelectedCardAppearance(appearance, e
|
|
|
396
387
|
tr.setSelection(_state.TextSelection.create(tr.doc, to + 1));
|
|
397
388
|
var previousNodePos = from - 1 > 0 ? from - 1 : 0;
|
|
398
389
|
var previousNode = tr.doc.nodeAt(previousNodePos);
|
|
399
|
-
if ((previousNode === null || previousNode === void 0
|
|
390
|
+
if ((previousNode === null || previousNode === void 0 || (_previousNode$type = previousNode.type) === null || _previousNode$type === void 0 ? void 0 : _previousNode$type.name) === 'paragraph') {
|
|
400
391
|
tr.delete(previousNodePos, from);
|
|
401
392
|
}
|
|
402
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
393
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
403
394
|
action: _analytics.ACTION.CHANGED_TYPE,
|
|
404
395
|
actionSubject: _analytics.ACTION_SUBJECT.SMART_LINK,
|
|
405
396
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
@@ -417,8 +408,7 @@ var setSelectedCardAppearance = function setSelectedCardAppearance(appearance, e
|
|
|
417
408
|
return true;
|
|
418
409
|
};
|
|
419
410
|
};
|
|
420
|
-
exports.
|
|
421
|
-
var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
411
|
+
var getLinkNodeType = exports.getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
422
412
|
switch (appearance) {
|
|
423
413
|
case 'inline':
|
|
424
414
|
return linkNodes.inlineCard;
|
|
@@ -430,8 +420,7 @@ var getLinkNodeType = function getLinkNodeType(appearance, linkNodes) {
|
|
|
430
420
|
};
|
|
431
421
|
|
|
432
422
|
// Apply an update made from the datasource edit modal to a card
|
|
433
|
-
exports.
|
|
434
|
-
var updateCardFromDatasourceModal = function updateCardFromDatasourceModal(state, node, newAdf, view, sourceEvent) {
|
|
423
|
+
var updateCardFromDatasourceModal = exports.updateCardFromDatasourceModal = function updateCardFromDatasourceModal(state, node, newAdf, view, sourceEvent) {
|
|
435
424
|
var tr = state.tr,
|
|
436
425
|
from = state.selection.from,
|
|
437
426
|
schemaNodes = state.schema.nodes;
|
|
@@ -446,10 +435,10 @@ var updateCardFromDatasourceModal = function updateCardFromDatasourceModal(state
|
|
|
446
435
|
var _ref4 = (_ref6 = node.attrs.datasource.views) !== null && _ref6 !== void 0 ? _ref6 : [],
|
|
447
436
|
_ref5 = (0, _slicedToArray2.default)(_ref4, 1),
|
|
448
437
|
oldViews = _ref5[0];
|
|
449
|
-
var newColumnKeys = newViews === null || newViews === void 0
|
|
438
|
+
var newColumnKeys = newViews === null || newViews === void 0 || (_newViews$properties = newViews.properties) === null || _newViews$properties === void 0 ? void 0 : _newViews$properties.columns.map(function (column) {
|
|
450
439
|
return column.key;
|
|
451
440
|
});
|
|
452
|
-
var oldColumnKeys = oldViews === null || oldViews === void 0
|
|
441
|
+
var oldColumnKeys = oldViews === null || oldViews === void 0 || (_oldViews$properties = oldViews.properties) === null || _oldViews$properties === void 0 ? void 0 : _oldViews$properties.columns.map(function (column) {
|
|
453
442
|
return column.key;
|
|
454
443
|
});
|
|
455
444
|
var isColumnChange = !(0, _isEqual.default)(oldColumnKeys, newColumnKeys);
|
|
@@ -476,8 +465,7 @@ var updateCardFromDatasourceModal = function updateCardFromDatasourceModal(state
|
|
|
476
465
|
(0, _actions.hideDatasourceModal)(tr);
|
|
477
466
|
view.dispatch(tr.scrollIntoView());
|
|
478
467
|
};
|
|
479
|
-
exports.
|
|
480
|
-
var insertDatasource = function insertDatasource(state, adf, view, sourceEvent) {
|
|
468
|
+
var insertDatasource = exports.insertDatasource = function insertDatasource(state, adf, view, sourceEvent) {
|
|
481
469
|
var tr = state.tr,
|
|
482
470
|
from = state.selection.from,
|
|
483
471
|
schemaNodes = state.schema.nodes;
|
|
@@ -494,5 +482,4 @@ var insertDatasource = function insertDatasource(state, adf, view, sourceEvent)
|
|
|
494
482
|
sourceEvent: sourceEvent
|
|
495
483
|
});
|
|
496
484
|
view.dispatch(tr.scrollIntoView());
|
|
497
|
-
};
|
|
498
|
-
exports.insertDatasource = insertDatasource;
|
|
485
|
+
};
|
|
@@ -29,7 +29,7 @@ var _pluginKey = require("./plugin-key");
|
|
|
29
29
|
var _reducers = _interopRequireDefault(require("./reducers"));
|
|
30
30
|
var _resolve = require("./util/resolve");
|
|
31
31
|
var _state2 = require("./util/state");
|
|
32
|
-
var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
32
|
+
var createPlugin = exports.createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
33
33
|
return function (pmPluginFactoryParams) {
|
|
34
34
|
var editorAppearance = options.editorAppearance,
|
|
35
35
|
platform = options.platform,
|
|
@@ -106,7 +106,7 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
106
106
|
if (isDatasource && shouldUpdateTableRef) {
|
|
107
107
|
var _node$attrs2;
|
|
108
108
|
// since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
|
|
109
|
-
var layout = (node === null || node === void 0
|
|
109
|
+
var layout = (node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.layout) || 'center';
|
|
110
110
|
|
|
111
111
|
// we use cardAction to set the same meta, hence, we will need to combine both layout+datasourceTableRef in one transaction
|
|
112
112
|
dispatch((0, _actions.setCardLayoutAndDatasourceTableRef)({
|
|
@@ -135,8 +135,8 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
135
135
|
* other tasks as per common implementations of the JavaScript event loop in browsers.
|
|
136
136
|
*/
|
|
137
137
|
var invoke = (0, _rafSchd.default)(function () {
|
|
138
|
-
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3
|
|
139
|
-
return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0
|
|
138
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3;
|
|
139
|
+
return (0, _resolve.resolveWithProvider)(view, provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
|
|
140
140
|
});
|
|
141
141
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
142
142
|
invoke();
|
|
@@ -148,7 +148,7 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
148
148
|
* so subscribers can now be notified and dispatch
|
|
149
149
|
* analytics events
|
|
150
150
|
*/
|
|
151
|
-
cardPluginEvents === null || cardPluginEvents === void 0
|
|
151
|
+
cardPluginEvents === null || cardPluginEvents === void 0 || cardPluginEvents.flush();
|
|
152
152
|
},
|
|
153
153
|
destroy: function destroy() {
|
|
154
154
|
// Cancel any outstanding raf callbacks.
|
|
@@ -173,8 +173,8 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
173
173
|
var hasIntlContext = true;
|
|
174
174
|
var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.datasource);
|
|
175
175
|
if (isDatasource) {
|
|
176
|
-
var _node$attrs4
|
|
177
|
-
if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0
|
|
176
|
+
var _node$attrs4;
|
|
177
|
+
if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.datasource) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.id)) {
|
|
178
178
|
return new _datasource.Datasource({
|
|
179
179
|
node: node,
|
|
180
180
|
view: view,
|
|
@@ -210,5 +210,4 @@ var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
210
210
|
key: _pluginKey.pluginKey
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
|
-
};
|
|
214
|
-
exports.createPlugin = createPlugin;
|
|
213
|
+
};
|
|
@@ -28,12 +28,12 @@ var getToolbarViewedItem = function getToolbarViewedItem(link) {
|
|
|
28
28
|
}
|
|
29
29
|
return [];
|
|
30
30
|
};
|
|
31
|
-
var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
|
|
31
|
+
var mountHyperlinkPlugin = exports.mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, options) {
|
|
32
32
|
return new _safePlugin.SafePlugin({
|
|
33
33
|
view: function view(editorView) {
|
|
34
34
|
requestAnimationFrame(function () {
|
|
35
|
-
var _pluginInjectionApi$h
|
|
36
|
-
pluginInjectionApi === null || pluginInjectionApi === void 0
|
|
35
|
+
var _pluginInjectionApi$h;
|
|
36
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$h = pluginInjectionApi.hyperlink) === null || _pluginInjectionApi$h === void 0 || (_pluginInjectionApi$h = _pluginInjectionApi$h.actions) === null || _pluginInjectionApi$h === void 0 || _pluginInjectionApi$h.prependToolbarButtons({
|
|
37
37
|
items: function items(state, intl, providerFactory, link) {
|
|
38
38
|
return [].concat((0, _toConsumableArray2.default)(getToolbarViewedItem(link)), [{
|
|
39
39
|
type: 'custom',
|
|
@@ -49,8 +49,8 @@ var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, opt
|
|
|
49
49
|
cardOptions: options,
|
|
50
50
|
providerFactory: providerFactory,
|
|
51
51
|
platform: options === null || options === void 0 ? void 0 : options.platform,
|
|
52
|
-
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0
|
|
53
|
-
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0
|
|
52
|
+
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
53
|
+
cardActions: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
}]);
|
|
@@ -63,5 +63,4 @@ var mountHyperlinkPlugin = function mountHyperlinkPlugin(pluginInjectionApi, opt
|
|
|
63
63
|
return {};
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
};
|
|
67
|
-
exports.mountHyperlinkPlugin = mountHyperlinkPlugin;
|
|
66
|
+
};
|
|
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pluginKey = void 0;
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var pluginKey = new _state.PluginKey('cardPlugin');
|
|
9
|
-
exports.pluginKey = pluginKey;
|
|
8
|
+
var pluginKey = exports.pluginKey = new _state.PluginKey('cardPlugin');
|
|
@@ -74,7 +74,7 @@ var hideDatasourceModal = function hideDatasourceModal(state) {
|
|
|
74
74
|
datasourceModalType: undefined
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
-
var _default = function _default(state, action) {
|
|
77
|
+
var _default = exports.default = function _default(state, action) {
|
|
78
78
|
switch (action.type) {
|
|
79
79
|
case 'QUEUE':
|
|
80
80
|
return queue(state, action);
|
|
@@ -100,5 +100,4 @@ var _default = function _default(state, action) {
|
|
|
100
100
|
case 'HIDE_DATASOURCE_MODAL':
|
|
101
101
|
return hideDatasourceModal(state);
|
|
102
102
|
}
|
|
103
|
-
};
|
|
104
|
-
exports.default = _default;
|
|
103
|
+
};
|
|
@@ -12,7 +12,7 @@ var _doc = require("../doc");
|
|
|
12
12
|
// ============================================================================ //
|
|
13
13
|
// Used for all interactions with the EditorCardProvider.
|
|
14
14
|
// ============================================================================ //
|
|
15
|
-
var resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) {
|
|
15
|
+
var resolveWithProvider = exports.resolveWithProvider = function resolveWithProvider(view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent) {
|
|
16
16
|
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
17
17
|
var shouldForceAppearance =
|
|
18
18
|
// This flag is set to true only in one place atm:
|
|
@@ -22,7 +22,6 @@ var resolveWithProvider = function resolveWithProvider(view, provider, request,
|
|
|
22
22
|
var handleResolve = provider.resolve(request.url, request.appearance, shouldForceAppearance).then(handleResolved(view, request, editorAnalyticsApi, createAnalyticsEvent, options), handleRejected(view, request, editorAnalyticsApi));
|
|
23
23
|
return handleResolve;
|
|
24
24
|
};
|
|
25
|
-
exports.resolveWithProvider = resolveWithProvider;
|
|
26
25
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
|
27
26
|
if (resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs) {
|
|
28
27
|
var datasourceId = resolvedCard.attrs.datasource.id;
|
|
@@ -55,7 +54,7 @@ var handleRejected = function handleRejected(view, request, editorAnalyticsApi)
|
|
|
55
54
|
};
|
|
56
55
|
|
|
57
56
|
// listen for card provider changes
|
|
58
|
-
var handleProvider = function handleProvider(_, provider, view) {
|
|
57
|
+
var handleProvider = exports.handleProvider = function handleProvider(_, provider, view) {
|
|
59
58
|
if (!provider) {
|
|
60
59
|
return;
|
|
61
60
|
}
|
|
@@ -64,5 +63,4 @@ var handleProvider = function handleProvider(_, provider, view) {
|
|
|
64
63
|
dispatch = view.dispatch;
|
|
65
64
|
dispatch((0, _actions.setProvider)(cardProvider)(state.tr));
|
|
66
65
|
});
|
|
67
|
-
};
|
|
68
|
-
exports.handleProvider = handleProvider;
|
|
66
|
+
};
|
|
@@ -14,11 +14,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
14
|
// ============================================================================ //
|
|
15
15
|
// Used for interactions with the Card Plugin's state.
|
|
16
16
|
// ============================================================================ //
|
|
17
|
-
var getPluginState = function getPluginState(editorState) {
|
|
17
|
+
var getPluginState = exports.getPluginState = function getPluginState(editorState) {
|
|
18
18
|
return _pluginKey.pluginKey.getState(editorState);
|
|
19
19
|
};
|
|
20
|
-
exports.
|
|
21
|
-
var getPluginStateWithUpdatedPos = function getPluginStateWithUpdatedPos(pluginState, tr) {
|
|
20
|
+
var getPluginStateWithUpdatedPos = exports.getPluginStateWithUpdatedPos = function getPluginStateWithUpdatedPos(pluginState, tr) {
|
|
22
21
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
23
22
|
requests: pluginState.requests.map(function (request) {
|
|
24
23
|
return _objectSpread(_objectSpread({}, request), {}, {
|
|
@@ -32,8 +31,7 @@ var getPluginStateWithUpdatedPos = function getPluginStateWithUpdatedPos(pluginS
|
|
|
32
31
|
})
|
|
33
32
|
});
|
|
34
33
|
};
|
|
35
|
-
exports.
|
|
36
|
-
var getNewRequests = function getNewRequests(oldState, currentState) {
|
|
34
|
+
var getNewRequests = exports.getNewRequests = function getNewRequests(oldState, currentState) {
|
|
37
35
|
if (oldState) {
|
|
38
36
|
return currentState.requests.filter(function (req) {
|
|
39
37
|
return !oldState.requests.find(function (oldReq) {
|
|
@@ -43,7 +41,6 @@ var getNewRequests = function getNewRequests(oldState, currentState) {
|
|
|
43
41
|
}
|
|
44
42
|
return currentState.requests;
|
|
45
43
|
};
|
|
46
|
-
exports.getNewRequests = getNewRequests;
|
|
47
44
|
var isSameRequest = function isSameRequest(requestA, requestB) {
|
|
48
45
|
return requestA.url === requestB.url && requestA.pos === requestB.pos;
|
|
49
46
|
};
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
34
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
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; }
|
|
36
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; }
|
|
37
|
-
var removeCard = function removeCard(editorAnalyticsApi) {
|
|
37
|
+
var removeCard = exports.removeCard = function removeCard(editorAnalyticsApi) {
|
|
38
38
|
return (0, _card.commandWithMetadata)(function (state, dispatch) {
|
|
39
39
|
if (!(state.selection instanceof _state.NodeSelection)) {
|
|
40
40
|
return false;
|
|
@@ -53,7 +53,7 @@ var removeCard = function removeCard(editorAnalyticsApi) {
|
|
|
53
53
|
if (dispatch) {
|
|
54
54
|
var tr = state.tr;
|
|
55
55
|
(0, _utils2.removeSelectedNode)(tr);
|
|
56
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
56
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(payload)(tr);
|
|
57
57
|
dispatch(tr);
|
|
58
58
|
}
|
|
59
59
|
return true;
|
|
@@ -61,8 +61,7 @@ var removeCard = function removeCard(editorAnalyticsApi) {
|
|
|
61
61
|
action: _analytics.ACTION.DELETED
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
-
exports.
|
|
65
|
-
var visitCardLink = function visitCardLink(editorAnalyticsApi) {
|
|
64
|
+
var visitCardLink = exports.visitCardLink = function visitCardLink(editorAnalyticsApi) {
|
|
66
65
|
return function (state, dispatch) {
|
|
67
66
|
if (!(state.selection instanceof _state.NodeSelection)) {
|
|
68
67
|
return false;
|
|
@@ -76,14 +75,13 @@ var visitCardLink = function visitCardLink(editorAnalyticsApi) {
|
|
|
76
75
|
window.open(url);
|
|
77
76
|
if (dispatch) {
|
|
78
77
|
var tr = state.tr;
|
|
79
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
78
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildVisitedLinkPayload)(type.name))(tr);
|
|
80
79
|
dispatch(tr);
|
|
81
80
|
}
|
|
82
81
|
return true;
|
|
83
82
|
};
|
|
84
83
|
};
|
|
85
|
-
exports.
|
|
86
|
-
var openLinkSettings = function openLinkSettings(editorAnalyticsApi) {
|
|
84
|
+
var openLinkSettings = exports.openLinkSettings = function openLinkSettings(editorAnalyticsApi) {
|
|
87
85
|
return function (state, dispatch) {
|
|
88
86
|
if (!(state.selection instanceof _state.NodeSelection)) {
|
|
89
87
|
return false;
|
|
@@ -92,14 +90,13 @@ var openLinkSettings = function openLinkSettings(editorAnalyticsApi) {
|
|
|
92
90
|
if (dispatch) {
|
|
93
91
|
var tr = state.tr,
|
|
94
92
|
type = state.selection.node.type;
|
|
95
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0
|
|
93
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _analytics.buildOpenedSettingsPayload)(type.name))(tr);
|
|
96
94
|
dispatch(tr);
|
|
97
95
|
}
|
|
98
96
|
return true;
|
|
99
97
|
};
|
|
100
98
|
};
|
|
101
|
-
exports.
|
|
102
|
-
var floatingToolbar = function floatingToolbar(cardOptions, featureFlags, platform, linkPickerOptions, pluginInjectionApi) {
|
|
99
|
+
var floatingToolbar = exports.floatingToolbar = function floatingToolbar(cardOptions, featureFlags, platform, linkPickerOptions, pluginInjectionApi) {
|
|
103
100
|
return function (state, intl, providerFactory) {
|
|
104
101
|
var _state$schema$nodes = state.schema.nodes,
|
|
105
102
|
inlineCard = _state$schema$nodes.inlineCard,
|
|
@@ -154,7 +151,6 @@ var floatingToolbar = function floatingToolbar(cardOptions, featureFlags, platfo
|
|
|
154
151
|
}, (0, _EditLinkToolbar.editLinkToolbarConfig)(Boolean(pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLinkingToolbar), isLinkPickerEnabled));
|
|
155
152
|
};
|
|
156
153
|
};
|
|
157
|
-
exports.floatingToolbar = floatingToolbar;
|
|
158
154
|
var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
159
155
|
var displayInfo = (0, _utils3.displayInfoForCard)(node, (0, _utils3.findCardInfo)(state));
|
|
160
156
|
var text = displayInfo.title || displayInfo.url;
|
|
@@ -197,7 +193,7 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
197
193
|
};
|
|
198
194
|
var generateToolbarItems = function generateToolbarItems(state, featureFlags, intl, providerFactory, cardOptions, platform, linkPicker, pluginInjectionApi) {
|
|
199
195
|
return function (node) {
|
|
200
|
-
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs2
|
|
196
|
+
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _node$attrs, _node$attrs2;
|
|
201
197
|
var _titleUrlPairFromNode2 = (0, _utils3.titleUrlPairFromNode)(node),
|
|
202
198
|
url = _titleUrlPairFromNode2.url;
|
|
203
199
|
var _ref = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
@@ -215,12 +211,12 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
215
211
|
}
|
|
216
212
|
var pluginState = _main.pluginKey.getState(state);
|
|
217
213
|
var currentAppearance = (0, _utils3.appearanceForNodeType)(node.type);
|
|
218
|
-
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0
|
|
214
|
+
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
219
215
|
hoverDecoration = _ref2.hoverDecoration;
|
|
220
|
-
var isDatasource = currentAppearance === 'block' && (node === null || node === void 0
|
|
216
|
+
var isDatasource = currentAppearance === 'block' && (node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.datasource);
|
|
221
217
|
var shouldRenderDatasourceToolbar = isDatasource &&
|
|
222
218
|
// not showing toolbar in mobile for now since not sure what our plans are for it
|
|
223
|
-
platform !== 'mobile' && cardOptions.allowDatasource && (0, _utils.canRenderDatasource)(node === null || node === void 0
|
|
219
|
+
platform !== 'mobile' && cardOptions.allowDatasource && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.datasource) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.id);
|
|
224
220
|
|
|
225
221
|
/* mobile builds toolbar natively using toolbarItems */
|
|
226
222
|
if (pluginState !== null && pluginState !== void 0 && pluginState.showLinkingToolbar && platform !== 'mobile') {
|
|
@@ -280,7 +276,7 @@ var generateToolbarItems = function generateToolbarItems(state, featureFlags, in
|
|
|
280
276
|
}]);
|
|
281
277
|
if (currentAppearance === 'embed') {
|
|
282
278
|
var _pluginInjectionApi$a2;
|
|
283
|
-
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0
|
|
279
|
+
var alignmentOptions = buildAlignmentOptions(state, intl, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.width, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions, cardOptions);
|
|
284
280
|
if (alignmentOptions.length) {
|
|
285
281
|
alignmentOptions.push({
|
|
286
282
|
type: 'separator'
|
|
@@ -20,7 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
20
20
|
* and children render function
|
|
21
21
|
*/
|
|
22
22
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
23
|
-
var CardContextProvider = /*#__PURE__*/function (_React$Component) {
|
|
23
|
+
var CardContextProvider = exports.CardContextProvider = /*#__PURE__*/function (_React$Component) {
|
|
24
24
|
(0, _inherits2.default)(CardContextProvider, _React$Component);
|
|
25
25
|
var _super = _createSuper(CardContextProvider);
|
|
26
26
|
function CardContextProvider() {
|
|
@@ -39,7 +39,6 @@ var CardContextProvider = /*#__PURE__*/function (_React$Component) {
|
|
|
39
39
|
}]);
|
|
40
40
|
return CardContextProvider;
|
|
41
41
|
}(_react.default.Component);
|
|
42
|
-
exports.CardContextProvider = CardContextProvider;
|
|
43
42
|
(0, _defineProperty2.default)(CardContextProvider, "contextTypes", {
|
|
44
43
|
contextAdapter: _propTypes.default.object
|
|
45
44
|
});
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
|
+
var _datasourceErrorBoundary = require("../../datasourceErrorBoundary");
|
|
10
11
|
var _index = require("./index");
|
|
11
12
|
var ModalWithState = function ModalWithState(_ref) {
|
|
12
13
|
var api = _ref.api,
|
|
@@ -16,10 +17,11 @@ var ModalWithState = function ModalWithState(_ref) {
|
|
|
16
17
|
if (!(cardState !== null && cardState !== void 0 && cardState.showDatasourceModal)) {
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
19
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_datasourceErrorBoundary.DatasourceErrorBoundary, {
|
|
21
|
+
view: editorView
|
|
22
|
+
}, /*#__PURE__*/_react.default.createElement(_index.DatasourceModal, {
|
|
20
23
|
view: editorView,
|
|
21
24
|
modalType: cardState === null || cardState === void 0 ? void 0 : cardState.datasourceModalType
|
|
22
|
-
});
|
|
25
|
+
}));
|
|
23
26
|
};
|
|
24
|
-
var _default = ModalWithState;
|
|
25
|
-
exports.default = _default;
|
|
27
|
+
var _default = exports.default = ModalWithState;
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
18
|
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; }
|
|
19
19
|
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; }
|
|
20
|
-
var DatasourceModal = function DatasourceModal(_ref) {
|
|
20
|
+
var DatasourceModal = exports.DatasourceModal = function DatasourceModal(_ref) {
|
|
21
21
|
var view = _ref.view,
|
|
22
22
|
modalType = _ref.modalType;
|
|
23
23
|
var dispatch = view.dispatch,
|
|
@@ -45,7 +45,7 @@ var DatasourceModal = function DatasourceModal(_ref) {
|
|
|
45
45
|
}, [existingNode, state, view]);
|
|
46
46
|
if (modalType === 'jira') {
|
|
47
47
|
var _existingNode$attrs, _tableView$properties;
|
|
48
|
-
var _ref2 = (existingNode === null || existingNode === void 0
|
|
48
|
+
var _ref2 = (existingNode === null || existingNode === void 0 || (_existingNode$attrs = existingNode.attrs) === null || _existingNode$attrs === void 0 ? void 0 : _existingNode$attrs.datasource) || {},
|
|
49
49
|
_ref2$id = _ref2.id,
|
|
50
50
|
datasourceId = _ref2$id === void 0 ? _linkDatasource.JIRA_LIST_OF_LINKS_DATASOURCE_ID : _ref2$id,
|
|
51
51
|
parameters = _ref2.parameters,
|
|
@@ -54,7 +54,7 @@ var DatasourceModal = function DatasourceModal(_ref) {
|
|
|
54
54
|
var _ref3 = views,
|
|
55
55
|
_ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
56
56
|
tableView = _ref4[0];
|
|
57
|
-
var visibleColumnKeys = tableView === null || tableView === void 0
|
|
57
|
+
var visibleColumnKeys = tableView === null || tableView === void 0 || (_tableView$properties = tableView.properties) === null || _tableView$properties === void 0 ? void 0 : _tableView$properties.columns.map(function (column) {
|
|
58
58
|
return column.key;
|
|
59
59
|
});
|
|
60
60
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -69,7 +69,7 @@ var DatasourceModal = function DatasourceModal(_ref) {
|
|
|
69
69
|
}
|
|
70
70
|
if (modalType === 'assets') {
|
|
71
71
|
var _existingNode$attrs2, _tableView$properties2;
|
|
72
|
-
var _ref5 = (existingNode === null || existingNode === void 0
|
|
72
|
+
var _ref5 = (existingNode === null || existingNode === void 0 || (_existingNode$attrs2 = existingNode.attrs) === null || _existingNode$attrs2 === void 0 ? void 0 : _existingNode$attrs2.datasource) || {},
|
|
73
73
|
_ref5$id = _ref5.id,
|
|
74
74
|
_datasourceId = _ref5$id === void 0 ? _linkDatasource.ASSETS_LIST_OF_LINKS_DATASOURCE_ID : _ref5$id,
|
|
75
75
|
_parameters = _ref5.parameters,
|
|
@@ -78,7 +78,7 @@ var DatasourceModal = function DatasourceModal(_ref) {
|
|
|
78
78
|
var _ref6 = _views,
|
|
79
79
|
_ref7 = (0, _slicedToArray2.default)(_ref6, 1),
|
|
80
80
|
_tableView = _ref7[0];
|
|
81
|
-
var _visibleColumnKeys = _tableView === null || _tableView === void 0
|
|
81
|
+
var _visibleColumnKeys = _tableView === null || _tableView === void 0 || (_tableView$properties2 = _tableView.properties) === null || _tableView$properties2 === void 0 ? void 0 : _tableView$properties2.columns.map(function (column) {
|
|
82
82
|
return column.key;
|
|
83
83
|
});
|
|
84
84
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -92,5 +92,4 @@ var DatasourceModal = function DatasourceModal(_ref) {
|
|
|
92
92
|
}));
|
|
93
93
|
}
|
|
94
94
|
return null; // null for now until we have modal component that handles other datasources
|
|
95
|
-
};
|
|
96
|
-
exports.DatasourceModal = DatasourceModal;
|
|
95
|
+
};
|