@atlaskit/editor-common 119.8.0 → 119.9.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,33 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 119.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`da678c24b2eb7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da678c24b2eb7) -
8
+ `validateADFEntity` takes an optional trailing `adfStage`, and full-ADF strictness is opt-in: only
9
+ a caller that names `final` is validated against full ADF, while omitting the argument keeps
10
+ stage-0 specs acceptable. Every existing caller behaves exactly as it did before.
11
+
12
+ Strictness is opt-in rather than derived from a default because a document holding a stage-0-only
13
+ construct, such as a `layoutSection` with a single column, otherwise has that content wrapped as
14
+ unsupported. Editors carry such constructs by design, since the editor's own schema enables them,
15
+ and renderers meet them in stored documents as well as in partially streamed ones. The legacy
16
+ `getValidDocument` path never enforced these cardinality rules, so deriving strictness
17
+ automatically would have made the two validation paths disagree on the same document.
18
+
19
+ `renderDocument`'s `adfStage` argument is consequently optional and no longer defaults to `final`
20
+ before reaching validation. It forwards whatever the caller supplied, and the legacy branch keeps
21
+ its own `final` default because it reads the value as a schema selector rather than as a
22
+ strictness request.
23
+
24
+ All of this is a no-op while `platform_editor_adf_validator_stage0` is off, and with the flag on
25
+ it changes nothing for callers that do not name a stage.
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
3
31
  ## 119.8.0
4
32
 
5
33
  ### Minor 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.7.0";
31
+ var packageVersion = "119.9.0";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -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.7.0";
27
+ var packageVersion = "119.9.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -15,6 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _validator = require("@atlaskit/adf-utils/validator");
16
16
  var _fg = require("@atlaskit/platform-feature-flags/fg");
17
17
  var _analytics = require("../analytics");
18
+ var _ADFStages = require("./ADFStages");
18
19
  var _trackUnsupportedContent = require("./track-unsupported-content");
19
20
  var _wrapWithUnsupported = require("./wrapWithUnsupported");
20
21
  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; }
@@ -168,11 +169,18 @@ function trackValidationError(dispatchAnalyticsEvent, error, entity) {
168
169
  }
169
170
 
170
171
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
171
- var validateADFEntity = exports.validateADFEntity = function validateADFEntity(schema, node, dispatchAnalyticsEvent, validationOverrides) {
172
+ var validateADFEntity = exports.validateADFEntity = function validateADFEntity(schema, node, dispatchAnalyticsEvent, validationOverrides, adfStage) {
172
173
  var nodes = Object.keys(schema.nodes);
173
174
  var marks = Object.keys(schema.marks);
175
+ // Full-ADF strictness is opt-in: only a caller that names `final` gets it, and omitting `adfStage`
176
+ // keeps stage-0 specs acceptable. Strictness has to be asked for rather than defaulted into,
177
+ // because a document holding a stage-0-only construct, such as a `layoutSection` with one column,
178
+ // otherwise has that content wrapped as unsupported. Editors carry such constructs by design,
179
+ // since the editor's own schema enables them, and renderers meet them in stored documents.
180
+ // `stage0` is only observable while `platform_editor_adf_validator_stage0` is enabled.
174
181
  var validate = (0, _validator.validator)(nodes, marks, {
175
- allowPrivateAttributes: true
182
+ allowPrivateAttributes: true,
183
+ stage0: adfStage !== _ADFStages.ADFStages.FINAL
176
184
  });
177
185
  var emptyDoc = {
178
186
  type: 'doc',
@@ -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.7.0";
17
+ const packageVersion = "119.9.0";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -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.7.0";
17
+ const packageVersion = "119.9.0";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -2,6 +2,7 @@ import { validator } from '@atlaskit/adf-utils/validator';
2
2
  import { fg } from '@atlaskit/platform-feature-flags/fg';
3
3
  import { ACTION_SUBJECT_ID } from '../analytics';
4
4
  export const UNSUPPORTED_NODE_ATTRIBUTE = 'unsupportedNodeAttribute';
5
+ import { ADFStages } from './ADFStages';
5
6
  import { fireUnsupportedEvent } from './track-unsupported-content';
6
7
  import { wrapWithUnsupported } from './wrapWithUnsupported';
7
8
  const errorCallbackFor = (marks, validate, dispatchAnalyticsEvent, validationOverrides) => {
@@ -149,11 +150,18 @@ function trackValidationError(dispatchAnalyticsEvent, error, entity) {
149
150
  }
150
151
 
151
152
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
152
- export const validateADFEntity = (schema, node, dispatchAnalyticsEvent, validationOverrides) => {
153
+ export const validateADFEntity = (schema, node, dispatchAnalyticsEvent, validationOverrides, adfStage) => {
153
154
  const nodes = Object.keys(schema.nodes);
154
155
  const marks = Object.keys(schema.marks);
156
+ // Full-ADF strictness is opt-in: only a caller that names `final` gets it, and omitting `adfStage`
157
+ // keeps stage-0 specs acceptable. Strictness has to be asked for rather than defaulted into,
158
+ // because a document holding a stage-0-only construct, such as a `layoutSection` with one column,
159
+ // otherwise has that content wrapped as unsupported. Editors carry such constructs by design,
160
+ // since the editor's own schema enables them, and renderers meet them in stored documents.
161
+ // `stage0` is only observable while `platform_editor_adf_validator_stage0` is enabled.
155
162
  const validate = validator(nodes, marks, {
156
- allowPrivateAttributes: true
163
+ allowPrivateAttributes: true,
164
+ stage0: adfStage !== ADFStages.FINAL
157
165
  });
158
166
  const emptyDoc = {
159
167
  type: 'doc',
@@ -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.7.0";
23
+ var packageVersion = "119.9.0";
24
24
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
25
25
  // Remove URL as it has UGC
26
26
  // Ignored via go/ees007
@@ -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.7.0";
24
+ var packageVersion = "119.9.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -5,6 +5,7 @@ import { validator } from '@atlaskit/adf-utils/validator';
5
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
6
6
  import { ACTION_SUBJECT_ID } from '../analytics';
7
7
  export var UNSUPPORTED_NODE_ATTRIBUTE = 'unsupportedNodeAttribute';
8
+ import { ADFStages } from './ADFStages';
8
9
  import { fireUnsupportedEvent } from './track-unsupported-content';
9
10
  import { wrapWithUnsupported } from './wrapWithUnsupported';
10
11
  var errorCallbackFor = function errorCallbackFor(marks, validate, dispatchAnalyticsEvent, validationOverrides) {
@@ -155,11 +156,18 @@ function trackValidationError(dispatchAnalyticsEvent, error, entity) {
155
156
  }
156
157
 
157
158
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
158
- export var validateADFEntity = function validateADFEntity(schema, node, dispatchAnalyticsEvent, validationOverrides) {
159
+ export var validateADFEntity = function validateADFEntity(schema, node, dispatchAnalyticsEvent, validationOverrides, adfStage) {
159
160
  var nodes = Object.keys(schema.nodes);
160
161
  var marks = Object.keys(schema.marks);
162
+ // Full-ADF strictness is opt-in: only a caller that names `final` gets it, and omitting `adfStage`
163
+ // keeps stage-0 specs acceptable. Strictness has to be asked for rather than defaulted into,
164
+ // because a document holding a stage-0-only construct, such as a `layoutSection` with one column,
165
+ // otherwise has that content wrapped as unsupported. Editors carry such constructs by design,
166
+ // since the editor's own schema enables them, and renderers meet them in stored documents.
167
+ // `stage0` is only observable while `platform_editor_adf_validator_stage0` is enabled.
161
168
  var validate = validator(nodes, marks, {
162
- allowPrivateAttributes: true
169
+ allowPrivateAttributes: true,
170
+ stage0: adfStage !== ADFStages.FINAL
163
171
  });
164
172
  var emptyDoc = {
165
173
  type: 'doc',
@@ -3,6 +3,7 @@ import type { ErrorCallbackOptions, Validate, ValidationError } from '@atlaskit/
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  export declare const UNSUPPORTED_NODE_ATTRIBUTE = "unsupportedNodeAttribute";
5
5
  import type { UnsupportedContentPayload } from './unsupportedContent/types';
6
+ import type { ADFStage } from './validator';
6
7
  export type DispatchAnalyticsEvent = (event: UnsupportedContentPayload) => void;
7
8
  export declare const validationErrorHandler: (entity: ADFEntity, error: ValidationError, options: ErrorCallbackOptions, marks: string[], validate: Validate, dispatchAnalyticsEvent?: DispatchAnalyticsEvent) => ADFEntity | {
8
9
  attrs: {
@@ -14,5 +15,5 @@ export declare const validateADFEntity: (schema: Schema, node: ADFEntity, dispat
14
15
  allowExpandInPanel?: boolean;
15
16
  allowNestedTables?: boolean;
16
17
  allowTableInPanel?: boolean;
17
- }) => ADFEntity;
18
+ }, adfStage?: ADFStage) => ADFEntity;
18
19
  export { wrapWithUnsupported } from './wrapWithUnsupported';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "119.8.0",
3
+ "version": "119.9.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/"
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@atlaskit/activity-provider": "^3.0.0",
32
32
  "@atlaskit/adf-schema": "^57.0.0",
33
- "@atlaskit/adf-utils": "^20.6.0",
33
+ "@atlaskit/adf-utils": "^20.7.0",
34
34
  "@atlaskit/afm-i18n-platform-editor-editor-common": "2.200.0",
35
35
  "@atlaskit/analytics-listeners": "^11.1.0",
36
36
  "@atlaskit/analytics-namespaced-context": "^8.1.0",