@atlaskit/editor-core 223.0.3 → 223.0.4

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,14 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 223.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9df0d15ebfb51`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9df0d15ebfb51) -
8
+ Add aria-readonly during SSR only for editor view mode, and use the configured mode when plugin
9
+ state is unavailable.
10
+ - Updated dependencies
11
+
3
12
  ## 223.0.3
4
13
 
5
14
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.ReactEditorView = ReactEditorView;
9
9
  exports.default = void 0;
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
13
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -34,6 +35,7 @@ var _view = require("@atlaskit/editor-prosemirror/view");
34
35
  var _editorSsrRenderer = require("@atlaskit/editor-ssr-renderer");
35
36
  var _createSsrEditorState = require("@atlaskit/editor-ssr-renderer/create-ssr-editor-state");
36
37
  var _createSsrPmPlugins = require("@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins");
38
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
37
39
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
38
40
  var _customData = require("@atlaskit/react-ufo/custom-data");
39
41
  var _interactionIdContext = require("@atlaskit/react-ufo/interaction-id-context");
@@ -1047,6 +1049,7 @@ function ReactEditorView(props) {
1047
1049
  // In separate memo, because some props like `props.intl` that need only for rendering
1048
1050
  // changes many times, but we don't want to process plugins and ADF document for each unnecessary changes.
1049
1051
  var ssrDeps = (0, _react.useMemo)(function () {
1052
+ var _pluginInjectionAPI$c4;
1050
1053
  if (!(0, _coreUtils.isSSR)()) {
1051
1054
  return null;
1052
1055
  }
@@ -1067,6 +1070,8 @@ function ReactEditorView(props) {
1067
1070
  return buildDoc(schema);
1068
1071
  };
1069
1072
  var doc = (0, _ssrMeasures.profileSSROperation)("".concat(SSR_TRACE_SEGMENT_NAME, "/buildDoc"), doBuildDoc, onSSRMeasure);
1073
+ var isViewMode = ((_pluginInjectionAPI$c4 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c4 === void 0 || (_pluginInjectionAPI$c4 = _pluginInjectionAPI$c4.editorViewMode) === null || _pluginInjectionAPI$c4 === void 0 || (_pluginInjectionAPI$c4 = _pluginInjectionAPI$c4.sharedState.currentState()) === null || _pluginInjectionAPI$c4 === void 0 ? void 0 : _pluginInjectionAPI$c4.mode) === 'view';
1074
+ var ariaReadonly = isViewMode && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_viewmode_aria_readonly_a11y') ? 'true' : undefined;
1070
1075
 
1071
1076
  // When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
1072
1077
  // HERE in ssrDeps — before any children render — so that FullPageToolbarNext can read correct
@@ -1096,6 +1101,7 @@ function ReactEditorView(props) {
1096
1101
  plugins: plugins,
1097
1102
  schema: schema,
1098
1103
  doc: doc,
1104
+ ariaReadonly: ariaReadonly,
1099
1105
  ssrPMPlugins: ssrPMPlugins,
1100
1106
  ssrEditorState: ssrState
1101
1107
  };
@@ -1104,6 +1110,7 @@ function ReactEditorView(props) {
1104
1110
  plugins: plugins,
1105
1111
  schema: schema,
1106
1112
  doc: doc,
1113
+ ariaReadonly: ariaReadonly,
1107
1114
  ssrPMPlugins: undefined,
1108
1115
  ssrEditorState: undefined
1109
1116
  };
@@ -1148,7 +1155,7 @@ function ReactEditorView(props) {
1148
1155
  if (!ssrDeps) {
1149
1156
  return null;
1150
1157
  }
1151
- return /*#__PURE__*/_react.default.createElement(_editorSsrRenderer.EditorSSRRenderer, {
1158
+ return /*#__PURE__*/_react.default.createElement(_editorSsrRenderer.EditorSSRRenderer, (0, _extends2.default)({
1152
1159
  intl: props.intl,
1153
1160
  doc: ssrDeps.doc,
1154
1161
  schema: ssrDeps.schema,
@@ -1161,7 +1168,11 @@ function ReactEditorView(props) {
1161
1168
  key: "ProseMirror",
1162
1169
  "aria-label": assistiveLabel || (isPageAppearance ? props.intl.formatMessage(_messages.editorMessages.fullPageEditorAssistiveLabel) : props.intl.formatMessage(_messages.editorMessages.editorAssistiveLabel)),
1163
1170
  id: EDIT_AREA_ID,
1164
- "aria-describedby": assistiveDescribedBy,
1171
+ "aria-describedby": assistiveDescribedBy
1172
+ // eslint-disable-next-line react/jsx-props-no-spreading -- aria-readonly must be omitted unless view mode is confirmed
1173
+ }, ssrDeps.ariaReadonly === 'true' ? {
1174
+ 'aria-readonly': 'true'
1175
+ } : {}, {
1165
1176
  "data-editor-id": editorId.current,
1166
1177
  onSSRMeasure: onSSRMeasure,
1167
1178
  prebuiltPMPlugins: ssrDeps.ssrPMPlugins,
@@ -1176,7 +1187,7 @@ function ReactEditorView(props) {
1176
1187
  oldEditorState: undefined
1177
1188
  });
1178
1189
  }
1179
- });
1190
+ }));
1180
1191
  }, [ssrDeps, props.intl, props.portalProviderAPI, assistiveLabel, isPageAppearance, assistiveDescribedBy, onSSRMeasure, handleSsrEditorStateChanged]);
1181
1192
  var editor = (0, _react.useMemo)(function () {
1182
1193
  // SSR editor will be available only in SSR environment,
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
8
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
9
- var version = exports.version = "223.0.2";
9
+ var version = exports.version = "223.0.3";
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React, { useCallback, useLayoutEffect, useMemo, useRef, useState, useEffect } from 'react';
2
3
  import { injectIntl } from 'react-intl';
3
4
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
@@ -23,6 +24,7 @@ import { EditorView } from '@atlaskit/editor-prosemirror/view';
23
24
  import { EditorSSRRenderer } from '@atlaskit/editor-ssr-renderer';
24
25
  import { createSSREditorState } from '@atlaskit/editor-ssr-renderer/create-ssr-editor-state';
25
26
  import { createSSRPMPlugins } from '@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins';
27
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
26
28
  import { fg } from '@atlaskit/platform-feature-flags';
27
29
  import { addUFOCustomData } from '@atlaskit/react-ufo/custom-data';
28
30
  import { getInteractionId } from '@atlaskit/react-ufo/interaction-id-context';
@@ -976,6 +978,7 @@ export function ReactEditorView(props) {
976
978
  // In separate memo, because some props like `props.intl` that need only for rendering
977
979
  // changes many times, but we don't want to process plugins and ADF document for each unnecessary changes.
978
980
  const ssrDeps = useMemo(() => {
981
+ var _pluginInjectionAPI$c8, _pluginInjectionAPI$c9, _pluginInjectionAPI$c0;
979
982
  if (!isSSR()) {
980
983
  return null;
981
984
  }
@@ -990,6 +993,8 @@ export function ReactEditorView(props) {
990
993
  const schema = profileSSROperation(`${SSR_TRACE_SEGMENT_NAME}/createSchema`, doCreateSchema, onSSRMeasure);
991
994
  const doBuildDoc = () => buildDoc(schema);
992
995
  const doc = profileSSROperation(`${SSR_TRACE_SEGMENT_NAME}/buildDoc`, doBuildDoc, onSSRMeasure);
996
+ const isViewMode = ((_pluginInjectionAPI$c8 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c8 === void 0 ? void 0 : (_pluginInjectionAPI$c9 = _pluginInjectionAPI$c8.editorViewMode) === null || _pluginInjectionAPI$c9 === void 0 ? void 0 : (_pluginInjectionAPI$c0 = _pluginInjectionAPI$c9.sharedState.currentState()) === null || _pluginInjectionAPI$c0 === void 0 ? void 0 : _pluginInjectionAPI$c0.mode) === 'view';
997
+ const ariaReadonly = isViewMode && isExperimentEnabled('platform_editor_viewmode_aria_readonly_a11y') ? 'true' : undefined;
993
998
 
994
999
  // When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
995
1000
  // HERE in ssrDeps — before any children render — so that FullPageToolbarNext can read correct
@@ -1013,6 +1018,7 @@ export function ReactEditorView(props) {
1013
1018
  plugins,
1014
1019
  schema,
1015
1020
  doc,
1021
+ ariaReadonly,
1016
1022
  ssrPMPlugins,
1017
1023
  ssrEditorState: ssrState
1018
1024
  };
@@ -1021,6 +1027,7 @@ export function ReactEditorView(props) {
1021
1027
  plugins,
1022
1028
  schema,
1023
1029
  doc,
1030
+ ariaReadonly,
1024
1031
  ssrPMPlugins: undefined,
1025
1032
  ssrEditorState: undefined
1026
1033
  };
@@ -1064,7 +1071,7 @@ export function ReactEditorView(props) {
1064
1071
  if (!ssrDeps) {
1065
1072
  return null;
1066
1073
  }
1067
- return /*#__PURE__*/React.createElement(EditorSSRRenderer, {
1074
+ return /*#__PURE__*/React.createElement(EditorSSRRenderer, _extends({
1068
1075
  intl: props.intl,
1069
1076
  doc: ssrDeps.doc,
1070
1077
  schema: ssrDeps.schema,
@@ -1077,7 +1084,11 @@ export function ReactEditorView(props) {
1077
1084
  key: "ProseMirror",
1078
1085
  "aria-label": assistiveLabel || (isPageAppearance ? props.intl.formatMessage(editorMessages.fullPageEditorAssistiveLabel) : props.intl.formatMessage(editorMessages.editorAssistiveLabel)),
1079
1086
  id: EDIT_AREA_ID,
1080
- "aria-describedby": assistiveDescribedBy,
1087
+ "aria-describedby": assistiveDescribedBy
1088
+ // eslint-disable-next-line react/jsx-props-no-spreading -- aria-readonly must be omitted unless view mode is confirmed
1089
+ }, ssrDeps.ariaReadonly === 'true' ? {
1090
+ 'aria-readonly': 'true'
1091
+ } : {}, {
1081
1092
  "data-editor-id": editorId.current,
1082
1093
  onSSRMeasure: onSSRMeasure,
1083
1094
  prebuiltPMPlugins: ssrDeps.ssrPMPlugins,
@@ -1092,7 +1103,7 @@ export function ReactEditorView(props) {
1092
1103
  oldEditorState: undefined
1093
1104
  });
1094
1105
  }
1095
- });
1106
+ }));
1096
1107
  }, [ssrDeps, props.intl, props.portalProviderAPI, assistiveLabel, isPageAppearance, assistiveDescribedBy, onSSRMeasure, handleSsrEditorStateChanged]);
1097
1108
  const editor = useMemo(() => {
1098
1109
  // SSR editor will be available only in SSR environment,
@@ -1,3 +1,3 @@
1
1
  export const name = "@atlaskit/editor-core";
2
2
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
3
- export const version = "223.0.2";
3
+ export const version = "223.0.3";
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
@@ -31,6 +32,7 @@ import { EditorView } from '@atlaskit/editor-prosemirror/view';
31
32
  import { EditorSSRRenderer } from '@atlaskit/editor-ssr-renderer';
32
33
  import { createSSREditorState } from '@atlaskit/editor-ssr-renderer/create-ssr-editor-state';
33
34
  import { createSSRPMPlugins } from '@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins';
35
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
34
36
  import { fg } from '@atlaskit/platform-feature-flags';
35
37
  import { addUFOCustomData } from '@atlaskit/react-ufo/custom-data';
36
38
  import { getInteractionId } from '@atlaskit/react-ufo/interaction-id-context';
@@ -1038,6 +1040,7 @@ export function ReactEditorView(props) {
1038
1040
  // In separate memo, because some props like `props.intl` that need only for rendering
1039
1041
  // changes many times, but we don't want to process plugins and ADF document for each unnecessary changes.
1040
1042
  var ssrDeps = useMemo(function () {
1043
+ var _pluginInjectionAPI$c4;
1041
1044
  if (!isSSR()) {
1042
1045
  return null;
1043
1046
  }
@@ -1058,6 +1061,8 @@ export function ReactEditorView(props) {
1058
1061
  return buildDoc(schema);
1059
1062
  };
1060
1063
  var doc = profileSSROperation("".concat(SSR_TRACE_SEGMENT_NAME, "/buildDoc"), doBuildDoc, onSSRMeasure);
1064
+ var isViewMode = ((_pluginInjectionAPI$c4 = pluginInjectionAPI.current.api()) === null || _pluginInjectionAPI$c4 === void 0 || (_pluginInjectionAPI$c4 = _pluginInjectionAPI$c4.editorViewMode) === null || _pluginInjectionAPI$c4 === void 0 || (_pluginInjectionAPI$c4 = _pluginInjectionAPI$c4.sharedState.currentState()) === null || _pluginInjectionAPI$c4 === void 0 ? void 0 : _pluginInjectionAPI$c4.mode) === 'view';
1065
+ var ariaReadonly = isViewMode && isExperimentEnabled('platform_editor_viewmode_aria_readonly_a11y') ? 'true' : undefined;
1061
1066
 
1062
1067
  // When the platform_editor_ssr_toolbar_optimistic is on, we create SSR-safe PM plugins and EditorState
1063
1068
  // HERE in ssrDeps — before any children render — so that FullPageToolbarNext can read correct
@@ -1087,6 +1092,7 @@ export function ReactEditorView(props) {
1087
1092
  plugins: plugins,
1088
1093
  schema: schema,
1089
1094
  doc: doc,
1095
+ ariaReadonly: ariaReadonly,
1090
1096
  ssrPMPlugins: ssrPMPlugins,
1091
1097
  ssrEditorState: ssrState
1092
1098
  };
@@ -1095,6 +1101,7 @@ export function ReactEditorView(props) {
1095
1101
  plugins: plugins,
1096
1102
  schema: schema,
1097
1103
  doc: doc,
1104
+ ariaReadonly: ariaReadonly,
1098
1105
  ssrPMPlugins: undefined,
1099
1106
  ssrEditorState: undefined
1100
1107
  };
@@ -1139,7 +1146,7 @@ export function ReactEditorView(props) {
1139
1146
  if (!ssrDeps) {
1140
1147
  return null;
1141
1148
  }
1142
- return /*#__PURE__*/React.createElement(EditorSSRRenderer, {
1149
+ return /*#__PURE__*/React.createElement(EditorSSRRenderer, _extends({
1143
1150
  intl: props.intl,
1144
1151
  doc: ssrDeps.doc,
1145
1152
  schema: ssrDeps.schema,
@@ -1152,7 +1159,11 @@ export function ReactEditorView(props) {
1152
1159
  key: "ProseMirror",
1153
1160
  "aria-label": assistiveLabel || (isPageAppearance ? props.intl.formatMessage(editorMessages.fullPageEditorAssistiveLabel) : props.intl.formatMessage(editorMessages.editorAssistiveLabel)),
1154
1161
  id: EDIT_AREA_ID,
1155
- "aria-describedby": assistiveDescribedBy,
1162
+ "aria-describedby": assistiveDescribedBy
1163
+ // eslint-disable-next-line react/jsx-props-no-spreading -- aria-readonly must be omitted unless view mode is confirmed
1164
+ }, ssrDeps.ariaReadonly === 'true' ? {
1165
+ 'aria-readonly': 'true'
1166
+ } : {}, {
1156
1167
  "data-editor-id": editorId.current,
1157
1168
  onSSRMeasure: onSSRMeasure,
1158
1169
  prebuiltPMPlugins: ssrDeps.ssrPMPlugins,
@@ -1167,7 +1178,7 @@ export function ReactEditorView(props) {
1167
1178
  oldEditorState: undefined
1168
1179
  });
1169
1180
  }
1170
- });
1181
+ }));
1171
1182
  }, [ssrDeps, props.intl, props.portalProviderAPI, assistiveLabel, isPageAppearance, assistiveDescribedBy, onSSRMeasure, handleSsrEditorStateChanged]);
1172
1183
  var editor = useMemo(function () {
1173
1184
  // SSR editor will be available only in SSR environment,
@@ -1,3 +1,3 @@
1
1
  export var name = "@atlaskit/editor-core";
2
2
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
3
- export var version = "223.0.2";
3
+ export var version = "223.0.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "223.0.3",
3
+ "version": "223.0.4",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"