@atlaskit/editor-common 86.4.0 → 86.4.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,15 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 86.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#122612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122612)
8
+ [`01a85ce0a88ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01a85ce0a88ec) -
9
+ [ux] ED-23705 Add logic to handle annotations on inline nodes when they are inserted or pasted.
10
+ Covers the following inline nodes: emoji, status, mention, date, inlineCard
11
+ - Updated dependencies
12
+
3
13
  ## 86.4.0
4
14
 
5
15
  ### Minor Changes
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "86.4.0";
20
+ var packageVersion = "86.4.1";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "86.4.0";
26
+ var packageVersion = "86.4.1";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  var DropList = /*#__PURE__*/function (_Component) {
@@ -8,6 +8,7 @@ exports.canApplyAnnotationOnRange = void 0;
8
8
  exports.containsAnyAnnotations = containsAnyAnnotations;
9
9
  exports.getAnnotationIdsFromRange = void 0;
10
10
  exports.getAnnotationInlineNodeTypes = getAnnotationInlineNodeTypes;
11
+ exports.getAnnotationMarksForPos = getAnnotationMarksForPos;
11
12
  exports.getRangeInlineNodeNames = getRangeInlineNodeNames;
12
13
  exports.hasAnnotationMark = hasAnnotationMark;
13
14
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -152,4 +153,18 @@ function getAnnotationInlineNodeTypes(state, annotationId) {
152
153
 
153
154
  // This sorting is done to make human consumption easier (ie. in dev tools, test snapshots, analytics events, ...)
154
155
  return (0, _toConsumableArray2.default)(inlineNodeNames).sort();
156
+ }
157
+
158
+ /*
159
+ Get the annotations marks from the given position and add them to the original marks array if they exist.
160
+ Used with the creation of the inline nodes: emoji, status, dates, mentions & inlineCards.
161
+ */
162
+ function getAnnotationMarksForPos(pos) {
163
+ if (!(0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes')) {
164
+ return undefined;
165
+ }
166
+ var annotationMarks = pos.marks().filter(function (mark) {
167
+ return mark.type === pos.doc.type.schema.marks.annotation;
168
+ });
169
+ return annotationMarks;
155
170
  }
@@ -408,6 +408,12 @@ Object.defineProperty(exports, "getAnnotationInlineNodeTypes", {
408
408
  return _annotation.getAnnotationInlineNodeTypes;
409
409
  }
410
410
  });
411
+ Object.defineProperty(exports, "getAnnotationMarksForPos", {
412
+ enumerable: true,
413
+ get: function get() {
414
+ return _annotation.getAnnotationMarksForPos;
415
+ }
416
+ });
411
417
  Object.defineProperty(exports, "getChangedNodes", {
412
418
  enumerable: true,
413
419
  get: function get() {
@@ -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 = "86.4.0";
4
+ const packageVersion = "86.4.1";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -12,7 +12,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
12
12
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
13
13
  import Layer from '../Layer';
14
14
  const packageName = "@atlaskit/editor-common";
15
- const packageVersion = "86.4.0";
15
+ const packageVersion = "86.4.1";
16
16
  const halfFocusRing = 1;
17
17
  const dropOffset = '0, 8';
18
18
  class DropList extends Component {
@@ -150,4 +150,16 @@ export function getAnnotationInlineNodeTypes(state, annotationId) {
150
150
 
151
151
  // This sorting is done to make human consumption easier (ie. in dev tools, test snapshots, analytics events, ...)
152
152
  return [...inlineNodeNames].sort();
153
+ }
154
+
155
+ /*
156
+ Get the annotations marks from the given position and add them to the original marks array if they exist.
157
+ Used with the creation of the inline nodes: emoji, status, dates, mentions & inlineCards.
158
+ */
159
+ export function getAnnotationMarksForPos(pos) {
160
+ if (!fg('editor_inline_comments_paste_insert_nodes')) {
161
+ return undefined;
162
+ }
163
+ const annotationMarks = pos.marks().filter(mark => mark.type === pos.doc.type.schema.marks.annotation);
164
+ return annotationMarks;
153
165
  }
@@ -2,7 +2,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { hasDocAsParent } from './document';
3
3
  import { isEmptyParagraph } from './editor-core-utils';
4
4
  export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
5
- export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export { default as browser } from './browser';
8
8
  export { default as ErrorReporter } from './error-reporter';
@@ -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 = "86.4.0";
10
+ var packageVersion = "86.4.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -20,7 +20,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
20
20
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "86.4.0";
23
+ var packageVersion = "86.4.1";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -140,4 +140,18 @@ export function getAnnotationInlineNodeTypes(state, annotationId) {
140
140
 
141
141
  // This sorting is done to make human consumption easier (ie. in dev tools, test snapshots, analytics events, ...)
142
142
  return _toConsumableArray(inlineNodeNames).sort();
143
+ }
144
+
145
+ /*
146
+ Get the annotations marks from the given position and add them to the original marks array if they exist.
147
+ Used with the creation of the inline nodes: emoji, status, dates, mentions & inlineCards.
148
+ */
149
+ export function getAnnotationMarksForPos(pos) {
150
+ if (!fg('editor_inline_comments_paste_insert_nodes')) {
151
+ return undefined;
152
+ }
153
+ var annotationMarks = pos.marks().filter(function (mark) {
154
+ return mark.type === pos.doc.type.schema.marks.annotation;
155
+ });
156
+ return annotationMarks;
143
157
  }
@@ -2,7 +2,7 @@ import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
2
  import { hasDocAsParent } from './document';
3
3
  import { isEmptyParagraph } from './editor-core-utils';
4
4
  export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
5
- export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export { default as browser } from './browser';
8
8
  export { default as ErrorReporter } from './error-reporter';
@@ -1,4 +1,4 @@
1
- import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Mark, Node as PMNode, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  type Range = {
4
4
  from: number;
@@ -30,4 +30,5 @@ export declare function getAnnotationInlineNodeTypes(state: {
30
30
  doc: PMNode;
31
31
  schema: Schema;
32
32
  }, annotationId: string): string[] | undefined;
33
+ export declare function getAnnotationMarksForPos(pos: ResolvedPos): Mark[] | undefined;
33
34
  export {};
@@ -2,7 +2,7 @@ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prose
2
2
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
4
  export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
5
- export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export type { Params } from './macro';
8
8
  export { default as browser } from './browser';
@@ -1,4 +1,4 @@
1
- import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
1
+ import type { Mark, Node as PMNode, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  type Range = {
4
4
  from: number;
@@ -30,4 +30,5 @@ export declare function getAnnotationInlineNodeTypes(state: {
30
30
  doc: PMNode;
31
31
  schema: Schema;
32
32
  }, annotationId: string): string[] | undefined;
33
+ export declare function getAnnotationMarksForPos(pos: ResolvedPos): Mark[] | undefined;
33
34
  export {};
@@ -2,7 +2,7 @@ import type { Node as PMNode, ResolvedPos, Schema } from '@atlaskit/editor-prose
2
2
  import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
4
4
  export { shouldAutoLinkifyMatch } from './should-auto-linkify-tld';
5
- export { canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
5
+ export { getAnnotationMarksForPos, canApplyAnnotationOnRange, containsAnyAnnotations, getAnnotationIdsFromRange, getAnnotationInlineNodeTypes, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
6
6
  export { getExtensionLozengeData } from './macro';
7
7
  export type { Params } from './macro';
8
8
  export { default as browser } from './browser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "86.4.0",
3
+ "version": "86.4.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/"
@@ -115,7 +115,7 @@
115
115
  "@atlaskit/editor-shared-styles": "^2.13.0",
116
116
  "@atlaskit/editor-tables": "^2.7.0",
117
117
  "@atlaskit/emoji": "^67.6.0",
118
- "@atlaskit/icon": "^22.6.0",
118
+ "@atlaskit/icon": "^22.7.0",
119
119
  "@atlaskit/icon-object": "^6.4.0",
120
120
  "@atlaskit/link-datasource": "^2.5.0",
121
121
  "@atlaskit/link-picker": "^1.39.0",
@@ -262,6 +262,9 @@
262
262
  },
263
263
  "react_18_color_picker_concurrent_mode": {
264
264
  "type": "boolean"
265
+ },
266
+ "editor_inline_comments_paste_insert_nodes": {
267
+ "type": "boolean"
265
268
  }
266
269
  }
267
270
  }