@atlaskit/editor-common 119.8.0 → 119.9.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,41 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 119.9.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4d7433f9c93d8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d7433f9c93d8) -
8
+ Clean up the enabled `platform_editor_code_block_fold_gutter` experiment for Confluence.
9
+ - Updated dependencies
10
+
11
+ ## 119.9.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`da678c24b2eb7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da678c24b2eb7) -
16
+ `validateADFEntity` takes an optional trailing `adfStage`, and full-ADF strictness is opt-in: only
17
+ a caller that names `final` is validated against full ADF, while omitting the argument keeps
18
+ stage-0 specs acceptable. Every existing caller behaves exactly as it did before.
19
+
20
+ Strictness is opt-in rather than derived from a default because a document holding a stage-0-only
21
+ construct, such as a `layoutSection` with a single column, otherwise has that content wrapped as
22
+ unsupported. Editors carry such constructs by design, since the editor's own schema enables them,
23
+ and renderers meet them in stored documents as well as in partially streamed ones. The legacy
24
+ `getValidDocument` path never enforced these cardinality rules, so deriving strictness
25
+ automatically would have made the two validation paths disagree on the same document.
26
+
27
+ `renderDocument`'s `adfStage` argument is consequently optional and no longer defaults to `final`
28
+ before reaching validation. It forwards whatever the caller supplied, and the legacy branch keeps
29
+ its own `final` default because it reads the value as a schema selector rather than as a
30
+ strictness request.
31
+
32
+ All of this is a no-op while `platform_editor_adf_validator_stage0` is off, and with the flag on
33
+ it changes nothing for callers that do not name a stage.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies
38
+
3
39
  ## 119.8.0
4
40
 
5
41
  ### Minor Changes
@@ -158,9 +158,7 @@ var setCodeBlockFoldState = exports.setCodeBlockFoldState = function setCodeBloc
158
158
  * Swap the old node key with the new node key in the wrapped states WeakMap.
159
159
  */
160
160
  var transferCodeBlockWrappedValue = exports.transferCodeBlockWrappedValue = function transferCodeBlockWrappedValue(oldCodeBlockNode, newCodeBlockNode) {
161
- if ((0, _expValEquals.expValEquals)('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
162
- transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
163
- }
161
+ transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
164
162
 
165
163
  // Don't overwrite the value for the new node if it already exists.
166
164
  // This can happen when a drag&drop is swapping nodes.
@@ -193,9 +191,7 @@ var transferCodeBlockFoldValue = function transferCodeBlockFoldValue(oldCodeBloc
193
191
  */
194
192
  var updateCodeBlockWrappedStateNodeKeys = exports.updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrappedStateNodeKeys(newCodeBlockNodes, oldState) {
195
193
  newCodeBlockNodes.forEach(function (newCodeBlockNode) {
196
- if ((0, _expValEquals.expValEquals)('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
197
- updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
198
- }
194
+ updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
199
195
  // Don't overwrite the value for the new node if it already exists.
200
196
  // This can happen when a drag&drop is swapping nodes.
201
197
  if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
@@ -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',
@@ -140,9 +140,7 @@ export const setCodeBlockFoldState = (codeBlockNode, foldRanges) => {
140
140
  * Swap the old node key with the new node key in the wrapped states WeakMap.
141
141
  */
142
142
  export const transferCodeBlockWrappedValue = (oldCodeBlockNode, newCodeBlockNode) => {
143
- if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
144
- transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
145
- }
143
+ transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
146
144
 
147
145
  // Don't overwrite the value for the new node if it already exists.
148
146
  // This can happen when a drag&drop is swapping nodes.
@@ -175,9 +173,7 @@ const transferCodeBlockFoldValue = (oldCodeBlockNode, newCodeBlockNode) => {
175
173
  */
176
174
  export const updateCodeBlockWrappedStateNodeKeys = (newCodeBlockNodes, oldState) => {
177
175
  newCodeBlockNodes.forEach(newCodeBlockNode => {
178
- if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
179
- updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
180
- }
176
+ updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
181
177
  // Don't overwrite the value for the new node if it already exists.
182
178
  // This can happen when a drag&drop is swapping nodes.
183
179
  if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
@@ -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',
@@ -152,9 +152,7 @@ export var setCodeBlockFoldState = function setCodeBlockFoldState(codeBlockNode,
152
152
  * Swap the old node key with the new node key in the wrapped states WeakMap.
153
153
  */
154
154
  export var transferCodeBlockWrappedValue = function transferCodeBlockWrappedValue(oldCodeBlockNode, newCodeBlockNode) {
155
- if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
156
- transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
157
- }
155
+ transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
158
156
 
159
157
  // Don't overwrite the value for the new node if it already exists.
160
158
  // This can happen when a drag&drop is swapping nodes.
@@ -187,9 +185,7 @@ var transferCodeBlockFoldValue = function transferCodeBlockFoldValue(oldCodeBloc
187
185
  */
188
186
  export var updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrappedStateNodeKeys(newCodeBlockNodes, oldState) {
189
187
  newCodeBlockNodes.forEach(function (newCodeBlockNode) {
190
- if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
191
- updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
192
- }
188
+ updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
193
189
  // Don't overwrite the value for the new node if it already exists.
194
190
  // This can happen when a drag&drop is swapping nodes.
195
191
  if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
@@ -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.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/"
@@ -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",
@@ -84,7 +84,7 @@
84
84
  "@atlaskit/task-decision": "^21.8.0",
85
85
  "@atlaskit/teams-app-config": "^2.2.0",
86
86
  "@atlaskit/textfield": "^10.0.0",
87
- "@atlaskit/tmp-editor-statsig": "^149.0.0",
87
+ "@atlaskit/tmp-editor-statsig": "^150.0.0",
88
88
  "@atlaskit/tokens": "^16.7.0",
89
89
  "@atlaskit/tooltip": "^24.0.0",
90
90
  "@atlaskit/width-detector": "^7.0.0",
@@ -125,7 +125,7 @@
125
125
  },
126
126
  "devDependencies": {
127
127
  "@atlaskit/media-core": "^38.0.0",
128
- "@atlassian/a11y-jest-testing": "^0.15.0",
128
+ "@atlassian/a11y-jest-testing": "^0.16.0",
129
129
  "@atlassian/experiment-test-utils": "^0.2.0",
130
130
  "@atlassian/feature-flags-test-utils": "^1.2.0",
131
131
  "@atlassian/testing-library": "^0.11.0",