@atlaskit/editor-common 113.0.0 → 113.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 113.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`bae5d569f660c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bae5d569f660c) -
8
+ Prevent flexible list creation when platform_editor_flexible_list_schema is on but
9
+ platform_editor_flexible_list_indentation is off. Slice normalisation in paste pipeline.
10
+ appendTransaction normaliser in list plugin.
11
+
12
+ Paste plugin detects list-into-list paste and sets a transaction meta to skip closeHistory,
13
+ keeping the paste and normalisation appendTransaction as a single undo step.
14
+
3
15
  ## 113.0.0
4
16
 
5
17
  ### Major Changes
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "112.22.0";
22
+ var packageVersion = "113.0.0";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -99,6 +99,12 @@ Object.defineProperty(exports, "transformSingleLineCodeBlockToCodeMark", {
99
99
  return _codeBlock.transformSingleLineCodeBlockToCodeMark;
100
100
  }
101
101
  });
102
+ Object.defineProperty(exports, "transformSliceEnsureListItemParagraphFirst", {
103
+ enumerable: true,
104
+ get: function get() {
105
+ return _listTransforms.transformSliceEnsureListItemParagraphFirst;
106
+ }
107
+ });
102
108
  Object.defineProperty(exports, "transformSliceExpandToNestedExpand", {
103
109
  enumerable: true,
104
110
  get: function get() {
@@ -4,12 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.transformToTaskList = exports.transformTaskListToBlockNodes = exports.transformListStructure = exports.transformListRecursively = exports.transformBetweenListTypes = exports.getFormattedNode = exports.createBlockTaskItem = void 0;
7
+ exports.transformToTaskList = exports.transformTaskListToBlockNodes = exports.transformSliceEnsureListItemParagraphFirst = exports.transformListStructure = exports.transformListRecursively = exports.transformBetweenListTypes = exports.getFormattedNode = exports.createBlockTaskItem = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _utils = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
+ var _slice2 = require("../utils/slice");
13
14
  var _listUtils = require("./list-utils");
14
15
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
15
16
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -436,4 +437,36 @@ var getFormattedNode = exports.getFormattedNode = function getFormattedNode(tr)
436
437
  node: nodeToFormat,
437
438
  pos: nodePos
438
439
  };
440
+ };
441
+
442
+ /**
443
+ * Ensures every `listItem` in a slice starts with a paragraph.
444
+ *
445
+ * @param slice - The slice to transform
446
+ * @param schema - The editor schema, used to create new paragraph nodes
447
+ * @returns A new slice with the transformation applied
448
+ */
449
+ var transformSliceEnsureListItemParagraphFirst = exports.transformSliceEnsureListItemParagraphFirst = function transformSliceEnsureListItemParagraphFirst(slice, schema) {
450
+ var _schema$nodes3 = schema.nodes,
451
+ listItem = _schema$nodes3.listItem,
452
+ paragraph = _schema$nodes3.paragraph;
453
+ if (!listItem || !paragraph) {
454
+ return slice;
455
+ }
456
+ return (0, _slice2.mapSlice)(slice, function (node) {
457
+ if (node.type === listItem) {
458
+ var firstChild = node.firstChild;
459
+ if (firstChild && firstChild.type !== paragraph) {
460
+ var emptyParagraph = paragraph.createAndFill();
461
+ if (emptyParagraph) {
462
+ var children = [emptyParagraph];
463
+ for (var i = 0; i < node.childCount; i++) {
464
+ children.push(node.child(i));
465
+ }
466
+ return node.copy(_model.Fragment.from(children));
467
+ }
468
+ }
469
+ }
470
+ return node;
471
+ });
439
472
  };
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "112.22.0";
27
+ var packageVersion = "113.0.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "112.22.0";
7
+ const packageVersion = "113.0.0";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -6,6 +6,6 @@ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpe
6
6
  export { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveLegacyContentMacro, transformSliceToRemoveMacroId } from './extension';
7
7
  export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock } from './code-block';
8
8
  export { transformSliceToDecisionList } from './decision-list';
9
- export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode } from './list-transforms';
9
+ export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, transformSliceEnsureListItemParagraphFirst } from './list-transforms';
10
10
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent } from './list-utils';
11
11
  export { removeBreakoutFromRendererSyncBlockHTML } from './sync-block';
@@ -1,6 +1,7 @@
1
1
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import { findChildrenByType, findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { mapSlice } from '../utils/slice';
4
5
  import { getSupportedListTypesSet, isBulletOrOrderedList, isTaskList, convertBlockToInlineContent } from './list-utils';
5
6
  const getContentSupportChecker = targetNodeType => {
6
7
  return node => {
@@ -429,4 +430,37 @@ export const getFormattedNode = tr => {
429
430
  node: nodeToFormat,
430
431
  pos: nodePos
431
432
  };
433
+ };
434
+
435
+ /**
436
+ * Ensures every `listItem` in a slice starts with a paragraph.
437
+ *
438
+ * @param slice - The slice to transform
439
+ * @param schema - The editor schema, used to create new paragraph nodes
440
+ * @returns A new slice with the transformation applied
441
+ */
442
+ export const transformSliceEnsureListItemParagraphFirst = (slice, schema) => {
443
+ const {
444
+ listItem,
445
+ paragraph
446
+ } = schema.nodes;
447
+ if (!listItem || !paragraph) {
448
+ return slice;
449
+ }
450
+ return mapSlice(slice, node => {
451
+ if (node.type === listItem) {
452
+ const firstChild = node.firstChild;
453
+ if (firstChild && firstChild.type !== paragraph) {
454
+ const emptyParagraph = paragraph.createAndFill();
455
+ if (emptyParagraph) {
456
+ const children = [emptyParagraph];
457
+ for (let i = 0; i < node.childCount; i++) {
458
+ children.push(node.child(i));
459
+ }
460
+ return node.copy(Fragment.from(children));
461
+ }
462
+ }
463
+ }
464
+ return node;
465
+ });
432
466
  };
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "112.22.0";
17
+ const packageVersion = "113.0.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "112.22.0";
13
+ var packageVersion = "113.0.0";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -6,6 +6,6 @@ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpe
6
6
  export { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveLegacyContentMacro, transformSliceToRemoveMacroId } from './extension';
7
7
  export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock } from './code-block';
8
8
  export { transformSliceToDecisionList } from './decision-list';
9
- export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode } from './list-transforms';
9
+ export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, transformSliceEnsureListItemParagraphFirst } from './list-transforms';
10
10
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent } from './list-utils';
11
11
  export { removeBreakoutFromRendererSyncBlockHTML } from './sync-block';
@@ -8,6 +8,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
8
8
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
9
9
  import { findChildrenByType, findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
+ import { mapSlice } from '../utils/slice';
11
12
  import { getSupportedListTypesSet, isBulletOrOrderedList, isTaskList, convertBlockToInlineContent } from './list-utils';
12
13
  var getContentSupportChecker = function getContentSupportChecker(targetNodeType) {
13
14
  return function (node) {
@@ -430,4 +431,36 @@ export var getFormattedNode = function getFormattedNode(tr) {
430
431
  node: nodeToFormat,
431
432
  pos: nodePos
432
433
  };
434
+ };
435
+
436
+ /**
437
+ * Ensures every `listItem` in a slice starts with a paragraph.
438
+ *
439
+ * @param slice - The slice to transform
440
+ * @param schema - The editor schema, used to create new paragraph nodes
441
+ * @returns A new slice with the transformation applied
442
+ */
443
+ export var transformSliceEnsureListItemParagraphFirst = function transformSliceEnsureListItemParagraphFirst(slice, schema) {
444
+ var _schema$nodes3 = schema.nodes,
445
+ listItem = _schema$nodes3.listItem,
446
+ paragraph = _schema$nodes3.paragraph;
447
+ if (!listItem || !paragraph) {
448
+ return slice;
449
+ }
450
+ return mapSlice(slice, function (node) {
451
+ if (node.type === listItem) {
452
+ var firstChild = node.firstChild;
453
+ if (firstChild && firstChild.type !== paragraph) {
454
+ var emptyParagraph = paragraph.createAndFill();
455
+ if (emptyParagraph) {
456
+ var children = [emptyParagraph];
457
+ for (var i = 0; i < node.childCount; i++) {
458
+ children.push(node.child(i));
459
+ }
460
+ return node.copy(Fragment.from(children));
461
+ }
462
+ }
463
+ }
464
+ return node;
465
+ });
433
466
  };
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "112.22.0";
24
+ var packageVersion = "113.0.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -3,7 +3,7 @@ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpe
3
3
  export { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveLegacyContentMacro, transformSliceToRemoveMacroId, } from './extension';
4
4
  export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock, } from './code-block';
5
5
  export { transformSliceToDecisionList } from './decision-list';
6
- export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, } from './list-transforms';
6
+ export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, transformSliceEnsureListItemParagraphFirst, } from './list-transforms';
7
7
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent, } from './list-utils';
8
8
  export { removeBreakoutFromRendererSyncBlockHTML } from './sync-block';
9
9
  export type { TransformContext, TransformFunction } from './list-types';
@@ -1,5 +1,5 @@
1
1
  import type { Mark, NodeType, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
+ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { TransformContext } from './list-types';
5
5
  type TransformListRecursivelyProps = {
@@ -40,4 +40,12 @@ export declare const getFormattedNode: (tr: Transaction) => {
40
40
  node: PMNode;
41
41
  pos: number;
42
42
  };
43
+ /**
44
+ * Ensures every `listItem` in a slice starts with a paragraph.
45
+ *
46
+ * @param slice - The slice to transform
47
+ * @param schema - The editor schema, used to create new paragraph nodes
48
+ * @returns A new slice with the transformation applied
49
+ */
50
+ export declare const transformSliceEnsureListItemParagraphFirst: (slice: Slice, schema: Schema) => Slice;
43
51
  export {};
@@ -3,7 +3,7 @@ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpe
3
3
  export { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveLegacyContentMacro, transformSliceToRemoveMacroId, } from './extension';
4
4
  export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, findCodeBlock, } from './code-block';
5
5
  export { transformSliceToDecisionList } from './decision-list';
6
- export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, } from './list-transforms';
6
+ export { createBlockTaskItem, transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, transformSliceEnsureListItemParagraphFirst, } from './list-transforms';
7
7
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent, } from './list-utils';
8
8
  export { removeBreakoutFromRendererSyncBlockHTML } from './sync-block';
9
9
  export type { TransformContext, TransformFunction } from './list-types';
@@ -1,5 +1,5 @@
1
1
  import type { Mark, NodeType, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
+ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { TransformContext } from './list-types';
5
5
  type TransformListRecursivelyProps = {
@@ -40,4 +40,12 @@ export declare const getFormattedNode: (tr: Transaction) => {
40
40
  node: PMNode;
41
41
  pos: number;
42
42
  };
43
+ /**
44
+ * Ensures every `listItem` in a slice starts with a paragraph.
45
+ *
46
+ * @param slice - The slice to transform
47
+ * @param schema - The editor schema, used to create new paragraph nodes
48
+ * @returns A new slice with the transformation applied
49
+ */
50
+ export declare const transformSliceEnsureListItemParagraphFirst: (slice: Slice, schema: Schema) => Slice;
43
51
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "113.0.0",
3
+ "version": "113.0.1",
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/"