@atlaskit/editor-plugin-paste 2.0.8 → 2.0.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/{commands.js → editor-commands/commands.js} +2 -2
  3. package/dist/cjs/index.js +2 -2
  4. package/dist/cjs/pm-plugins/analytics.js +11 -3
  5. package/dist/cjs/pm-plugins/main.js +14 -12
  6. package/dist/cjs/pm-plugins/plugin-factory.js +1 -1
  7. package/dist/cjs/{reducer.js → pm-plugins/reducer.js} +1 -1
  8. package/dist/cjs/{edge-cases → pm-plugins/util/edge-cases}/index.js +5 -5
  9. package/dist/cjs/{handlers.js → pm-plugins/util/handlers.js} +60 -12
  10. package/dist/es2019/{commands.js → editor-commands/commands.js} +2 -2
  11. package/dist/es2019/index.js +1 -1
  12. package/dist/es2019/pm-plugins/analytics.js +6 -2
  13. package/dist/es2019/pm-plugins/main.js +16 -9
  14. package/dist/es2019/pm-plugins/plugin-factory.js +1 -1
  15. package/dist/es2019/{reducer.js → pm-plugins/reducer.js} +1 -1
  16. package/dist/es2019/{edge-cases → pm-plugins/util/edge-cases}/index.js +1 -1
  17. package/dist/es2019/{handlers.js → pm-plugins/util/handlers.js} +57 -4
  18. package/dist/esm/{commands.js → editor-commands/commands.js} +2 -2
  19. package/dist/esm/index.js +1 -1
  20. package/dist/esm/pm-plugins/analytics.js +10 -2
  21. package/dist/esm/pm-plugins/main.js +16 -9
  22. package/dist/esm/pm-plugins/plugin-factory.js +1 -1
  23. package/dist/esm/{reducer.js → pm-plugins/reducer.js} +1 -1
  24. package/dist/esm/{edge-cases → pm-plugins/util/edge-cases}/index.js +1 -1
  25. package/dist/esm/{handlers.js → pm-plugins/util/handlers.js} +51 -4
  26. package/dist/types/{actions.d.ts → editor-actions/actions.d.ts} +1 -1
  27. package/dist/types/index.d.ts +2 -2
  28. package/dist/types/pastePlugin.d.ts +2 -0
  29. package/dist/types/pm-plugins/analytics.d.ts +1 -0
  30. package/dist/types/pm-plugins/main.d.ts +1 -2
  31. package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
  32. package/dist/types/pm-plugins/reducer.d.ts +3 -0
  33. package/dist/types/{handlers.d.ts → pm-plugins/util/handlers.d.ts} +1 -0
  34. package/dist/types-ts4.5/{actions.d.ts → editor-actions/actions.d.ts} +1 -1
  35. package/dist/types-ts4.5/index.d.ts +2 -2
  36. package/dist/types-ts4.5/pastePlugin.d.ts +2 -0
  37. package/dist/types-ts4.5/pm-plugins/analytics.d.ts +1 -0
  38. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -2
  39. package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +1 -1
  40. package/dist/types-ts4.5/pm-plugins/reducer.d.ts +3 -0
  41. package/dist/types-ts4.5/{handlers.d.ts → pm-plugins/util/handlers.d.ts} +1 -0
  42. package/package.json +11 -10
  43. package/dist/types/plugin.d.ts +0 -2
  44. package/dist/types/reducer.d.ts +0 -3
  45. package/dist/types-ts4.5/plugin.d.ts +0 -2
  46. package/dist/types-ts4.5/reducer.d.ts +0 -3
  47. /package/dist/cjs/{actions.js → editor-actions/actions.js} +0 -0
  48. /package/dist/cjs/{plugin.js → pastePlugin.js} +0 -0
  49. /package/dist/cjs/{types.js → pastePluginType.js} +0 -0
  50. /package/dist/cjs/{plugins → pm-plugins}/media.js +0 -0
  51. /package/dist/cjs/{edge-cases → pm-plugins/util/edge-cases}/lists.js +0 -0
  52. /package/dist/cjs/{util → pm-plugins/util}/index.js +0 -0
  53. /package/dist/cjs/{util → pm-plugins/util}/tinyMCE.js +0 -0
  54. /package/dist/es2019/{actions.js → editor-actions/actions.js} +0 -0
  55. /package/dist/es2019/{plugin.js → pastePlugin.js} +0 -0
  56. /package/dist/es2019/{types.js → pastePluginType.js} +0 -0
  57. /package/dist/es2019/{plugins → pm-plugins}/media.js +0 -0
  58. /package/dist/es2019/{edge-cases → pm-plugins/util/edge-cases}/lists.js +0 -0
  59. /package/dist/es2019/{util → pm-plugins/util}/index.js +0 -0
  60. /package/dist/es2019/{util → pm-plugins/util}/tinyMCE.js +0 -0
  61. /package/dist/esm/{actions.js → editor-actions/actions.js} +0 -0
  62. /package/dist/esm/{plugin.js → pastePlugin.js} +0 -0
  63. /package/dist/esm/{types.js → pastePluginType.js} +0 -0
  64. /package/dist/esm/{plugins → pm-plugins}/media.js +0 -0
  65. /package/dist/esm/{edge-cases → pm-plugins/util/edge-cases}/lists.js +0 -0
  66. /package/dist/esm/{util → pm-plugins/util}/index.js +0 -0
  67. /package/dist/esm/{util → pm-plugins/util}/tinyMCE.js +0 -0
  68. /package/dist/types/{commands.d.ts → editor-commands/commands.d.ts} +0 -0
  69. /package/dist/types/{types.d.ts → pastePluginType.d.ts} +0 -0
  70. /package/dist/types/{plugins → pm-plugins}/media.d.ts +0 -0
  71. /package/dist/types/{edge-cases → pm-plugins/util/edge-cases}/index.d.ts +0 -0
  72. /package/dist/types/{edge-cases → pm-plugins/util/edge-cases}/lists.d.ts +0 -0
  73. /package/dist/types/{util → pm-plugins/util}/index.d.ts +0 -0
  74. /package/dist/types/{util → pm-plugins/util}/tinyMCE.d.ts +0 -0
  75. /package/dist/types-ts4.5/{commands.d.ts → editor-commands/commands.d.ts} +0 -0
  76. /package/dist/types-ts4.5/{types.d.ts → pastePluginType.d.ts} +0 -0
  77. /package/dist/types-ts4.5/{plugins → pm-plugins}/media.d.ts +0 -0
  78. /package/dist/types-ts4.5/{edge-cases → pm-plugins/util/edge-cases}/index.d.ts +0 -0
  79. /package/dist/types-ts4.5/{edge-cases → pm-plugins/util/edge-cases}/lists.d.ts +0 -0
  80. /package/dist/types-ts4.5/{util → pm-plugins/util}/index.d.ts +0 -0
  81. /package/dist/types-ts4.5/{util → pm-plugins/util}/tinyMCE.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 2.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#179965](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179965)
8
+ [`e3fc2cb96b727`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e3fc2cb96b727) -
9
+ ED-26051 add analytics for inserting layout
10
+
11
+ ## 2.0.9
12
+
13
+ ### Patch Changes
14
+
15
+ - [#179922](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179922)
16
+ [`3fac1d870e06c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3fac1d870e06c) -
17
+ [ux] ED-25985 Table pasting logic for nested tables - prevents pasted tables from exceeding
18
+ nesting depth of 1 by either flattening deeply nested tables or moving the paste location to under
19
+ the destination table
20
+
3
21
  ## 2.0.8
4
22
 
5
23
  ### Patch Changes
@@ -11,8 +11,8 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _commands = require("@atlaskit/editor-prosemirror/commands");
12
12
  var _model = require("@atlaskit/editor-prosemirror/model");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
- var _actions = require("./actions");
15
- var _pluginFactory = require("./pm-plugins/plugin-factory");
14
+ var _actions = require("../editor-actions/actions");
15
+ var _pluginFactory = require("../pm-plugins/plugin-factory");
16
16
  /**
17
17
  * Use this to register macro link positions during a paste operation, that you
18
18
  * want to track in a document over time, through any document changes.
package/dist/cjs/index.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "pastePlugin", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _plugin.pastePlugin;
9
+ return _pastePlugin.pastePlugin;
10
10
  }
11
11
  });
12
- var _plugin = require("./plugin");
12
+ var _pastePlugin = require("./pastePlugin");
@@ -9,14 +9,14 @@ exports.createPasteMeasurePayload = void 0;
9
9
  exports.getContent = getContent;
10
10
  exports.getContentNodeTypes = void 0;
11
11
  exports.getMediaTraceId = getMediaTraceId;
12
- exports.sendPasteAnalyticsEvent = exports.handleSelectedTableWithAnalytics = exports.handleRichTextWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = exports.handlePastePanelOrDecisionIntoListWithAnalytics = exports.handlePasteNonNestableBlockNodesIntoListWithAnalytics = exports.handlePasteLinkOnSelectedTextWithAnalytics = exports.handlePasteIntoTaskAndDecisionWithAnalytics = exports.handlePasteIntoCaptionWithAnalytics = exports.handlePasteAsPlainTextWithAnalytics = exports.handleMediaSingleWithAnalytics = exports.handleMarkdownWithAnalytics = exports.handleExpandWithAnalytics = exports.handleCodeBlockWithAnalytics = void 0;
12
+ exports.sendPasteAnalyticsEvent = exports.handleSelectedTableWithAnalytics = exports.handleRichTextWithAnalytics = exports.handlePastePreservingMarksWithAnalytics = exports.handlePastePanelOrDecisionIntoListWithAnalytics = exports.handlePasteNonNestableBlockNodesIntoListWithAnalytics = exports.handlePasteLinkOnSelectedTextWithAnalytics = exports.handlePasteIntoTaskAndDecisionWithAnalytics = exports.handlePasteIntoCaptionWithAnalytics = exports.handlePasteAsPlainTextWithAnalytics = exports.handleNestedTablePasteWithAnalytics = exports.handleMediaSingleWithAnalytics = exports.handleMarkdownWithAnalytics = exports.handleExpandWithAnalytics = exports.handleCodeBlockWithAnalytics = void 0;
13
13
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _analytics = require("@atlaskit/editor-common/analytics");
16
16
  var _utils = require("@atlaskit/editor-common/utils");
17
17
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
18
- var _handlers = require("../handlers");
19
- var _util = require("../util");
18
+ var _util = require("./util");
19
+ var _handlers = require("./util/handlers");
20
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
22
  var contentToPasteContent = {
@@ -366,6 +366,14 @@ var handleExpandWithAnalytics = exports.handleExpandWithAnalytics = function han
366
366
  }))((0, _handlers.handleExpandPaste)(slice, isNestingExpandsSupported));
367
367
  };
368
368
  };
369
+ var handleNestedTablePasteWithAnalytics = exports.handleNestedTablePasteWithAnalytics = function handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, isNestingTablesSupported) {
370
+ return function (view, event, slice) {
371
+ return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
372
+ type: _analytics.PasteTypes.richText,
373
+ pasteSplitList: true
374
+ }))((0, _handlers.handleNestedTablePaste)(slice, isNestingTablesSupported));
375
+ };
376
+ };
369
377
  var handleSelectedTableWithAnalytics = exports.handleSelectedTableWithAnalytics = function handleSelectedTableWithAnalytics(editorAnalyticsAPI) {
370
378
  return function (view, event, slice) {
371
379
  return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
@@ -6,12 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.createPlugin = createPlugin;
8
8
  exports.isInsideBlockQuote = void 0;
9
- Object.defineProperty(exports, "stateKey", {
10
- enumerable: true,
11
- get: function get() {
12
- return _pluginFactory.pluginKey;
13
- }
14
- });
15
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
16
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
17
11
  var _uuid = _interopRequireDefault(require("uuid"));
@@ -29,15 +23,15 @@ var _model = require("@atlaskit/editor-prosemirror/model");
29
23
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
30
24
  var _utils3 = require("@atlaskit/editor-tables/utils");
31
25
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
32
- var _actions = require("../actions");
33
- var _commands = require("../commands");
34
- var _handlers = require("../handlers");
35
- var _media = require("../plugins/media");
36
- var _util = require("../util");
37
- var _tinyMCE = require("../util/tinyMCE");
26
+ var _actions = require("../editor-actions/actions");
27
+ var _commands = require("../editor-commands/commands");
28
+ var _media = require("../pm-plugins/media");
38
29
  var _analytics2 = require("./analytics");
39
30
  var _clipboardTextSerializer = require("./clipboard-text-serializer");
40
31
  var _pluginFactory = require("./plugin-factory");
32
+ var _util = require("./util");
33
+ var _handlers = require("./util/handlers");
34
+ var _tinyMCE = require("./util/tinyMCE");
41
35
  var isInsideBlockQuote = exports.isInsideBlockQuote = function isInsideBlockQuote(state) {
42
36
  var blockquote = state.schema.nodes.blockquote;
43
37
  return (0, _utils2.hasParentNodeOfType)(blockquote)(state.selection);
@@ -398,6 +392,11 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
398
392
  return true;
399
393
  }
400
394
 
395
+ // handle paste of nested tables to ensure nesting limits are respected
396
+ if ((0, _analytics2.handleNestedTablePasteWithAnalytics)(editorAnalyticsAPI, (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
397
+ return true;
398
+ }
399
+
401
400
  // handle the case when copy content from a table cell inside bodied extension
402
401
  if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
403
402
  return true;
@@ -476,6 +475,9 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
476
475
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
477
476
  slice = new _model.Slice(slice.content, 0, 0);
478
477
  }
478
+ if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_2')) {
479
+ slice = (0, _transforms.transformSingleColumnLayout)(slice, schema);
480
+ }
479
481
  return slice;
480
482
  },
481
483
  transformPastedHTML: function transformPastedHTML(html) {
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
- var _reducer = require("../reducer");
12
+ var _reducer = require("./reducer");
13
13
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
14
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
15
  var pluginKey = exports.pluginKey = new _state.PluginKey('pastePlugin');
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.reducer = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _actions = require("./actions");
10
+ var _actions = require("../editor-actions/actions");
11
11
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
12
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
13
  var reducer = exports.reducer = function reducer(state, action) {
@@ -12,7 +12,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _transform = require("@atlaskit/editor-prosemirror/transform");
14
14
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
15
- var _util = require("../util");
15
+ var _index = require("../index");
16
16
  var _lists = require("./lists");
17
17
  function insertSliceForLists(_ref) {
18
18
  var _slice$content$firstC;
@@ -25,7 +25,7 @@ function insertSliceForLists(_ref) {
25
25
  $from = _tr$selection.$from;
26
26
  var _ref2 = selection,
27
27
  $cursor = _ref2.$cursor;
28
- var panelNode = (0, _util.isSelectionInsidePanel)(selection);
28
+ var panelNode = (0, _index.isSelectionInsidePanel)(selection);
29
29
  var selectionIsInsideList = $from.blockRange($to, _utils.isListNode);
30
30
  if (!$cursor && selectionIsInsideList) {
31
31
  return (0, _lists.insertSliceIntoRangeSelectionInsideList)({
@@ -35,7 +35,7 @@ function insertSliceForLists(_ref) {
35
35
  }
36
36
 
37
37
  // if inside an empty panel, try and insert content inside it rather than replace it
38
- if (panelNode && (0, _util.isEmptyNode)(panelNode) && $from.node() === $to.node()) {
38
+ if (panelNode && (0, _index.isEmptyNode)(panelNode) && $from.node() === $to.node()) {
39
39
  return (0, _lists.insertSliceInsideOfPanelNodeSelected)(panelNode)({
40
40
  tr: tr,
41
41
  slice: slice,
@@ -45,7 +45,7 @@ function insertSliceForLists(_ref) {
45
45
  if (!$cursor || selectionIsInsideList) {
46
46
  return tr.replaceSelection(slice);
47
47
  }
48
- if ((0, _util.isEmptyNode)(tr.doc.resolve($cursor.pos).node())) {
48
+ if ((0, _index.isEmptyNode)(tr.doc.resolve($cursor.pos).node())) {
49
49
  return (0, _lists.insertSliceIntoEmptyNode)({
50
50
  tr: tr,
51
51
  slice: slice
@@ -59,7 +59,7 @@ function insertSliceForLists(_ref) {
59
59
  // it still inserts whole list node after the action/decision item).
60
60
  var pastingIntoActionOrDecision = Boolean((0, _utils2.findParentNodeOfType)([schema.nodes.taskList, schema.nodes.decisionList])(selection));
61
61
  var oneListItem = slice.content.childCount === 1 && (0, _utils.isListNode)(slice.content.firstChild) && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.childCount) === 1;
62
- if (!(pastingIntoActionOrDecision && oneListItem) && (0, _util.isCursorSelectionAtTextStartOrEnd)(selection)) {
62
+ if (!(pastingIntoActionOrDecision && oneListItem) && (0, _index.isCursorSelectionAtTextStartOrEnd)(selection)) {
63
63
  return (0, _lists.insertSliceAtNodeEdge)({
64
64
  tr: tr,
65
65
  slice: slice
@@ -13,6 +13,7 @@ exports.handleMacroAutoConvert = handleMacroAutoConvert;
13
13
  exports.handleMarkdown = handleMarkdown;
14
14
  exports.handleMediaSingle = handleMediaSingle;
15
15
  exports.handleMention = handleMention;
16
+ exports.handleNestedTablePaste = handleNestedTablePaste;
16
17
  exports.handleParagraphBlockMarks = handleParagraphBlockMarks;
17
18
  exports.handlePasteAsPlainText = handlePasteAsPlainText;
18
19
  exports.handlePasteIntoCaption = handlePasteIntoCaption;
@@ -31,6 +32,7 @@ var _v = _interopRequireDefault(require("uuid/v4"));
31
32
  var _analytics = require("@atlaskit/editor-common/analytics");
32
33
  var _coreUtils = require("@atlaskit/editor-common/core-utils");
33
34
  var _mark = require("@atlaskit/editor-common/mark");
35
+ var _nesting = require("@atlaskit/editor-common/nesting");
34
36
  var _selection = require("@atlaskit/editor-common/selection");
35
37
  var _utils = require("@atlaskit/editor-common/utils");
36
38
  var _history = require("@atlaskit/editor-prosemirror/history");
@@ -38,12 +40,13 @@ var _model = require("@atlaskit/editor-prosemirror/model");
38
40
  var _state = require("@atlaskit/editor-prosemirror/state");
39
41
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
40
42
  var _utils3 = require("@atlaskit/editor-tables/utils");
41
- var _commands = require("./commands");
43
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
44
+ var _commands = require("../../editor-commands/commands");
45
+ var _main = require("../main");
46
+ var _pluginFactory = require("../plugin-factory");
42
47
  var _edgeCases = require("./edge-cases");
43
48
  var _lists = require("./edge-cases/lists");
44
- var _main = require("./pm-plugins/main");
45
- var _pluginFactory = require("./pm-plugins/plugin-factory");
46
- var _util = require("./util");
49
+ var _index = require("./index");
47
50
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
48
51
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
49
52
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
@@ -119,7 +122,7 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
119
122
  var selectionIsValidNode = state.selection instanceof _state.NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
120
123
  var selectionHasValidParentNode = (0, _utils2.hasParentNodeOfType)([decisionItem, taskItem, panel])(state.selection);
121
124
  var selectionIsCodeBlock = (0, _utils2.hasParentNodeOfType)([codeBlock])(state.selection);
122
- var panelNode = (0, _util.isSelectionInsidePanel)(selection);
125
+ var panelNode = (0, _index.isSelectionInsidePanel)(selection);
123
126
  var selectionIsPanel = Boolean(panelNode);
124
127
 
125
128
  // we avoid handling codeBlock-in-panel use case in this function
@@ -153,14 +156,14 @@ function handlePasteIntoTaskOrDecisionOrPanel(slice, queueCardsFromChangedTr) {
153
156
  }
154
157
  var filters = [(0, _utils.linkifyContent)(schema)];
155
158
  var selectionMarks = selection.$head.marks();
156
- if (selection instanceof _state.TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && (0, _util.hasOnlyNodesOfType)(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || (0, _mark.anyMarkActive)(state, codeMark)) // check if there is a code mark anywhere in the selection
159
+ if (selection instanceof _state.TextSelection && Array.isArray(selectionMarks) && selectionMarks.length > 0 && (0, _index.hasOnlyNodesOfType)(paragraph, text, emoji, mention, hardBreak)(slice) && (!codeMark.isInSet(selectionMarks) || (0, _mark.anyMarkActive)(state, codeMark)) // check if there is a code mark anywhere in the selection
157
160
  ) {
158
- filters.push((0, _util.applyTextMarksToSlice)(schema, selection.$head.marks()));
161
+ filters.push((0, _index.applyTextMarksToSlice)(schema, selection.$head.marks()));
159
162
  }
160
163
  var transformedSlice = compose.apply(null, filters)(slice);
161
164
  var isFirstChildTaskNode = transformedSlice.content.firstChild.type === taskList || transformedSlice.content.firstChild.type === taskItem;
162
165
  var tr = (0, _history.closeHistory)(state.tr);
163
- if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && (0, _util.isEmptyNode)(panelNode) && selection.$from.node() === selection.$to.node()) {
166
+ if (panelNode && sliceHasTask && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === panel && (0, _index.isEmptyNode)(panelNode) && selection.$from.node() === selection.$to.node()) {
164
167
  return Boolean((0, _lists.insertSliceInsideOfPanelNodeSelected)(panelNode)({
165
168
  tr: tr,
166
169
  slice: slice
@@ -455,7 +458,7 @@ function handlePasteAsPlainText(slice, _event, editorAnalyticsAPI) {
455
458
  tr = (0, _utils3.replaceSelectedTable)(state, slice);
456
459
 
457
460
  // add analytics after replacing selected table
458
- tr = (0, _util.addReplaceSelectedTableAnalytics)(state, tr, editorAnalyticsAPI);
461
+ tr = (0, _index.addReplaceSelectedTableAnalytics)(state, tr, editorAnalyticsAPI);
459
462
 
460
463
  // otherwise just replace the selection
461
464
  if (!tr.docChanged) {
@@ -505,8 +508,8 @@ function handlePastePreservingMarks(slice, queueCardsFromChangedTr) {
505
508
 
506
509
  // if the pasted data is one of the node types below
507
510
  // we apply current selection marks to the pasted slice
508
- if ((0, _util.hasOnlyNodesOfType)(bulletList, hardBreak, heading, listItem, text, emoji, mention, orderedList)(slice) || selectionIsHeading || hasActiveCodeMark || hasAnnotationMark) {
509
- var transformedSlice = (0, _util.applyTextMarksToSlice)(schema, selectionMarks)(slice);
511
+ if ((0, _index.hasOnlyNodesOfType)(bulletList, hardBreak, heading, listItem, text, emoji, mention, orderedList)(slice) || selectionIsHeading || hasActiveCodeMark || hasAnnotationMark) {
512
+ var transformedSlice = (0, _index.applyTextMarksToSlice)(schema, selectionMarks)(slice);
510
513
  var tr = (0, _history.closeHistory)(state.tr).replaceSelection(transformedSlice).setStoredMarks(selectionMarks).scrollIntoView();
511
514
  queueCardsFromChangedTr === null || queueCardsFromChangedTr === void 0 || queueCardsFromChangedTr(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
512
515
  if (dispatch) {
@@ -696,6 +699,51 @@ function handleTableContentPasteInBodiedExtension(slice) {
696
699
  return false;
697
700
  };
698
701
  }
702
+ function handleNestedTablePaste(slice, isNestingTablesSupported) {
703
+ return function (state, dispatch) {
704
+ if (!isNestingTablesSupported || !(0, _coreUtils.insideTable)(state)) {
705
+ return false;
706
+ }
707
+ var schema = state.schema,
708
+ selection = state.selection;
709
+ var sliceHasTable = false;
710
+ slice.content.forEach(function (node) {
711
+ if (node.type === state.schema.nodes.table) {
712
+ sliceHasTable = true;
713
+ }
714
+ });
715
+ if (sliceHasTable) {
716
+ if ((0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
717
+ exposure: true
718
+ })) {
719
+ /* TEST COHORT */
720
+ // if slice has table - if pasting to deeply nested location place paste after top table
721
+ if ((0, _nesting.getParentOfTypeCount)(schema.nodes.table)(selection.$from) > 1) {
722
+ var positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(schema.nodes.table)(selection.$from);
723
+ var tr = state.tr;
724
+ tr = (0, _utils2.safeInsert)(slice.content, positionAfterTopTable)(tr);
725
+ tr.scrollIntoView();
726
+ if (dispatch) {
727
+ dispatch(tr);
728
+ return true;
729
+ }
730
+ }
731
+ } else {
732
+ /* CONTROL COHORT */
733
+ // if slice has table - place paste after top table
734
+ var _positionAfterTopTable = (0, _nesting.getPositionAfterTopParentNodeOfType)(schema.nodes.table)(selection.$from);
735
+ var _tr2 = state.tr;
736
+ _tr2 = (0, _utils2.safeInsert)(slice.content, _positionAfterTopTable)(_tr2);
737
+ _tr2.scrollIntoView();
738
+ if (dispatch) {
739
+ dispatch(_tr2);
740
+ return true;
741
+ }
742
+ }
743
+ }
744
+ return false;
745
+ };
746
+ }
699
747
  function handleExpandPaste(slice, isNestingExpandsSupported) {
700
748
  return function (state, dispatch) {
701
749
  var isInsideNestableExpand = isNestingExpandsSupported && !!insideExpand(state);
@@ -1047,7 +1095,7 @@ var handleSelectedTable = exports.handleSelectedTable = function handleSelectedT
1047
1095
  var tr = (0, _utils3.replaceSelectedTable)(state, slice);
1048
1096
 
1049
1097
  // add analytics after replacing selected table
1050
- tr = (0, _util.addReplaceSelectedTableAnalytics)(state, tr, editorAnalyticsAPI);
1098
+ tr = (0, _index.addReplaceSelectedTableAnalytics)(state, tr, editorAnalyticsAPI);
1051
1099
  if (tr.docChanged) {
1052
1100
  if (dispatch) {
1053
1101
  dispatch(tr);
@@ -2,8 +2,8 @@ import { isListNode, mapChildren, mapSlice } from '@atlaskit/editor-common/utils
2
2
  import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
3
3
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { PastePluginActionTypes as ActionTypes } from './actions';
6
- import { createCommand } from './pm-plugins/plugin-factory';
5
+ import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
6
+ import { createCommand } from '../pm-plugins/plugin-factory';
7
7
 
8
8
  /**
9
9
  * Use this to register macro link positions during a paste operation, that you
@@ -1,4 +1,4 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
2
  // Entry file in package.json
3
3
 
4
- export { pastePlugin } from './plugin';
4
+ export { pastePlugin } from './pastePlugin';
@@ -1,8 +1,8 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
2
2
  import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
3
3
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
4
- import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable } from '../handlers';
5
- import { getPasteSource } from '../util';
4
+ import { getPasteSource } from './util';
5
+ import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable, handleNestedTablePaste } from './util/handlers';
6
6
  const contentToPasteContent = {
7
7
  url: PasteContents.url,
8
8
  paragraph: PasteContents.text,
@@ -329,6 +329,10 @@ export const handleExpandWithAnalytics = (editorAnalyticsAPI, isNestingExpandsSu
329
329
  type: PasteTypes.richText,
330
330
  pasteSplitList: true
331
331
  }))(handleExpandPaste(slice, isNestingExpandsSupported));
332
+ export const handleNestedTablePasteWithAnalytics = (editorAnalyticsAPI, isNestingTablesSupported) => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
333
+ type: PasteTypes.richText,
334
+ pasteSplitList: true
335
+ }))(handleNestedTablePaste(slice, isNestingTablesSupported));
332
336
  export const handleSelectedTableWithAnalytics = editorAnalyticsAPI => (view, event, slice) => injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
333
337
  type: PasteTypes.richText
334
338
  }))(handleSelectedTable(editorAnalyticsAPI)(slice));
@@ -6,23 +6,22 @@ import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/
6
6
  import { isPastedFile as isPastedFileFromEvent, md } from '@atlaskit/editor-common/paste';
7
7
  import { measureRender } from '@atlaskit/editor-common/performance/measure-render';
8
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
9
- import { transformSingleLineCodeBlockToCodeMark, transformSliceNestedExpandToExpand, transformSliceToDecisionList, transformSliceToJoinAdjacentCodeBlocks } from '@atlaskit/editor-common/transforms';
9
+ import { transformSingleLineCodeBlockToCodeMark, transformSingleColumnLayout, transformSliceNestedExpandToExpand, transformSliceToDecisionList, transformSliceToJoinAdjacentCodeBlocks } from '@atlaskit/editor-common/transforms';
10
10
  import { containsAnyAnnotations, extractSliceFromStep, linkifyContent, mapChildren } from '@atlaskit/editor-common/utils';
11
11
  import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
12
12
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
13
13
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
14
14
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
15
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
- import { PastePluginActionTypes } from '../actions';
17
- import { splitParagraphs, upgradeTextToLists } from '../commands';
18
- import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
19
- import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
20
- import { escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
21
- import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from '../util/tinyMCE';
22
- import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent } from './analytics';
16
+ import { PastePluginActionTypes } from '../editor-actions/actions';
17
+ import { splitParagraphs, upgradeTextToLists } from '../editor-commands/commands';
18
+ import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../pm-plugins/media';
19
+ import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent, handleNestedTablePasteWithAnalytics } from './analytics';
23
20
  import { clipboardTextSerializer } from './clipboard-text-serializer';
24
21
  import { createPluginState, pluginKey as stateKey } from './plugin-factory';
25
- export { pluginKey as stateKey } from './plugin-factory';
22
+ import { escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
23
+ import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from './util/handlers';
24
+ import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from './util/tinyMCE';
26
25
  export const isInsideBlockQuote = state => {
27
26
  const {
28
27
  blockquote
@@ -369,6 +368,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
369
368
  return true;
370
369
  }
371
370
 
371
+ // handle paste of nested tables to ensure nesting limits are respected
372
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
373
+ return true;
374
+ }
375
+
372
376
  // handle the case when copy content from a table cell inside bodied extension
373
377
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
374
378
  return true;
@@ -445,6 +449,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
445
449
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
446
450
  slice = new Slice(slice.content, 0, 0);
447
451
  }
452
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_2')) {
453
+ slice = transformSingleColumnLayout(slice, schema);
454
+ }
448
455
  return slice;
449
456
  },
450
457
  transformPastedHTML(html) {
@@ -1,6 +1,6 @@
1
1
  import { pluginFactory } from '@atlaskit/editor-common/utils';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import { reducer } from '../reducer';
3
+ import { reducer } from './reducer';
4
4
  export const pluginKey = new PluginKey('pastePlugin');
5
5
  export const {
6
6
  createPluginState,
@@ -1,4 +1,4 @@
1
- import { PastePluginActionTypes as ActionTypes } from './actions';
1
+ import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
2
2
  export const reducer = (state, action) => {
3
3
  switch (action.type) {
4
4
  case ActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS:
@@ -3,7 +3,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
- import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../util';
6
+ import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../index';
7
7
  import { insertSliceAtNodeEdge, insertSliceInsideOfPanelNodeSelected, insertSliceIntoEmptyNode, insertSliceIntoRangeSelectionInsideList } from './lists';
8
8
  export function insertSliceForLists({
9
9
  tr,
@@ -2,6 +2,7 @@ import uuid from 'uuid/v4';
2
2
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { insideTable } from '@atlaskit/editor-common/core-utils';
4
4
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
5
+ import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
5
6
  import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
6
7
  import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isNodeEmpty, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
7
8
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
@@ -9,14 +10,15 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
9
10
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
10
11
  import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
11
12
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
13
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
12
14
  // TODO: ED-20519 Needs Macro extraction
13
15
 
14
- import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
16
+ import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from '../../editor-commands/commands';
17
+ import { isInsideBlockQuote } from '../main';
18
+ import { getPluginState as getPastePluginState } from '../plugin-factory';
15
19
  import { insertSliceForLists, insertSliceForTaskInsideList, insertSliceInsideBlockquote } from './edge-cases';
16
20
  import { insertSliceInsideOfPanelNodeSelected } from './edge-cases/lists';
17
- import { isInsideBlockQuote } from './pm-plugins/main';
18
- import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
19
- import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './util';
21
+ import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './index';
20
22
  const insideExpand = state => {
21
23
  const {
22
24
  expand,
@@ -681,6 +683,57 @@ export function handleTableContentPasteInBodiedExtension(slice) {
681
683
  return false;
682
684
  };
683
685
  }
686
+ export function handleNestedTablePaste(slice, isNestingTablesSupported) {
687
+ return (state, dispatch) => {
688
+ if (!isNestingTablesSupported || !insideTable(state)) {
689
+ return false;
690
+ }
691
+ const {
692
+ schema,
693
+ selection
694
+ } = state;
695
+ let sliceHasTable = false;
696
+ slice.content.forEach(node => {
697
+ if (node.type === state.schema.nodes.table) {
698
+ sliceHasTable = true;
699
+ }
700
+ });
701
+ if (sliceHasTable) {
702
+ if (editorExperiment('nested-tables-in-tables', true, {
703
+ exposure: true
704
+ })) {
705
+ /* TEST COHORT */
706
+ // if slice has table - if pasting to deeply nested location place paste after top table
707
+ if (getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1) {
708
+ const positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(selection.$from);
709
+ let {
710
+ tr
711
+ } = state;
712
+ tr = safeInsert(slice.content, positionAfterTopTable)(tr);
713
+ tr.scrollIntoView();
714
+ if (dispatch) {
715
+ dispatch(tr);
716
+ return true;
717
+ }
718
+ }
719
+ } else {
720
+ /* CONTROL COHORT */
721
+ // if slice has table - place paste after top table
722
+ const positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(selection.$from);
723
+ let {
724
+ tr
725
+ } = state;
726
+ tr = safeInsert(slice.content, positionAfterTopTable)(tr);
727
+ tr.scrollIntoView();
728
+ if (dispatch) {
729
+ dispatch(tr);
730
+ return true;
731
+ }
732
+ }
733
+ }
734
+ return false;
735
+ };
736
+ }
684
737
  export function handleExpandPaste(slice, isNestingExpandsSupported) {
685
738
  return (state, dispatch) => {
686
739
  const isInsideNestableExpand = isNestingExpandsSupported && !!insideExpand(state);
@@ -4,8 +4,8 @@ import { isListNode, mapChildren, mapSlice } from '@atlaskit/editor-common/utils
4
4
  import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
5
5
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
6
6
  import { EditorState } from '@atlaskit/editor-prosemirror/state';
7
- import { PastePluginActionTypes as ActionTypes } from './actions';
8
- import { createCommand } from './pm-plugins/plugin-factory';
7
+ import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
8
+ import { createCommand } from '../pm-plugins/plugin-factory';
9
9
 
10
10
  /**
11
11
  * Use this to register macro link positions during a paste operation, that you
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /* eslint-disable @atlaskit/editor/no-re-export */
2
2
  // Entry file in package.json
3
3
 
4
- export { pastePlugin } from './plugin';
4
+ export { pastePlugin } from './pastePlugin';
@@ -5,8 +5,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, PasteContents, PasteTypes } from '@atlaskit/editor-common/analytics';
6
6
  import { getLinkDomain, mapSlice } from '@atlaskit/editor-common/utils';
7
7
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
8
- import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable } from '../handlers';
9
- import { getPasteSource } from '../util';
8
+ import { getPasteSource } from './util';
9
+ import { handleCodeBlock, handleExpandPaste, handleMarkdown, handleMediaSingle, handlePasteAsPlainText, handlePasteIntoCaption, handlePasteIntoTaskOrDecisionOrPanel, handlePasteLinkOnSelectedText, handlePasteNonNestableBlockNodesIntoList, handlePastePanelOrDecisionContentIntoList, handlePastePreservingMarks, handleRichText, handleSelectedTable, handleNestedTablePaste } from './util/handlers';
10
10
  var contentToPasteContent = {
11
11
  url: PasteContents.url,
12
12
  paragraph: PasteContents.text,
@@ -354,6 +354,14 @@ export var handleExpandWithAnalytics = function handleExpandWithAnalytics(editor
354
354
  }))(handleExpandPaste(slice, isNestingExpandsSupported));
355
355
  };
356
356
  };
357
+ export var handleNestedTablePasteWithAnalytics = function handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, isNestingTablesSupported) {
358
+ return function (view, event, slice) {
359
+ return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
360
+ type: PasteTypes.richText,
361
+ pasteSplitList: true
362
+ }))(handleNestedTablePaste(slice, isNestingTablesSupported));
363
+ };
364
+ };
357
365
  export var handleSelectedTableWithAnalytics = function handleSelectedTableWithAnalytics(editorAnalyticsAPI) {
358
366
  return function (view, event, slice) {
359
367
  return injectAnalyticsPayloadBeforeCommand(editorAnalyticsAPI)(createPasteAnalyticsPayloadBySelection(event, slice, {
@@ -8,23 +8,22 @@ import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/
8
8
  import { isPastedFile as isPastedFileFromEvent, md } from '@atlaskit/editor-common/paste';
9
9
  import { measureRender } from '@atlaskit/editor-common/performance/measure-render';
10
10
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
- import { transformSingleLineCodeBlockToCodeMark, transformSliceNestedExpandToExpand, transformSliceToDecisionList, transformSliceToJoinAdjacentCodeBlocks } from '@atlaskit/editor-common/transforms';
11
+ import { transformSingleLineCodeBlockToCodeMark, transformSingleColumnLayout, transformSliceNestedExpandToExpand, transformSliceToDecisionList, transformSliceToJoinAdjacentCodeBlocks } from '@atlaskit/editor-common/transforms';
12
12
  import { containsAnyAnnotations, extractSliceFromStep, linkifyContent, mapChildren } from '@atlaskit/editor-common/utils';
13
13
  import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
14
14
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
15
15
  import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
16
16
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
- import { PastePluginActionTypes } from '../actions';
19
- import { splitParagraphs, upgradeTextToLists } from '../commands';
20
- import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from '../handlers';
21
- import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../plugins/media';
22
- import { escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from '../util';
23
- import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from '../util/tinyMCE';
24
- import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent } from './analytics';
18
+ import { PastePluginActionTypes } from '../editor-actions/actions';
19
+ import { splitParagraphs, upgradeTextToLists } from '../editor-commands/commands';
20
+ import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformSliceToMediaSingleWithNewExperience, unwrapNestedMediaElements } from '../pm-plugins/media';
21
+ import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent, handleNestedTablePasteWithAnalytics } from './analytics';
25
22
  import { clipboardTextSerializer } from './clipboard-text-serializer';
26
23
  import { createPluginState, pluginKey as stateKey } from './plugin-factory';
27
- export { pluginKey as stateKey } from './plugin-factory';
24
+ import { escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
25
+ import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from './util/handlers';
26
+ import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from './util/tinyMCE';
28
27
  export var isInsideBlockQuote = function isInsideBlockQuote(state) {
29
28
  var blockquote = state.schema.nodes.blockquote;
30
29
  return hasParentNodeOfType(blockquote)(state.selection);
@@ -385,6 +384,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
385
384
  return true;
386
385
  }
387
386
 
387
+ // handle paste of nested tables to ensure nesting limits are respected
388
+ if (handleNestedTablePasteWithAnalytics(editorAnalyticsAPI, fg('platform_editor_use_nested_table_pm_nodes'))(view, event, slice)(state, dispatch)) {
389
+ return true;
390
+ }
391
+
388
392
  // handle the case when copy content from a table cell inside bodied extension
389
393
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
390
394
  return true;
@@ -463,6 +467,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
463
467
  if (slice.content.childCount && slice.content.lastChild.type === schema.nodes.codeBlock) {
464
468
  slice = new Slice(slice.content, 0, 0);
465
469
  }
470
+ if (fg('platform_editor_advanced_layouts_post_fix_patch_2')) {
471
+ slice = transformSingleColumnLayout(slice, schema);
472
+ }
466
473
  return slice;
467
474
  },
468
475
  transformPastedHTML: function transformPastedHTML(html) {
@@ -4,7 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { pluginFactory } from '@atlaskit/editor-common/utils';
6
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
- import { reducer } from '../reducer';
7
+ import { reducer } from './reducer';
8
8
  export var pluginKey = new PluginKey('pastePlugin');
9
9
  var _pluginFactory = pluginFactory(pluginKey, reducer, {
10
10
  mapping: function mapping(tr, pluginState) {
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- import { PastePluginActionTypes as ActionTypes } from './actions';
5
+ import { PastePluginActionTypes as ActionTypes } from '../editor-actions/actions';
6
6
  export var reducer = function reducer(state, action) {
7
7
  switch (action.type) {
8
8
  case ActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS:
@@ -3,7 +3,7 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
- import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../util';
6
+ import { isCursorSelectionAtTextStartOrEnd, isEmptyNode, isSelectionInsidePanel } from '../index';
7
7
  import { insertSliceAtNodeEdge, insertSliceInsideOfPanelNodeSelected, insertSliceIntoEmptyNode, insertSliceIntoRangeSelectionInsideList } from './lists';
8
8
  export function insertSliceForLists(_ref) {
9
9
  var _slice$content$firstC;
@@ -10,6 +10,7 @@ import uuid from 'uuid/v4';
10
10
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
11
  import { insideTable } from '@atlaskit/editor-common/core-utils';
12
12
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
13
+ import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
13
14
  import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
14
15
  import { canLinkBeCreatedInRange, insideTableCell, isInListItem, isLinkMark, isListItemNode, isListNode, isNodeEmpty, isParagraph, isText, linkifyContent, mapSlice } from '@atlaskit/editor-common/utils';
15
16
  import { closeHistory } from '@atlaskit/editor-prosemirror/history';
@@ -17,14 +18,15 @@ import { Fragment, Node as PMNode, Slice } from '@atlaskit/editor-prosemirror/mo
17
18
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
18
19
  import { canInsert, contains, findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNode, hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
19
20
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
21
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
22
  // TODO: ED-20519 Needs Macro extraction
21
23
 
22
- import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
24
+ import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from '../../editor-commands/commands';
25
+ import { isInsideBlockQuote } from '../main';
26
+ import { getPluginState as getPastePluginState } from '../plugin-factory';
23
27
  import { insertSliceForLists, insertSliceForTaskInsideList, insertSliceInsideBlockquote } from './edge-cases';
24
28
  import { insertSliceInsideOfPanelNodeSelected } from './edge-cases/lists';
25
- import { isInsideBlockQuote } from './pm-plugins/main';
26
- import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
27
- import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './util';
29
+ import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType, isEmptyNode, isSelectionInsidePanel } from './index';
28
30
  var insideExpand = function insideExpand(state) {
29
31
  var _state$schema$nodes = state.schema.nodes,
30
32
  expand = _state$schema$nodes.expand,
@@ -672,6 +674,51 @@ export function handleTableContentPasteInBodiedExtension(slice) {
672
674
  return false;
673
675
  };
674
676
  }
677
+ export function handleNestedTablePaste(slice, isNestingTablesSupported) {
678
+ return function (state, dispatch) {
679
+ if (!isNestingTablesSupported || !insideTable(state)) {
680
+ return false;
681
+ }
682
+ var schema = state.schema,
683
+ selection = state.selection;
684
+ var sliceHasTable = false;
685
+ slice.content.forEach(function (node) {
686
+ if (node.type === state.schema.nodes.table) {
687
+ sliceHasTable = true;
688
+ }
689
+ });
690
+ if (sliceHasTable) {
691
+ if (editorExperiment('nested-tables-in-tables', true, {
692
+ exposure: true
693
+ })) {
694
+ /* TEST COHORT */
695
+ // if slice has table - if pasting to deeply nested location place paste after top table
696
+ if (getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1) {
697
+ var positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(selection.$from);
698
+ var tr = state.tr;
699
+ tr = safeInsert(slice.content, positionAfterTopTable)(tr);
700
+ tr.scrollIntoView();
701
+ if (dispatch) {
702
+ dispatch(tr);
703
+ return true;
704
+ }
705
+ }
706
+ } else {
707
+ /* CONTROL COHORT */
708
+ // if slice has table - place paste after top table
709
+ var _positionAfterTopTable = getPositionAfterTopParentNodeOfType(schema.nodes.table)(selection.$from);
710
+ var _tr2 = state.tr;
711
+ _tr2 = safeInsert(slice.content, _positionAfterTopTable)(_tr2);
712
+ _tr2.scrollIntoView();
713
+ if (dispatch) {
714
+ dispatch(_tr2);
715
+ return true;
716
+ }
717
+ }
718
+ }
719
+ return false;
720
+ };
721
+ }
675
722
  export function handleExpandPaste(slice, isNestingExpandsSupported) {
676
723
  return function (state, dispatch) {
677
724
  var isInsideNestableExpand = isNestingExpandsSupported && !!insideExpand(state);
@@ -1,4 +1,4 @@
1
- import type { LastContentPasted } from './types';
1
+ import type { LastContentPasted } from '../pastePluginType';
2
2
  export declare enum PastePluginActionTypes {
3
3
  START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
4
4
  STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
@@ -1,2 +1,2 @@
1
- export type { PastePlugin, PastePluginOptions, PastePluginState, LastContentPasted } from './types';
2
- export { pastePlugin } from './plugin';
1
+ export type { PastePlugin, PastePluginOptions, PastePluginState, LastContentPasted, } from './pastePluginType';
2
+ export { pastePlugin } from './pastePlugin';
@@ -0,0 +1,2 @@
1
+ import type { PastePlugin } from './pastePluginType';
2
+ export declare const pastePlugin: PastePlugin;
@@ -32,6 +32,7 @@ export declare const handleRichTextWithAnalytics: (view: EditorView, event: Clip
32
32
  export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command;
33
33
  export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
34
34
  export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
35
+ export declare const handleNestedTablePasteWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingTablesSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
35
36
  export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
36
37
  export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
37
38
  export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
@@ -7,6 +7,5 @@ import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/
7
7
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { PastePlugin } from '../index';
10
- export { pluginKey as stateKey } from './plugin-factory';
11
10
  export declare const isInsideBlockQuote: (state: EditorState) => boolean;
12
- export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../types").PastePluginState>;
11
+ export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
@@ -1,3 +1,3 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export declare const pluginKey: PluginKey<any>;
3
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("..").PastePluginState | ((state: import("prosemirror-state").EditorState) => import("..").PastePluginState)) => import("prosemirror-state").SafeStateField<import("..").PastePluginState>, createCommand: <A = import("../actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").PastePluginState;
3
+ export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("..").PastePluginState | ((state: import("prosemirror-state").EditorState) => import("..").PastePluginState)) => import("prosemirror-state").SafeStateField<import("..").PastePluginState>, createCommand: <A = import("../editor-actions/actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").PastePluginState;
@@ -0,0 +1,3 @@
1
+ import type { PastePluginAction as Action } from '../editor-actions/actions';
2
+ import type { PastePluginState as State } from '../pastePluginType';
3
+ export declare const reducer: (state: State, action: Action) => State;
@@ -20,6 +20,7 @@ export declare function handleMacroAutoConvert(text: string, slice: Slice, queue
20
20
  export declare function handleCodeBlock(text: string): Command;
21
21
  export declare function handleMediaSingle(inputMethod: InputMethodInsertMedia, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined): (slice: Slice) => Command;
22
22
  export declare function handleTableContentPasteInBodiedExtension(slice: Slice): Command;
23
+ export declare function handleNestedTablePaste(slice: Slice, isNestingTablesSupported?: boolean): Command;
23
24
  export declare function handleExpandPaste(slice: Slice, isNestingExpandsSupported?: boolean): Command;
24
25
  export declare function handleMarkdown(markdownSlice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, from?: number, to?: number): Command;
25
26
  export declare function handleParagraphBlockMarks(state: EditorState, slice: Slice): Slice;
@@ -1,4 +1,4 @@
1
- import type { LastContentPasted } from './types';
1
+ import type { LastContentPasted } from '../pastePluginType';
2
2
  export declare enum PastePluginActionTypes {
3
3
  START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
4
4
  STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
@@ -1,2 +1,2 @@
1
- export type { PastePlugin, PastePluginOptions, PastePluginState, LastContentPasted } from './types';
2
- export { pastePlugin } from './plugin';
1
+ export type { PastePlugin, PastePluginOptions, PastePluginState, LastContentPasted, } from './pastePluginType';
2
+ export { pastePlugin } from './pastePlugin';
@@ -0,0 +1,2 @@
1
+ import type { PastePlugin } from './pastePluginType';
2
+ export declare const pastePlugin: PastePlugin;
@@ -32,6 +32,7 @@ export declare const handleRichTextWithAnalytics: (view: EditorView, event: Clip
32
32
  export declare const handlePastePanelOrDecisionIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, findRootParentListNode: FindRootParentListNode | undefined) => Command;
33
33
  export declare const handlePasteNonNestableBlockNodesIntoListWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
34
34
  export declare const handleExpandWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingExpandsSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
35
+ export declare const handleNestedTablePasteWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, isNestingTablesSupported: boolean) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
35
36
  export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
36
37
  export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
37
38
  export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
@@ -7,6 +7,5 @@ import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/
7
7
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { PastePlugin } from '../index';
10
- export { pluginKey as stateKey } from './plugin-factory';
11
10
  export declare const isInsideBlockQuote: (state: EditorState) => boolean;
12
- export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../types").PastePluginState>;
11
+ export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
@@ -1,3 +1,3 @@
1
1
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
2
  export declare const pluginKey: PluginKey<any>;
3
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("..").PastePluginState | ((state: import("prosemirror-state").EditorState) => import("..").PastePluginState)) => import("prosemirror-state").SafeStateField<import("..").PastePluginState>, createCommand: <A = import("../actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").PastePluginState;
3
+ export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("..").PastePluginState | ((state: import("prosemirror-state").EditorState) => import("..").PastePluginState)) => import("prosemirror-state").SafeStateField<import("..").PastePluginState>, createCommand: <A = import("../editor-actions/actions").PastePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("..").PastePluginState;
@@ -0,0 +1,3 @@
1
+ import type { PastePluginAction as Action } from '../editor-actions/actions';
2
+ import type { PastePluginState as State } from '../pastePluginType';
3
+ export declare const reducer: (state: State, action: Action) => State;
@@ -20,6 +20,7 @@ export declare function handleMacroAutoConvert(text: string, slice: Slice, queue
20
20
  export declare function handleCodeBlock(text: string): Command;
21
21
  export declare function handleMediaSingle(inputMethod: InputMethodInsertMedia, insertMediaAsMediaSingle: InsertMediaAsMediaSingle | undefined): (slice: Slice) => Command;
22
22
  export declare function handleTableContentPasteInBodiedExtension(slice: Slice): Command;
23
+ export declare function handleNestedTablePaste(slice: Slice, isNestingTablesSupported?: boolean): Command;
23
24
  export declare function handleExpandPaste(slice: Slice, isNestingExpandsSupported?: boolean): Command;
24
25
  export declare function handleMarkdown(markdownSlice: Slice, queueCardsFromChangedTr: QueueCardsFromTransactionAction | undefined, from?: number, to?: number): Command;
25
26
  export declare function handleParagraphBlockMarks(state: EditorState, slice: Slice): Slice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^96.5.0",
34
+ "@atlaskit/editor-common": "^96.7.0",
35
35
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-annotation": "^1.26.0",
@@ -43,10 +43,10 @@
43
43
  "@atlaskit/editor-plugin-mentions": "^2.10.0",
44
44
  "@atlaskit/editor-prosemirror": "6.2.1",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
- "@atlaskit/media-client": "^28.5.0",
46
+ "@atlaskit/media-client": "^28.6.0",
47
47
  "@atlaskit/media-common": "^11.7.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
- "@atlaskit/tmp-editor-statsig": "^2.26.0",
49
+ "@atlaskit/tmp-editor-statsig": "^2.29.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "lodash": "^4.17.21",
52
52
  "uuid": "^3.1.0"
@@ -70,7 +70,7 @@
70
70
  "techstack": {
71
71
  "@atlassian/frontend": {
72
72
  "code-structure": [
73
- "tangerine-next"
73
+ "editor-plugin"
74
74
  ],
75
75
  "import-structure": [
76
76
  "atlassian-conventions"
@@ -103,11 +103,6 @@
103
103
  ]
104
104
  }
105
105
  },
106
- "techstackIgnore": {
107
- "stricter": [
108
- "@atlassian/tangerine/project-structure"
109
- ]
110
- },
111
106
  "platform-feature-flags": {
112
107
  "platform_editor_media_extended_resize_experience": {
113
108
  "type": "boolean"
@@ -120,6 +115,12 @@
120
115
  },
121
116
  "editor_nest_media_and_codeblock_in_quotes_jira": {
122
117
  "type": "boolean"
118
+ },
119
+ "platform_editor_use_nested_table_pm_nodes": {
120
+ "type": "boolean"
121
+ },
122
+ "platform_editor_advanced_layouts_post_fix_patch_2": {
123
+ "type": "boolean"
123
124
  }
124
125
  }
125
126
  }
@@ -1,2 +0,0 @@
1
- import type { PastePlugin } from './types';
2
- export declare const pastePlugin: PastePlugin;
@@ -1,3 +0,0 @@
1
- import type { PastePluginAction as Action } from './actions';
2
- import type { PastePluginState as State } from './types';
3
- export declare const reducer: (state: State, action: Action) => State;
@@ -1,2 +0,0 @@
1
- import type { PastePlugin } from './types';
2
- export declare const pastePlugin: PastePlugin;
@@ -1,3 +0,0 @@
1
- import type { PastePluginAction as Action } from './actions';
2
- import type { PastePluginState as State } from './types';
3
- export declare const reducer: (state: State, action: Action) => State;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes