@atlaskit/editor-common 110.31.0 → 110.31.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,13 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 110.31.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b14a5fc14cf22`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b14a5fc14cf22) -
8
+ [ux] EDITOR-2606 copy sync block from renderer should flatten out content instead of creating new
9
+ reference
10
+
3
11
  ## 110.31.0
4
12
 
5
13
  ### Minor Changes
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  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); }
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 = "110.30.2";
19
+ var packageVersion = "0.0.0-development";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // Ignored via go/ees007
@@ -153,16 +153,16 @@ Object.defineProperty(exports, "transformSliceToRemoveOpenNestedExpand", {
153
153
  return _expand.transformSliceToRemoveOpenNestedExpand;
154
154
  }
155
155
  });
156
- Object.defineProperty(exports, "transformTaskListToBlockNodes", {
156
+ Object.defineProperty(exports, "transformSyncBlock", {
157
157
  enumerable: true,
158
158
  get: function get() {
159
- return _listTransforms.transformTaskListToBlockNodes;
159
+ return _syncBlock.transformSyncBlock;
160
160
  }
161
161
  });
162
- Object.defineProperty(exports, "transformToNewReferenceSyncBlock", {
162
+ Object.defineProperty(exports, "transformTaskListToBlockNodes", {
163
163
  enumerable: true,
164
164
  get: function get() {
165
- return _syncBlock.transformToNewReferenceSyncBlock;
165
+ return _listTransforms.transformTaskListToBlockNodes;
166
166
  }
167
167
  });
168
168
  Object.defineProperty(exports, "transformToTaskList", {
@@ -4,34 +4,56 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.transformToNewReferenceSyncBlock = void 0;
7
+ exports.transformSyncBlock = 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 _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _slice = require("../utils/slice");
12
12
  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; }
13
13
  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; }
14
- var transformToNewReferenceSyncBlock = exports.transformToNewReferenceSyncBlock = function transformToNewReferenceSyncBlock(slice, schema) {
14
+ var transformSyncBlockNode = function transformSyncBlockNode(node, schema, isFromEditor) {
15
+ // if copying from renderer, flatten out the content and remove the sync block
16
+ if (!isFromEditor) {
17
+ return node.content;
18
+ }
19
+
20
+ // sync blocks need a unique localId to function correctly
21
+ var newAttrs = _objectSpread(_objectSpread({}, node.attrs), {}, {
22
+ localId: _adfSchema.uuid.generate()
23
+ });
24
+ return schema.nodes.syncBlock.create(newAttrs, null, (0, _toConsumableArray2.default)(node.marks));
25
+ };
26
+ var transformBodiedSyncBlockNode = function transformBodiedSyncBlockNode(node, schema, isFromEditor) {
27
+ // if copying from renderer, flatten out the content and remove the bodied sync block
28
+ if (!isFromEditor) {
29
+ return node.content;
30
+ }
31
+
32
+ // bodied sync blocks need a unique localId and convert to a reference sync block
33
+ // when converting we want to be specific about attributes and marks we carry over
34
+ var newAttrs = {
35
+ resourceId: node.attrs.resourceId,
36
+ localId: _adfSchema.uuid.generate()
37
+ };
38
+ var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
39
+ var _schema$nodes$syncBlo;
40
+ return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
41
+ }) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
42
+
43
+ return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
44
+ };
45
+
46
+ /**
47
+ * If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
48
+ * Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
49
+ */
50
+ var transformSyncBlock = exports.transformSyncBlock = function transformSyncBlock(slice, schema, pasteSource) {
51
+ var isFromEditor = pasteSource === 'fabric-editor';
15
52
  slice = (0, _slice.mapSlice)(slice, function (node) {
16
- // sync blocks need a unique localId to function correctly
17
53
  if (node.type === schema.nodes.syncBlock) {
18
- var newAttrs = _objectSpread(_objectSpread({}, node.attrs), {}, {
19
- localId: _adfSchema.uuid.generate()
20
- });
21
- return schema.nodes.syncBlock.create(newAttrs, null, (0, _toConsumableArray2.default)(node.marks));
54
+ return transformSyncBlockNode(node, schema, isFromEditor);
22
55
  } else if (node.type === schema.nodes.bodiedSyncBlock) {
23
- // bodied sync blocks need a unique localId and convert to a reference sync block
24
- // when converting we want to be specific about attributes and marks we carry over
25
- var _newAttrs = {
26
- resourceId: node.attrs.resourceId,
27
- localId: _adfSchema.uuid.generate()
28
- };
29
- var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
30
- var _schema$nodes$syncBlo;
31
- return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
32
- }) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
33
-
34
- return schema.nodes.syncBlock.create(_newAttrs, null, newMarks);
56
+ return transformBodiedSyncBlockNode(node, schema, isFromEditor);
35
57
  }
36
58
  return node;
37
59
  });
@@ -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 = "110.30.2";
27
+ var packageVersion = "0.0.0-development";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "110.30.2";
4
+ const packageVersion = "0.0.0-development";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -8,4 +8,4 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
8
8
  export { transformSliceToDecisionList } from './decision-list';
9
9
  export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode } from './list-transforms';
10
10
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent } from './list-utils';
11
- export { transformToNewReferenceSyncBlock } from './sync-block';
11
+ export { transformSyncBlock } from './sync-block';
@@ -1,27 +1,49 @@
1
1
  import { uuid } from '@atlaskit/adf-schema';
2
2
  import { mapSlice } from '../utils/slice';
3
- export const transformToNewReferenceSyncBlock = (slice, schema) => {
3
+ const transformSyncBlockNode = (node, schema, isFromEditor) => {
4
+ // if copying from renderer, flatten out the content and remove the sync block
5
+ if (!isFromEditor) {
6
+ return node.content;
7
+ }
8
+
9
+ // sync blocks need a unique localId to function correctly
10
+ const newAttrs = {
11
+ ...node.attrs,
12
+ localId: uuid.generate()
13
+ };
14
+ return schema.nodes.syncBlock.create(newAttrs, null, [...node.marks]);
15
+ };
16
+ const transformBodiedSyncBlockNode = (node, schema, isFromEditor) => {
17
+ // if copying from renderer, flatten out the content and remove the bodied sync block
18
+ if (!isFromEditor) {
19
+ return node.content;
20
+ }
21
+
22
+ // bodied sync blocks need a unique localId and convert to a reference sync block
23
+ // when converting we want to be specific about attributes and marks we carry over
24
+ const newAttrs = {
25
+ resourceId: node.attrs.resourceId,
26
+ localId: uuid.generate()
27
+ };
28
+ const newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(mark => {
29
+ var _schema$nodes$syncBlo;
30
+ return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
31
+ }) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
32
+
33
+ return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
34
+ };
35
+
36
+ /**
37
+ * If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
38
+ * Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
39
+ */
40
+ export const transformSyncBlock = (slice, schema, pasteSource) => {
41
+ const isFromEditor = pasteSource === 'fabric-editor';
4
42
  slice = mapSlice(slice, node => {
5
- // sync blocks need a unique localId to function correctly
6
43
  if (node.type === schema.nodes.syncBlock) {
7
- const newAttrs = {
8
- ...node.attrs,
9
- localId: uuid.generate()
10
- };
11
- return schema.nodes.syncBlock.create(newAttrs, null, [...node.marks]);
44
+ return transformSyncBlockNode(node, schema, isFromEditor);
12
45
  } else if (node.type === schema.nodes.bodiedSyncBlock) {
13
- // bodied sync blocks need a unique localId and convert to a reference sync block
14
- // when converting we want to be specific about attributes and marks we carry over
15
- const newAttrs = {
16
- resourceId: node.attrs.resourceId,
17
- localId: uuid.generate()
18
- };
19
- const newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(mark => {
20
- var _schema$nodes$syncBlo;
21
- return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
22
- }) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
23
-
24
- return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
46
+ return transformBodiedSyncBlockNode(node, schema, isFromEditor);
25
47
  }
26
48
  return node;
27
49
  });
@@ -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 = "110.30.2";
17
+ const packageVersion = "0.0.0-development";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "110.30.2";
10
+ var packageVersion = "0.0.0-development";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -8,4 +8,4 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
8
8
  export { transformSliceToDecisionList } from './decision-list';
9
9
  export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode } from './list-transforms';
10
10
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent } from './list-utils';
11
- export { transformToNewReferenceSyncBlock } from './sync-block';
11
+ export { transformSyncBlock } from './sync-block';
@@ -4,27 +4,49 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import { uuid } from '@atlaskit/adf-schema';
6
6
  import { mapSlice } from '../utils/slice';
7
- export var transformToNewReferenceSyncBlock = function transformToNewReferenceSyncBlock(slice, schema) {
7
+ var transformSyncBlockNode = function transformSyncBlockNode(node, schema, isFromEditor) {
8
+ // if copying from renderer, flatten out the content and remove the sync block
9
+ if (!isFromEditor) {
10
+ return node.content;
11
+ }
12
+
13
+ // sync blocks need a unique localId to function correctly
14
+ var newAttrs = _objectSpread(_objectSpread({}, node.attrs), {}, {
15
+ localId: uuid.generate()
16
+ });
17
+ return schema.nodes.syncBlock.create(newAttrs, null, _toConsumableArray(node.marks));
18
+ };
19
+ var transformBodiedSyncBlockNode = function transformBodiedSyncBlockNode(node, schema, isFromEditor) {
20
+ // if copying from renderer, flatten out the content and remove the bodied sync block
21
+ if (!isFromEditor) {
22
+ return node.content;
23
+ }
24
+
25
+ // bodied sync blocks need a unique localId and convert to a reference sync block
26
+ // when converting we want to be specific about attributes and marks we carry over
27
+ var newAttrs = {
28
+ resourceId: node.attrs.resourceId,
29
+ localId: uuid.generate()
30
+ };
31
+ var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
32
+ var _schema$nodes$syncBlo;
33
+ return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
34
+ }) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
35
+
36
+ return schema.nodes.syncBlock.create(newAttrs, null, newMarks);
37
+ };
38
+
39
+ /**
40
+ * If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
41
+ * Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
42
+ */
43
+ export var transformSyncBlock = function transformSyncBlock(slice, schema, pasteSource) {
44
+ var isFromEditor = pasteSource === 'fabric-editor';
8
45
  slice = mapSlice(slice, function (node) {
9
- // sync blocks need a unique localId to function correctly
10
46
  if (node.type === schema.nodes.syncBlock) {
11
- var newAttrs = _objectSpread(_objectSpread({}, node.attrs), {}, {
12
- localId: uuid.generate()
13
- });
14
- return schema.nodes.syncBlock.create(newAttrs, null, _toConsumableArray(node.marks));
47
+ return transformSyncBlockNode(node, schema, isFromEditor);
15
48
  } else if (node.type === schema.nodes.bodiedSyncBlock) {
16
- // bodied sync blocks need a unique localId and convert to a reference sync block
17
- // when converting we want to be specific about attributes and marks we carry over
18
- var _newAttrs = {
19
- resourceId: node.attrs.resourceId,
20
- localId: uuid.generate()
21
- };
22
- var newMarks = schema.nodes.syncBlock.markSet ? node.marks.filter(function (mark) {
23
- var _schema$nodes$syncBlo;
24
- return (_schema$nodes$syncBlo = schema.nodes.syncBlock.markSet) === null || _schema$nodes$syncBlo === void 0 ? void 0 : _schema$nodes$syncBlo.includes(mark.type);
25
- }) : node.marks; // schema.nodes.syncBlock.markSet is null meaning all marks are allowed
26
-
27
- return schema.nodes.syncBlock.create(_newAttrs, null, newMarks);
49
+ return transformBodiedSyncBlockNode(node, schema, isFromEditor);
28
50
  }
29
51
  return node;
30
52
  });
@@ -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 = "110.30.2";
24
+ var packageVersion = "0.0.0-development";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -5,5 +5,5 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
5
5
  export { transformSliceToDecisionList } from './decision-list';
6
6
  export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, } from './list-transforms';
7
7
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent, } from './list-utils';
8
- export { transformToNewReferenceSyncBlock } from './sync-block';
8
+ export { transformSyncBlock } from './sync-block';
9
9
  export type { TransformContext, TransformFunction } from './list-types';
@@ -1,2 +1,7 @@
1
1
  import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
- export declare const transformToNewReferenceSyncBlock: (slice: Slice, schema: Schema) => Slice;
2
+ import type { PasteSource } from '../analytics';
3
+ /**
4
+ * If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
5
+ * Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
6
+ */
7
+ export declare const transformSyncBlock: (slice: Slice, schema: Schema, pasteSource: PasteSource) => Slice;
@@ -5,5 +5,5 @@ export { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToC
5
5
  export { transformSliceToDecisionList } from './decision-list';
6
6
  export { transformListStructure, transformBetweenListTypes, transformListRecursively, transformToTaskList, transformTaskListToBlockNodes, getFormattedNode, } from './list-transforms';
7
7
  export { isBulletOrOrderedList, isTaskList, getSupportedListTypesSet, convertBlockToInlineContent, } from './list-utils';
8
- export { transformToNewReferenceSyncBlock } from './sync-block';
8
+ export { transformSyncBlock } from './sync-block';
9
9
  export type { TransformContext, TransformFunction } from './list-types';
@@ -1,2 +1,7 @@
1
1
  import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
- export declare const transformToNewReferenceSyncBlock: (slice: Slice, schema: Schema) => Slice;
2
+ import type { PasteSource } from '../analytics';
3
+ /**
4
+ * If we are copying from editor, transform the copied source or reference sync block to a new reference sync block
5
+ * Otherwise, (e.g. if copying from renderer), flatten out the content and remove the sync block
6
+ */
7
+ export declare const transformSyncBlock: (slice: Slice, schema: Schema, pasteSource: PasteSource) => Slice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "110.31.0",
3
+ "version": "110.31.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/"
@@ -84,7 +84,7 @@
84
84
  "@atlaskit/theme": "^21.0.0",
85
85
  "@atlaskit/tmp-editor-statsig": "^13.38.0",
86
86
  "@atlaskit/tokens": "^8.0.0",
87
- "@atlaskit/tooltip": "^20.8.0",
87
+ "@atlaskit/tooltip": "^20.9.0",
88
88
  "@atlaskit/ufo": "^0.4.0",
89
89
  "@atlaskit/width-detector": "^5.0.0",
90
90
  "@babel/runtime": "^7.0.0",