@atlaskit/editor-plugin-code-bidi-warning 1.3.1 → 2.0.0

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,35 @@
1
1
  # @atlaskit/editor-plugin-code-bidi-warning
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
8
+ [`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
9
+ This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
10
+ status of only supporting React 18 going forward. No explicit breaking change to React support has
11
+ been made in this release, but this is to signify going forward, breaking changes for React 16 or
12
+ React 17 may come via non-major semver releases.
13
+
14
+ Please refer this community post for more details:
15
+ https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
21
+ ## 1.4.0
22
+
23
+ ### Minor Changes
24
+
25
+ - [#105322](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105322)
26
+ [`8876083532adc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8876083532adc) -
27
+ Bumped editor-prosemirror version to 7.0.0
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies
32
+
3
33
  ## 1.3.1
4
34
 
5
35
  ### Patch Changes
@@ -8,13 +8,11 @@ exports.createBidiWarningsDecorationSetFromDoc = createBidiWarningsDecorationSet
8
8
  exports.pluginFactoryCreator = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
- var _reactDom = _interopRequireDefault(require("react-dom"));
12
11
  var _v = _interopRequireDefault(require("uuid/v4"));
13
12
  var _bidiWarning = _interopRequireDefault(require("@atlaskit/code/bidi-warning"));
14
13
  var _bidiWarningDecorator = _interopRequireDefault(require("@atlaskit/code/bidi-warning-decorator"));
15
14
  var _utils = require("@atlaskit/editor-common/utils");
16
15
  var _view = require("@atlaskit/editor-prosemirror/view");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
16
  var _pluginKey = require("./plugin-key");
19
17
  var _reducer = _interopRequireDefault(require("./reducer"));
20
18
  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; }
@@ -85,7 +83,7 @@ function createBidiWarningsDecorationSetFromDoc(_ref) {
85
83
  var position = _ref4.position,
86
84
  bidiCharacter = _ref4.bidiCharacter;
87
85
  var renderKey = (0, _v.default)();
88
- return _view.Decoration.widget(position, function () {
86
+ return _view.Decoration.widget(position, function (el) {
89
87
  return renderDOM({
90
88
  bidiCharacter: bidiCharacter,
91
89
  codeBidiWarningLabel: codeBidiWarningLabel,
@@ -94,10 +92,18 @@ function createBidiWarningsDecorationSetFromDoc(_ref) {
94
92
  renderKey: renderKey
95
93
  });
96
94
  }, {
97
- destroy: function destroy() {
98
- if ((0, _platformFeatureFlags.fg)('platform_editor_react18_plugin_portalprovider')) {
99
- nodeViewPortalProviderAPI.remove(renderKey);
100
- }
95
+ destroy: function destroy(el) {
96
+ // removing portalprovider clean up due to a rendering bug
97
+ // with this plugin under React 18. This matches the previous
98
+ // React 16 behaviour which never cleaned up rendering.
99
+ //
100
+ // This will mean CodeBidi instances are not cleaned up, but
101
+ // this is expected to be minimal due to the low frequency of
102
+ // bidi characters in code blocks.
103
+ //
104
+ // We will fix this in a follow up ticket to rewrite the plugin
105
+ // to use pure toDOM -> ED-26540
106
+ // nodeViewPortalProviderAPI.remove(renderKey);
101
107
  }
102
108
  });
103
109
  }));
@@ -110,24 +116,13 @@ function renderDOM(_ref5) {
110
116
  nodeViewPortalProviderAPI = _ref5.nodeViewPortalProviderAPI,
111
117
  renderKey = _ref5.renderKey;
112
118
  var element = document.createElement('span');
113
- if ((0, _platformFeatureFlags.fg)('platform_editor_react18_plugin_portalprovider')) {
114
- nodeViewPortalProviderAPI.render(function () {
115
- return /*#__PURE__*/_react.default.createElement(_bidiWarning.default, {
116
- bidiCharacter: bidiCharacter,
117
- skipChildren: true,
118
- label: codeBidiWarningLabel,
119
- tooltipEnabled: tooltipEnabled
120
- });
121
- }, element, renderKey);
122
- } else {
123
- // Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
124
- // we should investigate if there is a memory leak with such usage.
125
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(_bidiWarning.default, {
119
+ nodeViewPortalProviderAPI.render(function () {
120
+ return /*#__PURE__*/_react.default.createElement(_bidiWarning.default, {
126
121
  bidiCharacter: bidiCharacter,
127
122
  skipChildren: true,
128
123
  label: codeBidiWarningLabel,
129
124
  tooltipEnabled: tooltipEnabled
130
- }), element);
131
- }
125
+ });
126
+ }, element, renderKey);
132
127
  return element;
133
128
  }
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
- import ReactDOM from 'react-dom';
3
2
  import uuid from 'uuid/v4';
4
3
  import CodeBidiWarning from '@atlaskit/code/bidi-warning';
5
4
  import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
6
5
  import { pluginFactory, stepHasSlice } from '@atlaskit/editor-common/utils';
7
6
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
7
  import { codeBidiWarningPluginKey } from './plugin-key';
10
8
  import reducer from './reducer';
11
9
  export const pluginFactoryCreator = nodeViewPortalProviderAPI => pluginFactory(codeBidiWarningPluginKey, reducer, {
@@ -75,17 +73,25 @@ export function createBidiWarningsDecorationSetFromDoc({
75
73
  bidiCharacter
76
74
  }) => {
77
75
  const renderKey = uuid();
78
- return Decoration.widget(position, () => renderDOM({
76
+ return Decoration.widget(position, el => renderDOM({
79
77
  bidiCharacter,
80
78
  codeBidiWarningLabel,
81
79
  tooltipEnabled,
82
80
  nodeViewPortalProviderAPI,
83
81
  renderKey
84
82
  }), {
85
- destroy: () => {
86
- if (fg('platform_editor_react18_plugin_portalprovider')) {
87
- nodeViewPortalProviderAPI.remove(renderKey);
88
- }
83
+ destroy: el => {
84
+ // removing portalprovider clean up due to a rendering bug
85
+ // with this plugin under React 18. This matches the previous
86
+ // React 16 behaviour which never cleaned up rendering.
87
+ //
88
+ // This will mean CodeBidi instances are not cleaned up, but
89
+ // this is expected to be minimal due to the low frequency of
90
+ // bidi characters in code blocks.
91
+ //
92
+ // We will fix this in a follow up ticket to rewrite the plugin
93
+ // to use pure toDOM -> ED-26540
94
+ // nodeViewPortalProviderAPI.remove(renderKey);
89
95
  }
90
96
  });
91
97
  }));
@@ -99,22 +105,11 @@ function renderDOM({
99
105
  renderKey
100
106
  }) {
101
107
  const element = document.createElement('span');
102
- if (fg('platform_editor_react18_plugin_portalprovider')) {
103
- nodeViewPortalProviderAPI.render(() => /*#__PURE__*/React.createElement(CodeBidiWarning, {
104
- bidiCharacter: bidiCharacter,
105
- skipChildren: true,
106
- label: codeBidiWarningLabel,
107
- tooltipEnabled: tooltipEnabled
108
- }), element, renderKey);
109
- } else {
110
- // Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
111
- // we should investigate if there is a memory leak with such usage.
112
- ReactDOM.render( /*#__PURE__*/React.createElement(CodeBidiWarning, {
113
- bidiCharacter: bidiCharacter,
114
- skipChildren: true,
115
- label: codeBidiWarningLabel,
116
- tooltipEnabled: tooltipEnabled
117
- }), element);
118
- }
108
+ nodeViewPortalProviderAPI.render(() => /*#__PURE__*/React.createElement(CodeBidiWarning, {
109
+ bidiCharacter: bidiCharacter,
110
+ skipChildren: true,
111
+ label: codeBidiWarningLabel,
112
+ tooltipEnabled: tooltipEnabled
113
+ }), element, renderKey);
119
114
  return element;
120
115
  }
@@ -2,13 +2,11 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import React from 'react';
5
- import ReactDOM from 'react-dom';
6
5
  import uuid from 'uuid/v4';
7
6
  import CodeBidiWarning from '@atlaskit/code/bidi-warning';
8
7
  import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
9
8
  import { pluginFactory, stepHasSlice } from '@atlaskit/editor-common/utils';
10
9
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
10
  import { codeBidiWarningPluginKey } from './plugin-key';
13
11
  import reducer from './reducer';
14
12
  export var pluginFactoryCreator = function pluginFactoryCreator(nodeViewPortalProviderAPI) {
@@ -77,7 +75,7 @@ export function createBidiWarningsDecorationSetFromDoc(_ref) {
77
75
  var position = _ref4.position,
78
76
  bidiCharacter = _ref4.bidiCharacter;
79
77
  var renderKey = uuid();
80
- return Decoration.widget(position, function () {
78
+ return Decoration.widget(position, function (el) {
81
79
  return renderDOM({
82
80
  bidiCharacter: bidiCharacter,
83
81
  codeBidiWarningLabel: codeBidiWarningLabel,
@@ -86,10 +84,18 @@ export function createBidiWarningsDecorationSetFromDoc(_ref) {
86
84
  renderKey: renderKey
87
85
  });
88
86
  }, {
89
- destroy: function destroy() {
90
- if (fg('platform_editor_react18_plugin_portalprovider')) {
91
- nodeViewPortalProviderAPI.remove(renderKey);
92
- }
87
+ destroy: function destroy(el) {
88
+ // removing portalprovider clean up due to a rendering bug
89
+ // with this plugin under React 18. This matches the previous
90
+ // React 16 behaviour which never cleaned up rendering.
91
+ //
92
+ // This will mean CodeBidi instances are not cleaned up, but
93
+ // this is expected to be minimal due to the low frequency of
94
+ // bidi characters in code blocks.
95
+ //
96
+ // We will fix this in a follow up ticket to rewrite the plugin
97
+ // to use pure toDOM -> ED-26540
98
+ // nodeViewPortalProviderAPI.remove(renderKey);
93
99
  }
94
100
  });
95
101
  }));
@@ -102,24 +108,13 @@ function renderDOM(_ref5) {
102
108
  nodeViewPortalProviderAPI = _ref5.nodeViewPortalProviderAPI,
103
109
  renderKey = _ref5.renderKey;
104
110
  var element = document.createElement('span');
105
- if (fg('platform_editor_react18_plugin_portalprovider')) {
106
- nodeViewPortalProviderAPI.render(function () {
107
- return /*#__PURE__*/React.createElement(CodeBidiWarning, {
108
- bidiCharacter: bidiCharacter,
109
- skipChildren: true,
110
- label: codeBidiWarningLabel,
111
- tooltipEnabled: tooltipEnabled
112
- });
113
- }, element, renderKey);
114
- } else {
115
- // Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
116
- // we should investigate if there is a memory leak with such usage.
117
- ReactDOM.render( /*#__PURE__*/React.createElement(CodeBidiWarning, {
111
+ nodeViewPortalProviderAPI.render(function () {
112
+ return /*#__PURE__*/React.createElement(CodeBidiWarning, {
118
113
  bidiCharacter: bidiCharacter,
119
114
  skipChildren: true,
120
115
  label: codeBidiWarningLabel,
121
116
  tooltipEnabled: tooltipEnabled
122
- }), element);
123
- }
117
+ });
118
+ }, element, renderKey);
124
119
  return element;
125
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-bidi-warning",
3
- "version": "1.3.1",
3
+ "version": "2.0.0",
4
4
  "description": "Code bidi warning plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,16 +31,16 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/code": "^15.7.0",
35
- "@atlaskit/editor-common": "^99.7.0",
36
- "@atlaskit/editor-prosemirror": "6.2.1",
37
- "@atlaskit/platform-feature-flags": "^1.0.0",
34
+ "@atlaskit/code": "^16.0.0",
35
+ "@atlaskit/editor-common": "^100.0.0",
36
+ "@atlaskit/editor-prosemirror": "7.0.0",
37
+ "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "uuid": "^3.1.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "react": "^16.8.0 || ^17.0.0 || ~18.2.0",
43
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.2.0"
42
+ "react": "^18.2.0",
43
+ "react-dom": "^18.2.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@af/integration-testing": "*",
@@ -86,10 +86,5 @@
86
86
  "import-no-extraneous-disable-for-examples-and-docs"
87
87
  ]
88
88
  }
89
- },
90
- "platform-feature-flags": {
91
- "platform_editor_react18_plugin_portalprovider": {
92
- "type": "boolean"
93
- }
94
89
  }
95
90
  }