@atlaskit/editor-core 223.1.1 → 223.1.3

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,21 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 223.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`60bbe3aea8c6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/60bbe3aea8c6e) -
8
+ Register the page editor view's dom with insm so the insm measured event can report editorDomSize.
9
+ Secondary editors on the page (comment, chromeless, and editors nested inside a legacy content
10
+ extension) do not register. Behind the platform_editor_insm_dom_node_count experiment.
11
+ - Updated dependencies
12
+
13
+ ## 223.1.2
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 223.1.1
4
20
 
5
21
  ### Patch Changes
@@ -83,6 +83,9 @@
83
83
  {
84
84
  "path": "../../../design-system/icon/afm-cc/tsconfig.json"
85
85
  },
86
+ {
87
+ "path": "../../insm/afm-cc/tsconfig.json"
88
+ },
86
89
  {
87
90
  "path": "../../../design-system/link/afm-cc/tsconfig.json"
88
91
  },
@@ -35,6 +35,7 @@ var _view = require("@atlaskit/editor-prosemirror/view");
35
35
  var _editorSsrRenderer = require("@atlaskit/editor-ssr-renderer");
36
36
  var _createSsrEditorState = require("@atlaskit/editor-ssr-renderer/create-ssr-editor-state");
37
37
  var _createSsrPmPlugins = require("@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins");
38
+ var _api = require("@atlaskit/insm/api");
38
39
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
39
40
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
40
41
  var _customData = require("@atlaskit/react-ufo/custom-data");
@@ -950,6 +951,29 @@ function ReactEditorView(props) {
950
951
  }
951
952
  }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump]);
952
953
  var isPageAppearance = (0, _isFullPage.isFullPage)(nextAppearance) || nextAppearance === 'max';
954
+
955
+ // insm measures a page, so only the page's own editor reports its dom size -- not a
956
+ // secondary editor such as a comment editor, or one nested inside a legacy content
957
+ // extension. This runs as an effect rather than from handleEditorViewRef because
958
+ // `isNestedEditor` is only resolved once `editorRef` is attached, which happens after
959
+ // the mount node's ref callback.
960
+ (0, _react.useEffect)(function () {
961
+ if (!editorView || isNestedEditor.current || !isPageAppearance) {
962
+ return;
963
+ }
964
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insm_dom_node_count')) {
965
+ return;
966
+ }
967
+
968
+ // insm has no reference to the editor, so the element it measures for `editorDomSize`
969
+ // on session events is provided here. It's captured rather than read again on cleanup,
970
+ // as the view is destroyed by then.
971
+ var editorDom = editorView.dom;
972
+ _api.insm.registerEditorDom(editorDom);
973
+ return function () {
974
+ _api.insm.unregisterEditorDom(editorDom);
975
+ };
976
+ }, [editorView, isPageAppearance]);
953
977
  var createEditor = (0, _react.useCallback)(function (assistiveLabel, assistiveDescribedBy) {
954
978
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('cc_editor_focus_before_editor_on_load') && /*#__PURE__*/_react.default.createElement("div", {
955
979
  tabIndex: -1,
@@ -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.1.0";
9
+ var version = exports.version = "223.1.2";
@@ -24,6 +24,7 @@ import { EditorView } from '@atlaskit/editor-prosemirror/view';
24
24
  import { EditorSSRRenderer } from '@atlaskit/editor-ssr-renderer';
25
25
  import { createSSREditorState } from '@atlaskit/editor-ssr-renderer/create-ssr-editor-state';
26
26
  import { createSSRPMPlugins } from '@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins';
27
+ import { insm } from '@atlaskit/insm/api';
27
28
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
28
29
  import { fg } from '@atlaskit/platform-feature-flags';
29
30
  import { addUFOCustomData } from '@atlaskit/react-ufo/custom-data';
@@ -880,6 +881,29 @@ export function ReactEditorView(props) {
880
881
  }
881
882
  }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump]);
882
883
  const isPageAppearance = isFullPage(nextAppearance) || nextAppearance === 'max';
884
+
885
+ // insm measures a page, so only the page's own editor reports its dom size -- not a
886
+ // secondary editor such as a comment editor, or one nested inside a legacy content
887
+ // extension. This runs as an effect rather than from handleEditorViewRef because
888
+ // `isNestedEditor` is only resolved once `editorRef` is attached, which happens after
889
+ // the mount node's ref callback.
890
+ useEffect(() => {
891
+ if (!editorView || isNestedEditor.current || !isPageAppearance) {
892
+ return;
893
+ }
894
+ if (!isExperimentEnabled('platform_editor_insm_dom_node_count')) {
895
+ return;
896
+ }
897
+
898
+ // insm has no reference to the editor, so the element it measures for `editorDomSize`
899
+ // on session events is provided here. It's captured rather than read again on cleanup,
900
+ // as the view is destroyed by then.
901
+ const editorDom = editorView.dom;
902
+ insm.registerEditorDom(editorDom);
903
+ return () => {
904
+ insm.unregisterEditorDom(editorDom);
905
+ };
906
+ }, [editorView, isPageAppearance]);
883
907
  const createEditor = useCallback((assistiveLabel, assistiveDescribedBy) => {
884
908
  return /*#__PURE__*/React.createElement(React.Fragment, null, fg('cc_editor_focus_before_editor_on_load') && /*#__PURE__*/React.createElement("div", {
885
909
  tabIndex: -1,
@@ -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.1.0";
3
+ export const version = "223.1.2";
@@ -32,6 +32,7 @@ import { EditorView } from '@atlaskit/editor-prosemirror/view';
32
32
  import { EditorSSRRenderer } from '@atlaskit/editor-ssr-renderer';
33
33
  import { createSSREditorState } from '@atlaskit/editor-ssr-renderer/create-ssr-editor-state';
34
34
  import { createSSRPMPlugins } from '@atlaskit/editor-ssr-renderer/create-ssr-pm-plugins';
35
+ import { insm } from '@atlaskit/insm/api';
35
36
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
36
37
  import { fg } from '@atlaskit/platform-feature-flags';
37
38
  import { addUFOCustomData } from '@atlaskit/react-ufo/custom-data';
@@ -941,6 +942,29 @@ export function ReactEditorView(props) {
941
942
  }
942
943
  }, [createEditorView, onEditorCreated, eventDispatcher, onEditorDestroyed, handleAnalyticsEvent, mitigateScrollJump]);
943
944
  var isPageAppearance = isFullPage(nextAppearance) || nextAppearance === 'max';
945
+
946
+ // insm measures a page, so only the page's own editor reports its dom size -- not a
947
+ // secondary editor such as a comment editor, or one nested inside a legacy content
948
+ // extension. This runs as an effect rather than from handleEditorViewRef because
949
+ // `isNestedEditor` is only resolved once `editorRef` is attached, which happens after
950
+ // the mount node's ref callback.
951
+ useEffect(function () {
952
+ if (!editorView || isNestedEditor.current || !isPageAppearance) {
953
+ return;
954
+ }
955
+ if (!isExperimentEnabled('platform_editor_insm_dom_node_count')) {
956
+ return;
957
+ }
958
+
959
+ // insm has no reference to the editor, so the element it measures for `editorDomSize`
960
+ // on session events is provided here. It's captured rather than read again on cleanup,
961
+ // as the view is destroyed by then.
962
+ var editorDom = editorView.dom;
963
+ insm.registerEditorDom(editorDom);
964
+ return function () {
965
+ insm.unregisterEditorDom(editorDom);
966
+ };
967
+ }, [editorView, isPageAppearance]);
944
968
  var createEditor = useCallback(function (assistiveLabel, assistiveDescribedBy) {
945
969
  return /*#__PURE__*/React.createElement(React.Fragment, null, fg('cc_editor_focus_before_editor_on_load') && /*#__PURE__*/React.createElement("div", {
946
970
  tabIndex: -1,
@@ -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.1.0";
3
+ export var version = "223.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "223.1.1",
3
+ "version": "223.1.3",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -59,6 +59,7 @@
59
59
  "@atlaskit/emoji": "^71.16.0",
60
60
  "@atlaskit/feature-gate-js-client": "^6.0.0",
61
61
  "@atlaskit/icon": "^37.3.0",
62
+ "@atlaskit/insm": "^1.3.0",
62
63
  "@atlaskit/link": "^5.0.0",
63
64
  "@atlaskit/media-card": "^81.6.0",
64
65
  "@atlaskit/mention": "^27.15.0",
@@ -66,10 +67,10 @@
66
67
  "@atlaskit/platform-feature-flags": "^2.1.0",
67
68
  "@atlaskit/platform-feature-flags-react": "^1.1.0",
68
69
  "@atlaskit/react-compiler-gating": "^0.2.0",
69
- "@atlaskit/react-ufo": "^7.4.0",
70
+ "@atlaskit/react-ufo": "^7.5.0",
70
71
  "@atlaskit/task-decision": "^21.8.0",
71
- "@atlaskit/tmp-editor-statsig": "^146.0.0",
72
- "@atlaskit/tokens": "^16.6.0",
72
+ "@atlaskit/tmp-editor-statsig": "^147.0.0",
73
+ "@atlaskit/tokens": "^16.7.0",
73
74
  "@atlaskit/tooltip": "^24.0.0",
74
75
  "@atlaskit/width-detector": "^7.0.0",
75
76
  "@babel/runtime": "^7.0.0",
@@ -100,7 +101,7 @@
100
101
  "@atlaskit/adf-utils": "^20.5.0",
101
102
  "@atlaskit/analytics-listeners": "^11.1.0",
102
103
  "@atlaskit/code": "^19.0.0",
103
- "@atlaskit/collab-provider": "^23.0.0",
104
+ "@atlaskit/collab-provider": "^23.1.0",
104
105
  "@atlaskit/editor-plugin-annotation": "^14.0.0",
105
106
  "@atlaskit/editor-plugin-card": "^20.0.0",
106
107
  "@atlaskit/editor-plugin-list": "^16.0.0",