@atlaskit/editor-core 227.1.3 → 228.0.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,20 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 228.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e12b17836ab06`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e12b17836ab06) -
8
+ [ux] Skip the editor-core scroll restoration on editor load and ignore programmatic scroll/wheel
9
+ events when aborting UFO load interactions, behind cc_editor_scroll_restore_perf_improvements.
10
+ Products restore scroll position themselves after the document has rendered.
11
+
12
+ ## 228.0.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 227.1.3
4
19
 
5
20
  ### Patch Changes
@@ -796,7 +796,14 @@ function ReactEditorView(props) {
796
796
  isNestedEditor.current = !!((_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && _editorRef$current.closest('.extension-editable-area'));
797
797
  isNestedEditorCalculated.current = true;
798
798
  }
799
- var originalScrollToRestore = _react.default.useRef(!isNestedEditor.current && (0, _isFullPage.isFullPage)(props.editorProps.appearance) ? (_document$querySelect = document.querySelector('[data-editor-scroll-container]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.scrollTop : undefined);
799
+
800
+ // Preconditioned on the affected population - full page, non nested editors - so that experiment
801
+ // exposure is not diluted by editors which never run the scroll restoration code below.
802
+ var scrollRestorePerfEnabled = !isNestedEditor.current && (0, _isFullPage.isFullPage)(props.editorProps.appearance) && (0, _isExperimentEnabled.isExperimentEnabled)('cc_editor_scroll_restore_perf_improvements');
803
+ var originalScrollToRestore = _react.default.useRef(
804
+ // Reading scrollTop forces a synchronous layout, and this expression is re-evaluated on every
805
+ // render. Products restore scroll themselves after the document has rendered.
806
+ !isNestedEditor.current && (0, _isFullPage.isFullPage)(props.editorProps.appearance) && !scrollRestorePerfEnabled ? (_document$querySelect = document.querySelector('[data-editor-scroll-container]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.scrollTop : undefined);
800
807
  var mitigateScrollJump =
801
808
  // The feature gate here is being used to avoid potential bugs with the scroll restoration code
802
809
  // moving it to the end of the expression negates the point of the feature gate
@@ -875,7 +882,11 @@ function ReactEditorView(props) {
875
882
  }
876
883
  };
877
884
  if (scrollElement.current) {
878
- var wheelAbortHandler = function wheelAbortHandler() {
885
+ var wheelAbortHandler = function wheelAbortHandler(event) {
886
+ // Programmatic scrolls are not user interactions and must not abort the load metric.
887
+ if (scrollRestorePerfEnabled && !event.isTrusted) {
888
+ return;
889
+ }
879
890
  var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
880
891
  if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
881
892
  (0, _interactionMetrics.abortAll)('new_interaction', "wheel-on-editor-element");
@@ -885,7 +896,11 @@ function ReactEditorView(props) {
885
896
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
886
897
  scrollElement.current.addEventListener('wheel', wheelAbortHandler);
887
898
  possibleListeners.current.push(['wheel', wheelAbortHandler]);
888
- var scrollAbortHandler = function scrollAbortHandler() {
899
+ var scrollAbortHandler = function scrollAbortHandler(event) {
900
+ // Programmatic scrolls are not user interactions and must not abort the load metric.
901
+ if (scrollRestorePerfEnabled && !event.isTrusted) {
902
+ return;
903
+ }
889
904
  var activeInteraction = (0, _interactionMetrics.getActiveInteraction)();
890
905
  if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
891
906
  (0, _interactionMetrics.abortAll)('new_interaction', "scroll-on-editor-element");
@@ -940,7 +955,7 @@ function ReactEditorView(props) {
940
955
  (0, _nodeVisibility.nodeVisibilityManager)(viewRef.current.dom).disconnect();
941
956
  viewRef.current = undefined;
942
957
  }
943
- }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump]);
958
+ }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump, scrollRestorePerfEnabled]);
944
959
  var isPageAppearance = (0, _isFullPage.isFullPage)(nextAppearance) || nextAppearance === 'max';
945
960
  var createEditor = (0, _react.useCallback)(function (assistiveLabel, assistiveDescribedBy) {
946
961
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _fg.fg)('cc_editor_focus_before_editor_on_load') && /*#__PURE__*/_react.default.createElement("div", {
@@ -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 = "227.1.2";
9
+ var version = exports.version = "228.0.0";
@@ -744,7 +744,14 @@ export function ReactEditorView(props) {
744
744
  isNestedEditor.current = !!((_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && _editorRef$current.closest('.extension-editable-area'));
745
745
  isNestedEditorCalculated.current = true;
746
746
  }
747
- const originalScrollToRestore = React.useRef(!isNestedEditor.current && isFullPage(props.editorProps.appearance) ? (_document$querySelect = document.querySelector('[data-editor-scroll-container]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.scrollTop : undefined);
747
+
748
+ // Preconditioned on the affected population - full page, non nested editors - so that experiment
749
+ // exposure is not diluted by editors which never run the scroll restoration code below.
750
+ const scrollRestorePerfEnabled = !isNestedEditor.current && isFullPage(props.editorProps.appearance) && isExperimentEnabled('cc_editor_scroll_restore_perf_improvements');
751
+ const originalScrollToRestore = React.useRef(
752
+ // Reading scrollTop forces a synchronous layout, and this expression is re-evaluated on every
753
+ // render. Products restore scroll themselves after the document has rendered.
754
+ !isNestedEditor.current && isFullPage(props.editorProps.appearance) && !scrollRestorePerfEnabled ? (_document$querySelect = document.querySelector('[data-editor-scroll-container]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.scrollTop : undefined);
748
755
  const mitigateScrollJump =
749
756
  // The feature gate here is being used to avoid potential bugs with the scroll restoration code
750
757
  // moving it to the end of the expression negates the point of the feature gate
@@ -805,7 +812,11 @@ export function ReactEditorView(props) {
805
812
  }
806
813
  };
807
814
  if (scrollElement.current) {
808
- const wheelAbortHandler = () => {
815
+ const wheelAbortHandler = event => {
816
+ // Programmatic scrolls are not user interactions and must not abort the load metric.
817
+ if (scrollRestorePerfEnabled && !event.isTrusted) {
818
+ return;
819
+ }
809
820
  const activeInteraction = getActiveInteraction();
810
821
  if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
811
822
  abortAll('new_interaction', `wheel-on-editor-element`);
@@ -815,7 +826,11 @@ export function ReactEditorView(props) {
815
826
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
816
827
  scrollElement.current.addEventListener('wheel', wheelAbortHandler);
817
828
  possibleListeners.current.push(['wheel', wheelAbortHandler]);
818
- const scrollAbortHandler = () => {
829
+ const scrollAbortHandler = event => {
830
+ // Programmatic scrolls are not user interactions and must not abort the load metric.
831
+ if (scrollRestorePerfEnabled && !event.isTrusted) {
832
+ return;
833
+ }
819
834
  const activeInteraction = getActiveInteraction();
820
835
  if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
821
836
  abortAll('new_interaction', `scroll-on-editor-element`);
@@ -870,7 +885,7 @@ export function ReactEditorView(props) {
870
885
  nodeVisibilityManager(viewRef.current.dom).disconnect();
871
886
  viewRef.current = undefined;
872
887
  }
873
- }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump]);
888
+ }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump, scrollRestorePerfEnabled]);
874
889
  const isPageAppearance = isFullPage(nextAppearance) || nextAppearance === 'max';
875
890
  const createEditor = useCallback((assistiveLabel, assistiveDescribedBy) => {
876
891
  return /*#__PURE__*/React.createElement(React.Fragment, null, fg('cc_editor_focus_before_editor_on_load') && /*#__PURE__*/React.createElement("div", {
@@ -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 = "227.1.2";
3
+ export const version = "228.0.0";
@@ -787,7 +787,14 @@ export function ReactEditorView(props) {
787
787
  isNestedEditor.current = !!((_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && _editorRef$current.closest('.extension-editable-area'));
788
788
  isNestedEditorCalculated.current = true;
789
789
  }
790
- var originalScrollToRestore = React.useRef(!isNestedEditor.current && isFullPage(props.editorProps.appearance) ? (_document$querySelect = document.querySelector('[data-editor-scroll-container]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.scrollTop : undefined);
790
+
791
+ // Preconditioned on the affected population - full page, non nested editors - so that experiment
792
+ // exposure is not diluted by editors which never run the scroll restoration code below.
793
+ var scrollRestorePerfEnabled = !isNestedEditor.current && isFullPage(props.editorProps.appearance) && isExperimentEnabled('cc_editor_scroll_restore_perf_improvements');
794
+ var originalScrollToRestore = React.useRef(
795
+ // Reading scrollTop forces a synchronous layout, and this expression is re-evaluated on every
796
+ // render. Products restore scroll themselves after the document has rendered.
797
+ !isNestedEditor.current && isFullPage(props.editorProps.appearance) && !scrollRestorePerfEnabled ? (_document$querySelect = document.querySelector('[data-editor-scroll-container]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.scrollTop : undefined);
791
798
  var mitigateScrollJump =
792
799
  // The feature gate here is being used to avoid potential bugs with the scroll restoration code
793
800
  // moving it to the end of the expression negates the point of the feature gate
@@ -866,7 +873,11 @@ export function ReactEditorView(props) {
866
873
  }
867
874
  };
868
875
  if (scrollElement.current) {
869
- var wheelAbortHandler = function wheelAbortHandler() {
876
+ var wheelAbortHandler = function wheelAbortHandler(event) {
877
+ // Programmatic scrolls are not user interactions and must not abort the load metric.
878
+ if (scrollRestorePerfEnabled && !event.isTrusted) {
879
+ return;
880
+ }
870
881
  var activeInteraction = getActiveInteraction();
871
882
  if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
872
883
  abortAll('new_interaction', "wheel-on-editor-element");
@@ -876,7 +887,11 @@ export function ReactEditorView(props) {
876
887
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
877
888
  scrollElement.current.addEventListener('wheel', wheelAbortHandler);
878
889
  possibleListeners.current.push(['wheel', wheelAbortHandler]);
879
- var scrollAbortHandler = function scrollAbortHandler() {
890
+ var scrollAbortHandler = function scrollAbortHandler(event) {
891
+ // Programmatic scrolls are not user interactions and must not abort the load metric.
892
+ if (scrollRestorePerfEnabled && !event.isTrusted) {
893
+ return;
894
+ }
880
895
  var activeInteraction = getActiveInteraction();
881
896
  if (activeInteraction && ['edit-page', 'live-edit'].includes(activeInteraction.ufoName)) {
882
897
  abortAll('new_interaction', "scroll-on-editor-element");
@@ -931,7 +946,7 @@ export function ReactEditorView(props) {
931
946
  nodeVisibilityManager(viewRef.current.dom).disconnect();
932
947
  viewRef.current = undefined;
933
948
  }
934
- }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump]);
949
+ }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump, scrollRestorePerfEnabled]);
935
950
  var isPageAppearance = isFullPage(nextAppearance) || nextAppearance === 'max';
936
951
  var createEditor = useCallback(function (assistiveLabel, assistiveDescribedBy) {
937
952
  return /*#__PURE__*/React.createElement(React.Fragment, null, fg('cc_editor_focus_before_editor_on_load') && /*#__PURE__*/React.createElement("div", {
@@ -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 = "227.1.2";
3
+ export var version = "228.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "227.1.3",
3
+ "version": "228.0.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,15 +47,15 @@
47
47
  "@atlaskit/button": "^25.3.0",
48
48
  "@atlaskit/css": "^1.1.0",
49
49
  "@atlaskit/editor-json-transformer": "^9.8.0",
50
- "@atlaskit/editor-plugin-block-menu": "^16.0.0",
51
- "@atlaskit/editor-plugin-connectivity": "^17.0.0",
52
- "@atlaskit/editor-plugin-quick-insert": "^17.1.0",
53
- "@atlaskit/editor-plugin-selection-extension": "^20.0.0",
54
- "@atlaskit/editor-plugin-user-preferences": "^15.0.0",
50
+ "@atlaskit/editor-plugin-block-menu": "^17.0.0",
51
+ "@atlaskit/editor-plugin-connectivity": "^18.0.0",
52
+ "@atlaskit/editor-plugin-quick-insert": "^18.0.0",
53
+ "@atlaskit/editor-plugin-selection-extension": "^21.0.0",
54
+ "@atlaskit/editor-plugin-user-preferences": "^16.0.0",
55
55
  "@atlaskit/editor-plugins": "^16.1.0",
56
56
  "@atlaskit/editor-prosemirror": "^8.0.0",
57
57
  "@atlaskit/editor-shared-styles": "^4.2.0",
58
- "@atlaskit/editor-ssr-renderer": "^12.0.0",
58
+ "@atlaskit/editor-ssr-renderer": "^13.0.0",
59
59
  "@atlaskit/editor-toolbar": "^2.6.0",
60
60
  "@atlaskit/editor-toolbar-model": "^1.2.0",
61
61
  "@atlaskit/emoji": "^72.3.0",
@@ -92,7 +92,7 @@
92
92
  "uuid": "^11.1.1"
93
93
  },
94
94
  "peerDependencies": {
95
- "@atlaskit/editor-common": "^121.5.0",
95
+ "@atlaskit/editor-common": "^122.0.0",
96
96
  "@atlaskit/link-provider": "^5.6.0",
97
97
  "@atlaskit/media-core": "^38.2.0",
98
98
  "react": "^18.2.0",
@@ -108,37 +108,37 @@
108
108
  "@atlaskit/analytics-gas-types": "^6.2.0",
109
109
  "@atlaskit/analytics-listeners": "^11.3.0",
110
110
  "@atlaskit/code": "^19.2.0",
111
- "@atlaskit/collab-provider": "^26.0.0",
111
+ "@atlaskit/collab-provider": "^27.0.0",
112
112
  "@atlaskit/docs": "^12.2.0",
113
113
  "@atlaskit/drawer": "^14.3.0",
114
- "@atlaskit/editor-plugin-alignment": "^18.0.0",
115
- "@atlaskit/editor-plugin-annotation": "^17.0.0",
116
- "@atlaskit/editor-plugin-base": "^18.0.0",
117
- "@atlaskit/editor-plugin-card": "^23.0.0",
118
- "@atlaskit/editor-plugin-code-block-advanced": "^17.0.0",
119
- "@atlaskit/editor-plugin-collab-edit": "^18.1.0",
120
- "@atlaskit/editor-plugin-content-insertion": "^17.0.0",
121
- "@atlaskit/editor-plugin-editor-viewmode": "^19.0.0",
122
- "@atlaskit/editor-plugin-extension": "^20.0.0",
123
- "@atlaskit/editor-plugin-grid": "^17.0.0",
124
- "@atlaskit/editor-plugin-guideline": "^17.0.0",
125
- "@atlaskit/editor-plugin-highlight": "^17.0.0",
126
- "@atlaskit/editor-plugin-insert-block": "^18.1.0",
127
- "@atlaskit/editor-plugin-layout": "^18.0.0",
128
- "@atlaskit/editor-plugin-limited-mode": "^14.1.0",
129
- "@atlaskit/editor-plugin-list": "^19.0.0",
130
- "@atlaskit/editor-plugin-media": "^19.2.0",
131
- "@atlaskit/editor-plugin-paste": "^18.0.0",
132
- "@atlaskit/editor-plugin-selection-marker": "^17.0.0",
133
- "@atlaskit/editor-plugin-show-diff": "^15.1.0",
134
- "@atlaskit/editor-plugin-synced-block": "^15.1.0",
135
- "@atlaskit/editor-plugin-table": "^29.1.0",
136
- "@atlaskit/editor-plugin-tasks-and-decisions": "^20.0.0",
137
- "@atlaskit/editor-plugin-text-color": "^17.0.0",
138
- "@atlaskit/editor-plugin-toolbar-lists-indentation": "^18.0.0",
139
- "@atlaskit/editor-plugin-track-changes": "^16.0.0",
140
- "@atlaskit/editor-synced-block-provider": "^13.2.0",
141
- "@atlaskit/editor-synced-block-renderer": "^15.1.0",
114
+ "@atlaskit/editor-plugin-alignment": "^19.0.0",
115
+ "@atlaskit/editor-plugin-annotation": "^18.0.0",
116
+ "@atlaskit/editor-plugin-base": "^19.0.0",
117
+ "@atlaskit/editor-plugin-card": "^24.0.0",
118
+ "@atlaskit/editor-plugin-code-block-advanced": "^18.0.0",
119
+ "@atlaskit/editor-plugin-collab-edit": "^19.0.0",
120
+ "@atlaskit/editor-plugin-content-insertion": "^18.0.0",
121
+ "@atlaskit/editor-plugin-editor-viewmode": "^20.0.0",
122
+ "@atlaskit/editor-plugin-extension": "^21.0.0",
123
+ "@atlaskit/editor-plugin-grid": "^18.0.0",
124
+ "@atlaskit/editor-plugin-guideline": "^18.0.0",
125
+ "@atlaskit/editor-plugin-highlight": "^18.0.0",
126
+ "@atlaskit/editor-plugin-insert-block": "^19.0.0",
127
+ "@atlaskit/editor-plugin-layout": "^19.0.0",
128
+ "@atlaskit/editor-plugin-limited-mode": "^15.0.0",
129
+ "@atlaskit/editor-plugin-list": "^20.0.0",
130
+ "@atlaskit/editor-plugin-media": "^20.0.0",
131
+ "@atlaskit/editor-plugin-paste": "^19.0.0",
132
+ "@atlaskit/editor-plugin-selection-marker": "^18.0.0",
133
+ "@atlaskit/editor-plugin-show-diff": "^16.0.0",
134
+ "@atlaskit/editor-plugin-synced-block": "^16.0.0",
135
+ "@atlaskit/editor-plugin-table": "^30.0.0",
136
+ "@atlaskit/editor-plugin-tasks-and-decisions": "^21.0.0",
137
+ "@atlaskit/editor-plugin-text-color": "^18.0.0",
138
+ "@atlaskit/editor-plugin-toolbar-lists-indentation": "^19.0.0",
139
+ "@atlaskit/editor-plugin-track-changes": "^17.0.0",
140
+ "@atlaskit/editor-synced-block-provider": "^14.0.0",
141
+ "@atlaskit/editor-synced-block-renderer": "^16.0.0",
142
142
  "@atlaskit/editor-test-helpers": "workspace:^",
143
143
  "@atlaskit/form": "^17.2.0",
144
144
  "@atlaskit/link-provider": "^5.6.0",
@@ -155,7 +155,7 @@
155
155
  "@atlaskit/portal": "^6.4.0",
156
156
  "@atlaskit/profilecard": "^26.23.0",
157
157
  "@atlaskit/radio": "^10.2.0",
158
- "@atlaskit/renderer": "^139.1.0",
158
+ "@atlaskit/renderer": "^140.0.0",
159
159
  "@atlaskit/section-message": "^10.2.0",
160
160
  "@atlaskit/spinner": "^20.4.0",
161
161
  "@atlaskit/synchrony-test-helpers": "workspace:^",
@@ -166,11 +166,11 @@
166
166
  "@atlassian/a11y-jest-testing": "^0.17.0",
167
167
  "@atlassian/a11y-playwright-testing": "^0.12.0",
168
168
  "@atlassian/adf-schema-json": "^1.35.0",
169
- "@atlassian/editor-rovo-bridge": "^15.1.0",
169
+ "@atlassian/editor-rovo-bridge": "^16.0.0",
170
170
  "@atlassian/experiment-test-utils": "^0.2.0",
171
171
  "@atlassian/feature-flags-test-utils": "^1.3.0",
172
172
  "@atlassian/search-client": "^2.27.0",
173
- "@atlassian/search-provider": "^18.0.0",
173
+ "@atlassian/search-provider": "^19.0.0",
174
174
  "@atlassian/structured-docs-types": "workspace:^",
175
175
  "@atlassian/testing-library": "^0.11.0",
176
176
  "@atlassian/user-profile-card": "^1.37.0",