@atlaskit/editor-plugin-card 11.5.4 → 11.5.6
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 +18 -0
- package/dist/cjs/pm-plugins/doc.js +1 -1
- package/dist/cjs/pm-plugins/main.js +16 -0
- package/dist/cjs/ui/analytics/events-from-tr.js +25 -2
- package/dist/es2019/pm-plugins/doc.js +1 -1
- package/dist/es2019/pm-plugins/main.js +22 -0
- package/dist/es2019/ui/analytics/events-from-tr.js +24 -1
- package/dist/esm/pm-plugins/doc.js +1 -1
- package/dist/esm/pm-plugins/main.js +16 -0
- package/dist/esm/ui/analytics/events-from-tr.js +25 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 11.5.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
8
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
9
|
+
project refs are setup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 11.5.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`0d237a5696b06`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d237a5696b06) -
|
|
17
|
+
Uncoupled several block of changes from the aifc FG and moved them behind their own FG so they can
|
|
18
|
+
be rolled out quicker
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 11.5.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -322,7 +322,7 @@ var changeSelectedCardToLinkFallback = exports.changeSelectedCardToLinkFallback
|
|
|
322
322
|
})(tr);
|
|
323
323
|
}
|
|
324
324
|
if (dispatch) {
|
|
325
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
325
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_ai_generic_prep_for_aifc')) {
|
|
326
326
|
dispatch(tr.setMeta('addToHistory', false));
|
|
327
327
|
} else {
|
|
328
328
|
dispatch(tr.scrollIntoView());
|
|
@@ -75,6 +75,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
75
75
|
});
|
|
76
76
|
return new _safePlugin.SafePlugin({
|
|
77
77
|
state: {
|
|
78
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
78
79
|
init: function init() {
|
|
79
80
|
return {
|
|
80
81
|
requests: [],
|
|
@@ -90,6 +91,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
90
91
|
layout: undefined
|
|
91
92
|
};
|
|
92
93
|
},
|
|
94
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
93
95
|
apply: function apply(tr, pluginState, prevEditorState) {
|
|
94
96
|
var _pluginState$requests;
|
|
95
97
|
// Update all the positions of outstanding requests and
|
|
@@ -138,6 +140,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
138
140
|
return newState;
|
|
139
141
|
}
|
|
140
142
|
},
|
|
143
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
141
144
|
filterTransaction: function filterTransaction(tr) {
|
|
142
145
|
var isOutsideClicked = tr.getMeta('outsideProsemirrorEditorClicked');
|
|
143
146
|
if (isOutsideClicked) {
|
|
@@ -148,6 +151,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
148
151
|
}
|
|
149
152
|
return true;
|
|
150
153
|
},
|
|
154
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
151
155
|
view: function view(_view) {
|
|
152
156
|
var domAtPos = _view.domAtPos.bind(_view);
|
|
153
157
|
var rafCancellationCallbacks = [];
|
|
@@ -155,6 +159,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
155
159
|
(0, _resolve.handleProvider)('cardProvider', options.provider, _view);
|
|
156
160
|
}
|
|
157
161
|
return {
|
|
162
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
158
163
|
update: function update(view, prevState) {
|
|
159
164
|
var _selection$node;
|
|
160
165
|
var currentState = (0, _state2.getPluginState)(view.state);
|
|
@@ -199,6 +204,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
199
204
|
var newRequests = (0, _state2.getNewRequests)(oldState, currentState);
|
|
200
205
|
// Ask the CardProvider to resolve all new requests.
|
|
201
206
|
var _provider = currentState.provider;
|
|
207
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
208
|
+
|
|
202
209
|
newRequests.forEach(function (request) {
|
|
203
210
|
/**
|
|
204
211
|
* Queue each asynchronous resolve request on separate frames.
|
|
@@ -225,8 +232,11 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
225
232
|
*/
|
|
226
233
|
cardPluginEvents === null || cardPluginEvents === void 0 || cardPluginEvents.flush();
|
|
227
234
|
},
|
|
235
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
228
236
|
destroy: function destroy() {
|
|
229
237
|
// Cancel any outstanding raf callbacks.
|
|
238
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
239
|
+
|
|
230
240
|
rafCancellationCallbacks.forEach(function (cancellationCallback) {
|
|
231
241
|
return cancellationCallback();
|
|
232
242
|
});
|
|
@@ -234,6 +244,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
234
244
|
};
|
|
235
245
|
},
|
|
236
246
|
props: _objectSpread({
|
|
247
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
248
|
+
|
|
237
249
|
nodeViews: {
|
|
238
250
|
inlineCard: (0, _lazyInlineCard.lazyInlineCardView)({
|
|
239
251
|
inlineCardViewProducer: inlineCardViewProducer,
|
|
@@ -264,10 +276,14 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
264
276
|
})
|
|
265
277
|
}
|
|
266
278
|
}, enableInlineUpgradeFeatures && {
|
|
279
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
280
|
+
|
|
267
281
|
handleKeyDown: function handleKeyDown(view) {
|
|
268
282
|
handleAwarenessOverlay(view);
|
|
269
283
|
return false;
|
|
270
284
|
},
|
|
285
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
286
|
+
|
|
271
287
|
handleClick: function handleClick(view) {
|
|
272
288
|
handleAwarenessOverlay(view);
|
|
273
289
|
return false;
|
|
@@ -83,6 +83,9 @@ var findChanged = exports.findChanged = function findChanged(tr, state) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
88
|
+
|
|
86
89
|
stepMap.forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
87
90
|
var _tr$docs2;
|
|
88
91
|
var before = tr.docs[i];
|
|
@@ -109,6 +112,8 @@ var findChanged = exports.findChanged = function findChanged(tr, state) {
|
|
|
109
112
|
* Skip/filter out links that have been queued, they will be tracked later
|
|
110
113
|
*/
|
|
111
114
|
var queuedPositions = getQueuedPositions(tr);
|
|
115
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
116
|
+
|
|
112
117
|
return links.filter(function (link) {
|
|
113
118
|
return !queuedPositions.includes(link.pos);
|
|
114
119
|
});
|
|
@@ -166,6 +171,8 @@ var findChanged = exports.findChanged = function findChanged(tr, state) {
|
|
|
166
171
|
var newLink = inserted[_i];
|
|
167
172
|
|
|
168
173
|
// what is the 2nd argument 'assoc = -1' doing here exactly?
|
|
174
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
175
|
+
|
|
169
176
|
var mappedPos = tr.mapping.map(newLink.pos, -1);
|
|
170
177
|
var previousDisplay = getResolveLinkPrevDisplay(state, mappedPos);
|
|
171
178
|
updated.push({
|
|
@@ -207,6 +214,8 @@ var UPDATE_ACTIONS = [_analytics.ACTION.CHANGED_TYPE, _analytics.ACTION.UPDATED]
|
|
|
207
214
|
* intended to be perceived as an update to links, rather than insertion+deletion
|
|
208
215
|
*/
|
|
209
216
|
var isUpdateTr = function isUpdateTr(tr, isUndoOrRedo) {
|
|
217
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
218
|
+
|
|
210
219
|
return !!tr.steps.find(function (step) {
|
|
211
220
|
if (!(step instanceof _steps.LinkMetaStep)) {
|
|
212
221
|
return false;
|
|
@@ -253,6 +262,9 @@ var getQueuedPositions = function getQueuedPositions(tr) {
|
|
|
253
262
|
if (!isMetadataQueue(pluginMeta)) {
|
|
254
263
|
return [];
|
|
255
264
|
}
|
|
265
|
+
|
|
266
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
267
|
+
|
|
256
268
|
return pluginMeta.requests.map(function (_ref) {
|
|
257
269
|
var pos = _ref.pos;
|
|
258
270
|
return pos;
|
|
@@ -267,9 +279,13 @@ var getResolvePositions = function getResolvePositions(tr, state) {
|
|
|
267
279
|
if (!isMetadataResolve(pluginMeta)) {
|
|
268
280
|
return [];
|
|
269
281
|
}
|
|
270
|
-
return cardState.requests
|
|
282
|
+
return cardState.requests
|
|
283
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
284
|
+
.filter(function (request) {
|
|
271
285
|
return request.url === pluginMeta.url;
|
|
272
|
-
})
|
|
286
|
+
})
|
|
287
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
288
|
+
.map(function (request) {
|
|
273
289
|
return request.pos;
|
|
274
290
|
});
|
|
275
291
|
};
|
|
@@ -279,6 +295,9 @@ var getResolveLinkPrevDisplay = function getResolveLinkPrevDisplay(state, pos) {
|
|
|
279
295
|
if (!cardState) {
|
|
280
296
|
return undefined;
|
|
281
297
|
}
|
|
298
|
+
|
|
299
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
300
|
+
|
|
282
301
|
return (_cardState$requests$f = cardState.requests.find(function (request) {
|
|
283
302
|
return request.pos === pos;
|
|
284
303
|
})) === null || _cardState$requests$f === void 0 ? void 0 : _cardState$requests$f.previousAppearance;
|
|
@@ -299,6 +318,8 @@ function eventsFromTransaction(tr, state) {
|
|
|
299
318
|
*/
|
|
300
319
|
var isRemote = tr.getMeta('isRemote');
|
|
301
320
|
var isReplaceDocument = tr.getMeta('replaceDocument');
|
|
321
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
322
|
+
|
|
302
323
|
var isTableSort = tr.steps.find(function (step) {
|
|
303
324
|
return step instanceof _customSteps.TableSortStep;
|
|
304
325
|
});
|
|
@@ -321,6 +342,8 @@ function eventsFromTransaction(tr, state) {
|
|
|
321
342
|
inserted = _findChanged.inserted,
|
|
322
343
|
updated = _findChanged.updated;
|
|
323
344
|
var MAX_LINK_EVENTS = 50;
|
|
345
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
346
|
+
|
|
324
347
|
if ([removed, inserted, updated].some(function (arr) {
|
|
325
348
|
return arr.length > MAX_LINK_EVENTS;
|
|
326
349
|
})) {
|
|
@@ -294,7 +294,7 @@ export const changeSelectedCardToLinkFallback = (text, href, sendAnalytics, node
|
|
|
294
294
|
})(tr);
|
|
295
295
|
}
|
|
296
296
|
if (dispatch) {
|
|
297
|
-
if (fg('
|
|
297
|
+
if (fg('platform_editor_ai_generic_prep_for_aifc')) {
|
|
298
298
|
dispatch(tr.setMeta('addToHistory', false));
|
|
299
299
|
} else {
|
|
300
300
|
dispatch(tr.scrollIntoView());
|
|
@@ -65,6 +65,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
65
65
|
});
|
|
66
66
|
return new SafePlugin({
|
|
67
67
|
state: {
|
|
68
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
69
|
+
|
|
68
70
|
init() {
|
|
69
71
|
return {
|
|
70
72
|
requests: [],
|
|
@@ -80,6 +82,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
80
82
|
layout: undefined
|
|
81
83
|
};
|
|
82
84
|
},
|
|
85
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
86
|
+
|
|
83
87
|
apply(tr, pluginState, prevEditorState) {
|
|
84
88
|
var _pluginState$requests;
|
|
85
89
|
// Update all the positions of outstanding requests and
|
|
@@ -129,6 +133,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
129
133
|
return newState;
|
|
130
134
|
}
|
|
131
135
|
},
|
|
136
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
137
|
+
|
|
132
138
|
filterTransaction(tr) {
|
|
133
139
|
const isOutsideClicked = tr.getMeta('outsideProsemirrorEditorClicked');
|
|
134
140
|
if (isOutsideClicked) {
|
|
@@ -139,6 +145,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
139
145
|
}
|
|
140
146
|
return true;
|
|
141
147
|
},
|
|
148
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
149
|
+
|
|
142
150
|
view(view) {
|
|
143
151
|
const domAtPos = view.domAtPos.bind(view);
|
|
144
152
|
const rafCancellationCallbacks = [];
|
|
@@ -146,6 +154,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
146
154
|
handleProvider('cardProvider', options.provider, view);
|
|
147
155
|
}
|
|
148
156
|
return {
|
|
157
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
158
|
+
|
|
149
159
|
update(view, prevState) {
|
|
150
160
|
var _selection$node;
|
|
151
161
|
const currentState = getPluginState(view.state);
|
|
@@ -198,6 +208,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
198
208
|
const {
|
|
199
209
|
provider
|
|
200
210
|
} = currentState;
|
|
211
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
212
|
+
|
|
201
213
|
newRequests.forEach(request => {
|
|
202
214
|
/**
|
|
203
215
|
* Queue each asynchronous resolve request on separate frames.
|
|
@@ -224,13 +236,19 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
224
236
|
*/
|
|
225
237
|
cardPluginEvents === null || cardPluginEvents === void 0 ? void 0 : cardPluginEvents.flush();
|
|
226
238
|
},
|
|
239
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
240
|
+
|
|
227
241
|
destroy() {
|
|
228
242
|
// Cancel any outstanding raf callbacks.
|
|
243
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
244
|
+
|
|
229
245
|
rafCancellationCallbacks.forEach(cancellationCallback => cancellationCallback());
|
|
230
246
|
}
|
|
231
247
|
};
|
|
232
248
|
},
|
|
233
249
|
props: {
|
|
250
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
251
|
+
|
|
234
252
|
nodeViews: {
|
|
235
253
|
inlineCard: lazyInlineCardView({
|
|
236
254
|
inlineCardViewProducer,
|
|
@@ -261,10 +279,14 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
261
279
|
})
|
|
262
280
|
},
|
|
263
281
|
...(enableInlineUpgradeFeatures && {
|
|
282
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
283
|
+
|
|
264
284
|
handleKeyDown: view => {
|
|
265
285
|
handleAwarenessOverlay(view);
|
|
266
286
|
return false;
|
|
267
287
|
},
|
|
288
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
289
|
+
|
|
268
290
|
handleClick: view => {
|
|
269
291
|
handleAwarenessOverlay(view);
|
|
270
292
|
return false;
|
|
@@ -74,6 +74,9 @@ export const findChanged = (tr, state) => {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
|
|
78
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
79
|
+
|
|
77
80
|
stepMap.forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
78
81
|
var _tr$docs2;
|
|
79
82
|
const before = tr.docs[i];
|
|
@@ -96,6 +99,8 @@ export const findChanged = (tr, state) => {
|
|
|
96
99
|
* Skip/filter out links that have been queued, they will be tracked later
|
|
97
100
|
*/
|
|
98
101
|
const queuedPositions = getQueuedPositions(tr);
|
|
102
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
103
|
+
|
|
99
104
|
return links.filter(link => !queuedPositions.includes(link.pos));
|
|
100
105
|
};
|
|
101
106
|
|
|
@@ -149,6 +154,8 @@ export const findChanged = (tr, state) => {
|
|
|
149
154
|
const newLink = inserted[i];
|
|
150
155
|
|
|
151
156
|
// what is the 2nd argument 'assoc = -1' doing here exactly?
|
|
157
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
158
|
+
|
|
152
159
|
const mappedPos = tr.mapping.map(newLink.pos, -1);
|
|
153
160
|
const previousDisplay = getResolveLinkPrevDisplay(state, mappedPos);
|
|
154
161
|
updated.push({
|
|
@@ -190,6 +197,8 @@ const UPDATE_ACTIONS = [ACTION.CHANGED_TYPE, ACTION.UPDATED];
|
|
|
190
197
|
* intended to be perceived as an update to links, rather than insertion+deletion
|
|
191
198
|
*/
|
|
192
199
|
const isUpdateTr = (tr, isUndoOrRedo) => {
|
|
200
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
201
|
+
|
|
193
202
|
return !!tr.steps.find(step => {
|
|
194
203
|
if (!(step instanceof LinkMetaStep)) {
|
|
195
204
|
return false;
|
|
@@ -237,6 +246,9 @@ const getQueuedPositions = tr => {
|
|
|
237
246
|
if (!isMetadataQueue(pluginMeta)) {
|
|
238
247
|
return [];
|
|
239
248
|
}
|
|
249
|
+
|
|
250
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
251
|
+
|
|
240
252
|
return pluginMeta.requests.map(({
|
|
241
253
|
pos
|
|
242
254
|
}) => pos);
|
|
@@ -250,7 +262,11 @@ const getResolvePositions = (tr, state) => {
|
|
|
250
262
|
if (!isMetadataResolve(pluginMeta)) {
|
|
251
263
|
return [];
|
|
252
264
|
}
|
|
253
|
-
return cardState.requests
|
|
265
|
+
return cardState.requests
|
|
266
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
267
|
+
.filter(request => request.url === pluginMeta.url)
|
|
268
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
269
|
+
.map(request => request.pos);
|
|
254
270
|
};
|
|
255
271
|
const getResolveLinkPrevDisplay = (state, pos) => {
|
|
256
272
|
var _cardState$requests$f;
|
|
@@ -258,6 +274,9 @@ const getResolveLinkPrevDisplay = (state, pos) => {
|
|
|
258
274
|
if (!cardState) {
|
|
259
275
|
return undefined;
|
|
260
276
|
}
|
|
277
|
+
|
|
278
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
279
|
+
|
|
261
280
|
return (_cardState$requests$f = cardState.requests.find(request => request.pos === pos)) === null || _cardState$requests$f === void 0 ? void 0 : _cardState$requests$f.previousAppearance;
|
|
262
281
|
};
|
|
263
282
|
const isDatasourceDowngrade = (previousSubject, currentSubject) => previousSubject === EVENT_SUBJECT.DATASOURCE && currentSubject === EVENT_SUBJECT.LINK;
|
|
@@ -272,6 +291,8 @@ export function eventsFromTransaction(tr, state) {
|
|
|
272
291
|
*/
|
|
273
292
|
const isRemote = tr.getMeta('isRemote');
|
|
274
293
|
const isReplaceDocument = tr.getMeta('replaceDocument');
|
|
294
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
295
|
+
|
|
275
296
|
const isTableSort = tr.steps.find(step => step instanceof TableSortStep);
|
|
276
297
|
if (isRemote || isReplaceDocument || isTableSort) {
|
|
277
298
|
return events;
|
|
@@ -294,6 +315,8 @@ export function eventsFromTransaction(tr, state) {
|
|
|
294
315
|
updated
|
|
295
316
|
} = findChanged(tr, state);
|
|
296
317
|
const MAX_LINK_EVENTS = 50;
|
|
318
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
319
|
+
|
|
297
320
|
if ([removed, inserted, updated].some(arr => arr.length > MAX_LINK_EVENTS)) {
|
|
298
321
|
return [];
|
|
299
322
|
}
|
|
@@ -316,7 +316,7 @@ export var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkF
|
|
|
316
316
|
})(tr);
|
|
317
317
|
}
|
|
318
318
|
if (dispatch) {
|
|
319
|
-
if (fg('
|
|
319
|
+
if (fg('platform_editor_ai_generic_prep_for_aifc')) {
|
|
320
320
|
dispatch(tr.setMeta('addToHistory', false));
|
|
321
321
|
} else {
|
|
322
322
|
dispatch(tr.scrollIntoView());
|
|
@@ -68,6 +68,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
68
68
|
});
|
|
69
69
|
return new SafePlugin({
|
|
70
70
|
state: {
|
|
71
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
71
72
|
init: function init() {
|
|
72
73
|
return {
|
|
73
74
|
requests: [],
|
|
@@ -83,6 +84,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
83
84
|
layout: undefined
|
|
84
85
|
};
|
|
85
86
|
},
|
|
87
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
86
88
|
apply: function apply(tr, pluginState, prevEditorState) {
|
|
87
89
|
var _pluginState$requests;
|
|
88
90
|
// Update all the positions of outstanding requests and
|
|
@@ -131,6 +133,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
131
133
|
return newState;
|
|
132
134
|
}
|
|
133
135
|
},
|
|
136
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
134
137
|
filterTransaction: function filterTransaction(tr) {
|
|
135
138
|
var isOutsideClicked = tr.getMeta('outsideProsemirrorEditorClicked');
|
|
136
139
|
if (isOutsideClicked) {
|
|
@@ -141,6 +144,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
141
144
|
}
|
|
142
145
|
return true;
|
|
143
146
|
},
|
|
147
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
144
148
|
view: function view(_view) {
|
|
145
149
|
var domAtPos = _view.domAtPos.bind(_view);
|
|
146
150
|
var rafCancellationCallbacks = [];
|
|
@@ -148,6 +152,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
148
152
|
handleProvider('cardProvider', options.provider, _view);
|
|
149
153
|
}
|
|
150
154
|
return {
|
|
155
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
151
156
|
update: function update(view, prevState) {
|
|
152
157
|
var _selection$node;
|
|
153
158
|
var currentState = getPluginState(view.state);
|
|
@@ -192,6 +197,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
192
197
|
var newRequests = getNewRequests(oldState, currentState);
|
|
193
198
|
// Ask the CardProvider to resolve all new requests.
|
|
194
199
|
var _provider = currentState.provider;
|
|
200
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
201
|
+
|
|
195
202
|
newRequests.forEach(function (request) {
|
|
196
203
|
/**
|
|
197
204
|
* Queue each asynchronous resolve request on separate frames.
|
|
@@ -218,8 +225,11 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
218
225
|
*/
|
|
219
226
|
cardPluginEvents === null || cardPluginEvents === void 0 || cardPluginEvents.flush();
|
|
220
227
|
},
|
|
228
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
221
229
|
destroy: function destroy() {
|
|
222
230
|
// Cancel any outstanding raf callbacks.
|
|
231
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
232
|
+
|
|
223
233
|
rafCancellationCallbacks.forEach(function (cancellationCallback) {
|
|
224
234
|
return cancellationCallback();
|
|
225
235
|
});
|
|
@@ -227,6 +237,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
227
237
|
};
|
|
228
238
|
},
|
|
229
239
|
props: _objectSpread({
|
|
240
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
241
|
+
|
|
230
242
|
nodeViews: {
|
|
231
243
|
inlineCard: lazyInlineCardView({
|
|
232
244
|
inlineCardViewProducer: inlineCardViewProducer,
|
|
@@ -257,10 +269,14 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
257
269
|
})
|
|
258
270
|
}
|
|
259
271
|
}, enableInlineUpgradeFeatures && {
|
|
272
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
273
|
+
|
|
260
274
|
handleKeyDown: function handleKeyDown(view) {
|
|
261
275
|
handleAwarenessOverlay(view);
|
|
262
276
|
return false;
|
|
263
277
|
},
|
|
278
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
279
|
+
|
|
264
280
|
handleClick: function handleClick(view) {
|
|
265
281
|
handleAwarenessOverlay(view);
|
|
266
282
|
return false;
|
|
@@ -76,6 +76,9 @@ export var findChanged = function findChanged(tr, state) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
81
|
+
|
|
79
82
|
stepMap.forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
80
83
|
var _tr$docs2;
|
|
81
84
|
var before = tr.docs[i];
|
|
@@ -102,6 +105,8 @@ export var findChanged = function findChanged(tr, state) {
|
|
|
102
105
|
* Skip/filter out links that have been queued, they will be tracked later
|
|
103
106
|
*/
|
|
104
107
|
var queuedPositions = getQueuedPositions(tr);
|
|
108
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
109
|
+
|
|
105
110
|
return links.filter(function (link) {
|
|
106
111
|
return !queuedPositions.includes(link.pos);
|
|
107
112
|
});
|
|
@@ -159,6 +164,8 @@ export var findChanged = function findChanged(tr, state) {
|
|
|
159
164
|
var newLink = inserted[_i];
|
|
160
165
|
|
|
161
166
|
// what is the 2nd argument 'assoc = -1' doing here exactly?
|
|
167
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
168
|
+
|
|
162
169
|
var mappedPos = tr.mapping.map(newLink.pos, -1);
|
|
163
170
|
var previousDisplay = getResolveLinkPrevDisplay(state, mappedPos);
|
|
164
171
|
updated.push({
|
|
@@ -200,6 +207,8 @@ var UPDATE_ACTIONS = [ACTION.CHANGED_TYPE, ACTION.UPDATED];
|
|
|
200
207
|
* intended to be perceived as an update to links, rather than insertion+deletion
|
|
201
208
|
*/
|
|
202
209
|
var isUpdateTr = function isUpdateTr(tr, isUndoOrRedo) {
|
|
210
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
211
|
+
|
|
203
212
|
return !!tr.steps.find(function (step) {
|
|
204
213
|
if (!(step instanceof LinkMetaStep)) {
|
|
205
214
|
return false;
|
|
@@ -246,6 +255,9 @@ var getQueuedPositions = function getQueuedPositions(tr) {
|
|
|
246
255
|
if (!isMetadataQueue(pluginMeta)) {
|
|
247
256
|
return [];
|
|
248
257
|
}
|
|
258
|
+
|
|
259
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
260
|
+
|
|
249
261
|
return pluginMeta.requests.map(function (_ref) {
|
|
250
262
|
var pos = _ref.pos;
|
|
251
263
|
return pos;
|
|
@@ -260,9 +272,13 @@ var getResolvePositions = function getResolvePositions(tr, state) {
|
|
|
260
272
|
if (!isMetadataResolve(pluginMeta)) {
|
|
261
273
|
return [];
|
|
262
274
|
}
|
|
263
|
-
return cardState.requests
|
|
275
|
+
return cardState.requests
|
|
276
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
277
|
+
.filter(function (request) {
|
|
264
278
|
return request.url === pluginMeta.url;
|
|
265
|
-
})
|
|
279
|
+
})
|
|
280
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
281
|
+
.map(function (request) {
|
|
266
282
|
return request.pos;
|
|
267
283
|
});
|
|
268
284
|
};
|
|
@@ -272,6 +288,9 @@ var getResolveLinkPrevDisplay = function getResolveLinkPrevDisplay(state, pos) {
|
|
|
272
288
|
if (!cardState) {
|
|
273
289
|
return undefined;
|
|
274
290
|
}
|
|
291
|
+
|
|
292
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
293
|
+
|
|
275
294
|
return (_cardState$requests$f = cardState.requests.find(function (request) {
|
|
276
295
|
return request.pos === pos;
|
|
277
296
|
})) === null || _cardState$requests$f === void 0 ? void 0 : _cardState$requests$f.previousAppearance;
|
|
@@ -292,6 +311,8 @@ export function eventsFromTransaction(tr, state) {
|
|
|
292
311
|
*/
|
|
293
312
|
var isRemote = tr.getMeta('isRemote');
|
|
294
313
|
var isReplaceDocument = tr.getMeta('replaceDocument');
|
|
314
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
315
|
+
|
|
295
316
|
var isTableSort = tr.steps.find(function (step) {
|
|
296
317
|
return step instanceof TableSortStep;
|
|
297
318
|
});
|
|
@@ -314,6 +335,8 @@ export function eventsFromTransaction(tr, state) {
|
|
|
314
335
|
inserted = _findChanged.inserted,
|
|
315
336
|
updated = _findChanged.updated;
|
|
316
337
|
var MAX_LINK_EVENTS = 50;
|
|
338
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
339
|
+
|
|
317
340
|
if ([removed, inserted, updated].some(function (arr) {
|
|
318
341
|
return arr.length > MAX_LINK_EVENTS;
|
|
319
342
|
})) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.6",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"@atlaskit/menu": "^8.4.0",
|
|
60
60
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
61
61
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
62
|
-
"@atlaskit/primitives": "^16.
|
|
62
|
+
"@atlaskit/primitives": "^16.3.0",
|
|
63
63
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
64
|
-
"@atlaskit/smart-card": "^43.
|
|
64
|
+
"@atlaskit/smart-card": "^43.10.0",
|
|
65
65
|
"@atlaskit/theme": "^21.0.0",
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
67
|
-
"@atlaskit/tokens": "^8.
|
|
66
|
+
"@atlaskit/tmp-editor-statsig": "^13.42.0",
|
|
67
|
+
"@atlaskit/tokens": "^8.3.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|
|
70
70
|
"lodash": "^4.17.21",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^3.1.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^110.
|
|
76
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
77
77
|
"@atlaskit/link-provider": "^4.0.0",
|
|
78
78
|
"react": "^18.2.0",
|
|
79
79
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
"platform_editor_adf_with_localid": {
|
|
125
125
|
"type": "boolean"
|
|
126
126
|
},
|
|
127
|
-
"
|
|
127
|
+
"platform_editor_ai_generic_prep_for_aifc": {
|
|
128
128
|
"type": "boolean"
|
|
129
129
|
},
|
|
130
130
|
"platform_editor_ai_aifc_patch_beta_2": {
|