@atlaskit/editor-core 189.4.19 → 189.5.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,22 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 189.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#58597](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58597) [`205975214b9c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/205975214b9c) - ED-20961: Handle copy paste - list with blockquote
8
+
9
+ ## 189.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#58193](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58193) [`142df4424484`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/142df4424484) - NO-ISSUE Added new editor plugin to enable Loom video recording in the Editor
14
+
15
+ ### Patch Changes
16
+
17
+ - [#58193](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58193) [`c03518e00722`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c03518e00722) - NO-ISSUE Improved Loom unit tests
18
+ - Updated dependencies
19
+
3
20
  ## 189.4.19
4
21
 
5
22
  ### Patch Changes
@@ -4,9 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.insertSliceForLists = insertSliceForLists;
7
+ exports.insertSliceForListsInsideBlockquote = insertSliceForListsInsideBlockquote;
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
7
9
  var _utils = require("@atlaskit/editor-prosemirror/utils");
8
10
  var _lists = require("./lists");
9
11
  var _utils2 = require("@atlaskit/editor-common/utils");
12
+ var _transform = require("@atlaskit/editor-prosemirror/transform");
10
13
  var _util = require("../util");
11
14
  function insertSliceForLists(_ref) {
12
15
  var _slice$content$firstC;
@@ -59,4 +62,27 @@ function insertSliceForLists(_ref) {
59
62
  });
60
63
  }
61
64
  tr.replaceSelection(slice);
65
+ }
66
+ function insertSliceForListsInsideBlockquote(_ref3) {
67
+ var tr = _ref3.tr,
68
+ slice = _ref3.slice;
69
+ (0, _utils.safeInsert)(slice.content, tr.selection.$to.pos)(tr).scrollIntoView();
70
+ // ProseMirror doesn't give a proper way to tell us where something was inserted.
71
+ // However, we can know "how" it inserted something.
72
+ //
73
+ // So, instead of weird depth calculations, we can use the step produced by the transform.
74
+ // For instance:
75
+ // The `replaceStep.to and replaceStep.from`, tell us the real position
76
+ // where the content will be insert.
77
+ // Then, we can use the `tr.mapping.map` to the updated position after the replace operation
78
+ var replaceStep = tr.steps[0];
79
+ if (!(replaceStep instanceof _transform.ReplaceStep)) {
80
+ return tr;
81
+ }
82
+ var nextPosition = tr.mapping.map(replaceStep.to);
83
+ // The findFrom will make search for both: TextSelection and NodeSelections.
84
+ var nextSelection = _state.Selection.findFrom(tr.doc.resolve(Math.min(nextPosition, tr.doc.content.size)), -1);
85
+ if (nextSelection) {
86
+ tr.setSelection(nextSelection);
87
+ }
62
88
  }
@@ -861,15 +861,24 @@ function handleRichText(slice, queueCardsFromChangedTr) {
861
861
  schema: schema
862
862
  });
863
863
  } else if (noNeedForSafeInsert) {
864
- var _slice$content$lastCh;
865
- tr.replaceSelection(slice);
866
- // when cursor is inside a table cell, and slice.content.lastChild is a panel, expand, or decisionList
867
- // need to make sure the cursor position is is right after the panel, expand, or decisionList
868
- // still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
869
- var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
870
- if ((0, _utils3.insideTableCell)(state) && shouldUpdateCursorPosAfterPaste) {
871
- var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
872
- tr.setSelection(new _selection.GapCursorSelection(nextPos, _selection.Side.RIGHT));
864
+ var _firstChildOfSlice$ty2, _firstChildOfSlice$co;
865
+ if ((firstChildOfSlice === null || firstChildOfSlice === void 0 || (_firstChildOfSlice$ty2 = firstChildOfSlice.type) === null || _firstChildOfSlice$ty2 === void 0 ? void 0 : _firstChildOfSlice$ty2.name) === 'blockquote' && (firstChildOfSlice === null || firstChildOfSlice === void 0 || (_firstChildOfSlice$co = firstChildOfSlice.content.firstChild) === null || _firstChildOfSlice$co === void 0 ? void 0 : _firstChildOfSlice$co.type.name) === ('bulletList' || 'orderedList')) {
866
+ // checks if parent node is a blockquote and child node is either a bulletlist or orderedlist
867
+ (0, _edgeCases.insertSliceForListsInsideBlockquote)({
868
+ tr: tr,
869
+ slice: slice
870
+ });
871
+ } else {
872
+ var _slice$content$lastCh;
873
+ tr.replaceSelection(slice);
874
+ // when cursor is inside a table cell, and slice.content.lastChild is a panel, expand, or decisionList
875
+ // need to make sure the cursor position is is right after the panel, expand, or decisionList
876
+ // still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
877
+ var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
878
+ if ((0, _utils3.insideTableCell)(state) && shouldUpdateCursorPosAfterPaste) {
879
+ var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
880
+ tr.setSelection(new _selection.GapCursorSelection(nextPos, _selection.Side.RIGHT));
881
+ }
873
882
  }
874
883
  } else {
875
884
  // need to scan the slice if there's a block node or list items inside it
@@ -8,44 +8,45 @@ exports.default = createUniversalPreset;
8
8
  exports.isExpandInsertionEnabled = isExpandInsertionEnabled;
9
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _plugins = require("../plugins");
11
+ var _editorPluginBorder = require("@atlaskit/editor-plugin-border");
12
+ var _editorPluginCaption = require("@atlaskit/editor-plugin-caption");
13
+ var _editorPluginCard = require("@atlaskit/editor-plugin-card");
12
14
  var _editorPluginCodeBidiWarning = require("@atlaskit/editor-plugin-code-bidi-warning");
13
- var _editorPluginTasksAndDecisions = require("@atlaskit/editor-plugin-tasks-and-decisions");
14
- var _editorPluginPanel = require("@atlaskit/editor-plugin-panel");
15
- var _editorPluginTextColor = require("@atlaskit/editor-plugin-text-color");
15
+ var _editorPluginContentInsertion = require("@atlaskit/editor-plugin-content-insertion");
16
+ var _editorPluginContextPanel = require("@atlaskit/editor-plugin-context-panel");
17
+ var _editorPluginDate = require("@atlaskit/editor-plugin-date");
18
+ var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
19
+ var _editorPluginExpand = require("@atlaskit/editor-plugin-expand");
20
+ var _editorPluginFragment = require("@atlaskit/editor-plugin-fragment");
21
+ var _editorPluginGrid = require("@atlaskit/editor-plugin-grid");
22
+ var _editorPluginGuideline = require("@atlaskit/editor-plugin-guideline");
23
+ var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
16
24
  var _editorPluginHistory = require("@atlaskit/editor-plugin-history");
25
+ var _editorPluginImageUpload = require("@atlaskit/editor-plugin-image-upload");
17
26
  var _editorPluginIndentation = require("@atlaskit/editor-plugin-indentation");
18
- var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
19
27
  var _editorPluginInsertBlock = require("@atlaskit/editor-plugin-insert-block");
20
- var _editorPluginDate = require("@atlaskit/editor-plugin-date");
28
+ var _editorPluginLayout = require("@atlaskit/editor-plugin-layout");
29
+ var _editorPluginList = require("@atlaskit/editor-plugin-list");
30
+ var _editorPluginLoom = require("@atlaskit/editor-plugin-loom");
21
31
  var _editorPluginMaxContentSize = require("@atlaskit/editor-plugin-max-content-size");
22
- var _editorPluginCaption = require("@atlaskit/editor-plugin-caption");
23
- var _editorPluginBorder = require("@atlaskit/editor-plugin-border");
24
- var _editorPluginHelpDialog = require("@atlaskit/editor-plugin-help-dialog");
25
32
  var _editorPluginMedia = require("@atlaskit/editor-plugin-media");
26
- var _editorPluginRule = require("@atlaskit/editor-plugin-rule");
27
- var _editorPluginFragment = require("@atlaskit/editor-plugin-fragment");
28
- var _editorPluginEmoji = require("@atlaskit/editor-plugin-emoji");
33
+ var _editorPluginMentions = require("@atlaskit/editor-plugin-mentions");
34
+ var _editorPluginPanel = require("@atlaskit/editor-plugin-panel");
29
35
  var _editorPluginPasteOptionsToolbar = require("@atlaskit/editor-plugin-paste-options-toolbar");
30
- var _editorPluginList = require("@atlaskit/editor-plugin-list");
31
- var _editorPluginImageUpload = require("@atlaskit/editor-plugin-image-upload");
32
- var _editorPluginGuideline = require("@atlaskit/editor-plugin-guideline");
33
- var _editorPluginContextPanel = require("@atlaskit/editor-plugin-context-panel");
34
- var _editorPluginGrid = require("@atlaskit/editor-plugin-grid");
35
- var _editorPluginCard = require("@atlaskit/editor-plugin-card");
36
- var _editorPluginLayout = require("@atlaskit/editor-plugin-layout");
36
+ var _editorPluginPlaceholderText = require("@atlaskit/editor-plugin-placeholder-text");
37
+ var _editorPluginRule = require("@atlaskit/editor-plugin-rule");
38
+ var _editorPluginSaveOnEnter = require("@atlaskit/editor-plugin-save-on-enter");
39
+ var _editorPluginScrollIntoView = require("@atlaskit/editor-plugin-scroll-into-view");
40
+ var _editorPluginStatus = require("@atlaskit/editor-plugin-status");
37
41
  var _editorPluginTable = require("@atlaskit/editor-plugin-table");
42
+ var _editorPluginTasksAndDecisions = require("@atlaskit/editor-plugin-tasks-and-decisions");
43
+ var _editorPluginTextColor = require("@atlaskit/editor-plugin-text-color");
38
44
  var _editorPluginToolbarListsIndentation = require("@atlaskit/editor-plugin-toolbar-lists-indentation");
39
- var _editorPluginContentInsertion = require("@atlaskit/editor-plugin-content-insertion");
40
45
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
41
- var _editorPluginSaveOnEnter = require("@atlaskit/editor-plugin-save-on-enter");
42
- var _editorPluginScrollIntoView = require("@atlaskit/editor-plugin-scroll-into-view");
43
- var _editorPluginMentions = require("@atlaskit/editor-plugin-mentions");
44
- var _editorPluginPlaceholderText = require("@atlaskit/editor-plugin-placeholder-text");
45
- var _editorPluginExpand = require("@atlaskit/editor-plugin-expand");
46
+ var _plugins = require("../plugins");
47
+ var _utils = require("@atlaskit/editor-common/utils");
46
48
  var _isFullPage = require("../utils/is-full-page");
47
49
  var _default = require("./default");
48
- var _utils = require("@atlaskit/editor-common/utils");
49
50
  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; }
50
51
  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; }
51
52
  /**
@@ -419,7 +420,12 @@ function createUniversalPreset(appearance, props, featureFlags, prevAppearance,
419
420
  return builder;
420
421
  }).add([_editorPluginCodeBidiWarning.codeBidiWarningPlugin, {
421
422
  appearance: appearance
422
- }]);
423
+ }]).maybeAdd(_editorPluginLoom.loomPlugin, function (loomPlugin, builder) {
424
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.loom-integration')) {
425
+ return builder.add(loomPlugin);
426
+ }
427
+ return builder;
428
+ });
423
429
  return finalPreset;
424
430
  }
425
431
  function isExpandInsertionEnabled(_ref) {
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "189.4.19";
8
+ var version = exports.version = "189.5.1";
@@ -1,6 +1,8 @@
1
- import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
1
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
2
+ import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
2
3
  import { insertSliceIntoRangeSelectionInsideList, insertSliceInsideOfPanelNodeSelected, insertSliceAtNodeEdge, insertSliceIntoEmptyNode } from './lists';
3
4
  import { isListNode } from '@atlaskit/editor-common/utils';
5
+ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
6
  import { isSelectionInsidePanel, isEmptyNode, isCursorSelectionAtTextStartOrEnd } from '../util';
5
7
  export function insertSliceForLists({
6
8
  tr,
@@ -58,4 +60,28 @@ export function insertSliceForLists({
58
60
  });
59
61
  }
60
62
  tr.replaceSelection(slice);
63
+ }
64
+ export function insertSliceForListsInsideBlockquote({
65
+ tr,
66
+ slice
67
+ }) {
68
+ safeInsert(slice.content, tr.selection.$to.pos)(tr).scrollIntoView();
69
+ // ProseMirror doesn't give a proper way to tell us where something was inserted.
70
+ // However, we can know "how" it inserted something.
71
+ //
72
+ // So, instead of weird depth calculations, we can use the step produced by the transform.
73
+ // For instance:
74
+ // The `replaceStep.to and replaceStep.from`, tell us the real position
75
+ // where the content will be insert.
76
+ // Then, we can use the `tr.mapping.map` to the updated position after the replace operation
77
+ const replaceStep = tr.steps[0];
78
+ if (!(replaceStep instanceof ReplaceStep)) {
79
+ return tr;
80
+ }
81
+ const nextPosition = tr.mapping.map(replaceStep.to);
82
+ // The findFrom will make search for both: TextSelection and NodeSelections.
83
+ const nextSelection = Selection.findFrom(tr.doc.resolve(Math.min(nextPosition, tr.doc.content.size)), -1);
84
+ if (nextSelection) {
85
+ tr.setSelection(nextSelection);
86
+ }
61
87
  }
@@ -11,7 +11,7 @@ import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
11
11
  // TODO: ED-20519 Needs Macro extraction
12
12
 
13
13
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
14
- import { insertSliceForLists } from './edge-cases';
14
+ import { insertSliceForLists, insertSliceForListsInsideBlockquote } from './edge-cases';
15
15
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
16
16
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
17
17
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
@@ -843,15 +843,24 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
843
843
  schema
844
844
  });
845
845
  } else if (noNeedForSafeInsert) {
846
- var _slice$content$lastCh, _slice$content$lastCh2;
847
- tr.replaceSelection(slice);
848
- // when cursor is inside a table cell, and slice.content.lastChild is a panel, expand, or decisionList
849
- // need to make sure the cursor position is is right after the panel, expand, or decisionList
850
- // still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
851
- const shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : (_slice$content$lastCh2 = _slice$content$lastCh.type) === null || _slice$content$lastCh2 === void 0 ? void 0 : _slice$content$lastCh2.name) || '');
852
- if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
853
- const nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
854
- tr.setSelection(new GapCursorSelection(nextPos, Side.RIGHT));
846
+ var _firstChildOfSlice$ty2, _firstChildOfSlice$co;
847
+ if ((firstChildOfSlice === null || firstChildOfSlice === void 0 ? void 0 : (_firstChildOfSlice$ty2 = firstChildOfSlice.type) === null || _firstChildOfSlice$ty2 === void 0 ? void 0 : _firstChildOfSlice$ty2.name) === 'blockquote' && (firstChildOfSlice === null || firstChildOfSlice === void 0 ? void 0 : (_firstChildOfSlice$co = firstChildOfSlice.content.firstChild) === null || _firstChildOfSlice$co === void 0 ? void 0 : _firstChildOfSlice$co.type.name) === ('bulletList' || 'orderedList')) {
848
+ // checks if parent node is a blockquote and child node is either a bulletlist or orderedlist
849
+ insertSliceForListsInsideBlockquote({
850
+ tr,
851
+ slice
852
+ });
853
+ } else {
854
+ var _slice$content$lastCh, _slice$content$lastCh2;
855
+ tr.replaceSelection(slice);
856
+ // when cursor is inside a table cell, and slice.content.lastChild is a panel, expand, or decisionList
857
+ // need to make sure the cursor position is is right after the panel, expand, or decisionList
858
+ // still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
859
+ const shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 ? void 0 : (_slice$content$lastCh2 = _slice$content$lastCh.type) === null || _slice$content$lastCh2 === void 0 ? void 0 : _slice$content$lastCh2.name) || '');
860
+ if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
861
+ const nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
862
+ tr.setSelection(new GapCursorSelection(nextPos, Side.RIGHT));
863
+ }
855
864
  }
856
865
  } else {
857
866
  // need to scan the slice if there's a block node or list items inside it
@@ -1,41 +1,42 @@
1
- import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, jiraIssuePlugin, alignmentPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin } from '../plugins';
1
+ import { borderPlugin } from '@atlaskit/editor-plugin-border';
2
+ import { captionPlugin } from '@atlaskit/editor-plugin-caption';
3
+ import { cardPlugin } from '@atlaskit/editor-plugin-card';
2
4
  import { codeBidiWarningPlugin } from '@atlaskit/editor-plugin-code-bidi-warning';
3
- import { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugin-tasks-and-decisions';
4
- import { panelPlugin } from '@atlaskit/editor-plugin-panel';
5
- import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
5
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
6
+ import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
7
+ import { datePlugin } from '@atlaskit/editor-plugin-date';
8
+ import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
9
+ import { expandPlugin } from '@atlaskit/editor-plugin-expand';
10
+ import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
11
+ import { gridPlugin } from '@atlaskit/editor-plugin-grid';
12
+ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
13
+ import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
6
14
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
15
+ import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
7
16
  import { indentationPlugin } from '@atlaskit/editor-plugin-indentation';
8
- import { statusPlugin } from '@atlaskit/editor-plugin-status';
9
17
  import { insertBlockPlugin } from '@atlaskit/editor-plugin-insert-block';
10
- import { datePlugin } from '@atlaskit/editor-plugin-date';
18
+ import { layoutPlugin } from '@atlaskit/editor-plugin-layout';
19
+ import { listPlugin } from '@atlaskit/editor-plugin-list';
20
+ import { loomPlugin } from '@atlaskit/editor-plugin-loom';
11
21
  import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
12
- import { captionPlugin } from '@atlaskit/editor-plugin-caption';
13
- import { borderPlugin } from '@atlaskit/editor-plugin-border';
14
- import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
15
22
  import { mediaPlugin } from '@atlaskit/editor-plugin-media';
16
- import { rulePlugin } from '@atlaskit/editor-plugin-rule';
17
- import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
18
- import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
23
+ import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
24
+ import { panelPlugin } from '@atlaskit/editor-plugin-panel';
19
25
  import { pasteOptionsToolbarPlugin } from '@atlaskit/editor-plugin-paste-options-toolbar';
20
- import { listPlugin } from '@atlaskit/editor-plugin-list';
21
- import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
22
- import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
23
- import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
24
- import { gridPlugin } from '@atlaskit/editor-plugin-grid';
25
- import { cardPlugin } from '@atlaskit/editor-plugin-card';
26
- import { layoutPlugin } from '@atlaskit/editor-plugin-layout';
26
+ import { placeholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
27
+ import { rulePlugin } from '@atlaskit/editor-plugin-rule';
28
+ import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
29
+ import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
30
+ import { statusPlugin } from '@atlaskit/editor-plugin-status';
27
31
  import { tablesPlugin } from '@atlaskit/editor-plugin-table';
32
+ import { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugin-tasks-and-decisions';
33
+ import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
28
34
  import { toolbarListsIndentationPlugin } from '@atlaskit/editor-plugin-toolbar-lists-indentation';
29
- import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
30
35
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
31
- import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
32
- import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
33
- import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
34
- import { placeholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
35
- import { expandPlugin } from '@atlaskit/editor-plugin-expand';
36
+ import { alignmentPlugin, annotationPlugin, avatarGroupPlugin, beforePrimaryToolbarPlugin, breakoutPlugin, collabEditPlugin, customAutoformatPlugin, dataConsumerMarkPlugin, extensionPlugin, feedbackDialogPlugin, findReplacePlugin, jiraIssuePlugin, mobileDimensionsPlugin, mobileSelectionPlugin, viewUpdateSubscriptionPlugin } from '../plugins';
37
+ import { shouldForceTracking } from '@atlaskit/editor-common/utils';
36
38
  import { isFullPage as fullPageCheck } from '../utils/is-full-page';
37
39
  import { createDefaultPreset } from './default';
38
- import { shouldForceTracking } from '@atlaskit/editor-common/utils';
39
40
  /**
40
41
  * Creates a preset with all of the available plugins.
41
42
  * Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
@@ -415,7 +416,12 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
415
416
  return builder;
416
417
  }).add([codeBidiWarningPlugin, {
417
418
  appearance
418
- }]);
419
+ }]).maybeAdd(loomPlugin, (loomPlugin, builder) => {
420
+ if (getBooleanFF('platform.editor.loom-integration')) {
421
+ return builder.add(loomPlugin);
422
+ }
423
+ return builder;
424
+ });
419
425
  return finalPreset;
420
426
  }
421
427
  export function isExpandInsertionEnabled({
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "189.4.19";
2
+ export const version = "189.5.1";
@@ -1,6 +1,8 @@
1
- import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
1
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
2
+ import { findParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
2
3
  import { insertSliceIntoRangeSelectionInsideList, insertSliceInsideOfPanelNodeSelected, insertSliceAtNodeEdge, insertSliceIntoEmptyNode } from './lists';
3
4
  import { isListNode } from '@atlaskit/editor-common/utils';
5
+ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
6
  import { isSelectionInsidePanel, isEmptyNode, isCursorSelectionAtTextStartOrEnd } from '../util';
5
7
  export function insertSliceForLists(_ref) {
6
8
  var _slice$content$firstC;
@@ -53,4 +55,27 @@ export function insertSliceForLists(_ref) {
53
55
  });
54
56
  }
55
57
  tr.replaceSelection(slice);
58
+ }
59
+ export function insertSliceForListsInsideBlockquote(_ref3) {
60
+ var tr = _ref3.tr,
61
+ slice = _ref3.slice;
62
+ safeInsert(slice.content, tr.selection.$to.pos)(tr).scrollIntoView();
63
+ // ProseMirror doesn't give a proper way to tell us where something was inserted.
64
+ // However, we can know "how" it inserted something.
65
+ //
66
+ // So, instead of weird depth calculations, we can use the step produced by the transform.
67
+ // For instance:
68
+ // The `replaceStep.to and replaceStep.from`, tell us the real position
69
+ // where the content will be insert.
70
+ // Then, we can use the `tr.mapping.map` to the updated position after the replace operation
71
+ var replaceStep = tr.steps[0];
72
+ if (!(replaceStep instanceof ReplaceStep)) {
73
+ return tr;
74
+ }
75
+ var nextPosition = tr.mapping.map(replaceStep.to);
76
+ // The findFrom will make search for both: TextSelection and NodeSelections.
77
+ var nextSelection = Selection.findFrom(tr.doc.resolve(Math.min(nextPosition, tr.doc.content.size)), -1);
78
+ if (nextSelection) {
79
+ tr.setSelection(nextSelection);
80
+ }
56
81
  }
@@ -19,7 +19,7 @@ import { GapCursorSelection, Side } from '@atlaskit/editor-common/selection';
19
19
  // TODO: ED-20519 Needs Macro extraction
20
20
 
21
21
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
22
- import { insertSliceForLists } from './edge-cases';
22
+ import { insertSliceForLists, insertSliceForListsInsideBlockquote } from './edge-cases';
23
23
  import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
24
24
  import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory';
25
25
  import { anyMarkActive } from '@atlaskit/editor-common/mark';
@@ -840,15 +840,24 @@ export function handleRichText(slice, queueCardsFromChangedTr) {
840
840
  schema: schema
841
841
  });
842
842
  } else if (noNeedForSafeInsert) {
843
- var _slice$content$lastCh;
844
- tr.replaceSelection(slice);
845
- // when cursor is inside a table cell, and slice.content.lastChild is a panel, expand, or decisionList
846
- // need to make sure the cursor position is is right after the panel, expand, or decisionList
847
- // still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
848
- var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
849
- if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
850
- var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
851
- tr.setSelection(new GapCursorSelection(nextPos, Side.RIGHT));
843
+ var _firstChildOfSlice$ty2, _firstChildOfSlice$co;
844
+ if ((firstChildOfSlice === null || firstChildOfSlice === void 0 || (_firstChildOfSlice$ty2 = firstChildOfSlice.type) === null || _firstChildOfSlice$ty2 === void 0 ? void 0 : _firstChildOfSlice$ty2.name) === 'blockquote' && (firstChildOfSlice === null || firstChildOfSlice === void 0 || (_firstChildOfSlice$co = firstChildOfSlice.content.firstChild) === null || _firstChildOfSlice$co === void 0 ? void 0 : _firstChildOfSlice$co.type.name) === ('bulletList' || 'orderedList')) {
845
+ // checks if parent node is a blockquote and child node is either a bulletlist or orderedlist
846
+ insertSliceForListsInsideBlockquote({
847
+ tr: tr,
848
+ slice: slice
849
+ });
850
+ } else {
851
+ var _slice$content$lastCh;
852
+ tr.replaceSelection(slice);
853
+ // when cursor is inside a table cell, and slice.content.lastChild is a panel, expand, or decisionList
854
+ // need to make sure the cursor position is is right after the panel, expand, or decisionList
855
+ // still in the same table cell, see issue: https://product-fabric.atlassian.net/browse/ED-17862
856
+ var shouldUpdateCursorPosAfterPaste = ['panel', 'nestedExpand', 'decisionList', 'codeBlock'].includes(((_slice$content$lastCh = slice.content.lastChild) === null || _slice$content$lastCh === void 0 || (_slice$content$lastCh = _slice$content$lastCh.type) === null || _slice$content$lastCh === void 0 ? void 0 : _slice$content$lastCh.name) || '');
857
+ if (insideTableCell(state) && shouldUpdateCursorPosAfterPaste) {
858
+ var nextPos = tr.doc.resolve(tr.mapping.map(selection.$from.pos));
859
+ tr.setSelection(new GapCursorSelection(nextPos, Side.RIGHT));
860
+ }
852
861
  }
853
862
  } else {
854
863
  // need to scan the slice if there's a block node or list items inside it
@@ -2,44 +2,45 @@ import _typeof from "@babel/runtime/helpers/typeof";
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 { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, extensionPlugin, jiraIssuePlugin, alignmentPlugin, customAutoformatPlugin, feedbackDialogPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin } from '../plugins';
5
+ import { borderPlugin } from '@atlaskit/editor-plugin-border';
6
+ import { captionPlugin } from '@atlaskit/editor-plugin-caption';
7
+ import { cardPlugin } from '@atlaskit/editor-plugin-card';
6
8
  import { codeBidiWarningPlugin } from '@atlaskit/editor-plugin-code-bidi-warning';
7
- import { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugin-tasks-and-decisions';
8
- import { panelPlugin } from '@atlaskit/editor-plugin-panel';
9
- import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
9
+ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
10
+ import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
11
+ import { datePlugin } from '@atlaskit/editor-plugin-date';
12
+ import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
13
+ import { expandPlugin } from '@atlaskit/editor-plugin-expand';
14
+ import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
15
+ import { gridPlugin } from '@atlaskit/editor-plugin-grid';
16
+ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
17
+ import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
10
18
  import { historyPlugin } from '@atlaskit/editor-plugin-history';
19
+ import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
11
20
  import { indentationPlugin } from '@atlaskit/editor-plugin-indentation';
12
- import { statusPlugin } from '@atlaskit/editor-plugin-status';
13
21
  import { insertBlockPlugin } from '@atlaskit/editor-plugin-insert-block';
14
- import { datePlugin } from '@atlaskit/editor-plugin-date';
22
+ import { layoutPlugin } from '@atlaskit/editor-plugin-layout';
23
+ import { listPlugin } from '@atlaskit/editor-plugin-list';
24
+ import { loomPlugin } from '@atlaskit/editor-plugin-loom';
15
25
  import { maxContentSizePlugin } from '@atlaskit/editor-plugin-max-content-size';
16
- import { captionPlugin } from '@atlaskit/editor-plugin-caption';
17
- import { borderPlugin } from '@atlaskit/editor-plugin-border';
18
- import { helpDialogPlugin } from '@atlaskit/editor-plugin-help-dialog';
19
26
  import { mediaPlugin } from '@atlaskit/editor-plugin-media';
20
- import { rulePlugin } from '@atlaskit/editor-plugin-rule';
21
- import { fragmentPlugin } from '@atlaskit/editor-plugin-fragment';
22
- import { emojiPlugin } from '@atlaskit/editor-plugin-emoji';
27
+ import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
28
+ import { panelPlugin } from '@atlaskit/editor-plugin-panel';
23
29
  import { pasteOptionsToolbarPlugin } from '@atlaskit/editor-plugin-paste-options-toolbar';
24
- import { listPlugin } from '@atlaskit/editor-plugin-list';
25
- import { imageUploadPlugin } from '@atlaskit/editor-plugin-image-upload';
26
- import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
27
- import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
28
- import { gridPlugin } from '@atlaskit/editor-plugin-grid';
29
- import { cardPlugin } from '@atlaskit/editor-plugin-card';
30
- import { layoutPlugin } from '@atlaskit/editor-plugin-layout';
30
+ import { placeholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
31
+ import { rulePlugin } from '@atlaskit/editor-plugin-rule';
32
+ import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
33
+ import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
34
+ import { statusPlugin } from '@atlaskit/editor-plugin-status';
31
35
  import { tablesPlugin } from '@atlaskit/editor-plugin-table';
36
+ import { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugin-tasks-and-decisions';
37
+ import { textColorPlugin } from '@atlaskit/editor-plugin-text-color';
32
38
  import { toolbarListsIndentationPlugin } from '@atlaskit/editor-plugin-toolbar-lists-indentation';
33
- import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
34
39
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
35
- import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
36
- import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
37
- import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
38
- import { placeholderTextPlugin } from '@atlaskit/editor-plugin-placeholder-text';
39
- import { expandPlugin } from '@atlaskit/editor-plugin-expand';
40
+ import { alignmentPlugin, annotationPlugin, avatarGroupPlugin, beforePrimaryToolbarPlugin, breakoutPlugin, collabEditPlugin, customAutoformatPlugin, dataConsumerMarkPlugin, extensionPlugin, feedbackDialogPlugin, findReplacePlugin, jiraIssuePlugin, mobileDimensionsPlugin, mobileSelectionPlugin, viewUpdateSubscriptionPlugin } from '../plugins';
41
+ import { shouldForceTracking } from '@atlaskit/editor-common/utils';
40
42
  import { isFullPage as fullPageCheck } from '../utils/is-full-page';
41
43
  import { createDefaultPreset } from './default';
42
- import { shouldForceTracking } from '@atlaskit/editor-common/utils';
43
44
  /**
44
45
  * Creates a preset with all of the available plugins.
45
46
  * Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
@@ -411,7 +412,12 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
411
412
  return builder;
412
413
  }).add([codeBidiWarningPlugin, {
413
414
  appearance: appearance
414
- }]);
415
+ }]).maybeAdd(loomPlugin, function (loomPlugin, builder) {
416
+ if (getBooleanFF('platform.editor.loom-integration')) {
417
+ return builder.add(loomPlugin);
418
+ }
419
+ return builder;
420
+ });
415
421
  return finalPreset;
416
422
  }
417
423
  export function isExpandInsertionEnabled(_ref) {
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "189.4.19";
2
+ export var version = "189.5.1";
@@ -5,3 +5,7 @@ export declare function insertSliceForLists({ tr, slice, schema, }: {
5
5
  slice: Slice;
6
6
  schema: Schema;
7
7
  }): void | Transaction;
8
+ export declare function insertSliceForListsInsideBlockquote({ tr, slice, }: {
9
+ tr: Transaction;
10
+ slice: Slice;
11
+ }): Transaction | undefined;
@@ -1,11 +1,11 @@
1
1
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorAppearance } from '@atlaskit/editor-common/types';
3
+ import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
3
4
  import type { EditorProps } from '../types';
5
+ import type { EditorPluginFeatureProps, EditorProviderProps, EditorSharedPropsWithPlugins } from '../types/editor-props';
6
+ import type { FeatureFlags } from '../types/feature-flags';
4
7
  import type { DefaultPresetPluginOptions } from './default';
5
8
  import type { EditorPresetProps } from './types';
6
- import type { EditorSharedPropsWithPlugins, EditorPluginFeatureProps, EditorProviderProps } from '../types/editor-props';
7
- import type { FeatureFlags } from '../types/feature-flags';
8
- import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
9
9
  type UniversalPresetProps = EditorPresetProps & DefaultPresetPluginOptions & EditorSharedPropsWithPlugins & EditorPluginFeatureProps & EditorProviderProps;
10
10
  /**
11
11
  * Creates a preset with all of the available plugins.
@@ -5,3 +5,7 @@ export declare function insertSliceForLists({ tr, slice, schema, }: {
5
5
  slice: Slice;
6
6
  schema: Schema;
7
7
  }): void | Transaction;
8
+ export declare function insertSliceForListsInsideBlockquote({ tr, slice, }: {
9
+ tr: Transaction;
10
+ slice: Slice;
11
+ }): Transaction | undefined;
@@ -1,11 +1,11 @@
1
1
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { EditorAppearance } from '@atlaskit/editor-common/types';
3
+ import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
3
4
  import type { EditorProps } from '../types';
5
+ import type { EditorPluginFeatureProps, EditorProviderProps, EditorSharedPropsWithPlugins } from '../types/editor-props';
6
+ import type { FeatureFlags } from '../types/feature-flags';
4
7
  import type { DefaultPresetPluginOptions } from './default';
5
8
  import type { EditorPresetProps } from './types';
6
- import type { EditorSharedPropsWithPlugins, EditorPluginFeatureProps, EditorProviderProps } from '../types/editor-props';
7
- import type { FeatureFlags } from '../types/feature-flags';
8
- import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
9
9
  type UniversalPresetProps = EditorPresetProps & DefaultPresetPluginOptions & EditorSharedPropsWithPlugins & EditorPluginFeatureProps & EditorProviderProps;
10
10
  /**
11
11
  * Creates a preset with all of the available plugins.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "189.4.19",
3
+ "version": "189.5.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/checkbox": "^13.0.0",
52
52
  "@atlaskit/date": "^0.10.0",
53
53
  "@atlaskit/datetime-picker": "^13.0.0",
54
- "@atlaskit/editor-common": "^76.24.0",
54
+ "@atlaskit/editor-common": "^76.25.0",
55
55
  "@atlaskit/editor-json-transformer": "^8.10.0",
56
56
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
57
57
  "@atlaskit/editor-plugin-analytics": "^0.3.0",
@@ -89,6 +89,7 @@
89
89
  "@atlaskit/editor-plugin-insert-block": "^0.2.0",
90
90
  "@atlaskit/editor-plugin-layout": "^0.1.0",
91
91
  "@atlaskit/editor-plugin-list": "^1.4.0",
92
+ "@atlaskit/editor-plugin-loom": "^0.1.0",
92
93
  "@atlaskit/editor-plugin-max-content-size": "^0.1.0",
93
94
  "@atlaskit/editor-plugin-media": "^0.4.0",
94
95
  "@atlaskit/editor-plugin-mentions": "^0.1.0",
@@ -349,6 +350,9 @@
349
350
  "platform.editor.ordered-list-auto-join-improvements_mrlv5": {
350
351
  "type": "boolean",
351
352
  "referenceOnly": "true"
353
+ },
354
+ "platform.editor.loom-integration": {
355
+ "type": "boolean"
352
356
  }
353
357
  }
354
358
  }