@atlaskit/editor-common 119.10.2 → 119.11.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 119.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`52e80c8d44e5f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/52e80c8d44e5f) -
8
+ Behind `platform_editor_sanitize_selection_fragments`, `getFragmentsFromSelection` now sanitises
9
+ selection fragments via `JSONTransformer.encodeNode` instead of the raw `nodeToJSON`, so the
10
+ schema-only `panel_c1` container variant no longer leaks to Remix and other AI selection-context
11
+ consumers when `platform_editor_nest_table_in_panel` is enabled. `keepNestedTables: true` is
12
+ passed to keep nested tables intact. `encodeNode` and editor-common's `nodeToJSON` now accept
13
+ `SanitizeNodeOptions`, matching `encode`.
14
+ - [`37cc9ce2fd879`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/37cc9ce2fd879) -
15
+ Add new analytic entrypoint name for suggestions panel
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 119.10.2
4
22
 
5
23
  ### Patch Changes
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
28
28
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
29
29
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
30
30
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
31
- var packageVersion = "119.10.1";
31
+ var packageVersion = "119.10.2";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -5,12 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getFragmentsFromSelection = void 0;
7
7
  var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
8
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
9
+ var _nodes = require("../utils/nodes");
8
10
  var _contextHelpers = require("./context-helpers");
9
11
  /**
10
12
  * Get the fragments from the selection.
11
- * @param selection The selection to get the fragments from.
12
- * @param schema The schema to use to convert the nodes to JSON.
13
- * @returns The fragments as an array of JSON nodes.
13
+ *
14
+ * The result crosses an editor boundary Remix, Rovo/convo-ai and AIFC treat it as persistable
15
+ * ADF. The two same-named `nodeToJSON` exports are not interchangeable: `editor-json-transformer`'s
16
+ * is a verbatim ProseMirror serialisation and leaks schema-only container variants such as
17
+ * `panel_c1`, while `../utils/nodes` sanitises.
18
+ *
19
+ * `keepNestedTables: true` keeps the gate scoped to that strip — the sanitiser would otherwise also
20
+ * rewrite nested tables into an extension carrying stringified ADF.
14
21
  */
15
22
  var getFragmentsFromSelection = exports.getFragmentsFromSelection = function getFragmentsFromSelection(selection) {
16
23
  if (!selection || selection.empty) {
@@ -18,9 +25,12 @@ var getFragmentsFromSelection = exports.getFragmentsFromSelection = function get
18
25
  }
19
26
  var slice = (0, _contextHelpers.getSliceFromSelection)(selection);
20
27
  var content = slice.content;
28
+ var sanitizeFragments = (0, _fg.fg)('platform_editor_sanitize_selection_fragments');
21
29
  var fragment = [];
22
30
  content.forEach(function (node) {
23
- fragment.push((0, _editorJsonTransformer.nodeToJSON)(node));
31
+ fragment.push(sanitizeFragments ? (0, _nodes.nodeToJSON)(node, {
32
+ keepNestedTables: true
33
+ }) : (0, _editorJsonTransformer.nodeToJSON)(node));
24
34
  });
25
35
  return fragment;
26
36
  };
@@ -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 = "119.10.1";
27
+ var packageVersion = "119.10.2";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -109,8 +109,8 @@ function toJSON(node) {
109
109
  }
110
110
 
111
111
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
112
- function nodeToJSON(node) {
113
- return transformer.encodeNode(node);
112
+ function nodeToJSON(node, options) {
113
+ return transformer.encodeNode(node, options);
114
114
  }
115
115
  // eslint-disable-next-line @atlaskit/editor/no-re-export
116
116
 
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
14
14
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
15
15
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
16
16
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
17
- const packageVersion = "119.10.1";
17
+ const packageVersion = "119.10.2";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -1,11 +1,18 @@
1
- import { nodeToJSON } from '@atlaskit/editor-json-transformer';
1
+ import { nodeToJSON as unsanitizedNodeToJSON } from '@atlaskit/editor-json-transformer';
2
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
+ import { nodeToJSON } from '../utils/nodes';
2
4
  import { getSliceFromSelection } from './context-helpers';
3
5
 
4
6
  /**
5
7
  * Get the fragments from the selection.
6
- * @param selection The selection to get the fragments from.
7
- * @param schema The schema to use to convert the nodes to JSON.
8
- * @returns The fragments as an array of JSON nodes.
8
+ *
9
+ * The result crosses an editor boundary Remix, Rovo/convo-ai and AIFC treat it as persistable
10
+ * ADF. The two same-named `nodeToJSON` exports are not interchangeable: `editor-json-transformer`'s
11
+ * is a verbatim ProseMirror serialisation and leaks schema-only container variants such as
12
+ * `panel_c1`, while `../utils/nodes` sanitises.
13
+ *
14
+ * `keepNestedTables: true` keeps the gate scoped to that strip — the sanitiser would otherwise also
15
+ * rewrite nested tables into an extension carrying stringified ADF.
9
16
  */
10
17
  export const getFragmentsFromSelection = selection => {
11
18
  if (!selection || selection.empty) {
@@ -13,9 +20,12 @@ export const getFragmentsFromSelection = selection => {
13
20
  }
14
21
  const slice = getSliceFromSelection(selection);
15
22
  const content = slice.content;
23
+ const sanitizeFragments = fg('platform_editor_sanitize_selection_fragments');
16
24
  const fragment = [];
17
25
  content.forEach(node => {
18
- fragment.push(nodeToJSON(node));
26
+ fragment.push(sanitizeFragments ? nodeToJSON(node, {
27
+ keepNestedTables: true
28
+ }) : unsanitizedNodeToJSON(node));
19
29
  });
20
30
  return fragment;
21
31
  };
@@ -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 = "119.10.1";
17
+ const packageVersion = "119.10.2";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -49,8 +49,8 @@ export function toJSON(node) {
49
49
  }
50
50
 
51
51
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
52
- export function nodeToJSON(node) {
53
- return transformer.encodeNode(node);
52
+ export function nodeToJSON(node, options) {
53
+ return transformer.encodeNode(node, options);
54
54
  }
55
55
  // eslint-disable-next-line @atlaskit/editor/no-re-export
56
56
  export { findChangedNodesFromTransaction } from './findChangedNodesFromTransaction';
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
20
20
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
21
21
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
22
22
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
23
- var packageVersion = "119.10.1";
23
+ var packageVersion = "119.10.2";
24
24
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
25
25
  // Remove URL as it has UGC
26
26
  // Ignored via go/ees007
@@ -1,11 +1,18 @@
1
- import { nodeToJSON } from '@atlaskit/editor-json-transformer';
1
+ import { nodeToJSON as unsanitizedNodeToJSON } from '@atlaskit/editor-json-transformer';
2
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
+ import { nodeToJSON } from '../utils/nodes';
2
4
  import { getSliceFromSelection } from './context-helpers';
3
5
 
4
6
  /**
5
7
  * Get the fragments from the selection.
6
- * @param selection The selection to get the fragments from.
7
- * @param schema The schema to use to convert the nodes to JSON.
8
- * @returns The fragments as an array of JSON nodes.
8
+ *
9
+ * The result crosses an editor boundary Remix, Rovo/convo-ai and AIFC treat it as persistable
10
+ * ADF. The two same-named `nodeToJSON` exports are not interchangeable: `editor-json-transformer`'s
11
+ * is a verbatim ProseMirror serialisation and leaks schema-only container variants such as
12
+ * `panel_c1`, while `../utils/nodes` sanitises.
13
+ *
14
+ * `keepNestedTables: true` keeps the gate scoped to that strip — the sanitiser would otherwise also
15
+ * rewrite nested tables into an extension carrying stringified ADF.
9
16
  */
10
17
  export var getFragmentsFromSelection = function getFragmentsFromSelection(selection) {
11
18
  if (!selection || selection.empty) {
@@ -13,9 +20,12 @@ export var getFragmentsFromSelection = function getFragmentsFromSelection(select
13
20
  }
14
21
  var slice = getSliceFromSelection(selection);
15
22
  var content = slice.content;
23
+ var sanitizeFragments = fg('platform_editor_sanitize_selection_fragments');
16
24
  var fragment = [];
17
25
  content.forEach(function (node) {
18
- fragment.push(nodeToJSON(node));
26
+ fragment.push(sanitizeFragments ? nodeToJSON(node, {
27
+ keepNestedTables: true
28
+ }) : unsanitizedNodeToJSON(node));
19
29
  });
20
30
  return fragment;
21
31
  };
@@ -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 = "119.10.1";
24
+ var packageVersion = "119.10.2";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -59,8 +59,8 @@ export function toJSON(node) {
59
59
  }
60
60
 
61
61
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
62
- export function nodeToJSON(node) {
63
- return transformer.encodeNode(node);
62
+ export function nodeToJSON(node, options) {
63
+ return transformer.encodeNode(node, options);
64
64
  }
65
65
  // eslint-disable-next-line @atlaskit/editor/no-re-export
66
66
  export { findChangedNodesFromTransaction } from './findChangedNodesFromTransaction';
@@ -14,7 +14,7 @@ export type AiSuggestionsEntryPoint = 'primaryToolbar' | 'commentsEmptyState' |
14
14
  */
15
15
  | 'followUpCard';
16
16
  export type AiSuggestionInteractionPoint = 'sidebar' | 'card' | 'statusBar';
17
- export type AiSuggestionsRightRailEntryPoint = 'suggestionsTab' | 'suggestionCard';
17
+ export type AiSuggestionsRightRailEntryPoint = 'suggestionsPanel' | 'suggestionsTab' | 'suggestionCard';
18
18
  export type AiSuggestionsConversationErrorReason = 'agentDeactivated' | 'agentProvisioning' | 'agentExternalConfigReference' | 'conversationSetup' | 'streamError';
19
19
  type NoDiffSuggestionAEP = OperationalAEP<ACTION.NO_DIFF_FOUND, ACTION_SUBJECT.AI_SUGGESTIONS, undefined, {
20
20
  suggestionType: string;
@@ -1,9 +1,14 @@
1
- import type { JSONNode } from '@atlaskit/editor-json-transformer';
1
+ import type { JSONNode } from '@atlaskit/editor-json-transformer/types';
2
2
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  /**
4
4
  * Get the fragments from the selection.
5
- * @param selection The selection to get the fragments from.
6
- * @param schema The schema to use to convert the nodes to JSON.
7
- * @returns The fragments as an array of JSON nodes.
5
+ *
6
+ * The result crosses an editor boundary Remix, Rovo/convo-ai and AIFC treat it as persistable
7
+ * ADF. The two same-named `nodeToJSON` exports are not interchangeable: `editor-json-transformer`'s
8
+ * is a verbatim ProseMirror serialisation and leaks schema-only container variants such as
9
+ * `panel_c1`, while `../utils/nodes` sanitises.
10
+ *
11
+ * `keepNestedTables: true` keeps the gate scoped to that strip — the sanitiser would otherwise also
12
+ * rewrite nested tables into an extension carrying stringified ADF.
8
13
  */
9
14
  export declare const getFragmentsFromSelection: (selection?: Selection) => JSONNode[] | null;
@@ -1,4 +1,5 @@
1
1
  import type { JSONDocNode, JSONNode } from '@atlaskit/editor-json-transformer';
2
+ import type { SanitizeNodeOptions } from '@atlaskit/editor-json-transformer/sanitize/sanitize-node';
2
3
  import type { MarkType, NodeType, Mark as PMMark, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
3
4
  import { SelectedState } from './SelectedState';
4
5
  /** Validates prosemirror nodes, and returns true only if all nodes are valid */
@@ -16,7 +17,7 @@ export declare const isLinkMark: (node: PMEntities, schema: Schema) => boolean |
16
17
  */
17
18
  export declare const isNodeSelectedOrInRange: (anchorPosition: number, headPosition: number, nodePosition: number | undefined, nodeSize: number) => SelectedState | null;
18
19
  export declare function toJSON(node: PMNode): JSONDocNode;
19
- export declare function nodeToJSON(node: PMNode): JSONNode;
20
+ export declare function nodeToJSON(node: PMNode, options?: SanitizeNodeOptions): JSONNode;
20
21
  export { findChangedNodesFromTransaction } from './findChangedNodesFromTransaction';
21
22
  export { validNode } from './validNode';
22
23
  export { SelectedState } from './SelectedState';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "119.10.2",
3
+ "version": "119.11.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/"
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/css": "^1.0.0",
43
43
  "@atlaskit/custom-steps": "^1.0.0",
44
44
  "@atlaskit/dropdown-menu": "^18.1.0",
45
- "@atlaskit/editor-json-transformer": "^9.4.0",
45
+ "@atlaskit/editor-json-transformer": "^9.5.0",
46
46
  "@atlaskit/editor-palette": "^3.4.0",
47
47
  "@atlaskit/editor-prosemirror": "^8.0.0",
48
48
  "@atlaskit/editor-shared-styles": "^4.0.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/link-datasource": "^6.4.0",
58
58
  "@atlaskit/link-picker": "^6.4.0",
59
59
  "@atlaskit/media-card": "^81.6.0",
60
- "@atlaskit/media-client": "^37.3.0",
60
+ "@atlaskit/media-client": "^37.4.0",
61
61
  "@atlaskit/media-client-react": "^6.1.0",
62
62
  "@atlaskit/media-common": "^14.4.0",
63
63
  "@atlaskit/media-file-preview": "^1.1.0",
@@ -172,6 +172,9 @@
172
172
  "platform_editor_use_new_experiments_api": {
173
173
  "type": "boolean"
174
174
  },
175
+ "platform_editor_sanitize_selection_fragments": {
176
+ "type": "boolean"
177
+ },
175
178
  "platform-dst-popper-consolidation": {
176
179
  "type": "boolean",
177
180
  "referenceOnly": true