@atlaskit/editor-plugin-card 32.1.2 → 32.1.4
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 +15 -15
- package/dist/cjs/nodeviews/blockCard.js +10 -9
- package/dist/cjs/nodeviews/datasource.js +8 -7
- package/dist/cjs/nodeviews/embedCard.js +21 -18
- package/dist/cjs/nodeviews/genericCard.js +7 -7
- package/dist/cjs/nodeviews/inlineCard.js +4 -4
- package/dist/cjs/nodeviews/inlineCardBase.js +6 -6
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +10 -10
- package/dist/cjs/nodeviews/toDOM-fixes/blockCard.js +2 -2
- package/dist/cjs/nodeviews/toDOM-fixes/embedCard.js +6 -6
- package/dist/cjs/nodeviews/toDOM-fixes/inlineCard.js +2 -2
- package/dist/cjs/pm-plugins/doc.js +45 -40
- package/dist/cjs/pm-plugins/main.js +8 -8
- package/dist/cjs/pm-plugins/shouldReplaceLink.js +4 -4
- package/dist/cjs/pm-plugins/util/resolve.js +2 -1
- package/dist/cjs/ui/ConfigureOverlay/index.js +2 -2
- package/dist/cjs/ui/DatasourceAppearanceButton.js +7 -6
- package/dist/cjs/ui/DatasourceDropdownOption.js +5 -5
- package/dist/cjs/ui/DatasourceModal/ModalWithState.js +2 -2
- package/dist/cjs/ui/EditLinkToolbar.js +16 -15
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -17
- package/dist/cjs/ui/EditToolbarButton/index.js +18 -15
- package/dist/cjs/ui/EditorAnalyticsContext.js +2 -2
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/common.js +11 -11
- package/dist/cjs/ui/EditorSmartCardEvents.js +2 -2
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +4 -4
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +8 -6
- package/dist/cjs/ui/InlineCardOverlay/index.js +3 -3
- package/dist/cjs/ui/LayoutButton/index.js +6 -6
- package/dist/cjs/ui/LinkToolbarAppearance.js +23 -22
- package/dist/cjs/ui/LinkToolbarAppearanceDropdown.js +20 -17
- package/dist/cjs/ui/OpenLinkToolbarButton/index.js +2 -2
- package/dist/cjs/ui/OpenPreviewButton/index.js +9 -9
- package/dist/cjs/ui/PasteDisplayAsMenu.js +21 -18
- package/dist/cjs/ui/ResizableEmbedCard.js +17 -14
- package/dist/cjs/ui/SmartCardSSRReactContextsProvider.js +2 -2
- package/dist/cjs/ui/analytics/events-from-tr.js +7 -6
- package/dist/cjs/ui/editDatasourceAction.js +5 -5
- package/dist/cjs/ui/nativeEmbedNode.js +6 -6
- package/dist/cjs/ui/preview/PreviewInvoker.js +2 -2
- package/dist/cjs/ui/quick-insert/DatasourceQuickInsertMenuItem.js +5 -5
- package/dist/cjs/ui/quick-insert/getCardQuickInsertComponents.js +11 -11
- package/dist/cjs/ui/toolbar.js +75 -68
- package/dist/es2019/cardPlugin.js +3 -3
- package/dist/es2019/nodeviews/blockCard.js +4 -3
- package/dist/es2019/nodeviews/datasource.js +4 -3
- package/dist/es2019/nodeviews/embedCard.js +8 -5
- package/dist/es2019/nodeviews/genericCard.js +2 -2
- package/dist/es2019/nodeviews/inlineCard.js +2 -2
- package/dist/es2019/nodeviews/inlineCardBase.js +3 -3
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +3 -3
- package/dist/es2019/nodeviews/toDOM-fixes/blockCard.js +1 -1
- package/dist/es2019/nodeviews/toDOM-fixes/embedCard.js +2 -2
- package/dist/es2019/nodeviews/toDOM-fixes/inlineCard.js +1 -1
- package/dist/es2019/pm-plugins/doc.js +8 -3
- package/dist/es2019/pm-plugins/main.js +3 -3
- package/dist/es2019/pm-plugins/shouldReplaceLink.js +1 -1
- package/dist/es2019/pm-plugins/util/resolve.js +2 -1
- package/dist/es2019/ui/ConfigureOverlay/index.js +1 -1
- package/dist/es2019/ui/DatasourceAppearanceButton.js +3 -3
- package/dist/es2019/ui/DatasourceDropdownOption.js +1 -1
- package/dist/es2019/ui/DatasourceModal/ModalWithState.js +1 -1
- package/dist/es2019/ui/EditLinkToolbar.js +6 -5
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +6 -3
- package/dist/es2019/ui/EditToolbarButton/index.js +6 -3
- package/dist/es2019/ui/EditorAnalyticsContext.js +1 -1
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/common.js +1 -1
- package/dist/es2019/ui/EditorSmartCardEvents.js +1 -1
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +2 -2
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +4 -2
- package/dist/es2019/ui/InlineCardOverlay/index.js +2 -2
- package/dist/es2019/ui/LayoutButton/index.js +3 -3
- package/dist/es2019/ui/LinkToolbarAppearance.js +6 -3
- package/dist/es2019/ui/LinkToolbarAppearanceDropdown.js +6 -3
- package/dist/es2019/ui/OpenLinkToolbarButton/index.js +1 -1
- package/dist/es2019/ui/OpenPreviewButton/index.js +3 -3
- package/dist/es2019/ui/PasteDisplayAsMenu.js +7 -4
- package/dist/es2019/ui/ResizableEmbedCard.js +6 -3
- package/dist/es2019/ui/SmartCardSSRReactContextsProvider.js +1 -1
- package/dist/es2019/ui/analytics/events-from-tr.js +4 -3
- package/dist/es2019/ui/editDatasourceAction.js +1 -1
- package/dist/es2019/ui/nativeEmbedNode.js +2 -2
- package/dist/es2019/ui/preview/PreviewInvoker.js +1 -1
- package/dist/es2019/ui/quick-insert/DatasourceQuickInsertMenuItem.js +1 -1
- package/dist/es2019/ui/quick-insert/getCardQuickInsertComponents.js +2 -2
- package/dist/es2019/ui/toolbar.js +15 -8
- package/dist/esm/cardPlugin.js +3 -3
- package/dist/esm/nodeviews/blockCard.js +4 -3
- package/dist/esm/nodeviews/datasource.js +4 -3
- package/dist/esm/nodeviews/embedCard.js +8 -5
- package/dist/esm/nodeviews/genericCard.js +2 -2
- package/dist/esm/nodeviews/inlineCard.js +2 -2
- package/dist/esm/nodeviews/inlineCardBase.js +3 -3
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +3 -3
- package/dist/esm/nodeviews/toDOM-fixes/blockCard.js +1 -1
- package/dist/esm/nodeviews/toDOM-fixes/embedCard.js +2 -2
- package/dist/esm/nodeviews/toDOM-fixes/inlineCard.js +1 -1
- package/dist/esm/pm-plugins/doc.js +8 -3
- package/dist/esm/pm-plugins/main.js +3 -3
- package/dist/esm/pm-plugins/shouldReplaceLink.js +1 -1
- package/dist/esm/pm-plugins/util/resolve.js +2 -1
- package/dist/esm/ui/ConfigureOverlay/index.js +1 -1
- package/dist/esm/ui/DatasourceAppearanceButton.js +3 -3
- package/dist/esm/ui/DatasourceDropdownOption.js +1 -1
- package/dist/esm/ui/DatasourceModal/ModalWithState.js +1 -1
- package/dist/esm/ui/EditLinkToolbar.js +6 -5
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +6 -3
- package/dist/esm/ui/EditToolbarButton/index.js +6 -3
- package/dist/esm/ui/EditorAnalyticsContext.js +1 -1
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/common.js +1 -1
- package/dist/esm/ui/EditorSmartCardEvents.js +1 -1
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +2 -2
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +4 -2
- package/dist/esm/ui/InlineCardOverlay/index.js +2 -2
- package/dist/esm/ui/LayoutButton/index.js +3 -3
- package/dist/esm/ui/LinkToolbarAppearance.js +6 -3
- package/dist/esm/ui/LinkToolbarAppearanceDropdown.js +6 -3
- package/dist/esm/ui/OpenLinkToolbarButton/index.js +1 -1
- package/dist/esm/ui/OpenPreviewButton/index.js +3 -3
- package/dist/esm/ui/PasteDisplayAsMenu.js +7 -4
- package/dist/esm/ui/ResizableEmbedCard.js +6 -3
- package/dist/esm/ui/SmartCardSSRReactContextsProvider.js +1 -1
- package/dist/esm/ui/analytics/events-from-tr.js +4 -3
- package/dist/esm/ui/editDatasourceAction.js +1 -1
- package/dist/esm/ui/nativeEmbedNode.js +2 -2
- package/dist/esm/ui/preview/PreviewInvoker.js +1 -1
- package/dist/esm/ui/quick-insert/DatasourceQuickInsertMenuItem.js +1 -1
- package/dist/esm/ui/quick-insert/getCardQuickInsertComponents.js +2 -2
- package/dist/esm/ui/toolbar.js +15 -8
- package/dist/types/cardPluginType.d.ts +20 -18
- package/dist/types/nodeviews/blockCard.d.ts +2 -2
- package/dist/types/nodeviews/datasource.d.ts +3 -3
- package/dist/types/nodeviews/embedCard.d.ts +2 -1
- package/dist/types/nodeviews/genericCard.d.ts +7 -6
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/nodeviews/lazy-inline-card.d.ts +1 -1
- package/dist/types/pm-plugins/actions.d.ts +3 -3
- package/dist/types/pm-plugins/doc.d.ts +5 -5
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types/pm-plugins/util/resolve.d.ts +4 -3
- package/dist/types/pm-plugins/util/state.d.ts +6 -5
- package/dist/types/pm-plugins/utils.d.ts +2 -2
- package/dist/types/types/index.d.ts +8 -5
- package/dist/types/ui/DatasourceAppearanceButton.d.ts +1 -1
- package/dist/types/ui/DatasourceDropdownOption.d.ts +1 -1
- package/dist/types/ui/DatasourceModal/ModalWithState.d.ts +2 -1
- package/dist/types/ui/DatasourceModal/index.d.ts +1 -1
- package/dist/types/ui/EditLinkToolbar.d.ts +8 -5
- package/dist/types/ui/EditToolbarButton/types.d.ts +2 -2
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +3 -3
- package/dist/types/ui/HyperlinkToolbarAppearanceDropdown.d.ts +2 -1
- package/dist/types/ui/LayoutButton/types.d.ts +1 -1
- package/dist/types/ui/LinkToolbarAppearance.d.ts +2 -2
- package/dist/types/ui/LinkToolbarAppearanceDropdown.d.ts +2 -1
- package/dist/types/ui/OpenLinkToolbarButton/index.d.ts +1 -1
- package/dist/types/ui/OpenPreviewButton/index.d.ts +1 -1
- package/dist/types/ui/PasteDisplayAsMenu.d.ts +1 -1
- package/dist/types/ui/ResizableEmbedCard.d.ts +1 -1
- package/dist/types/ui/analytics/utils.d.ts +1 -1
- package/dist/types/ui/datasourceErrorBoundary.d.ts +1 -1
- package/dist/types/ui/editDatasourceAction.d.ts +2 -2
- package/dist/types/ui/hooks/useLinkUpgradeDiscoverability.d.ts +1 -1
- package/dist/types/ui/nativeEmbedNode.d.ts +1 -1
- package/dist/types/ui/quick-insert/DatasourceQuickInsertMenuItem.d.ts +1 -1
- package/dist/types/ui/quick-insert/getCardQuickInsertComponents.d.ts +1 -1
- package/dist/types/ui/toolbar.d.ts +7 -4
- package/package.json +2 -2
|
@@ -10,10 +10,15 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
12
12
|
var _isSafeUrl = require("@atlaskit/adf-schema/is-safe-url");
|
|
13
|
-
var
|
|
13
|
+
var _linkingUtils = require("@atlaskit/editor-common/analytics/linking-utils");
|
|
14
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
15
|
+
var _nodeEvents = require("@atlaskit/editor-common/analytics/types/node-events");
|
|
14
16
|
var _card = require("@atlaskit/editor-common/card");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
+
var _utils = require("@atlaskit/editor-common/link/utils");
|
|
18
|
+
var _processRawValue3 = require("@atlaskit/editor-common/process-raw-value");
|
|
19
|
+
var _annotation = require("@atlaskit/editor-common/utils/annotation");
|
|
20
|
+
var _document = require("@atlaskit/editor-common/utils/document");
|
|
21
|
+
var _hyperlink = require("@atlaskit/editor-common/utils/hyperlink");
|
|
17
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
23
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
24
|
var _closeHistory = require("@atlaskit/prosemirror-history/closeHistory");
|
|
@@ -53,7 +58,7 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
53
58
|
nodes.push(schema.text(' '));
|
|
54
59
|
}
|
|
55
60
|
tr.replaceWith(pos, pos + (node.text || url).length, nodes);
|
|
56
|
-
var annotationMarksForPos = (0,
|
|
61
|
+
var annotationMarksForPos = (0, _annotation.getAnnotationMarksForPos)($head);
|
|
57
62
|
if (annotationMarksForPos && annotationMarksForPos.length > 0) {
|
|
58
63
|
annotationMarksForPos.forEach(function (annotationMark) {
|
|
59
64
|
// Add the annotation mark on to the inlineCard node and the trailing space node.
|
|
@@ -99,7 +104,7 @@ var replaceQueuedUrlWithCard = exports.replaceQueuedUrlWithCard = function repla
|
|
|
99
104
|
// Build a fresh transaction (editorState is the snapshot at call-time; positions
|
|
100
105
|
// are mapped through it). For the async case we fall back to cardData if the
|
|
101
106
|
// transform returned nothing, mirroring what the sync path would do.
|
|
102
|
-
var asyncCardAdf = resolvedNode ? resolvedNode : (_processRawValue = (0,
|
|
107
|
+
var asyncCardAdf = resolvedNode ? resolvedNode : (_processRawValue = (0, _processRawValue3.processRawValue)(schema, cardData)) !== null && _processRawValue !== void 0 ? _processRawValue : null;
|
|
103
108
|
var asyncTr = editorState.tr;
|
|
104
109
|
if (asyncCardAdf) {
|
|
105
110
|
pendingRequests.forEach(function (request) {
|
|
@@ -114,7 +119,7 @@ var replaceQueuedUrlWithCard = exports.replaceQueuedUrlWithCard = function repla
|
|
|
114
119
|
}
|
|
115
120
|
if (!cardAdf) {
|
|
116
121
|
var _processRawValue2;
|
|
117
|
-
cardAdf = (_processRawValue2 = (0,
|
|
122
|
+
cardAdf = (_processRawValue2 = (0, _processRawValue3.processRawValue)(schema, cardData)) !== null && _processRawValue2 !== void 0 ? _processRawValue2 : null;
|
|
118
123
|
}
|
|
119
124
|
var tr = editorState.tr;
|
|
120
125
|
if (cardAdf) {
|
|
@@ -150,15 +155,15 @@ var replaceQueuedUrlWithCard = exports.replaceQueuedUrlWithCard = function repla
|
|
|
150
155
|
var sourceEvent = requests[0].sourceEvent;
|
|
151
156
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
152
157
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
-
action: analyticsAction ||
|
|
154
|
-
actionSubject:
|
|
155
|
-
actionSubjectId:
|
|
156
|
-
eventType:
|
|
158
|
+
action: analyticsAction || _enums.ACTION.INSERTED,
|
|
159
|
+
actionSubject: _enums.ACTION_SUBJECT.DOCUMENT,
|
|
160
|
+
actionSubjectId: _enums.ACTION_SUBJECT_ID.SMART_LINK,
|
|
161
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
157
162
|
attributes: {
|
|
158
163
|
inputMethod: inputMethod,
|
|
159
164
|
nodeType: nodeType,
|
|
160
165
|
nodeContext: nodeContext,
|
|
161
|
-
fromCurrentDomain: (0,
|
|
166
|
+
fromCurrentDomain: (0, _hyperlink.isFromCurrentDomain)(url)
|
|
162
167
|
},
|
|
163
168
|
nonPrivacySafeAttributes: {
|
|
164
169
|
domainName: domainName
|
|
@@ -185,8 +190,8 @@ var handleFallbackWithAnalytics = exports.handleFallbackWithAnalytics = function
|
|
|
185
190
|
return false;
|
|
186
191
|
}
|
|
187
192
|
var tr = state.tr;
|
|
188
|
-
if (request.source !==
|
|
189
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0,
|
|
193
|
+
if (request.source !== _enums.INPUT_METHOD.FLOATING_TB) {
|
|
194
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _hyperlink.getLinkCreationAnalyticsEvent)(request.source, request.url))(tr);
|
|
190
195
|
}
|
|
191
196
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
192
197
|
action: request.analyticsAction,
|
|
@@ -253,7 +258,7 @@ var queueCardsFromChangedTr = exports.queueCardsFromChangedTr = function queueCa
|
|
|
253
258
|
source: source,
|
|
254
259
|
sourceEvent: sourceEvent
|
|
255
260
|
};
|
|
256
|
-
(0,
|
|
261
|
+
(0, _document.nodesBetweenChanged)(tr, function (node, pos) {
|
|
257
262
|
return collectLinkRequest(requests, node, pos, options);
|
|
258
263
|
});
|
|
259
264
|
if (analyticsAction) {
|
|
@@ -308,7 +313,7 @@ var queueCardFromChangedTr = exports.queueCardFromChangedTr = function queueCard
|
|
|
308
313
|
var schema = state.schema;
|
|
309
314
|
var link = schema.marks.link;
|
|
310
315
|
var requests = [];
|
|
311
|
-
(0,
|
|
316
|
+
(0, _document.nodesBetweenChanged)(tr, function (node, pos) {
|
|
312
317
|
if (!node.isText) {
|
|
313
318
|
return true;
|
|
314
319
|
}
|
|
@@ -350,12 +355,12 @@ var convertHyperlinkToSmartCard = exports.convertHyperlinkToSmartCard = function
|
|
|
350
355
|
previousAppearance: 'url',
|
|
351
356
|
compareLinkText: normalizeLinkText,
|
|
352
357
|
source: source,
|
|
353
|
-
analyticsAction:
|
|
358
|
+
analyticsAction: _enums.ACTION.CHANGED_TYPE,
|
|
354
359
|
shouldReplaceLink: true
|
|
355
360
|
};
|
|
356
361
|
};
|
|
357
362
|
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
358
|
-
var activeLinkMark = (0,
|
|
363
|
+
var activeLinkMark = (0, _utils.getActiveLinkMark)(state);
|
|
359
364
|
if (activeLinkMark) {
|
|
360
365
|
var linkMark = activeLinkMark.node.marks.find(function (mark) {
|
|
361
366
|
return mark.type === link;
|
|
@@ -375,7 +380,7 @@ var convertHyperlinkToSmartCard = exports.convertHyperlinkToSmartCard = function
|
|
|
375
380
|
});
|
|
376
381
|
}
|
|
377
382
|
(0, _card.addLinkMetadata)(state.selection, state.tr, {
|
|
378
|
-
action:
|
|
383
|
+
action: _enums.ACTION.CHANGED_TYPE
|
|
379
384
|
});
|
|
380
385
|
return (0, _actions.queueCards)(requests)(state.tr);
|
|
381
386
|
};
|
|
@@ -392,11 +397,11 @@ var changeSelectedCardToLink = exports.changeSelectedCardToLink = function chang
|
|
|
392
397
|
if (sendAnalytics) {
|
|
393
398
|
if (selectedNode) {
|
|
394
399
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
395
|
-
action:
|
|
396
|
-
actionSubject:
|
|
397
|
-
eventType:
|
|
400
|
+
action: _enums.ACTION.CHANGED_TYPE,
|
|
401
|
+
actionSubject: _enums.ACTION_SUBJECT.SMART_LINK,
|
|
402
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
398
403
|
attributes: {
|
|
399
|
-
newType:
|
|
404
|
+
newType: _nodeEvents.SMART_LINK_TYPE.URL,
|
|
400
405
|
previousType: (0, _utils2.appearanceForNodeType)(selectedNode.type)
|
|
401
406
|
}
|
|
402
407
|
})(tr);
|
|
@@ -418,9 +423,9 @@ var changeSelectedCardToLinkFallback = exports.changeSelectedCardToLinkFallback
|
|
|
418
423
|
}
|
|
419
424
|
if (sendAnalytics) {
|
|
420
425
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
421
|
-
action:
|
|
422
|
-
actionSubject:
|
|
423
|
-
eventType:
|
|
426
|
+
action: _enums.ACTION.ERRORED,
|
|
427
|
+
actionSubject: _enums.ACTION_SUBJECT.SMART_LINK,
|
|
428
|
+
eventType: _enums.EVENT_TYPE.OPERATIONAL,
|
|
424
429
|
attributes: {
|
|
425
430
|
error: 'Smart card falling back to link.'
|
|
426
431
|
}
|
|
@@ -440,7 +445,7 @@ var updateCard = exports.updateCard = function updateCard(href, sourceEvent) {
|
|
|
440
445
|
}
|
|
441
446
|
var cardAppearance = (0, _utils2.selectedCardAppearance)(state);
|
|
442
447
|
var tr = cardToLinkWithTransaction(state, href, href);
|
|
443
|
-
queueCardFromChangedTr(state, tr,
|
|
448
|
+
queueCardFromChangedTr(state, tr, _enums.INPUT_METHOD.MANUAL, _enums.ACTION.UPDATED, undefined, sourceEvent, cardAppearance);
|
|
444
449
|
if (dispatch) {
|
|
445
450
|
dispatch(tr.scrollIntoView());
|
|
446
451
|
}
|
|
@@ -475,10 +480,10 @@ var changeSelectedCardToText = exports.changeSelectedCardToText = function chang
|
|
|
475
480
|
var tr = state.tr.replaceSelectionWith(state.schema.text(text), false);
|
|
476
481
|
if (dispatch) {
|
|
477
482
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
478
|
-
action:
|
|
483
|
+
action: _enums.ACTION.UNLINK
|
|
479
484
|
});
|
|
480
485
|
tr.scrollIntoView();
|
|
481
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0,
|
|
486
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _linkingUtils.unlinkPayload)(_enums.ACTION_SUBJECT_ID.CARD_INLINE))(tr);
|
|
482
487
|
dispatch(tr);
|
|
483
488
|
}
|
|
484
489
|
return true;
|
|
@@ -491,10 +496,10 @@ var setSelectedCardAppearance = exports.setSelectedCardAppearance = function set
|
|
|
491
496
|
if (!selectedNode) {
|
|
492
497
|
// When there is no selected node, we insert a new one
|
|
493
498
|
// and replace the existing blue link
|
|
494
|
-
var _tr = convertHyperlinkToSmartCard(state,
|
|
499
|
+
var _tr = convertHyperlinkToSmartCard(state, _enums.INPUT_METHOD.FLOATING_TB, appearance);
|
|
495
500
|
if (dispatch) {
|
|
496
501
|
(0, _card.addLinkMetadata)(state.selection, _tr, {
|
|
497
|
-
action:
|
|
502
|
+
action: _enums.ACTION.CHANGED_TYPE
|
|
498
503
|
});
|
|
499
504
|
dispatch(_tr.scrollIntoView());
|
|
500
505
|
}
|
|
@@ -522,16 +527,16 @@ var setSelectedCardAppearance = exports.setSelectedCardAppearance = function set
|
|
|
522
527
|
augmentTransaction: function augmentTransaction(augmentTr) {
|
|
523
528
|
updateDatasourceStash(augmentTr, selectedNode);
|
|
524
529
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
525
|
-
action:
|
|
526
|
-
actionSubject:
|
|
527
|
-
eventType:
|
|
530
|
+
action: _enums.ACTION.CHANGED_TYPE,
|
|
531
|
+
actionSubject: _enums.ACTION_SUBJECT.SMART_LINK,
|
|
532
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
528
533
|
attributes: {
|
|
529
534
|
newType: appearance,
|
|
530
535
|
previousType: (0, _utils2.appearanceForNodeType)(selectedNode.type)
|
|
531
536
|
}
|
|
532
537
|
})(augmentTr);
|
|
533
538
|
(0, _card.addLinkMetadata)(state.selection, augmentTr, {
|
|
534
|
-
action:
|
|
539
|
+
action: _enums.ACTION.CHANGED_TYPE
|
|
535
540
|
});
|
|
536
541
|
}
|
|
537
542
|
});
|
|
@@ -553,16 +558,16 @@ var setSelectedCardAppearance = exports.setSelectedCardAppearance = function set
|
|
|
553
558
|
tr.delete(previousNodePos, from);
|
|
554
559
|
}
|
|
555
560
|
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
556
|
-
action:
|
|
557
|
-
actionSubject:
|
|
558
|
-
eventType:
|
|
561
|
+
action: _enums.ACTION.CHANGED_TYPE,
|
|
562
|
+
actionSubject: _enums.ACTION_SUBJECT.SMART_LINK,
|
|
563
|
+
eventType: _enums.EVENT_TYPE.TRACK,
|
|
559
564
|
attributes: {
|
|
560
565
|
newType: appearance,
|
|
561
566
|
previousType: (0, _utils2.appearanceForNodeType)(selectedNode.type)
|
|
562
567
|
}
|
|
563
568
|
})(tr);
|
|
564
569
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
565
|
-
action:
|
|
570
|
+
action: _enums.ACTION.CHANGED_TYPE
|
|
566
571
|
});
|
|
567
572
|
if (dispatch) {
|
|
568
573
|
dispatch(tr.scrollIntoView());
|
|
@@ -643,7 +648,7 @@ var updateCardViaDatasource = exports.updateCardViaDatasource = function updateC
|
|
|
643
648
|
tr.setNodeMarkup(from, schemaNodes.inlineCard, newAdf.attrs);
|
|
644
649
|
}
|
|
645
650
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
646
|
-
action:
|
|
651
|
+
action: _enums.ACTION.UPDATED,
|
|
647
652
|
sourceEvent: sourceEvent,
|
|
648
653
|
inputMethod: inputMethod
|
|
649
654
|
});
|
|
@@ -669,7 +674,7 @@ var insertDatasource = exports.insertDatasource = function insertDatasource(stat
|
|
|
669
674
|
newNode && tr.insert(from, newNode);
|
|
670
675
|
(0, _actions.hideDatasourceModal)(tr);
|
|
671
676
|
(0, _card.addLinkMetadata)(state.selection, tr, {
|
|
672
|
-
action:
|
|
677
|
+
action: _enums.ACTION.INSERTED,
|
|
673
678
|
sourceEvent: sourceEvent
|
|
674
679
|
});
|
|
675
680
|
view.dispatch(tr.scrollIntoView());
|
|
@@ -8,10 +8,10 @@ exports.createPlugin = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var _getInlineNodeViewProducer = require("@atlaskit/editor-common/getInlineNodeViewProducer");
|
|
12
|
+
var _isSsr = require("@atlaskit/editor-common/is-ssr");
|
|
13
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
|
-
var
|
|
14
|
+
var _smartCard = require("@atlaskit/editor-common/styles/smartCard");
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
17
17
|
var _constants = require("@atlaskit/linking-common/constants");
|
|
@@ -63,7 +63,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
63
63
|
embedCardTransformers = options.embedCardTransformers;
|
|
64
64
|
var intl = pmPluginFactoryParams.getIntl();
|
|
65
65
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
|
|
66
|
-
var inlineCardViewProducer = (0,
|
|
66
|
+
var inlineCardViewProducer = (0, _getInlineNodeViewProducer.getInlineNodeViewProducer)({
|
|
67
67
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
68
68
|
Component: _inlineCard.InlineCardNodeView,
|
|
69
69
|
extraComponentProps: {
|
|
@@ -76,7 +76,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
76
76
|
onClickCallback: onClickCallback,
|
|
77
77
|
isPageSSRed: isPageSSRed,
|
|
78
78
|
provider: provider,
|
|
79
|
-
CompetitorPrompt: (0,
|
|
79
|
+
CompetitorPrompt: (0, _isSsr.isSSR)() ? undefined : CompetitorPrompt,
|
|
80
80
|
intl: intl,
|
|
81
81
|
smartCardContext: smartCardContext
|
|
82
82
|
}
|
|
@@ -199,7 +199,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
199
199
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
200
200
|
var datasourceTableRef = // Ignored via go/ees005
|
|
201
201
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
202
|
-
(_findDomRefAtPos = (0, _utils.findDomRefAtPos)(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(".".concat(
|
|
202
|
+
(_findDomRefAtPos = (0, _utils.findDomRefAtPos)(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(".".concat(_smartCard.DATASOURCE_INNER_CONTAINER_CLASSNAME));
|
|
203
203
|
var node = selection.node;
|
|
204
204
|
var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource);
|
|
205
205
|
var shouldUpdateTableRef = datasourceTableRef && (currentState === null || currentState === void 0 ? void 0 : currentState.datasourceTableRef) !== datasourceTableRef;
|
|
@@ -277,7 +277,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
277
277
|
inlineCardViewProducer: inlineCardViewProducer,
|
|
278
278
|
isPageSSRed: isPageSSRed,
|
|
279
279
|
provider: provider,
|
|
280
|
-
CompetitorPrompt: (0,
|
|
280
|
+
CompetitorPrompt: (0, _isSsr.isSSR)() ? undefined : options.CompetitorPrompt,
|
|
281
281
|
intl: intl,
|
|
282
282
|
smartCardContext: smartCardContext
|
|
283
283
|
}),
|
|
@@ -290,7 +290,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
290
290
|
onClickCallback: options.onClickCallback,
|
|
291
291
|
isPageSSRed: isPageSSRed,
|
|
292
292
|
provider: provider,
|
|
293
|
-
CompetitorPrompt: (0,
|
|
293
|
+
CompetitorPrompt: (0, _isSsr.isSSR)() ? undefined : options.CompetitorPrompt,
|
|
294
294
|
intl: intl,
|
|
295
295
|
smartCardContext: smartCardContext
|
|
296
296
|
})
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.shouldReplaceLink = shouldReplaceLink;
|
|
7
7
|
var _normalizeUrl = require("@atlaskit/adf-schema/normalize-url");
|
|
8
|
-
var
|
|
8
|
+
var _md = require("@atlaskit/editor-common/paste/md");
|
|
9
9
|
function shouldReplaceLink(node) {
|
|
10
10
|
var compareLinkText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
11
11
|
var compareToUrl = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -20,13 +20,13 @@ function shouldReplaceLink(node) {
|
|
|
20
20
|
// ED-6041: compare normalised link text after linkfy from Markdown transformer
|
|
21
21
|
// instead, since it always decodes URL ('%20' -> ' ') on the link text
|
|
22
22
|
|
|
23
|
-
var normalisedHref = (0, _normalizeUrl.normalizeUrl)(
|
|
24
|
-
var normalizedLinkText = (0, _normalizeUrl.normalizeUrl)(
|
|
23
|
+
var normalisedHref = (0, _normalizeUrl.normalizeUrl)(_md.md.normalizeLinkText(linkMark.attrs.href));
|
|
24
|
+
var normalizedLinkText = (0, _normalizeUrl.normalizeUrl)(_md.md.normalizeLinkText(node.text || ''));
|
|
25
25
|
if (compareLinkText && normalisedHref !== normalizedLinkText) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
if (compareToUrl) {
|
|
29
|
-
var normalizedUrl = (0, _normalizeUrl.normalizeUrl)(
|
|
29
|
+
var normalizedUrl = (0, _normalizeUrl.normalizeUrl)(_md.md.normalizeLinkText(compareToUrl));
|
|
30
30
|
if (normalizedUrl !== normalisedHref) {
|
|
31
31
|
return false;
|
|
32
32
|
}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.resolveWithProvider = exports.handleProvider = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
|
+
var _datasource = require("@atlaskit/editor-common/utils/datasource");
|
|
8
9
|
var _actions = require("../actions");
|
|
9
10
|
var _doc = require("../doc");
|
|
10
11
|
var isFreshlyPastedOnNewLine = function isFreshlyPastedOnNewLine(view) {
|
|
@@ -48,7 +49,7 @@ var resolveWithProvider = exports.resolveWithProvider = function resolveWithProv
|
|
|
48
49
|
var updateCardType = function updateCardType(resolvedCard, options) {
|
|
49
50
|
if (resolvedCard.type === 'blockCard' && 'datasource' in resolvedCard.attrs) {
|
|
50
51
|
var datasourceId = resolvedCard.attrs.datasource.id;
|
|
51
|
-
if (!options.allowDatasource || !(0,
|
|
52
|
+
if (!options.allowDatasource || !(0, _datasource.canRenderDatasource)(datasourceId)) {
|
|
52
53
|
delete resolvedCard.attrs.datasource;
|
|
53
54
|
resolvedCard.type = 'inlineCard';
|
|
54
55
|
return;
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _react2 = require("@emotion/react");
|
|
11
|
-
var
|
|
11
|
+
var _ConfigureLinkOverlay = require("@atlaskit/editor-common/link/ConfigureLinkOverlay");
|
|
12
12
|
/**
|
|
13
13
|
* @jsxRuntime classic
|
|
14
14
|
* @jsx jsx
|
|
@@ -59,7 +59,7 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
|
|
|
59
59
|
"data-testid": "inline-card-overlay-wrapper"
|
|
60
60
|
}, (0, _react2.jsx)("span", {
|
|
61
61
|
css: ConfigureOverlayWrapperStyles
|
|
62
|
-
}, showConfigureButton && (0, _react2.jsx)(
|
|
62
|
+
}, showConfigureButton && (0, _react2.jsx)(_ConfigureLinkOverlay.OverlayButton, {
|
|
63
63
|
editorView: view,
|
|
64
64
|
targetElementPos: targetElementPos,
|
|
65
65
|
onDropdownChange: onDropdownChange,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.DatasourceAppearanceButton = void 0;
|
|
7
8
|
var _react = require("react");
|
|
8
9
|
var _react2 = require("@emotion/react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _Button = _interopRequireDefault(require("@atlaskit/editor-common/FloatingToolbar/Button"));
|
|
11
|
+
var _card = require("@atlaskit/editor-common/messages/card");
|
|
12
|
+
var _datasource = require("@atlaskit/editor-common/utils/datasource");
|
|
12
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
14
|
var _schema = require("@atlaskit/link-datasource/utils/schema");
|
|
14
15
|
var _useSmartLinkContext = require("@atlaskit/link-provider/use-smart-link-context");
|
|
@@ -83,7 +84,7 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
|
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
}, [parameters, datasourceId, inputMethod, editorState, editorView, url]);
|
|
86
|
-
if (!parameters || !datasourceId || !(0,
|
|
87
|
+
if (!parameters || !datasourceId || !(0, _datasource.canRenderDatasource)(datasourceId)) {
|
|
87
88
|
return null;
|
|
88
89
|
}
|
|
89
90
|
if (url) {
|
|
@@ -93,8 +94,8 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
|
|
|
93
94
|
return null;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
var buttonLabel = intl.formatMessage(
|
|
97
|
-
return (0, _react2.jsx)(_compiled.Flex, null, (0, _react2.jsx)(
|
|
97
|
+
var buttonLabel = intl.formatMessage(_card.messages.datasourceAppearanceTitle);
|
|
98
|
+
return (0, _react2.jsx)(_compiled.Flex, null, (0, _react2.jsx)(_Button.default, {
|
|
98
99
|
css: buttonStyles,
|
|
99
100
|
title: buttonLabel,
|
|
100
101
|
icon: (0, _react2.jsx)(_DatasourceIcon.DatasourceIcon, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.datasourceDisplayInformation = exports.DatasourceDropdownOption = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _card = require("@atlaskit/editor-common/messages/card");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _smartLinkList = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-list"));
|
|
12
12
|
var _schema = require("@atlaskit/link-datasource/utils/schema");
|
|
@@ -16,7 +16,7 @@ var _doc = require("../pm-plugins/doc");
|
|
|
16
16
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
17
17
|
var _useFetchDatasourceInfo = require("./useFetchDatasourceInfo");
|
|
18
18
|
var datasourceDisplayInformation = exports.datasourceDisplayInformation = {
|
|
19
|
-
title:
|
|
19
|
+
title: _card.messages.datasourceAppearanceTitle,
|
|
20
20
|
icon: _smartLinkList.default,
|
|
21
21
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
22
22
|
iconFallback: _smartLinkList.default
|
|
@@ -89,9 +89,9 @@ var DatasourceDropdownOption = exports.DatasourceDropdownOption = function Datas
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return /*#__PURE__*/_react.default.createElement(_buttonItem.default, {
|
|
92
|
-
key: intl.formatMessage(
|
|
92
|
+
key: intl.formatMessage(_card.messages.datasourceAppearanceTitle),
|
|
93
93
|
iconBefore: (0, _smartLinkList.default)({
|
|
94
|
-
label: intl.formatMessage(
|
|
94
|
+
label: intl.formatMessage(_card.messages.datasourceAppearanceTitle)
|
|
95
95
|
})
|
|
96
96
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
97
97
|
,
|
|
@@ -99,5 +99,5 @@ var DatasourceDropdownOption = exports.DatasourceDropdownOption = function Datas
|
|
|
99
99
|
return dispatchCommand(onChangeAppearance);
|
|
100
100
|
},
|
|
101
101
|
isSelected: selected
|
|
102
|
-
}, intl.formatMessage(
|
|
102
|
+
}, intl.formatMessage(_card.messages.datasourceAppearanceTitle));
|
|
103
103
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.modalTypeToComponentMap = exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var
|
|
9
|
+
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
10
10
|
var _assetsConfigModalWithWrappers = require("@atlaskit/link-datasource/assets-config-modal-with-wrappers");
|
|
11
11
|
var _assetsModal = require("@atlaskit/link-datasource/assets-modal");
|
|
12
12
|
var _confluenceSearchConfigModalWithWrappers = require("@atlaskit/link-datasource/confluence-search-config-modal-with-wrappers");
|
|
@@ -28,7 +28,7 @@ var ModalWithState = function ModalWithState(_ref) {
|
|
|
28
28
|
var api = _ref.api,
|
|
29
29
|
editorView = _ref.editorView;
|
|
30
30
|
var cardContext = (0, _useSmartLinkContext.useSmartLinkContext)();
|
|
31
|
-
var _useSharedPluginState = (0,
|
|
31
|
+
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['card'], selector),
|
|
32
32
|
showDatasourceModal = _useSharedPluginState.showDatasourceModal,
|
|
33
33
|
datasourceModalType = _useSharedPluginState.datasourceModalType;
|
|
34
34
|
if (!showDatasourceModal || !datasourceModalType) {
|
|
@@ -13,15 +13,16 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
16
|
+
var _linkingUtils = require("@atlaskit/editor-common/analytics/linking-utils");
|
|
17
|
+
var _enums = require("@atlaskit/editor-common/analytics/types/enums");
|
|
18
|
+
var _utils = require("@atlaskit/editor-common/card/utils");
|
|
19
|
+
var _linkSearchConstants = require("@atlaskit/editor-common/link-search-constants");
|
|
20
|
+
var _HyperlinkAddToolbar = require("@atlaskit/editor-common/link/HyperlinkAddToolbar");
|
|
21
|
+
var _linkToolbar = require("@atlaskit/editor-common/messages/link-toolbar");
|
|
21
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
22
23
|
var _actions = require("../pm-plugins/actions");
|
|
23
24
|
var _doc = require("../pm-plugins/doc");
|
|
24
|
-
var
|
|
25
|
+
var _utils2 = require("../pm-plugins/utils");
|
|
25
26
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
26
27
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
28
|
function HyperlinkAddToolbarWithState(_ref) {
|
|
@@ -38,7 +39,7 @@ function HyperlinkAddToolbarWithState(_ref) {
|
|
|
38
39
|
onClose = _ref.onClose,
|
|
39
40
|
onEscapeCallback = _ref.onEscapeCallback,
|
|
40
41
|
onClickAwayCallback = _ref.onClickAwayCallback;
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_HyperlinkAddToolbar.HyperlinkAddToolbar, {
|
|
42
43
|
linkPickerOptions: linkPickerOptions,
|
|
43
44
|
onSubmit: onSubmit,
|
|
44
45
|
displayText: displayText,
|
|
@@ -101,7 +102,7 @@ var EditLinkToolbar = exports.EditLinkToolbar = /*#__PURE__*/function (_React$Co
|
|
|
101
102
|
// Assumes that the smart card link picker can only ever be invoked by clicking "edit"
|
|
102
103
|
// via the floating toolbar
|
|
103
104
|
,
|
|
104
|
-
invokeMethod:
|
|
105
|
+
invokeMethod: _enums.INPUT_METHOD.FLOATING_TB,
|
|
105
106
|
lpLinkPicker: lpLinkPicker
|
|
106
107
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
107
108
|
,
|
|
@@ -116,7 +117,7 @@ var EditLinkToolbar = exports.EditLinkToolbar = /*#__PURE__*/function (_React$Co
|
|
|
116
117
|
onEscapeCallback: function onEscapeCallback(state, dispatch) {
|
|
117
118
|
var tr = state.tr;
|
|
118
119
|
(0, _actions.hideLinkToolbar)(tr);
|
|
119
|
-
forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector("[aria-label=\"".concat(
|
|
120
|
+
forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector("[aria-label=\"".concat(_linkToolbar.linkToolbarMessages.editLink.defaultMessage, "\"]"))(tr);
|
|
120
121
|
if (dispatch) {
|
|
121
122
|
dispatch(tr);
|
|
122
123
|
return true;
|
|
@@ -146,7 +147,7 @@ var getEditLinkCallback = exports.getEditLinkCallback = function getEditLinkCall
|
|
|
146
147
|
if (dispatch) {
|
|
147
148
|
var tr = state.tr;
|
|
148
149
|
(0, _actions.showLinkToolbar)(tr);
|
|
149
|
-
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0,
|
|
150
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent((0, _linkingUtils.buildEditLinkPayload)(type))(tr);
|
|
150
151
|
tr.setMeta('scrollIntoView', scrollIntoView);
|
|
151
152
|
dispatch(tr);
|
|
152
153
|
return true;
|
|
@@ -169,7 +170,7 @@ var buildEditLinkToolbar = exports.buildEditLinkToolbar = function buildEditLink
|
|
|
169
170
|
if (!view || !providerFactory) {
|
|
170
171
|
return null;
|
|
171
172
|
}
|
|
172
|
-
var displayInfo = (0,
|
|
173
|
+
var displayInfo = (0, _utils2.displayInfoForCard)(node, (0, _utils2.findCardInfo)(view.state));
|
|
173
174
|
return /*#__PURE__*/_react.default.createElement(EditLinkToolbar, {
|
|
174
175
|
key: idx,
|
|
175
176
|
view: view,
|
|
@@ -190,8 +191,8 @@ var buildEditLinkToolbar = exports.buildEditLinkToolbar = function buildEditLink
|
|
|
190
191
|
// (even if the url was also changed) - we don't want to lose the custom title.
|
|
191
192
|
if (titleChanged) {
|
|
192
193
|
var _pluginInjectionApi$a;
|
|
193
|
-
return (0,
|
|
194
|
-
action:
|
|
194
|
+
return (0, _utils.commandWithMetadata)((0, _doc.changeSelectedCardToLink)(newText, newHref, undefined, undefined, undefined, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions), {
|
|
195
|
+
action: _enums.ACTION.UPDATED,
|
|
195
196
|
inputMethod: inputMethod,
|
|
196
197
|
sourceEvent: analytic
|
|
197
198
|
})(view.state, view.dispatch);
|
|
@@ -211,8 +212,8 @@ var editLinkToolbarConfig = exports.editLinkToolbarConfig = function editLinkToo
|
|
|
211
212
|
return {};
|
|
212
213
|
}
|
|
213
214
|
return {
|
|
214
|
-
height: (_linkPickerOptions$po = linkPickerOptions === null || linkPickerOptions === void 0 ? void 0 : linkPickerOptions.popupHeight) !== null && _linkPickerOptions$po !== void 0 ? _linkPickerOptions$po : lpLinkPicker ?
|
|
215
|
-
width: (_linkPickerOptions$po2 = linkPickerOptions === null || linkPickerOptions === void 0 ? void 0 : linkPickerOptions.popupWidth) !== null && _linkPickerOptions$po2 !== void 0 ? _linkPickerOptions$po2 :
|
|
215
|
+
height: (_linkPickerOptions$po = linkPickerOptions === null || linkPickerOptions === void 0 ? void 0 : linkPickerOptions.popupHeight) !== null && _linkPickerOptions$po !== void 0 ? _linkPickerOptions$po : lpLinkPicker ? _linkSearchConstants.LINKPICKER_HEIGHT_IN_PX : _linkSearchConstants.RECENT_SEARCH_HEIGHT_IN_PX,
|
|
216
|
+
width: (_linkPickerOptions$po2 = linkPickerOptions === null || linkPickerOptions === void 0 ? void 0 : linkPickerOptions.popupWidth) !== null && _linkPickerOptions$po2 !== void 0 ? _linkPickerOptions$po2 : _linkSearchConstants.RECENT_SEARCH_WIDTH_IN_PX,
|
|
216
217
|
// forcePlacement is always true to prevent the popup from rendering off-screen
|
|
217
218
|
forcePlacement: true
|
|
218
219
|
};
|