@atlaskit/editor-common 76.12.1 → 76.13.0

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 (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/monitoring/error.js +1 -1
  3. package/dist/cjs/rank.js +58 -0
  4. package/dist/cjs/transforms/code-block.js +49 -0
  5. package/dist/cjs/transforms/decision-list.js +17 -0
  6. package/dist/cjs/transforms/index.js +27 -1
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/cjs/utils/annotation/index.js +39 -2
  9. package/dist/cjs/utils/index.js +12 -0
  10. package/dist/es2019/monitoring/error.js +1 -1
  11. package/dist/es2019/rank.js +50 -0
  12. package/dist/es2019/transforms/code-block.js +44 -0
  13. package/dist/es2019/transforms/decision-list.js +11 -0
  14. package/dist/es2019/transforms/index.js +3 -1
  15. package/dist/es2019/ui/DropList/index.js +1 -1
  16. package/dist/es2019/utils/annotation/index.js +41 -1
  17. package/dist/es2019/utils/index.js +1 -1
  18. package/dist/esm/monitoring/error.js +1 -1
  19. package/dist/esm/rank.js +50 -0
  20. package/dist/esm/transforms/code-block.js +42 -0
  21. package/dist/esm/transforms/decision-list.js +11 -0
  22. package/dist/esm/transforms/index.js +3 -1
  23. package/dist/esm/ui/DropList/index.js +1 -1
  24. package/dist/esm/utils/annotation/index.js +35 -1
  25. package/dist/esm/utils/index.js +1 -1
  26. package/dist/types/rank.d.ts +19 -0
  27. package/dist/types/transforms/code-block.d.ts +6 -0
  28. package/dist/types/transforms/decision-list.d.ts +3 -0
  29. package/dist/types/transforms/index.d.ts +2 -0
  30. package/dist/types/ui/MediaSingle/grid.d.ts +2 -2
  31. package/dist/types/utils/annotation/index.d.ts +4 -1
  32. package/dist/types/utils/index.d.ts +1 -1
  33. package/dist/types-ts4.5/rank.d.ts +19 -0
  34. package/dist/types-ts4.5/transforms/code-block.d.ts +6 -0
  35. package/dist/types-ts4.5/transforms/decision-list.d.ts +3 -0
  36. package/dist/types-ts4.5/transforms/index.d.ts +2 -0
  37. package/dist/types-ts4.5/ui/MediaSingle/grid.d.ts +2 -2
  38. package/dist/types-ts4.5/utils/annotation/index.d.ts +4 -1
  39. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  40. package/legacy-rank-plugins/package.json +15 -0
  41. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 76.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#41923](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41923) [`0120da635b9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0120da635b9) - [ED-20519] Decoupling more paste plugin from editor-core moving common functions to editor-common
8
+
9
+ ## 76.12.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#40916](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40916) [`0b80e2e68ea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0b80e2e68ea) - [ux] media single node with external type media should not show migration ui. Update external image with natural dimensions accordingly, and fixed whitespace issue in external image.
14
+
3
15
  ## 76.12.1
4
16
 
5
17
  ### Patch Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "76.12.1";
19
+ var packageVersion = "76.13.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.rankEditorPlugins = void 0;
7
+ exports.sortByOrder = sortByOrder;
8
+ exports.sortByOrderWithTypeName = sortByOrderWithTypeName;
9
+ // @depreacted
10
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
11
+ var rankEditorPlugins = exports.rankEditorPlugins = {
12
+ plugins: ['featureFlagsContextPlugin', 'compositionPlugin', 'inlineCursorTargetPlugin', 'typeAhead', 'typeAheadInsertItem', 'focusHandlerPlugin', 'frozenEditor', 'submitEditor', 'saveOnEnter', 'customAutoformatting', 'newlinePreserveMarksPlugin', 'imageUpload', 'imageUploadInputRule', 'clipboard', 'paste', 'pasteKeymap', 'mention', 'mentionInputRule', 'mentionKeymap', 'emoji', 'placeholderText', 'emojiInputRule', 'emojiKeymap', 'emojiAsciiInputRule', 'blockType', 'quickInsert', 'tasksAndDecisions', 'blockTypeInputRule', 'tasksAndDecisionsInputRule', 'list', 'typeAheadKeymap', 'typeAheadInputRule', 'date',
13
+ // Needs to be before indentation to handle tab into input field
14
+ 'dateKeymap',
15
+ // This should be always after `typeAheadKeymap` & `emojiKeymap`
16
+ 'indentationKeymap', 'textColor', 'alignmentPlugin', 'listInputRule', 'listKeymap', 'codeBlock', 'codeBlockIDEKeyBindings', 'codeBlockKeyMap', 'textFormatting', 'textFormattingCursor', 'textFormattingInputRule', 'textFormattingSmartRule', 'textFormattingClear', 'textFormattingKeymap',
17
+ // task/decisions keymap needs to be above table keymap so can indent actions in a table
18
+ 'tasksAndDecisionsKeyMap',
19
+ // expand and table keymaps need to be above selection keymap to add their custom selection behaviour:
20
+ // https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
21
+ 'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap',
22
+ // media keymap above selection keymap to allow navigating past the mediaSingle node
23
+ 'mediaKeymap',
24
+ // selection keymap needs to be above gap cursor keymap so it can set node selections from
25
+ // left/right arrows
26
+ 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
27
+ nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
28
+ marks: [
29
+ // Fragment mark is both for inline and block elements
30
+ 'fragment',
31
+ // Inline marks
32
+ 'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery',
33
+ // Block marks
34
+ 'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer', 'border',
35
+ // Unsupported mark
36
+ 'unsupportedMark', 'unsupportedNodeAttribute']
37
+ };
38
+
39
+ // @depreacted
40
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
41
+ function sortByOrder(item) {
42
+ return function (a, b) {
43
+ return rankEditorPlugins[item].indexOf(a.name) - rankEditorPlugins[item].indexOf(b.name);
44
+ };
45
+ }
46
+
47
+ // while functionally the same, in order to avoid potentially rewriting the ~10
48
+ // existing implementations of the above function I decided creating a separate
49
+ // function avoided that whole mess. If someone can think of a better way to implement
50
+ // the above and below into a single function please do so
51
+
52
+ // @depreacted
53
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
54
+ function sortByOrderWithTypeName(item) {
55
+ return function (a, b) {
56
+ return rankEditorPlugins[item].indexOf(a.type.name) - rankEditorPlugins[item].indexOf(b.type.name);
57
+ };
58
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.transformSingleLineCodeBlockToCodeMark = exports.findCodeBlock = void 0;
7
+ exports.transformSliceToJoinAdjacentCodeBlocks = transformSliceToJoinAdjacentCodeBlocks;
8
+ var _model = require("@atlaskit/editor-prosemirror/model");
9
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
10
+ var _slice = require("../utils/slice");
11
+ function joinCodeBlocks(left, right) {
12
+ var textContext = "".concat(left.textContent, "\n").concat(right.textContent);
13
+ return left.type.create(left.attrs, left.type.schema.text(textContext));
14
+ }
15
+ function mergeAdjacentCodeBlocks(fragment) {
16
+ var children = [];
17
+ fragment.forEach(function (maybeCodeBlock) {
18
+ if (maybeCodeBlock.type === maybeCodeBlock.type.schema.nodes.codeBlock) {
19
+ var peekAtPrevious = children[children.length - 1];
20
+ if (peekAtPrevious && peekAtPrevious.type === maybeCodeBlock.type) {
21
+ return children.push(joinCodeBlocks(children.pop(), maybeCodeBlock));
22
+ }
23
+ }
24
+ return children.push(maybeCodeBlock);
25
+ });
26
+ return _model.Fragment.from(children);
27
+ }
28
+ function transformSliceToJoinAdjacentCodeBlocks(slice) {
29
+ slice = (0, _slice.mapSlice)(slice, function (node) {
30
+ return node.isBlock && !node.isTextblock ? node.copy(mergeAdjacentCodeBlocks(node.content)) : node;
31
+ });
32
+ // mapSlice won't be able to merge adjacent top-level code-blocks
33
+ return new _model.Slice(mergeAdjacentCodeBlocks(slice.content), slice.openStart, slice.openEnd);
34
+ }
35
+ var transformSingleLineCodeBlockToCodeMark = exports.transformSingleLineCodeBlockToCodeMark = function transformSingleLineCodeBlockToCodeMark(slice, schema) {
36
+ if (slice.content.childCount === 1 && (slice.openStart || slice.openEnd)) {
37
+ var maybeCodeBlock = slice.content.firstChild;
38
+ if (maybeCodeBlock && maybeCodeBlock.type === schema.nodes.codeBlock) {
39
+ if (maybeCodeBlock.textContent && maybeCodeBlock.textContent.indexOf('\n') === -1) {
40
+ return new _model.Slice(_model.Fragment.from(schema.text(maybeCodeBlock.textContent, [schema.marks.code.create()])), 0, 0);
41
+ }
42
+ }
43
+ }
44
+ return slice;
45
+ };
46
+ var findCodeBlock = exports.findCodeBlock = function findCodeBlock(state, selection) {
47
+ var codeBlock = state.schema.nodes.codeBlock;
48
+ return (0, _utils.findSelectedNodeOfType)(codeBlock)(selection || state.selection) || (0, _utils.findParentNodeOfType)(codeBlock)(selection || state.selection);
49
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.transformSliceToDecisionList = void 0;
7
+ var _model = require("@atlaskit/editor-prosemirror/model");
8
+ // If slice is decisionItem, wrap it inside a decisionList. This prevents an
9
+ // additional newline from being pasted along with the selected decision item.
10
+ var transformSliceToDecisionList = exports.transformSliceToDecisionList = function transformSliceToDecisionList(slice, schema) {
11
+ var node = slice.content.firstChild;
12
+ if (slice.content.childCount === 1 && node && node.type.name === 'decisionItem') {
13
+ var decisionListWrapperNode = schema.nodes.decisionList.create({}, node);
14
+ return new _model.Slice(_model.Fragment.from(decisionListWrapperNode), slice.openStart, slice.openEnd);
15
+ }
16
+ return slice;
17
+ };
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "findCodeBlock", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _codeBlock.findCodeBlock;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "findExpand", {
7
13
  enumerable: true,
8
14
  get: function get() {
@@ -21,12 +27,30 @@ Object.defineProperty(exports, "removeLayoutFromLastChild", {
21
27
  return _layout.removeLayoutFromLastChild;
22
28
  }
23
29
  });
30
+ Object.defineProperty(exports, "transformSingleLineCodeBlockToCodeMark", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _codeBlock.transformSingleLineCodeBlockToCodeMark;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "transformSliceNestedExpandToExpand", {
25
37
  enumerable: true,
26
38
  get: function get() {
27
39
  return _expand.transformSliceNestedExpandToExpand;
28
40
  }
29
41
  });
42
+ Object.defineProperty(exports, "transformSliceToDecisionList", {
43
+ enumerable: true,
44
+ get: function get() {
45
+ return _decisionList.transformSliceToDecisionList;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "transformSliceToJoinAdjacentCodeBlocks", {
49
+ enumerable: true,
50
+ get: function get() {
51
+ return _codeBlock.transformSliceToJoinAdjacentCodeBlocks;
52
+ }
53
+ });
30
54
  Object.defineProperty(exports, "transformSliceToRemoveOpenBodiedExtension", {
31
55
  enumerable: true,
32
56
  get: function get() {
@@ -53,4 +77,6 @@ Object.defineProperty(exports, "unwrapContentFromLayout", {
53
77
  });
54
78
  var _layout = require("./layout");
55
79
  var _expand = require("./expand");
56
- var _extension = require("./extension");
80
+ var _extension = require("./extension");
81
+ var _codeBlock = require("./code-block");
82
+ var _decisionList = require("./decision-list");
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "76.12.1";
27
+ var packageVersion = "76.13.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -3,7 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAnnotationIdsFromRange = exports.canApplyAnnotationOnRange = void 0;
6
+ exports.canApplyAnnotationOnRange = void 0;
7
+ exports.containsAnyAnnotations = containsAnyAnnotations;
8
+ exports.getAnnotationIdsFromRange = void 0;
9
+ exports.hasAnnotationMark = hasAnnotationMark;
7
10
  var canApplyAnnotationOnRange = exports.canApplyAnnotationOnRange = function canApplyAnnotationOnRange(rangeSelection, doc, schema) {
8
11
  var from = rangeSelection.from,
9
12
  to = rangeSelection.to;
@@ -44,4 +47,38 @@ var getAnnotationIdsFromRange = exports.getAnnotationIdsFromRange = function get
44
47
  return true;
45
48
  });
46
49
  return Array.from(annotations);
47
- };
50
+ };
51
+
52
+ /*
53
+ * verifies if node contains annotation mark
54
+ */
55
+ function hasAnnotationMark(node, state) {
56
+ var annotationMark = state.schema.marks.annotation;
57
+ return !!(annotationMark && node && node.marks.length && annotationMark.isInSet(node.marks));
58
+ }
59
+
60
+ /*
61
+ * verifies that slice contains any annotations
62
+ */
63
+ function containsAnyAnnotations(slice, state) {
64
+ if (!slice.content.size) {
65
+ return false;
66
+ }
67
+ var hasAnnotation = false;
68
+ slice.content.forEach(function (node) {
69
+ hasAnnotation = hasAnnotation || hasAnnotationMark(node, state);
70
+ // return early if annotation found already
71
+ if (hasAnnotation) {
72
+ return true;
73
+ }
74
+ // check annotations in descendants
75
+ node.descendants(function (node) {
76
+ if (hasAnnotationMark(node, state)) {
77
+ hasAnnotation = true;
78
+ return false;
79
+ }
80
+ return true;
81
+ });
82
+ });
83
+ return hasAnnotation;
84
+ }
@@ -239,6 +239,12 @@ Object.defineProperty(exports, "compose", {
239
239
  return _compose.compose;
240
240
  }
241
241
  });
242
+ Object.defineProperty(exports, "containsAnyAnnotations", {
243
+ enumerable: true,
244
+ get: function get() {
245
+ return _annotation.containsAnyAnnotations;
246
+ }
247
+ });
242
248
  Object.defineProperty(exports, "containsClassName", {
243
249
  enumerable: true,
244
250
  get: function get() {
@@ -522,6 +528,12 @@ Object.defineProperty(exports, "gridTypeForLayout", {
522
528
  return _grid.gridTypeForLayout;
523
529
  }
524
530
  });
531
+ Object.defineProperty(exports, "hasAnnotationMark", {
532
+ enumerable: true,
533
+ get: function get() {
534
+ return _annotation.hasAnnotationMark;
535
+ }
536
+ });
525
537
  Object.defineProperty(exports, "hasDocAsParent", {
526
538
  enumerable: true,
527
539
  get: function get() {
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "76.12.1";
3
+ const packageVersion = "76.13.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,50 @@
1
+ // @depreacted
2
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
3
+ export const rankEditorPlugins = {
4
+ plugins: ['featureFlagsContextPlugin', 'compositionPlugin', 'inlineCursorTargetPlugin', 'typeAhead', 'typeAheadInsertItem', 'focusHandlerPlugin', 'frozenEditor', 'submitEditor', 'saveOnEnter', 'customAutoformatting', 'newlinePreserveMarksPlugin', 'imageUpload', 'imageUploadInputRule', 'clipboard', 'paste', 'pasteKeymap', 'mention', 'mentionInputRule', 'mentionKeymap', 'emoji', 'placeholderText', 'emojiInputRule', 'emojiKeymap', 'emojiAsciiInputRule', 'blockType', 'quickInsert', 'tasksAndDecisions', 'blockTypeInputRule', 'tasksAndDecisionsInputRule', 'list', 'typeAheadKeymap', 'typeAheadInputRule', 'date',
5
+ // Needs to be before indentation to handle tab into input field
6
+ 'dateKeymap',
7
+ // This should be always after `typeAheadKeymap` & `emojiKeymap`
8
+ 'indentationKeymap', 'textColor', 'alignmentPlugin', 'listInputRule', 'listKeymap', 'codeBlock', 'codeBlockIDEKeyBindings', 'codeBlockKeyMap', 'textFormatting', 'textFormattingCursor', 'textFormattingInputRule', 'textFormattingSmartRule', 'textFormattingClear', 'textFormattingKeymap',
9
+ // task/decisions keymap needs to be above table keymap so can indent actions in a table
10
+ 'tasksAndDecisionsKeyMap',
11
+ // expand and table keymaps need to be above selection keymap to add their custom selection behaviour:
12
+ // https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
13
+ 'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap',
14
+ // media keymap above selection keymap to allow navigating past the mediaSingle node
15
+ 'mediaKeymap',
16
+ // selection keymap needs to be above gap cursor keymap so it can set node selections from
17
+ // left/right arrows
18
+ 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
19
+ nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
20
+ marks: [
21
+ // Fragment mark is both for inline and block elements
22
+ 'fragment',
23
+ // Inline marks
24
+ 'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery',
25
+ // Block marks
26
+ 'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer', 'border',
27
+ // Unsupported mark
28
+ 'unsupportedMark', 'unsupportedNodeAttribute']
29
+ };
30
+
31
+ // @depreacted
32
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
33
+ export function sortByOrder(item) {
34
+ return function (a, b) {
35
+ return rankEditorPlugins[item].indexOf(a.name) - rankEditorPlugins[item].indexOf(b.name);
36
+ };
37
+ }
38
+
39
+ // while functionally the same, in order to avoid potentially rewriting the ~10
40
+ // existing implementations of the above function I decided creating a separate
41
+ // function avoided that whole mess. If someone can think of a better way to implement
42
+ // the above and below into a single function please do so
43
+
44
+ // @depreacted
45
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
46
+ export function sortByOrderWithTypeName(item) {
47
+ return function (a, b) {
48
+ return rankEditorPlugins[item].indexOf(a.type.name) - rankEditorPlugins[item].indexOf(b.type.name);
49
+ };
50
+ }
@@ -0,0 +1,44 @@
1
+ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
+ import { mapSlice } from '../utils/slice';
4
+ function joinCodeBlocks(left, right) {
5
+ const textContext = `${left.textContent}\n${right.textContent}`;
6
+ return left.type.create(left.attrs, left.type.schema.text(textContext));
7
+ }
8
+ function mergeAdjacentCodeBlocks(fragment) {
9
+ const children = [];
10
+ fragment.forEach(maybeCodeBlock => {
11
+ if (maybeCodeBlock.type === maybeCodeBlock.type.schema.nodes.codeBlock) {
12
+ const peekAtPrevious = children[children.length - 1];
13
+ if (peekAtPrevious && peekAtPrevious.type === maybeCodeBlock.type) {
14
+ return children.push(joinCodeBlocks(children.pop(), maybeCodeBlock));
15
+ }
16
+ }
17
+ return children.push(maybeCodeBlock);
18
+ });
19
+ return Fragment.from(children);
20
+ }
21
+ export function transformSliceToJoinAdjacentCodeBlocks(slice) {
22
+ slice = mapSlice(slice, node => {
23
+ return node.isBlock && !node.isTextblock ? node.copy(mergeAdjacentCodeBlocks(node.content)) : node;
24
+ });
25
+ // mapSlice won't be able to merge adjacent top-level code-blocks
26
+ return new Slice(mergeAdjacentCodeBlocks(slice.content), slice.openStart, slice.openEnd);
27
+ }
28
+ export const transformSingleLineCodeBlockToCodeMark = (slice, schema) => {
29
+ if (slice.content.childCount === 1 && (slice.openStart || slice.openEnd)) {
30
+ const maybeCodeBlock = slice.content.firstChild;
31
+ if (maybeCodeBlock && maybeCodeBlock.type === schema.nodes.codeBlock) {
32
+ if (maybeCodeBlock.textContent && maybeCodeBlock.textContent.indexOf('\n') === -1) {
33
+ return new Slice(Fragment.from(schema.text(maybeCodeBlock.textContent, [schema.marks.code.create()])), 0, 0);
34
+ }
35
+ }
36
+ }
37
+ return slice;
38
+ };
39
+ export const findCodeBlock = (state, selection) => {
40
+ const {
41
+ codeBlock
42
+ } = state.schema.nodes;
43
+ return findSelectedNodeOfType(codeBlock)(selection || state.selection) || findParentNodeOfType(codeBlock)(selection || state.selection);
44
+ };
@@ -0,0 +1,11 @@
1
+ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
+ // If slice is decisionItem, wrap it inside a decisionList. This prevents an
3
+ // additional newline from being pasted along with the selected decision item.
4
+ export const transformSliceToDecisionList = (slice, schema) => {
5
+ const node = slice.content.firstChild;
6
+ if (slice.content.childCount === 1 && node && node.type.name === 'decisionItem') {
7
+ const decisionListWrapperNode = schema.nodes.decisionList.create({}, node);
8
+ return new Slice(Fragment.from(decisionListWrapperNode), slice.openStart, slice.openEnd);
9
+ }
10
+ return slice;
11
+ };
@@ -1,3 +1,5 @@
1
1
  export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes } from './layout';
2
2
  export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand } from './expand';
3
- export { transformSliceToRemoveOpenBodiedExtension } from './extension';
3
+ export { transformSliceToRemoveOpenBodiedExtension } from './extension';
4
+ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock } from './code-block';
5
+ export { transformSliceToDecisionList } from './decision-list';
@@ -9,7 +9,7 @@ import { themed } from '@atlaskit/theme/components';
9
9
  import { borderRadius } from '@atlaskit/theme/constants';
10
10
  import Layer from '../Layer';
11
11
  const packageName = "@atlaskit/editor-common";
12
- const packageVersion = "76.12.1";
12
+ const packageVersion = "76.13.0";
13
13
  const halfFocusRing = 1;
14
14
  const dropOffset = '0, 8';
15
15
  class DropList extends Component {
@@ -42,4 +42,44 @@ export const getAnnotationIdsFromRange = (rangeSelection, doc, schema) => {
42
42
  return true;
43
43
  });
44
44
  return Array.from(annotations);
45
- };
45
+ };
46
+
47
+ /*
48
+ * verifies if node contains annotation mark
49
+ */
50
+ export function hasAnnotationMark(node, state) {
51
+ const {
52
+ schema: {
53
+ marks: {
54
+ annotation: annotationMark
55
+ }
56
+ }
57
+ } = state;
58
+ return !!(annotationMark && node && node.marks.length && annotationMark.isInSet(node.marks));
59
+ }
60
+
61
+ /*
62
+ * verifies that slice contains any annotations
63
+ */
64
+ export function containsAnyAnnotations(slice, state) {
65
+ if (!slice.content.size) {
66
+ return false;
67
+ }
68
+ let hasAnnotation = false;
69
+ slice.content.forEach(node => {
70
+ hasAnnotation = hasAnnotation || hasAnnotationMark(node, state);
71
+ // return early if annotation found already
72
+ if (hasAnnotation) {
73
+ return true;
74
+ }
75
+ // check annotations in descendants
76
+ node.descendants(node => {
77
+ if (hasAnnotationMark(node, state)) {
78
+ hasAnnotation = true;
79
+ return false;
80
+ }
81
+ return true;
82
+ });
83
+ });
84
+ return hasAnnotation;
85
+ }
@@ -1,7 +1,7 @@
1
1
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { hasDocAsParent } from './document';
3
3
  import { isEmptyParagraph } from './editor-core-utils';
4
- export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
4
+ export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark } from './annotation';
5
5
  export { getExtensionLozengeData } from './macro';
6
6
  export { default as browser } from './browser';
7
7
  export { default as ErrorReporter } from './error-reporter';
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  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; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "76.12.1";
9
+ var packageVersion = "76.13.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -0,0 +1,50 @@
1
+ // @depreacted
2
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
3
+ export var rankEditorPlugins = {
4
+ plugins: ['featureFlagsContextPlugin', 'compositionPlugin', 'inlineCursorTargetPlugin', 'typeAhead', 'typeAheadInsertItem', 'focusHandlerPlugin', 'frozenEditor', 'submitEditor', 'saveOnEnter', 'customAutoformatting', 'newlinePreserveMarksPlugin', 'imageUpload', 'imageUploadInputRule', 'clipboard', 'paste', 'pasteKeymap', 'mention', 'mentionInputRule', 'mentionKeymap', 'emoji', 'placeholderText', 'emojiInputRule', 'emojiKeymap', 'emojiAsciiInputRule', 'blockType', 'quickInsert', 'tasksAndDecisions', 'blockTypeInputRule', 'tasksAndDecisionsInputRule', 'list', 'typeAheadKeymap', 'typeAheadInputRule', 'date',
5
+ // Needs to be before indentation to handle tab into input field
6
+ 'dateKeymap',
7
+ // This should be always after `typeAheadKeymap` & `emojiKeymap`
8
+ 'indentationKeymap', 'textColor', 'alignmentPlugin', 'listInputRule', 'listKeymap', 'codeBlock', 'codeBlockIDEKeyBindings', 'codeBlockKeyMap', 'textFormatting', 'textFormattingCursor', 'textFormattingInputRule', 'textFormattingSmartRule', 'textFormattingClear', 'textFormattingKeymap',
9
+ // task/decisions keymap needs to be above table keymap so can indent actions in a table
10
+ 'tasksAndDecisionsKeyMap',
11
+ // expand and table keymaps need to be above selection keymap to add their custom selection behaviour:
12
+ // https://product-fabric.atlassian.net/wiki/spaces/E/pages/1113098008/Selection+Guide#Special-Cases
13
+ 'expandKeymap', 'tableSelectionKeymap', 'tableKeymap', 'captionKeymap',
14
+ // media keymap above selection keymap to allow navigating past the mediaSingle node
15
+ 'mediaKeymap',
16
+ // selection keymap needs to be above gap cursor keymap so it can set node selections from
17
+ // left/right arrows
18
+ 'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
19
+ nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
20
+ marks: [
21
+ // Fragment mark is both for inline and block elements
22
+ 'fragment',
23
+ // Inline marks
24
+ 'link', 'em', 'strong', 'textColor', 'strike', 'subsup', 'underline', 'code', 'typeAheadQuery',
25
+ // Block marks
26
+ 'alignment', 'breakout', 'indentation', 'annotation', 'dataConsumer', 'border',
27
+ // Unsupported mark
28
+ 'unsupportedMark', 'unsupportedNodeAttribute']
29
+ };
30
+
31
+ // @depreacted
32
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
33
+ export function sortByOrder(item) {
34
+ return function (a, b) {
35
+ return rankEditorPlugins[item].indexOf(a.name) - rankEditorPlugins[item].indexOf(b.name);
36
+ };
37
+ }
38
+
39
+ // while functionally the same, in order to avoid potentially rewriting the ~10
40
+ // existing implementations of the above function I decided creating a separate
41
+ // function avoided that whole mess. If someone can think of a better way to implement
42
+ // the above and below into a single function please do so
43
+
44
+ // @depreacted
45
+ // @private This rank is not stable and should not be trusted. If you need to change this file, please let the Editor lego team know about it
46
+ export function sortByOrderWithTypeName(item) {
47
+ return function (a, b) {
48
+ return rankEditorPlugins[item].indexOf(a.type.name) - rankEditorPlugins[item].indexOf(b.type.name);
49
+ };
50
+ }
@@ -0,0 +1,42 @@
1
+ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
+ import { mapSlice } from '../utils/slice';
4
+ function joinCodeBlocks(left, right) {
5
+ var textContext = "".concat(left.textContent, "\n").concat(right.textContent);
6
+ return left.type.create(left.attrs, left.type.schema.text(textContext));
7
+ }
8
+ function mergeAdjacentCodeBlocks(fragment) {
9
+ var children = [];
10
+ fragment.forEach(function (maybeCodeBlock) {
11
+ if (maybeCodeBlock.type === maybeCodeBlock.type.schema.nodes.codeBlock) {
12
+ var peekAtPrevious = children[children.length - 1];
13
+ if (peekAtPrevious && peekAtPrevious.type === maybeCodeBlock.type) {
14
+ return children.push(joinCodeBlocks(children.pop(), maybeCodeBlock));
15
+ }
16
+ }
17
+ return children.push(maybeCodeBlock);
18
+ });
19
+ return Fragment.from(children);
20
+ }
21
+ export function transformSliceToJoinAdjacentCodeBlocks(slice) {
22
+ slice = mapSlice(slice, function (node) {
23
+ return node.isBlock && !node.isTextblock ? node.copy(mergeAdjacentCodeBlocks(node.content)) : node;
24
+ });
25
+ // mapSlice won't be able to merge adjacent top-level code-blocks
26
+ return new Slice(mergeAdjacentCodeBlocks(slice.content), slice.openStart, slice.openEnd);
27
+ }
28
+ export var transformSingleLineCodeBlockToCodeMark = function transformSingleLineCodeBlockToCodeMark(slice, schema) {
29
+ if (slice.content.childCount === 1 && (slice.openStart || slice.openEnd)) {
30
+ var maybeCodeBlock = slice.content.firstChild;
31
+ if (maybeCodeBlock && maybeCodeBlock.type === schema.nodes.codeBlock) {
32
+ if (maybeCodeBlock.textContent && maybeCodeBlock.textContent.indexOf('\n') === -1) {
33
+ return new Slice(Fragment.from(schema.text(maybeCodeBlock.textContent, [schema.marks.code.create()])), 0, 0);
34
+ }
35
+ }
36
+ }
37
+ return slice;
38
+ };
39
+ export var findCodeBlock = function findCodeBlock(state, selection) {
40
+ var codeBlock = state.schema.nodes.codeBlock;
41
+ return findSelectedNodeOfType(codeBlock)(selection || state.selection) || findParentNodeOfType(codeBlock)(selection || state.selection);
42
+ };
@@ -0,0 +1,11 @@
1
+ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
+ // If slice is decisionItem, wrap it inside a decisionList. This prevents an
3
+ // additional newline from being pasted along with the selected decision item.
4
+ export var transformSliceToDecisionList = function transformSliceToDecisionList(slice, schema) {
5
+ var node = slice.content.firstChild;
6
+ if (slice.content.childCount === 1 && node && node.type.name === 'decisionItem') {
7
+ var decisionListWrapperNode = schema.nodes.decisionList.create({}, node);
8
+ return new Slice(Fragment.from(decisionListWrapperNode), slice.openStart, slice.openEnd);
9
+ }
10
+ return slice;
11
+ };
@@ -1,3 +1,5 @@
1
1
  export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes } from './layout';
2
2
  export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand } from './expand';
3
- export { transformSliceToRemoveOpenBodiedExtension } from './extension';
3
+ export { transformSliceToRemoveOpenBodiedExtension } from './extension';
4
+ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock } from './code-block';
5
+ export { transformSliceToDecisionList } from './decision-list';
@@ -19,7 +19,7 @@ import { themed } from '@atlaskit/theme/components';
19
19
  import { borderRadius } from '@atlaskit/theme/constants';
20
20
  import Layer from '../Layer';
21
21
  var packageName = "@atlaskit/editor-common";
22
- var packageVersion = "76.12.1";
22
+ var packageVersion = "76.13.0";
23
23
  var halfFocusRing = 1;
24
24
  var dropOffset = '0, 8';
25
25
  var DropList = /*#__PURE__*/function (_Component) {
@@ -38,4 +38,38 @@ export var getAnnotationIdsFromRange = function getAnnotationIdsFromRange(rangeS
38
38
  return true;
39
39
  });
40
40
  return Array.from(annotations);
41
- };
41
+ };
42
+
43
+ /*
44
+ * verifies if node contains annotation mark
45
+ */
46
+ export function hasAnnotationMark(node, state) {
47
+ var annotationMark = state.schema.marks.annotation;
48
+ return !!(annotationMark && node && node.marks.length && annotationMark.isInSet(node.marks));
49
+ }
50
+
51
+ /*
52
+ * verifies that slice contains any annotations
53
+ */
54
+ export function containsAnyAnnotations(slice, state) {
55
+ if (!slice.content.size) {
56
+ return false;
57
+ }
58
+ var hasAnnotation = false;
59
+ slice.content.forEach(function (node) {
60
+ hasAnnotation = hasAnnotation || hasAnnotationMark(node, state);
61
+ // return early if annotation found already
62
+ if (hasAnnotation) {
63
+ return true;
64
+ }
65
+ // check annotations in descendants
66
+ node.descendants(function (node) {
67
+ if (hasAnnotationMark(node, state)) {
68
+ hasAnnotation = true;
69
+ return false;
70
+ }
71
+ return true;
72
+ });
73
+ });
74
+ return hasAnnotation;
75
+ }
@@ -1,7 +1,7 @@
1
1
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { hasDocAsParent } from './document';
3
3
  import { isEmptyParagraph } from './editor-core-utils';
4
- export { canApplyAnnotationOnRange, getAnnotationIdsFromRange } from './annotation';
4
+ export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark } from './annotation';
5
5
  export { getExtensionLozengeData } from './macro';
6
6
  export { default as browser } from './browser';
7
7
  export { default as ErrorReporter } from './error-reporter';
@@ -0,0 +1,19 @@
1
+ export declare const rankEditorPlugins: {
2
+ plugins: string[];
3
+ nodes: string[];
4
+ marks: string[];
5
+ };
6
+ export declare function sortByOrder(item: 'plugins' | 'nodes' | 'marks'): (a: {
7
+ name: string;
8
+ }, b: {
9
+ name: string;
10
+ }) => number;
11
+ export declare function sortByOrderWithTypeName(item: 'plugins' | 'nodes' | 'marks'): (a: {
12
+ type: {
13
+ name: string;
14
+ };
15
+ }, b: {
16
+ type: {
17
+ name: string;
18
+ };
19
+ }) => number;
@@ -0,0 +1,6 @@
1
+ import { Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
4
+ export declare function transformSliceToJoinAdjacentCodeBlocks(slice: Slice): Slice;
5
+ export declare const transformSingleLineCodeBlockToCodeMark: (slice: Slice, schema: Schema) => Slice;
6
+ export declare const findCodeBlock: (state: EditorState, selection?: Selection | null) => import("prosemirror-utils/dist/types").FindResult;
@@ -0,0 +1,3 @@
1
+ import { Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
+ export declare const transformSliceToDecisionList: (slice: Slice, schema: Schema) => Slice;
@@ -1,3 +1,5 @@
1
1
  export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes, } from './layout';
2
2
  export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand, } from './expand';
3
3
  export { transformSliceToRemoveOpenBodiedExtension } from './extension';
4
+ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock, } from './code-block';
5
+ export { transformSliceToDecisionList } from './decision-list';
@@ -1,6 +1,6 @@
1
- import { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
1
+ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { EditorContainerWidth } from '../../types';
3
+ import type { EditorContainerWidth } from '../../types';
4
4
  export declare const layoutSupportsWidth: (layout: MediaSingleLayout) => boolean;
5
5
  export declare function calcPxFromColumns(columns: number, lineLength: number, gridSize: number): number;
6
6
  export declare function calcColumnsFromPx(width: number, lineLength: number, gridSize: number): number;
@@ -1,8 +1,11 @@
1
- import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
3
  type Range = {
3
4
  from: number;
4
5
  to: number;
5
6
  };
6
7
  export declare const canApplyAnnotationOnRange: (rangeSelection: Range, doc: PMNode, schema: Schema) => boolean;
7
8
  export declare const getAnnotationIdsFromRange: (rangeSelection: Range, doc: PMNode, schema: Schema) => string[];
9
+ export declare function hasAnnotationMark(node: PMNode, state: EditorState): boolean;
10
+ export declare function containsAnyAnnotations(slice: Slice, state: EditorState): boolean;
8
11
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
- export { canApplyAnnotationOnRange, getAnnotationIdsFromRange, } from './annotation';
4
+ export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, } from './annotation';
5
5
  export { getExtensionLozengeData } from './macro';
6
6
  export type { Params } from './macro';
7
7
  export { default as browser } from './browser';
@@ -0,0 +1,19 @@
1
+ export declare const rankEditorPlugins: {
2
+ plugins: string[];
3
+ nodes: string[];
4
+ marks: string[];
5
+ };
6
+ export declare function sortByOrder(item: 'plugins' | 'nodes' | 'marks'): (a: {
7
+ name: string;
8
+ }, b: {
9
+ name: string;
10
+ }) => number;
11
+ export declare function sortByOrderWithTypeName(item: 'plugins' | 'nodes' | 'marks'): (a: {
12
+ type: {
13
+ name: string;
14
+ };
15
+ }, b: {
16
+ type: {
17
+ name: string;
18
+ };
19
+ }) => number;
@@ -0,0 +1,6 @@
1
+ import { Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
+ import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
4
+ export declare function transformSliceToJoinAdjacentCodeBlocks(slice: Slice): Slice;
5
+ export declare const transformSingleLineCodeBlockToCodeMark: (slice: Slice, schema: Schema) => Slice;
6
+ export declare const findCodeBlock: (state: EditorState, selection?: Selection | null) => import("prosemirror-utils/dist/types").FindResult;
@@ -0,0 +1,3 @@
1
+ import { Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
+ export declare const transformSliceToDecisionList: (slice: Slice, schema: Schema) => Slice;
@@ -1,3 +1,5 @@
1
1
  export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes, } from './layout';
2
2
  export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand, } from './expand';
3
3
  export { transformSliceToRemoveOpenBodiedExtension } from './extension';
4
+ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock, } from './code-block';
5
+ export { transformSliceToDecisionList } from './decision-list';
@@ -1,6 +1,6 @@
1
- import { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
1
+ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import { EditorContainerWidth } from '../../types';
3
+ import type { EditorContainerWidth } from '../../types';
4
4
  export declare const layoutSupportsWidth: (layout: MediaSingleLayout) => boolean;
5
5
  export declare function calcPxFromColumns(columns: number, lineLength: number, gridSize: number): number;
6
6
  export declare function calcColumnsFromPx(width: number, lineLength: number, gridSize: number): number;
@@ -1,8 +1,11 @@
1
- import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
+ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
2
3
  type Range = {
3
4
  from: number;
4
5
  to: number;
5
6
  };
6
7
  export declare const canApplyAnnotationOnRange: (rangeSelection: Range, doc: PMNode, schema: Schema) => boolean;
7
8
  export declare const getAnnotationIdsFromRange: (rangeSelection: Range, doc: PMNode, schema: Schema) => string[];
9
+ export declare function hasAnnotationMark(node: PMNode, state: EditorState): boolean;
10
+ export declare function containsAnyAnnotations(slice: Slice, state: EditorState): boolean;
8
11
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
- export { canApplyAnnotationOnRange, getAnnotationIdsFromRange, } from './annotation';
4
+ export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, hasAnnotationMark, } from './annotation';
5
5
  export { getExtensionLozengeData } from './macro';
6
6
  export type { Params } from './macro';
7
7
  export { default as browser } from './browser';
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/legacy-rank-plugins",
3
+ "main": "../dist/cjs/rank.js",
4
+ "module": "../dist/esm/rank.js",
5
+ "module:es2019": "../dist/es2019/rank.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/rank.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <4.9": {
10
+ "*": [
11
+ "../dist/types-ts4.5/rank.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "76.12.1",
3
+ "version": "76.13.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -81,7 +81,8 @@
81
81
  "./lists": "./src/lists/index.ts",
82
82
  "./element-browser": "./src/element-browser/index.ts",
83
83
  "./floating-toolbar": "./src/floating-toolbar/index.ts",
84
- "./copy-button": "./src/copy-button/index.ts"
84
+ "./copy-button": "./src/copy-button/index.ts",
85
+ "./legacy-rank-plugins": "./src/rank.ts"
85
86
  },
86
87
  "dependencies": {
87
88
  "@atlaskit/activity-provider": "^2.4.0",