@atlaskit/editor-common 82.10.0 → 82.11.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,19 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 82.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 82.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#112275](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112275)
14
+ [`6f3058e0347a3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6f3058e0347a3) -
15
+ ED-23734 - add `getInlineNodeTypes` function to `InlineCommentViewComponentProps`
16
+
3
17
  ## 82.10.0
4
18
 
5
19
  ### 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 = "82.10.0";
20
+ var packageVersion = "82.11.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
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
20
20
  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); }; }
21
21
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "82.10.0";
23
+ var packageVersion = "82.11.1";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -7,9 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.canApplyAnnotationOnRange = void 0;
8
8
  exports.containsAnyAnnotations = containsAnyAnnotations;
9
9
  exports.getAnnotationIdsFromRange = void 0;
10
+ exports.getAnnotationInlineNodeTypes = getAnnotationInlineNodeTypes;
10
11
  exports.getRangeInlineNodeNames = getRangeInlineNodeNames;
11
12
  exports.hasAnnotationMark = hasAnnotationMark;
12
13
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
14
+ var _adfSchema = require("@atlaskit/adf-schema");
13
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
16
  var canApplyAnnotationOnRange = exports.canApplyAnnotationOnRange = function canApplyAnnotationOnRange(rangeSelection, doc, schema) {
15
17
  var from = rangeSelection.from,
@@ -122,4 +124,32 @@ function getRangeInlineNodeNames(_ref) {
122
124
  // We sort the list alphabetically to make human consumption of the list easier (in tools like the analytics extension)
123
125
  var sortedNames = (0, _toConsumableArray2.default)(nodeNames).sort();
124
126
  return sortedNames;
127
+ }
128
+
129
+ /**
130
+ * This function returns a list of node types that are wrapped by an annotation mark.
131
+ *
132
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
133
+ *
134
+ * @todo: Do not forget to remove `undefined` when the
135
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
136
+ */
137
+ function getAnnotationInlineNodeTypes(state, annotationId) {
138
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
139
+ return undefined;
140
+ }
141
+ var mark = state.schema.marks.annotation.create({
142
+ id: annotationId,
143
+ annotationType: _adfSchema.AnnotationTypes.INLINE_COMMENT
144
+ });
145
+ var inlineNodeNames = new Set();
146
+ state.doc.descendants(function (node, pos) {
147
+ if (mark.isInSet(node.marks)) {
148
+ inlineNodeNames.add(node.type.name);
149
+ }
150
+ return true;
151
+ });
152
+
153
+ // This sorting is done to make human consumption easier (ie. in dev tools, test snapshots, analytics events, ...)
154
+ return (0, _toConsumableArray2.default)(inlineNodeNames).sort();
125
155
  }
@@ -402,6 +402,12 @@ Object.defineProperty(exports, "getAnnotationIdsFromRange", {
402
402
  return _annotation.getAnnotationIdsFromRange;
403
403
  }
404
404
  });
405
+ Object.defineProperty(exports, "getAnnotationInlineNodeTypes", {
406
+ enumerable: true,
407
+ get: function get() {
408
+ return _annotation.getAnnotationInlineNodeTypes;
409
+ }
410
+ });
405
411
  Object.defineProperty(exports, "getChangedNodes", {
406
412
  enumerable: true,
407
413
  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 = "82.10.0";
4
+ const packageVersion = "82.11.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
@@ -9,7 +9,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
9
9
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
10
10
  import Layer from '../Layer';
11
11
  const packageName = "@atlaskit/editor-common";
12
- const packageVersion = "82.10.0";
12
+ const packageVersion = "82.11.1";
13
13
  const halfFocusRing = 1;
14
14
  const dropOffset = '0, 8';
15
15
  class DropList extends Component {
@@ -1,3 +1,4 @@
1
+ import { AnnotationTypes } from '@atlaskit/adf-schema';
1
2
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
3
  export const canApplyAnnotationOnRange = (rangeSelection, doc, schema) => {
3
4
  const {
@@ -123,4 +124,32 @@ export function getRangeInlineNodeNames({
123
124
  // We sort the list alphabetically to make human consumption of the list easier (in tools like the analytics extension)
124
125
  const sortedNames = [...nodeNames].sort();
125
126
  return sortedNames;
127
+ }
128
+
129
+ /**
130
+ * This function returns a list of node types that are wrapped by an annotation mark.
131
+ *
132
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
133
+ *
134
+ * @todo: Do not forget to remove `undefined` when the
135
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
136
+ */
137
+ export function getAnnotationInlineNodeTypes(state, annotationId) {
138
+ if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
139
+ return undefined;
140
+ }
141
+ const mark = state.schema.marks.annotation.create({
142
+ id: annotationId,
143
+ annotationType: AnnotationTypes.INLINE_COMMENT
144
+ });
145
+ const inlineNodeNames = new Set();
146
+ state.doc.descendants((node, pos) => {
147
+ if (mark.isInSet(node.marks)) {
148
+ inlineNodeNames.add(node.type.name);
149
+ }
150
+ return true;
151
+ });
152
+
153
+ // This sorting is done to make human consumption easier (ie. in dev tools, test snapshots, analytics events, ...)
154
+ return [...inlineNodeNames].sort();
126
155
  }
@@ -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, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
5
+ export { 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 = "82.10.0";
10
+ var packageVersion = "82.11.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
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "82.10.0";
20
+ var packageVersion = "82.11.1";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,4 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { AnnotationTypes } from '@atlaskit/adf-schema';
2
3
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  export var canApplyAnnotationOnRange = function canApplyAnnotationOnRange(rangeSelection, doc, schema) {
4
5
  var from = rangeSelection.from,
@@ -111,4 +112,32 @@ export function getRangeInlineNodeNames(_ref) {
111
112
  // We sort the list alphabetically to make human consumption of the list easier (in tools like the analytics extension)
112
113
  var sortedNames = _toConsumableArray(nodeNames).sort();
113
114
  return sortedNames;
115
+ }
116
+
117
+ /**
118
+ * This function returns a list of node types that are wrapped by an annotation mark.
119
+ *
120
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
121
+ *
122
+ * @todo: Do not forget to remove `undefined` when the
123
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
124
+ */
125
+ export function getAnnotationInlineNodeTypes(state, annotationId) {
126
+ if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
127
+ return undefined;
128
+ }
129
+ var mark = state.schema.marks.annotation.create({
130
+ id: annotationId,
131
+ annotationType: AnnotationTypes.INLINE_COMMENT
132
+ });
133
+ var inlineNodeNames = new Set();
134
+ state.doc.descendants(function (node, pos) {
135
+ if (mark.isInSet(node.marks)) {
136
+ inlineNodeNames.add(node.type.name);
137
+ }
138
+ return true;
139
+ });
140
+
141
+ // This sorting is done to make human consumption easier (ie. in dev tools, test snapshots, analytics events, ...)
142
+ return _toConsumableArray(inlineNodeNames).sort();
114
143
  }
@@ -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, hasAnnotationMark, getRangeInlineNodeNames } from './annotation';
5
+ export { 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,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import type { MacroInteractionDesignFeatureFlags } from "./types";
4
+ import type { MacroInteractionDesignFeatureFlags } from './types';
5
5
  type Props = {
6
6
  children: React.ReactNode;
7
7
  nodeType: string;
@@ -79,6 +79,16 @@ export type InlineCommentViewComponentProps = {
79
79
  */
80
80
  clickElementTarget?: HTMLElement;
81
81
  deleteAnnotation: (annotationInfo: AnnotationInfo) => ActionResult;
82
+ /**
83
+ * Return a list of inline node types, which are wrapped by the annotation,
84
+ * for annotation with given ID.
85
+ *
86
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
87
+ *
88
+ * @todo: Do not forget to remove `undefined` when the
89
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
90
+ */
91
+ getInlineNodeTypes: (annotationId: string) => string[] | undefined;
82
92
  };
83
93
  export type InlineCommentHoverComponentProps = {
84
94
  /**
@@ -18,4 +18,16 @@ export declare function getRangeInlineNodeNames({ doc, pos, }: {
18
18
  to: number;
19
19
  };
20
20
  }): string[] | undefined;
21
+ /**
22
+ * This function returns a list of node types that are wrapped by an annotation mark.
23
+ *
24
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
25
+ *
26
+ * @todo: Do not forget to remove `undefined` when the
27
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
28
+ */
29
+ export declare function getAnnotationInlineNodeTypes(state: {
30
+ doc: PMNode;
31
+ schema: Schema;
32
+ }, annotationId: string): string[] | undefined;
21
33
  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, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
5
+ export { 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,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import type { MacroInteractionDesignFeatureFlags } from "./types";
4
+ import type { MacroInteractionDesignFeatureFlags } from './types';
5
5
  type Props = {
6
6
  children: React.ReactNode;
7
7
  nodeType: string;
@@ -79,6 +79,16 @@ export type InlineCommentViewComponentProps = {
79
79
  */
80
80
  clickElementTarget?: HTMLElement;
81
81
  deleteAnnotation: (annotationInfo: AnnotationInfo) => ActionResult;
82
+ /**
83
+ * Return a list of inline node types, which are wrapped by the annotation,
84
+ * for annotation with given ID.
85
+ *
86
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
87
+ *
88
+ * @todo: Do not forget to remove `undefined` when the
89
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
90
+ */
91
+ getInlineNodeTypes: (annotationId: string) => string[] | undefined;
82
92
  };
83
93
  export type InlineCommentHoverComponentProps = {
84
94
  /**
@@ -18,4 +18,16 @@ export declare function getRangeInlineNodeNames({ doc, pos, }: {
18
18
  to: number;
19
19
  };
20
20
  }): string[] | undefined;
21
+ /**
22
+ * This function returns a list of node types that are wrapped by an annotation mark.
23
+ *
24
+ * The `undefined` will be returned if `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is off.
25
+ *
26
+ * @todo: Do not forget to remove `undefined` when the
27
+ * `platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz` is removed.
28
+ */
29
+ export declare function getAnnotationInlineNodeTypes(state: {
30
+ doc: PMNode;
31
+ schema: Schema;
32
+ }, annotationId: string): string[] | undefined;
21
33
  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, hasAnnotationMark, getRangeInlineNodeNames, } from './annotation';
5
+ export { 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": "82.10.0",
3
+ "version": "82.11.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/"
@@ -102,7 +102,7 @@
102
102
  "@atlaskit/analytics-namespaced-context": "^6.10.0",
103
103
  "@atlaskit/analytics-next": "^9.3.0",
104
104
  "@atlaskit/analytics-next-stable-react-context": "1.0.1",
105
- "@atlaskit/button": "^17.23.0",
105
+ "@atlaskit/button": "^18.0.0",
106
106
  "@atlaskit/code": "^15.3.0",
107
107
  "@atlaskit/codemod-utils": "^4.2.0",
108
108
  "@atlaskit/custom-steps": "^0.2.0",
@@ -123,7 +123,7 @@
123
123
  "@atlaskit/media-file-preview": "^0.5.0",
124
124
  "@atlaskit/media-picker": "^66.4.0",
125
125
  "@atlaskit/media-ui": "^25.10.0",
126
- "@atlaskit/media-viewer": "48.6.6",
126
+ "@atlaskit/media-viewer": "48.6.7",
127
127
  "@atlaskit/mention": "^23.2.0",
128
128
  "@atlaskit/menu": "^2.5.0",
129
129
  "@atlaskit/platform-feature-flags": "^0.2.0",
@@ -136,7 +136,7 @@
136
136
  "@atlaskit/task-decision": "^17.10.0",
137
137
  "@atlaskit/textfield": "^6.4.0",
138
138
  "@atlaskit/theme": "^12.11.0",
139
- "@atlaskit/tokens": "^1.51.0",
139
+ "@atlaskit/tokens": "^1.52.0",
140
140
  "@atlaskit/tooltip": "^18.5.0",
141
141
  "@atlaskit/ufo": "^0.2.0",
142
142
  "@atlaskit/width-detector": "^4.2.0",