@atlaskit/editor-core 219.1.11 → 219.1.13

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,29 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 219.1.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 219.1.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [`673df46586c14`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/673df46586c14) -
14
+ Fix `contentComponents` / `primaryToolbarComponents` going stale after a preset reconfigure.
15
+
16
+ `ReactEditorView.reconfigureState` mutates `config.current` (a `useRef`) but didn't schedule a
17
+ re-render, so the `render` prop kept passing the pre-reconfigure component arrays to the editor's
18
+ `AppearanceComponent`. Plugins added via reconfigure (e.g. `markdownModePlugin` flipping in via
19
+ `.maybeAdd(..., isMarkdownMode)`) had their `contentComponent` / `primaryToolbarComponent` ignored
20
+ until some unrelated state change (focus, selection) re-rendered the editor view. Now bumps a
21
+ state counter at the end of `reconfigureState` to trigger a follow-up render with the
22
+ freshly-mutated config. Gated on the `cc-markdown-mode` experiment for now since that's the only
23
+ known consumer flipping plugins via `.maybeAdd` mid-life.
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 219.1.11
4
28
 
5
29
  ### Patch Changes
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.ReactEditorView = ReactEditorView;
9
9
  exports.default = void 0;
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _reactIntl = require("react-intl");
@@ -35,6 +35,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
35
35
  var _interactionIdContext = require("@atlaskit/react-ufo/interaction-id-context");
36
36
  var _interactionMetrics = require("@atlaskit/react-ufo/interaction-metrics");
37
37
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
38
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
38
39
  var _useProviders = require("../composable-editor/hooks/useProviders");
39
40
  var _featureFlagsFromProps = require("../utils/feature-flags-from-props");
40
41
  var _getNodesCount = require("../utils/getNodesCount");
@@ -354,6 +355,13 @@ function ReactEditorView(props) {
354
355
  // this.view will be destroyed when React unmounts in handleEditorViewRef
355
356
  };
356
357
  }, [eventDispatcher]);
358
+
359
+ // Bumped after `reconfigureState` so the render prop re-reads the
360
+ // in-place-mutated `config.current` (contentComponents / toolbar
361
+ // components from the rebuilt preset).
362
+ var _useState = (0, _react.useState)(0),
363
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
364
+ bumpConfigVersion = _useState2[1];
357
365
  var reconfigureState = (0, _react.useCallback)(function (props) {
358
366
  if (!viewRef.current) {
359
367
  return;
@@ -393,9 +401,18 @@ function ReactEditorView(props) {
393
401
  // need to update the state first so when the view builds the nodeviews it is
394
402
  // using the latest plugins
395
403
  viewRef.current.updateState(newState);
396
- return viewRef.current.update(_objectSpread(_objectSpread({}, viewRef.current.props), {}, {
404
+ var result = viewRef.current.update(_objectSpread(_objectSpread({}, viewRef.current.props), {}, {
397
405
  state: newState
398
406
  }));
407
+
408
+ // EDITOR-6702: gated until we have a broader gate; reconfigure is a
409
+ // low-level path so use NoExposure.
410
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('cc-markdown-mode', 'isEnabled', true)) {
411
+ bumpConfigVersion(function (v) {
412
+ return v + 1;
413
+ });
414
+ }
415
+ return result;
399
416
  }, [blur, dispatchAnalyticsEvent, eventDispatcher, dispatch, errorReporter, featureFlags]);
400
417
  var onEditorViewUpdated = (0, _react.useCallback)(function (_ref2) {
401
418
  var _config$current;
@@ -581,10 +598,10 @@ function ReactEditorView(props) {
581
598
  });
582
599
  return view;
583
600
  }, [getDirectEditorProps, dispatchAnalyticsEvent]);
584
- var _useState = (0, _react.useState)(undefined),
585
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
586
- editorView = _useState2[0],
587
- setEditorView = _useState2[1];
601
+ var _useState3 = (0, _react.useState)(undefined),
602
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
603
+ editorView = _useState4[0],
604
+ setEditorView = _useState4[1];
588
605
 
589
606
  // Detects if the editor is nested inside an extension - ie. it is a Legacy Content Extension (LCE)
590
607
  var isNestedEditor = (0, _react.useRef)(null);
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "0.0.0-development";
8
+ var version = exports.version = "219.1.12";
@@ -24,6 +24,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
24
24
  import { getInteractionId } from '@atlaskit/react-ufo/interaction-id-context';
25
25
  import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
26
26
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
27
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
27
28
  import { useProviders } from '../composable-editor/hooks/useProviders';
28
29
  import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
29
30
  import { getNodesCount } from '../utils/getNodesCount';
@@ -330,6 +331,11 @@ export function ReactEditorView(props) {
330
331
  // this.view will be destroyed when React unmounts in handleEditorViewRef
331
332
  };
332
333
  }, [eventDispatcher]);
334
+
335
+ // Bumped after `reconfigureState` so the render prop re-reads the
336
+ // in-place-mutated `config.current` (contentComponents / toolbar
337
+ // components from the rebuilt preset).
338
+ const [, bumpConfigVersion] = useState(0);
333
339
  const reconfigureState = useCallback(props => {
334
340
  if (!viewRef.current) {
335
341
  return;
@@ -366,10 +372,17 @@ export function ReactEditorView(props) {
366
372
  // need to update the state first so when the view builds the nodeviews it is
367
373
  // using the latest plugins
368
374
  viewRef.current.updateState(newState);
369
- return viewRef.current.update({
375
+ const result = viewRef.current.update({
370
376
  ...viewRef.current.props,
371
377
  state: newState
372
378
  });
379
+
380
+ // EDITOR-6702: gated until we have a broader gate; reconfigure is a
381
+ // low-level path so use NoExposure.
382
+ if (expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true)) {
383
+ bumpConfigVersion(v => v + 1);
384
+ }
385
+ return result;
373
386
  }, [blur, dispatchAnalyticsEvent, eventDispatcher, dispatch, errorReporter, featureFlags]);
374
387
  const onEditorViewUpdated = useCallback(({
375
388
  originalTransaction,
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "0.0.0-development";
2
+ export const version = "219.1.12";
@@ -1,5 +1,5 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
5
5
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -32,6 +32,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
32
32
  import { getInteractionId } from '@atlaskit/react-ufo/interaction-id-context';
33
33
  import { abortAll, getActiveInteraction } from '@atlaskit/react-ufo/interaction-metrics';
34
34
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
35
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
35
36
  import { useProviders } from '../composable-editor/hooks/useProviders';
36
37
  import { createFeatureFlagsFromProps } from '../utils/feature-flags-from-props';
37
38
  import { getNodesCount } from '../utils/getNodesCount';
@@ -345,6 +346,13 @@ export function ReactEditorView(props) {
345
346
  // this.view will be destroyed when React unmounts in handleEditorViewRef
346
347
  };
347
348
  }, [eventDispatcher]);
349
+
350
+ // Bumped after `reconfigureState` so the render prop re-reads the
351
+ // in-place-mutated `config.current` (contentComponents / toolbar
352
+ // components from the rebuilt preset).
353
+ var _useState = useState(0),
354
+ _useState2 = _slicedToArray(_useState, 2),
355
+ bumpConfigVersion = _useState2[1];
348
356
  var reconfigureState = useCallback(function (props) {
349
357
  if (!viewRef.current) {
350
358
  return;
@@ -384,9 +392,18 @@ export function ReactEditorView(props) {
384
392
  // need to update the state first so when the view builds the nodeviews it is
385
393
  // using the latest plugins
386
394
  viewRef.current.updateState(newState);
387
- return viewRef.current.update(_objectSpread(_objectSpread({}, viewRef.current.props), {}, {
395
+ var result = viewRef.current.update(_objectSpread(_objectSpread({}, viewRef.current.props), {}, {
388
396
  state: newState
389
397
  }));
398
+
399
+ // EDITOR-6702: gated until we have a broader gate; reconfigure is a
400
+ // low-level path so use NoExposure.
401
+ if (expValEqualsNoExposure('cc-markdown-mode', 'isEnabled', true)) {
402
+ bumpConfigVersion(function (v) {
403
+ return v + 1;
404
+ });
405
+ }
406
+ return result;
390
407
  }, [blur, dispatchAnalyticsEvent, eventDispatcher, dispatch, errorReporter, featureFlags]);
391
408
  var onEditorViewUpdated = useCallback(function (_ref2) {
392
409
  var _config$current;
@@ -572,10 +589,10 @@ export function ReactEditorView(props) {
572
589
  });
573
590
  return view;
574
591
  }, [getDirectEditorProps, dispatchAnalyticsEvent]);
575
- var _useState = useState(undefined),
576
- _useState2 = _slicedToArray(_useState, 2),
577
- editorView = _useState2[0],
578
- setEditorView = _useState2[1];
592
+ var _useState3 = useState(undefined),
593
+ _useState4 = _slicedToArray(_useState3, 2),
594
+ editorView = _useState4[0],
595
+ setEditorView = _useState4[1];
579
596
 
580
597
  // Detects if the editor is nested inside an extension - ie. it is a Legacy Content Extension (LCE)
581
598
  var isNestedEditor = useRef(null);
@@ -1,2 +1,2 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "0.0.0-development";
2
+ export var version = "219.1.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "219.1.11",
3
+ "version": "219.1.13",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@atlaskit/activity-provider": "^2.5.0",
49
- "@atlaskit/adf-schema": "^52.6.0",
49
+ "@atlaskit/adf-schema": "^52.7.0",
50
50
  "@atlaskit/afm-i18n-platform-editor-editor-core": "2.10.0",
51
51
  "@atlaskit/analytics-namespaced-context": "^7.2.0",
52
52
  "@atlaskit/analytics-next": "^11.2.0",
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/editor-plugin-connectivity": "^10.0.0",
59
59
  "@atlaskit/editor-plugin-quick-insert": "^10.2.0",
60
60
  "@atlaskit/editor-plugin-user-preferences": "^8.0.0",
61
- "@atlaskit/editor-plugins": "^13.0.0",
61
+ "@atlaskit/editor-plugins": "^13.1.0",
62
62
  "@atlaskit/editor-prosemirror": "^7.3.0",
63
63
  "@atlaskit/editor-shared-styles": "^3.10.0",
64
64
  "@atlaskit/editor-ssr-renderer": "^5.1.0",
@@ -68,13 +68,13 @@
68
68
  "@atlaskit/feature-gate-js-client": "^5.5.0",
69
69
  "@atlaskit/icon": "^34.3.0",
70
70
  "@atlaskit/link": "^3.4.0",
71
- "@atlaskit/media-card": "^80.3.0",
71
+ "@atlaskit/media-card": "^80.4.0",
72
72
  "@atlaskit/mention": "^25.0.0",
73
73
  "@atlaskit/platform-feature-flags": "^1.1.0",
74
74
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
75
- "@atlaskit/react-ufo": "^5.17.0",
75
+ "@atlaskit/react-ufo": "^5.18.0",
76
76
  "@atlaskit/task-decision": "^20.0.0",
77
- "@atlaskit/tmp-editor-statsig": "^73.0.0",
77
+ "@atlaskit/tmp-editor-statsig": "^74.0.0",
78
78
  "@atlaskit/tokens": "^13.0.0",
79
79
  "@atlaskit/tooltip": "^21.2.0",
80
80
  "@atlaskit/width-detector": "^5.1.0",
@@ -91,7 +91,7 @@
91
91
  "uuid": "^3.1.0"
92
92
  },
93
93
  "peerDependencies": {
94
- "@atlaskit/editor-common": "^114.13.0",
94
+ "@atlaskit/editor-common": "^114.15.0",
95
95
  "@atlaskit/link-provider": "^4.3.0",
96
96
  "@atlaskit/media-core": "^37.0.0",
97
97
  "react": "^18.2.0",
@@ -102,7 +102,7 @@
102
102
  "@af/editor-libra": "workspace:^",
103
103
  "@af/suppress-react-warnings": "workspace:^",
104
104
  "@af/visual-regression": "workspace:^",
105
- "@atlaskit/adf-utils": "^19.27.0",
105
+ "@atlaskit/adf-utils": "^19.28.0",
106
106
  "@atlaskit/analytics-listeners": "^10.0.0",
107
107
  "@atlaskit/collab-provider": "^18.1.0",
108
108
  "@atlaskit/editor-plugin-annotation": "^10.1.0",
@@ -128,7 +128,7 @@
128
128
  "@atlassian/editor-rovo-bridge": "^8.4.0",
129
129
  "@atlassian/feature-flags-test-utils": "^1.0.0",
130
130
  "@atlassian/react-compiler-gating": "workspace:^",
131
- "@atlassian/search-client": "^1.5.0",
131
+ "@atlassian/search-client": "^1.6.0",
132
132
  "@atlassian/search-provider": "^11.0.0",
133
133
  "@atlassian/structured-docs-types": "workspace:^",
134
134
  "@emotion/jest": "^11.8.0",