@atlaskit/editor-plugin-card 4.5.8 → 4.5.10
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 +2 -1
- package/dist/cjs/nodeviews/blockCard.js +6 -1
- package/dist/cjs/nodeviews/embedCard.js +12 -2
- package/dist/cjs/nodeviews/genericCard.js +2 -0
- package/dist/cjs/nodeviews/inlineCard.js +10 -2
- package/dist/cjs/pm-plugins/doc.js +25 -5
- package/dist/cjs/pm-plugins/keymap.js +5 -0
- package/dist/cjs/pm-plugins/main.js +5 -1
- package/dist/cjs/pm-plugins/util/resolve.js +8 -2
- package/dist/cjs/pm-plugins/utils.js +4 -1
- package/dist/cjs/ui/DatasourceIcon/index.js +4 -0
- package/dist/cjs/ui/EditLinkToolbar.js +8 -2
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -5
- package/dist/cjs/ui/EditToolbarButton/index.js +20 -5
- package/dist/cjs/ui/EditorLinkingPlatformAnalytics/index.js +7 -1
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +3 -0
- package/dist/cjs/ui/InlineCardOverlay/index.js +49 -45
- package/dist/cjs/ui/LayoutButton/index.js +4 -1
- package/dist/cjs/ui/ResizableEmbedCard.js +6 -1
- package/dist/cjs/ui/analytics/events-from-tr.js +3 -0
- package/dist/cjs/ui/analytics/utils.js +4 -1
- package/dist/cjs/ui/editDatasourceAction.js +4 -1
- package/dist/cjs/ui/toolbar.js +32 -7
- package/dist/es2019/cardPlugin.js +2 -0
- package/dist/es2019/nodeviews/blockCard.js +6 -1
- package/dist/es2019/nodeviews/embedCard.js +12 -2
- package/dist/es2019/nodeviews/genericCard.js +2 -0
- package/dist/es2019/nodeviews/inlineCard.js +10 -2
- package/dist/es2019/pm-plugins/doc.js +33 -7
- package/dist/es2019/pm-plugins/keymap.js +5 -0
- package/dist/es2019/pm-plugins/main.js +5 -1
- package/dist/es2019/pm-plugins/util/resolve.js +8 -2
- package/dist/es2019/pm-plugins/utils.js +8 -2
- package/dist/es2019/ui/DatasourceIcon/index.js +4 -0
- package/dist/es2019/ui/EditLinkToolbar.js +8 -2
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -5
- package/dist/es2019/ui/EditToolbarButton/index.js +20 -5
- package/dist/es2019/ui/EditorLinkingPlatformAnalytics/index.js +7 -1
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +3 -0
- package/dist/es2019/ui/InlineCardOverlay/index.js +47 -43
- package/dist/es2019/ui/LayoutButton/index.js +4 -1
- package/dist/es2019/ui/LinkToolbarAppearance.js +0 -1
- package/dist/es2019/ui/ResizableEmbedCard.js +6 -1
- package/dist/es2019/ui/analytics/events-from-tr.js +3 -0
- package/dist/es2019/ui/analytics/utils.js +4 -1
- package/dist/es2019/ui/editDatasourceAction.js +4 -1
- package/dist/es2019/ui/toolbar.js +32 -7
- package/dist/esm/cardPlugin.js +2 -0
- package/dist/esm/nodeviews/blockCard.js +6 -1
- package/dist/esm/nodeviews/embedCard.js +12 -2
- package/dist/esm/nodeviews/genericCard.js +2 -0
- package/dist/esm/nodeviews/inlineCard.js +10 -2
- package/dist/esm/pm-plugins/doc.js +25 -5
- package/dist/esm/pm-plugins/keymap.js +5 -0
- package/dist/esm/pm-plugins/main.js +5 -1
- package/dist/esm/pm-plugins/util/resolve.js +8 -2
- package/dist/esm/pm-plugins/utils.js +4 -1
- package/dist/esm/ui/DatasourceIcon/index.js +4 -0
- package/dist/esm/ui/EditLinkToolbar.js +8 -2
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +20 -5
- package/dist/esm/ui/EditToolbarButton/index.js +20 -5
- package/dist/esm/ui/EditorLinkingPlatformAnalytics/index.js +7 -1
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +3 -0
- package/dist/esm/ui/InlineCardOverlay/index.js +49 -45
- package/dist/esm/ui/LayoutButton/index.js +4 -1
- package/dist/esm/ui/LinkToolbarAppearance.js +0 -1
- package/dist/esm/ui/ResizableEmbedCard.js +6 -1
- package/dist/esm/ui/analytics/events-from-tr.js +3 -0
- package/dist/esm/ui/analytics/utils.js +4 -1
- package/dist/esm/ui/editDatasourceAction.js +4 -1
- package/dist/esm/ui/toolbar.js +32 -7
- package/dist/types/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types/ui/LinkToolbarAppearance.d.ts +1 -1
- package/dist/types/ui/analytics/types.d.ts +1 -1
- package/dist/types/ui/datasourceErrorBoundary.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditLinkToolbar.d.ts +1 -1
- package/dist/types-ts4.5/ui/LinkToolbarAppearance.d.ts +1 -1
- package/dist/types-ts4.5/ui/analytics/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/datasourceErrorBoundary.d.ts +1 -1
- package/package.json +5 -5
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -103,7 +103,10 @@ var openLinkSettings = exports.openLinkSettings = function openLinkSettings(edit
|
|
|
103
103
|
return true;
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
|
-
var floatingToolbar = exports.floatingToolbar = function floatingToolbar(cardOptions, lpLinkPicker, linkPickerOptions, pluginInjectionApi, disableFloatingToolbar
|
|
106
|
+
var floatingToolbar = exports.floatingToolbar = function floatingToolbar(cardOptions, lpLinkPicker, linkPickerOptions, pluginInjectionApi, disableFloatingToolbar
|
|
107
|
+
// Ignored via go/ees005
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
109
|
+
) {
|
|
107
110
|
return function (state, intl, providerFactory) {
|
|
108
111
|
if (disableFloatingToolbar) {
|
|
109
112
|
return;
|
|
@@ -138,11 +141,15 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(cardOpt
|
|
|
138
141
|
preventPopupOverflow: isLinkPickerEnabled
|
|
139
142
|
}, toolbarOffset), {}, {
|
|
140
143
|
getDomRef: function getDomRef(view) {
|
|
144
|
+
// Ignored via go/ees005
|
|
145
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
141
146
|
var element = (0, _utils2.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view));
|
|
142
147
|
if (!element) {
|
|
143
148
|
return undefined;
|
|
144
149
|
}
|
|
145
150
|
if (isEmbedCard) {
|
|
151
|
+
// Ignored via go/ees005
|
|
152
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
146
153
|
return element.querySelector(".".concat(_styles.richMediaClassName));
|
|
147
154
|
}
|
|
148
155
|
return element;
|
|
@@ -164,7 +171,10 @@ var unlinkCard = function unlinkCard(node, state, editorAnalyticsApi) {
|
|
|
164
171
|
return false;
|
|
165
172
|
};
|
|
166
173
|
};
|
|
167
|
-
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions
|
|
174
|
+
var buildAlignmentOptions = function buildAlignmentOptions(state, intl, widthPluginDependencyApi, analyticsApi, cardOptions
|
|
175
|
+
// Ignored via go/ees005
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
177
|
+
) {
|
|
168
178
|
return (0, _card.buildLayoutButtons)(state, intl, state.schema.nodes.embedCard, widthPluginDependencyApi, analyticsApi, true, true, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowWrapping, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.allowAlignment);
|
|
169
179
|
};
|
|
170
180
|
var withToolbarMetadata = function withToolbarMetadata(command) {
|
|
@@ -189,7 +199,10 @@ var getToolbarViewedItem = function getToolbarViewedItem(url, display) {
|
|
|
189
199
|
}
|
|
190
200
|
}];
|
|
191
201
|
};
|
|
192
|
-
var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, lpLinkPicker, linkPicker, pluginInjectionApi
|
|
202
|
+
var generateToolbarItems = function generateToolbarItems(state, intl, providerFactory, cardOptions, lpLinkPicker, linkPicker, pluginInjectionApi
|
|
203
|
+
// Ignored via go/ees005
|
|
204
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
205
|
+
) {
|
|
193
206
|
return function (node) {
|
|
194
207
|
var _pluginInjectionApi$a, _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$a2, _node$attrs;
|
|
195
208
|
var _titleUrlPairFromNode2 = (0, _utils3.titleUrlPairFromNode)(node),
|
|
@@ -380,7 +393,10 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
380
393
|
}
|
|
381
394
|
};
|
|
382
395
|
};
|
|
383
|
-
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi
|
|
396
|
+
var getUnlinkButtonGroup = function getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi
|
|
397
|
+
// Ignored via go/ees005
|
|
398
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
399
|
+
) {
|
|
384
400
|
return node.type === inlineCard ? [{
|
|
385
401
|
id: 'editor.link.unlink',
|
|
386
402
|
focusEditoronEnter: true,
|
|
@@ -405,7 +421,10 @@ var getSettingsButton = exports.getSettingsButton = function getSettingsButton(i
|
|
|
405
421
|
target: '_blank'
|
|
406
422
|
};
|
|
407
423
|
};
|
|
408
|
-
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance
|
|
424
|
+
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance
|
|
425
|
+
// Ignored via go/ees005
|
|
426
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
427
|
+
) {
|
|
409
428
|
var _node$attrs2;
|
|
410
429
|
var toolbarItems = [];
|
|
411
430
|
var canShowAppearanceSwitch = function canShowAppearanceSwitch() {
|
|
@@ -514,11 +533,17 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
514
533
|
});
|
|
515
534
|
return toolbarItems;
|
|
516
535
|
};
|
|
517
|
-
var shouldRenderToolbarPulse = exports.shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled
|
|
536
|
+
var shouldRenderToolbarPulse = exports.shouldRenderToolbarPulse = function shouldRenderToolbarPulse(embedEnabled, appearance, status, isDiscoverabilityEnabled
|
|
537
|
+
// Ignored via go/ees005
|
|
538
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
539
|
+
) {
|
|
518
540
|
return embedEnabled && appearance === 'inline' && status === 'resolved' && isDiscoverabilityEnabled;
|
|
519
541
|
};
|
|
520
542
|
var getStartingToolbarItems = exports.getStartingToolbarItems = function getStartingToolbarItems(options, api) {
|
|
521
|
-
return function (intl, link, onEditLink, metadata
|
|
543
|
+
return function (intl, link, onEditLink, metadata
|
|
544
|
+
// Ignored via go/ees005
|
|
545
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
546
|
+
) {
|
|
522
547
|
var editLinkItem = options.allowDatasource ? [{
|
|
523
548
|
type: 'custom',
|
|
524
549
|
fallback: [],
|
|
@@ -16,6 +16,8 @@ import { createEventsQueue } from './ui/analytics/create-events-queue';
|
|
|
16
16
|
import DatasourceModalWithState from './ui/DatasourceModal/ModalWithState';
|
|
17
17
|
import { EditorLinkingPlatformAnalytics } from './ui/EditorLinkingPlatformAnalytics';
|
|
18
18
|
import { EditorSmartCardEvents } from './ui/EditorSmartCardEvents';
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
19
21
|
import LayoutButton from './ui/LayoutButton';
|
|
20
22
|
import { floatingToolbar, getEndingToolbarItems, getStartingToolbarItems } from './ui/toolbar';
|
|
21
23
|
export const cardPlugin = ({
|
|
@@ -15,6 +15,8 @@ import { Card } from './genericCard';
|
|
|
15
15
|
export class BlockCardComponent extends React.PureComponent {
|
|
16
16
|
constructor(props) {
|
|
17
17
|
super(props);
|
|
18
|
+
// Ignored via go/ees005
|
|
19
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
18
20
|
_defineProperty(this, "onResolve", data => {
|
|
19
21
|
const {
|
|
20
22
|
getPos,
|
|
@@ -157,7 +159,10 @@ export const blockCardNodeView = ({
|
|
|
157
159
|
onClickCallback,
|
|
158
160
|
allowDatasource,
|
|
159
161
|
inlineCardViewProducer
|
|
160
|
-
}) => (node, view, getPos, decorations
|
|
162
|
+
}) => (node, view, getPos, decorations
|
|
163
|
+
// Ignored via go/ees005
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
165
|
+
) => {
|
|
161
166
|
const {
|
|
162
167
|
portalProviderAPI,
|
|
163
168
|
eventDispatcher
|
|
@@ -54,7 +54,10 @@ const CardInner = ({
|
|
|
54
54
|
richMediaWrapperHeight = heightAlone;
|
|
55
55
|
richMediaWrapperWidth = undefined;
|
|
56
56
|
}
|
|
57
|
-
return /*#__PURE__*/React.createElement(RichMediaWrapper
|
|
57
|
+
return /*#__PURE__*/React.createElement(RichMediaWrapper
|
|
58
|
+
// Ignored via go/ees005
|
|
59
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
60
|
+
, _extends({}, cardProps, {
|
|
58
61
|
height: richMediaWrapperHeight,
|
|
59
62
|
width: richMediaWrapperWidth,
|
|
60
63
|
nodeType: "embedCard",
|
|
@@ -71,7 +74,10 @@ const CardInner = ({
|
|
|
71
74
|
highlight: highlight
|
|
72
75
|
});
|
|
73
76
|
};
|
|
74
|
-
return /*#__PURE__*/React.createElement(ResizableEmbedCard
|
|
77
|
+
return /*#__PURE__*/React.createElement(ResizableEmbedCard
|
|
78
|
+
// Ignored via go/ees005
|
|
79
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
80
|
+
, _extends({}, cardProps, {
|
|
75
81
|
height: heightAlone,
|
|
76
82
|
aspectRatio: aspectRatio,
|
|
77
83
|
view: view,
|
|
@@ -82,6 +88,8 @@ const CardInner = ({
|
|
|
82
88
|
displayGrid: displayGrid,
|
|
83
89
|
updateSize: updateSize,
|
|
84
90
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
91
|
+
// Ignored via go/ees005
|
|
92
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
85
93
|
}, fg('platform_fix_embedded_card_re-rendering') && {
|
|
86
94
|
isResizeDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
|
|
87
95
|
}), smartCard);
|
|
@@ -90,6 +98,8 @@ const CardInner = ({
|
|
|
90
98
|
export class EmbedCardComponent extends React.PureComponent {
|
|
91
99
|
constructor(props) {
|
|
92
100
|
super(props);
|
|
101
|
+
// Ignored via go/ees005
|
|
102
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
93
103
|
_defineProperty(this, "embedIframeRef", /*#__PURE__*/React.createRef());
|
|
94
104
|
_defineProperty(this, "state", {
|
|
95
105
|
hasPreview: true
|
|
@@ -103,6 +103,8 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
103
103
|
}) => /*#__PURE__*/React.createElement(WithCardContext, null, cardContext => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
104
104
|
key: url,
|
|
105
105
|
cardContext: cardContext
|
|
106
|
+
// Ignored via go/ees005
|
|
107
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
106
108
|
}, this.props, {
|
|
107
109
|
onClick: onClick
|
|
108
110
|
})))));
|
|
@@ -29,7 +29,10 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
29
29
|
url,
|
|
30
30
|
data
|
|
31
31
|
} = node.attrs;
|
|
32
|
-
const scrollContainer = useMemo(
|
|
32
|
+
const scrollContainer = useMemo(
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
35
|
+
() => findOverflowScrollParent(view.dom) || undefined, [view.dom]);
|
|
33
36
|
const onResolve = useCallback(data => {
|
|
34
37
|
if (!getPos || typeof getPos === 'boolean') {
|
|
35
38
|
return;
|
|
@@ -150,10 +153,15 @@ export function InlineCardNodeView(props) {
|
|
|
150
153
|
useAlternativePreloader: useAlternativePreloader,
|
|
151
154
|
pluginInjectionApi: pluginInjectionApi,
|
|
152
155
|
onClickCallback: onClickCallback
|
|
156
|
+
// Ignored via go/ees005
|
|
157
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
153
158
|
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view')));
|
|
154
159
|
}
|
|
155
160
|
export const inlineCardNodeView = ({
|
|
156
161
|
inlineCardViewProducer
|
|
157
|
-
}) => (node, view, getPos, decorations
|
|
162
|
+
}) => (node, view, getPos, decorations
|
|
163
|
+
// Ignored via go/ees005
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
165
|
+
) => {
|
|
158
166
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
159
167
|
};
|
|
@@ -14,6 +14,8 @@ import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, se
|
|
|
14
14
|
/**
|
|
15
15
|
* Attempt to replace the link into the respective card.
|
|
16
16
|
*/
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
19
|
function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
18
20
|
const {
|
|
19
21
|
inlineCard
|
|
@@ -55,7 +57,10 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
|
|
|
55
57
|
}
|
|
56
58
|
return $pos.node($pos.depth - 1).type.name;
|
|
57
59
|
}
|
|
58
|
-
export const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent
|
|
60
|
+
export const replaceQueuedUrlWithCard = (url, cardData, analyticsAction, editorAnalyticsApi, createAnalyticsEvent
|
|
61
|
+
// Ignored via go/ees005
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
63
|
+
) => (editorState, dispatch) => {
|
|
59
64
|
const state = pluginKey.getState(editorState);
|
|
60
65
|
if (!state) {
|
|
61
66
|
return false;
|
|
@@ -139,7 +144,10 @@ export const handleFallbackWithAnalytics = (request, editorAnalyticsApi) => (sta
|
|
|
139
144
|
}
|
|
140
145
|
return true;
|
|
141
146
|
};
|
|
142
|
-
export const queueCardsFromChangedTr = (state, tr, source, analyticsAction, normalizeLinkText = true, sourceEvent = undefined, appearance = 'inline'
|
|
147
|
+
export const queueCardsFromChangedTr = (state, tr, source, analyticsAction, normalizeLinkText = true, sourceEvent = undefined, appearance = 'inline'
|
|
148
|
+
// Ignored via go/ees005
|
|
149
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
150
|
+
) => {
|
|
143
151
|
const {
|
|
144
152
|
schema
|
|
145
153
|
} = state;
|
|
@@ -175,7 +183,10 @@ export const queueCardsFromChangedTr = (state, tr, source, analyticsAction, norm
|
|
|
175
183
|
}
|
|
176
184
|
return queueCards(requests)(tr);
|
|
177
185
|
};
|
|
178
|
-
export const queueCardFromChangedTr = (state, tr, source, analyticsAction, normalizeLinkText = true, sourceEvent = undefined, previousAppearance
|
|
186
|
+
export const queueCardFromChangedTr = (state, tr, source, analyticsAction, normalizeLinkText = true, sourceEvent = undefined, previousAppearance
|
|
187
|
+
// Ignored via go/ees005
|
|
188
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
189
|
+
) => {
|
|
179
190
|
const {
|
|
180
191
|
schema
|
|
181
192
|
} = state;
|
|
@@ -210,7 +221,10 @@ export const queueCardFromChangedTr = (state, tr, source, analyticsAction, norma
|
|
|
210
221
|
});
|
|
211
222
|
return queueCards(requests)(tr);
|
|
212
223
|
};
|
|
213
|
-
export const convertHyperlinkToSmartCard = (state, source, appearance, normalizeLinkText = true
|
|
224
|
+
export const convertHyperlinkToSmartCard = (state, source, appearance, normalizeLinkText = true
|
|
225
|
+
// Ignored via go/ees005
|
|
226
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
227
|
+
) => {
|
|
214
228
|
const {
|
|
215
229
|
schema
|
|
216
230
|
} = state;
|
|
@@ -238,7 +252,10 @@ export const convertHyperlinkToSmartCard = (state, source, appearance, normalize
|
|
|
238
252
|
});
|
|
239
253
|
return queueCards(requests)(state.tr);
|
|
240
254
|
};
|
|
241
|
-
export const changeSelectedCardToLink = (text, href, sendAnalytics, node, pos, editorAnalyticsApi
|
|
255
|
+
export const changeSelectedCardToLink = (text, href, sendAnalytics, node, pos, editorAnalyticsApi
|
|
256
|
+
// Ignored via go/ees005
|
|
257
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
258
|
+
) => (state, dispatch) => {
|
|
242
259
|
const selectedNode = state.selection instanceof NodeSelection ? state.selection.node : undefined;
|
|
243
260
|
let tr;
|
|
244
261
|
if (node && pos) {
|
|
@@ -265,7 +282,10 @@ export const changeSelectedCardToLink = (text, href, sendAnalytics, node, pos, e
|
|
|
265
282
|
}
|
|
266
283
|
return true;
|
|
267
284
|
};
|
|
268
|
-
export const changeSelectedCardToLinkFallback = (text, href, sendAnalytics, node, pos, editorAnalyticsApi
|
|
285
|
+
export const changeSelectedCardToLinkFallback = (text, href, sendAnalytics, node, pos, editorAnalyticsApi
|
|
286
|
+
// Ignored via go/ees005
|
|
287
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
288
|
+
) => (state, dispatch) => {
|
|
269
289
|
let tr;
|
|
270
290
|
if (node && pos) {
|
|
271
291
|
tr = cardNodeToLinkWithTransaction(state, text, href, node, pos);
|
|
@@ -314,6 +334,9 @@ function cardToLinkWithTransaction(state, text, href) {
|
|
|
314
334
|
})]), false);
|
|
315
335
|
return tr;
|
|
316
336
|
}
|
|
337
|
+
|
|
338
|
+
// Ignored via go/ees005
|
|
339
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
317
340
|
function cardNodeToLinkWithTransaction(state, text, href, node, pos) {
|
|
318
341
|
const {
|
|
319
342
|
link
|
|
@@ -482,7 +505,10 @@ export const updateCardViaDatasource = args => {
|
|
|
482
505
|
}
|
|
483
506
|
view.dispatch(tr.scrollIntoView());
|
|
484
507
|
};
|
|
485
|
-
export const insertDatasource = (state, adf, view, sourceEvent
|
|
508
|
+
export const insertDatasource = (state, adf, view, sourceEvent
|
|
509
|
+
// Ignored via go/ees005
|
|
510
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
511
|
+
) => {
|
|
486
512
|
const {
|
|
487
513
|
tr,
|
|
488
514
|
selection: {
|
|
@@ -52,7 +52,12 @@ export function cardKeymap(featureFlags) {
|
|
|
52
52
|
|
|
53
53
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1227468 introduced since Chrome 91
|
|
54
54
|
if (browser.chrome && browser.chrome_version > 90) {
|
|
55
|
+
// Ignored via go/ees005
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
55
57
|
bindKeymapWithCommand(moveUp.common, selectAboveBelowInlineCard('up'), list);
|
|
58
|
+
|
|
59
|
+
// Ignored via go/ees005
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
56
61
|
bindKeymapWithCommand(moveDown.common, selectAboveBelowInlineCard('down'), list);
|
|
57
62
|
}
|
|
58
63
|
return keymap(list);
|
|
@@ -182,7 +182,11 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
182
182
|
const isBlockCardSelected = selection instanceof NodeSelection && ((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type) === schema.nodes.blockCard;
|
|
183
183
|
if (isBlockCardSelected) {
|
|
184
184
|
var _findDomRefAtPos, _node$attrs;
|
|
185
|
-
|
|
185
|
+
// Ignored via go/ees005
|
|
186
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
187
|
+
const datasourceTableRef = // Ignored via go/ees005
|
|
188
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
189
|
+
(_findDomRefAtPos = findDomRefAtPos(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(`.${DATASOURCE_INNER_CONTAINER_CLASSNAME}`);
|
|
186
190
|
const {
|
|
187
191
|
node
|
|
188
192
|
} = selection;
|
|
@@ -31,7 +31,10 @@ const isFreshlyPastedOnNewLine = view => {
|
|
|
31
31
|
// ============================================================================ //
|
|
32
32
|
// Used for all interactions with the EditorCardProvider.
|
|
33
33
|
// ============================================================================ //
|
|
34
|
-
export const resolveWithProvider = (view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent
|
|
34
|
+
export const resolveWithProvider = (view, provider, request, options, editorAnalyticsApi, createAnalyticsEvent
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
37
|
+
) => {
|
|
35
38
|
const isEmbedFriendlyLocation = fg('hardcoded-embeds-only-on-new-line') ? isFreshlyPastedOnNewLine(view) : true;
|
|
36
39
|
|
|
37
40
|
// When user manually changes appearance from blue link to smart link, we should respect that,
|
|
@@ -61,7 +64,10 @@ const updateCardType = (resolvedCard, options) => {
|
|
|
61
64
|
resolvedCard.type = 'inlineCard';
|
|
62
65
|
}
|
|
63
66
|
};
|
|
64
|
-
const handleResolved = (view, request, editorAnalyticsApi, createAnalyticsEvent, options
|
|
67
|
+
const handleResolved = (view, request, editorAnalyticsApi, createAnalyticsEvent, options
|
|
68
|
+
// Ignored via go/ees005
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
70
|
+
) => resolvedCard => {
|
|
65
71
|
updateCardType(resolvedCard, options);
|
|
66
72
|
replaceQueuedUrlWithCard(request.url, resolvedCard, request.analyticsAction, editorAnalyticsApi, createAnalyticsEvent)(view.state, view.dispatch);
|
|
67
73
|
return resolvedCard;
|
|
@@ -47,7 +47,10 @@ export const findCardInfo = state => {
|
|
|
47
47
|
}
|
|
48
48
|
return pluginState.cards.find(cardInfo => cardInfo.pos === state.selection.from);
|
|
49
49
|
};
|
|
50
|
-
const isAppearanceSupportedInParent = (currentNodePosition, editorState, fragment, currentAppearance
|
|
50
|
+
const isAppearanceSupportedInParent = (currentNodePosition, editorState, fragment, currentAppearance
|
|
51
|
+
// Ignored via go/ees005
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
53
|
+
) => {
|
|
51
54
|
const resolvedPosition = editorState.doc.resolve(currentNodePosition);
|
|
52
55
|
const parent = currentAppearance === 'embed' || currentAppearance === 'block' ? resolvedPosition.node() : resolvedPosition.node(-1);
|
|
53
56
|
return parent && parent.type.validContent(fragment);
|
|
@@ -115,7 +118,10 @@ export const focusEditorView = editorView => {
|
|
|
115
118
|
editorView.focus();
|
|
116
119
|
}
|
|
117
120
|
};
|
|
118
|
-
export const getAwarenessProps = (editorState, getPos, allowEmbeds, allowBlockCards, disableOverlay = false
|
|
121
|
+
export const getAwarenessProps = (editorState, getPos, allowEmbeds, allowBlockCards, disableOverlay = false
|
|
122
|
+
// Ignored via go/ees005
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
124
|
+
) => {
|
|
119
125
|
var _editorState$selectio, _editorState$selectio2, _editorState$selectio3;
|
|
120
126
|
const getPosFunction = typeof getPos !== 'boolean' ? getPos : undefined;
|
|
121
127
|
const linkPosition = getPosFunction === null || getPosFunction === void 0 ? void 0 : getPosFunction();
|
|
@@ -9,6 +9,8 @@ const IconDatasourceGlyph = props => {
|
|
|
9
9
|
height: "15",
|
|
10
10
|
viewBox: "0 0 15 15",
|
|
11
11
|
fill: "none"
|
|
12
|
+
// Ignored via go/ees005
|
|
13
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
14
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
13
15
|
fillRule: "evenodd",
|
|
14
16
|
clipRule: "evenodd",
|
|
@@ -28,5 +30,7 @@ export const DatasourceIcon = props => {
|
|
|
28
30
|
xcss: wrapperStyles
|
|
29
31
|
}, /*#__PURE__*/React.createElement(Icon, _extends({
|
|
30
32
|
glyph: IconDatasourceGlyph
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
31
35
|
}, props)));
|
|
32
36
|
};
|
|
@@ -75,7 +75,10 @@ export class EditLinkToolbar extends React.Component {
|
|
|
75
75
|
// via the floating toolbar
|
|
76
76
|
,
|
|
77
77
|
invokeMethod: INPUT_METHOD.FLOATING_TB,
|
|
78
|
-
lpLinkPicker: lpLinkPicker
|
|
78
|
+
lpLinkPicker: lpLinkPicker
|
|
79
|
+
// Ignored via go/ees005
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
81
|
+
,
|
|
79
82
|
onSubmit: (href, title, displayText, inputMethod, analytic) => {
|
|
80
83
|
this.hideLinkToolbar();
|
|
81
84
|
if (onSubmit) {
|
|
@@ -150,7 +153,10 @@ export const buildEditLinkToolbar = ({
|
|
|
150
153
|
text: displayInfo.title || '',
|
|
151
154
|
node: node,
|
|
152
155
|
lpLinkPicker: lpLinkPicker,
|
|
153
|
-
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 ? void 0 : (_pluginInjectionApi$f2 = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector
|
|
156
|
+
forceFocusSelector: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$f = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f === void 0 ? void 0 : (_pluginInjectionApi$f2 = _pluginInjectionApi$f.actions) === null || _pluginInjectionApi$f2 === void 0 ? void 0 : _pluginInjectionApi$f2.forceFocusSelector
|
|
157
|
+
// Ignored via go/ees005
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
159
|
+
,
|
|
154
160
|
onSubmit: (newHref, newText, inputMethod, analytic) => {
|
|
155
161
|
const urlChanged = newHref !== displayInfo.url;
|
|
156
162
|
const titleChanged = newText !== displayInfo.title;
|
|
@@ -52,7 +52,10 @@ const EditToolbarButtonPresentation = ({
|
|
|
52
52
|
}, jsx(Button, {
|
|
53
53
|
testId: "edit-link",
|
|
54
54
|
onClick: onEditLink
|
|
55
|
-
}, jsx(FormattedMessage
|
|
55
|
+
}, jsx(FormattedMessage
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
58
|
+
, linkToolbarMessages.editLink)), jsx(Separator, null));
|
|
56
59
|
}
|
|
57
60
|
case 'edit-datasource':
|
|
58
61
|
{
|
|
@@ -62,7 +65,10 @@ const EditToolbarButtonPresentation = ({
|
|
|
62
65
|
testId: "edit-datasource",
|
|
63
66
|
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
64
67
|
onClick: onEditDatasource
|
|
65
|
-
}, jsx(FormattedMessage
|
|
68
|
+
}, jsx(FormattedMessage
|
|
69
|
+
// Ignored via go/ees005
|
|
70
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
71
|
+
, linkToolbarMessages.editDatasourceStandalone)), jsx(Separator, null));
|
|
66
72
|
}
|
|
67
73
|
case 'edit-dropdown':
|
|
68
74
|
{
|
|
@@ -79,7 +85,10 @@ const EditToolbarButtonPresentation = ({
|
|
|
79
85
|
selected: isOpen,
|
|
80
86
|
disabled: false,
|
|
81
87
|
ariaHasPopup: true
|
|
82
|
-
}, jsx(FormattedMessage
|
|
88
|
+
}, jsx(FormattedMessage
|
|
89
|
+
// Ignored via go/ees005
|
|
90
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
91
|
+
, messages.editDropdownTriggerTitle)), jsx(Separator, null));
|
|
83
92
|
return jsx(Flex, {
|
|
84
93
|
ref: containerRef
|
|
85
94
|
}, jsx(UiDropdown, {
|
|
@@ -96,11 +105,17 @@ const EditToolbarButtonPresentation = ({
|
|
|
96
105
|
key: "edit.link",
|
|
97
106
|
onClick: onEditLink,
|
|
98
107
|
testId: "edit-dropdown-edit-link-item"
|
|
99
|
-
}, jsx(FormattedMessage
|
|
108
|
+
}, jsx(FormattedMessage
|
|
109
|
+
// Ignored via go/ees005
|
|
110
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
111
|
+
, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
100
112
|
key: "edit.datasource",
|
|
101
113
|
onClick: onEditDatasource,
|
|
102
114
|
testId: "edit-dropdown-edit-datasource-item"
|
|
103
|
-
}, jsx(FormattedMessage
|
|
115
|
+
}, jsx(FormattedMessage
|
|
116
|
+
// Ignored via go/ees005
|
|
117
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
118
|
+
, messages.editDropdownEditDatasourceTitle))));
|
|
104
119
|
}
|
|
105
120
|
case 'none':
|
|
106
121
|
default:
|
|
@@ -85,7 +85,10 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
85
85
|
}, jsx(Button, {
|
|
86
86
|
testId: "edit-link",
|
|
87
87
|
onClick: onEditLink
|
|
88
|
-
}, jsx(FormattedMessage
|
|
88
|
+
}, jsx(FormattedMessage
|
|
89
|
+
// Ignored via go/ees005
|
|
90
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
91
|
+
, linkToolbarMessages.editLink)), jsx(Separator, null));
|
|
89
92
|
}
|
|
90
93
|
case 'edit-datasource':
|
|
91
94
|
{
|
|
@@ -95,7 +98,10 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
95
98
|
testId: "edit-datasource",
|
|
96
99
|
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
97
100
|
onClick: onEditDatasource
|
|
98
|
-
}, jsx(FormattedMessage
|
|
101
|
+
}, jsx(FormattedMessage
|
|
102
|
+
// Ignored via go/ees005
|
|
103
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
104
|
+
, linkToolbarMessages.editDatasourceStandalone)), jsx(Separator, null));
|
|
99
105
|
}
|
|
100
106
|
case 'edit-dropdown':
|
|
101
107
|
{
|
|
@@ -112,7 +118,10 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
112
118
|
selected: isOpen,
|
|
113
119
|
disabled: false,
|
|
114
120
|
ariaHasPopup: true
|
|
115
|
-
}, jsx(FormattedMessage
|
|
121
|
+
}, jsx(FormattedMessage
|
|
122
|
+
// Ignored via go/ees005
|
|
123
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
124
|
+
, messages.editDropdownTriggerTitle)), jsx(Separator, null));
|
|
116
125
|
return jsx(Flex, {
|
|
117
126
|
ref: containerRef
|
|
118
127
|
}, jsx(UiDropdown, {
|
|
@@ -129,11 +138,17 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
129
138
|
key: "edit.link",
|
|
130
139
|
onClick: onEditLink,
|
|
131
140
|
testId: "edit-dropdown-edit-link-item"
|
|
132
|
-
}, jsx(FormattedMessage
|
|
141
|
+
}, jsx(FormattedMessage
|
|
142
|
+
// Ignored via go/ees005
|
|
143
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
144
|
+
, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
133
145
|
key: "edit.datasource",
|
|
134
146
|
onClick: onEditDatasource,
|
|
135
147
|
testId: "edit-dropdown-edit-datasource-item"
|
|
136
|
-
}, jsx(FormattedMessage
|
|
148
|
+
}, jsx(FormattedMessage
|
|
149
|
+
// Ignored via go/ees005
|
|
150
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
151
|
+
, messages.editDropdownEditDatasourceTitle))));
|
|
137
152
|
}
|
|
138
153
|
case 'none':
|
|
139
154
|
default:
|
|
@@ -9,6 +9,12 @@ export class EditorLinkingPlatformAnalytics extends React.PureComponent {
|
|
|
9
9
|
render() {
|
|
10
10
|
return /*#__PURE__*/React.createElement(EditorSmartCardProvider, null, /*#__PURE__*/React.createElement(EditorSmartCardProviderValueGuard, null, /*#__PURE__*/React.createElement(EditorAnalyticsContext, {
|
|
11
11
|
editorView: this.props.editorView
|
|
12
|
-
}, /*#__PURE__*/React.createElement(LinkEventsBinding
|
|
12
|
+
}, /*#__PURE__*/React.createElement(LinkEventsBinding
|
|
13
|
+
// Ignored via go/ees005
|
|
14
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
15
|
+
, this.props), /*#__PURE__*/React.createElement(DatasourceEventsBinding
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
18
|
+
, this.props))));
|
|
13
19
|
}
|
|
14
20
|
}
|
|
@@ -16,6 +16,9 @@ export function HyperlinkToolbarAppearance(props) {
|
|
|
16
16
|
cardOptions,
|
|
17
17
|
editorAnalyticsApi
|
|
18
18
|
} = props;
|
|
19
|
+
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line require-await
|
|
19
22
|
const getProvider = async () => {
|
|
20
23
|
var _props$cardOptions;
|
|
21
24
|
if ((_props$cardOptions = props.cardOptions) !== null && _props$cardOptions !== void 0 && _props$cardOptions.provider) {
|