@atlaskit/editor-plugin-paste 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 8.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5812c1aff4a50`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5812c1aff4a50) -
8
+ Clean up platform_editor_pasting_nested_table_fix experiment - Fix nested table pasting by using
9
+ getLastPastedSlice
10
+ - Updated dependencies
11
+
3
12
  ## 8.0.0
4
13
 
5
14
  ### Patch Changes
@@ -290,48 +290,26 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
290
290
  // we make sure to call paste options toolbar
291
291
  // only for a valid paste action
292
292
  if (isDocChanged) {
293
- if ((0, _expValEquals.expValEquals)('platform_editor_pasting_nested_table_fix', 'isEnabled', true)) {
294
- var pastedSlice = getLastPastedSlice(tr);
295
- if (pastedSlice) {
296
- var _input;
297
- var pasteStartPos = state.selection.from;
298
- var pasteEndPos = tr.selection.to;
299
- var contentPasted = {
300
- pasteStartPos: pasteStartPos,
301
- pasteEndPos: pasteEndPos,
302
- text: text,
303
- isShiftPressed: Boolean(
304
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
305
- view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
306
- isPlainText: Boolean(isPlainText),
307
- pastedSlice: pastedSlice,
308
- pastedAt: Date.now(),
309
- pasteSource: (0, _util.getPasteSource)(event)
310
- };
311
- tr.setMeta(_pluginFactory.pluginKey, {
312
- type: _actions.PastePluginActionTypes.ON_PASTE,
313
- contentPasted: contentPasted
314
- });
315
- }
316
- } else {
317
- var _input2;
318
- var _pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
319
- var _pasteEndPos = tr.selection.to;
320
- var _contentPasted = {
321
- pasteStartPos: _pasteStartPos,
322
- pasteEndPos: _pasteEndPos,
293
+ var pastedSlice = getLastPastedSlice(tr);
294
+ if (pastedSlice) {
295
+ var _input;
296
+ var pasteStartPos = state.selection.from;
297
+ var pasteEndPos = tr.selection.to;
298
+ var contentPasted = {
299
+ pasteStartPos: pasteStartPos,
300
+ pasteEndPos: pasteEndPos,
323
301
  text: text,
324
302
  isShiftPressed: Boolean(
325
303
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
- view.shiftKey || ((_input2 = view.input) === null || _input2 === void 0 ? void 0 : _input2.shiftKey)),
304
+ view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
327
305
  isPlainText: Boolean(isPlainText),
328
- pastedSlice: tr.doc.slice(_pasteStartPos, _pasteEndPos),
306
+ pastedSlice: pastedSlice,
329
307
  pastedAt: Date.now(),
330
308
  pasteSource: (0, _util.getPasteSource)(event)
331
309
  };
332
310
  tr.setMeta(_pluginFactory.pluginKey, {
333
311
  type: _actions.PastePluginActionTypes.ON_PASTE,
334
- contentPasted: _contentPasted
312
+ contentPasted: contentPasted
335
313
  });
336
314
  }
337
315
  }
@@ -252,32 +252,10 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
252
252
  // we make sure to call paste options toolbar
253
253
  // only for a valid paste action
254
254
  if (isDocChanged) {
255
- if (expValEquals('platform_editor_pasting_nested_table_fix', 'isEnabled', true)) {
256
- const pastedSlice = getLastPastedSlice(tr);
257
- if (pastedSlice) {
258
- var _input;
259
- const pasteStartPos = state.selection.from;
260
- const pasteEndPos = tr.selection.to;
261
- const contentPasted = {
262
- pasteStartPos,
263
- pasteEndPos,
264
- text,
265
- isShiftPressed: Boolean(
266
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
- view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
268
- isPlainText: Boolean(isPlainText),
269
- pastedSlice,
270
- pastedAt: Date.now(),
271
- pasteSource: getPasteSource(event)
272
- };
273
- tr.setMeta(stateKey, {
274
- type: PastePluginActionTypes.ON_PASTE,
275
- contentPasted
276
- });
277
- }
278
- } else {
279
- var _input2;
280
- const pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
255
+ const pastedSlice = getLastPastedSlice(tr);
256
+ if (pastedSlice) {
257
+ var _input;
258
+ const pasteStartPos = state.selection.from;
281
259
  const pasteEndPos = tr.selection.to;
282
260
  const contentPasted = {
283
261
  pasteStartPos,
@@ -285,9 +263,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
285
263
  text,
286
264
  isShiftPressed: Boolean(
287
265
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
288
- view.shiftKey || ((_input2 = view.input) === null || _input2 === void 0 ? void 0 : _input2.shiftKey)),
266
+ view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
289
267
  isPlainText: Boolean(isPlainText),
290
- pastedSlice: tr.doc.slice(pasteStartPos, pasteEndPos),
268
+ pastedSlice,
291
269
  pastedAt: Date.now(),
292
270
  pasteSource: getPasteSource(event)
293
271
  };
@@ -282,48 +282,26 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
282
282
  // we make sure to call paste options toolbar
283
283
  // only for a valid paste action
284
284
  if (isDocChanged) {
285
- if (expValEquals('platform_editor_pasting_nested_table_fix', 'isEnabled', true)) {
286
- var pastedSlice = getLastPastedSlice(tr);
287
- if (pastedSlice) {
288
- var _input;
289
- var pasteStartPos = state.selection.from;
290
- var pasteEndPos = tr.selection.to;
291
- var contentPasted = {
292
- pasteStartPos: pasteStartPos,
293
- pasteEndPos: pasteEndPos,
294
- text: text,
295
- isShiftPressed: Boolean(
296
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
297
- view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
298
- isPlainText: Boolean(isPlainText),
299
- pastedSlice: pastedSlice,
300
- pastedAt: Date.now(),
301
- pasteSource: getPasteSource(event)
302
- };
303
- tr.setMeta(stateKey, {
304
- type: PastePluginActionTypes.ON_PASTE,
305
- contentPasted: contentPasted
306
- });
307
- }
308
- } else {
309
- var _input2;
310
- var _pasteStartPos = Math.min(state.selection.anchor, state.selection.head);
311
- var _pasteEndPos = tr.selection.to;
312
- var _contentPasted = {
313
- pasteStartPos: _pasteStartPos,
314
- pasteEndPos: _pasteEndPos,
285
+ var pastedSlice = getLastPastedSlice(tr);
286
+ if (pastedSlice) {
287
+ var _input;
288
+ var pasteStartPos = state.selection.from;
289
+ var pasteEndPos = tr.selection.to;
290
+ var contentPasted = {
291
+ pasteStartPos: pasteStartPos,
292
+ pasteEndPos: pasteEndPos,
315
293
  text: text,
316
294
  isShiftPressed: Boolean(
317
295
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
- view.shiftKey || ((_input2 = view.input) === null || _input2 === void 0 ? void 0 : _input2.shiftKey)),
296
+ view.shiftKey || ((_input = view.input) === null || _input === void 0 ? void 0 : _input.shiftKey)),
319
297
  isPlainText: Boolean(isPlainText),
320
- pastedSlice: tr.doc.slice(_pasteStartPos, _pasteEndPos),
298
+ pastedSlice: pastedSlice,
321
299
  pastedAt: Date.now(),
322
300
  pasteSource: getPasteSource(event)
323
301
  };
324
302
  tr.setMeta(stateKey, {
325
303
  type: PastePluginActionTypes.ON_PASTE,
326
- contentPasted: _contentPasted
304
+ contentPasted: contentPasted
327
305
  });
328
306
  }
329
307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",