@atlaskit/editor-plugin-code-block-advanced 23.0.0 → 24.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,21 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 24.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e7cc9c65c49ee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e7cc9c65c49ee) -
8
+ Updated codeblock cleanup hook to also call destroy method of the codemirror instance. This
9
+ reduces the event listener and dom element count which increases each time a code block is added
10
+ and removed
11
+ - Updated dependencies
12
+
13
+ ## 23.0.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 23.0.0
4
20
 
5
21
  ### Patch Changes
@@ -19,6 +19,7 @@ var _messages = require("@atlaskit/editor-common/messages");
19
19
  var _whitespace = require("@atlaskit/editor-common/whitespace");
20
20
  var _state2 = require("@atlaskit/editor-prosemirror/state");
21
21
  var _view2 = require("@atlaskit/editor-prosemirror/view");
22
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
22
23
  var _fg = require("@atlaskit/platform-feature-flags/fg");
23
24
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
25
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
@@ -210,6 +211,9 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
210
211
  (_this$cleanupBorderAr2 = this.cleanupBorderAreaClick) === null || _this$cleanupBorderAr2 === void 0 || _this$cleanupBorderAr2.call(this);
211
212
  (_this$cleanupDisabled = this.cleanupDisabledState) === null || _this$cleanupDisabled === void 0 || _this$cleanupDisabled.call(this);
212
213
  (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 || _this$unsubscribeCont.call(this);
214
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks')) {
215
+ this.cm.destroy();
216
+ }
213
217
  }
214
218
  }, {
215
219
  key: "forwardUpdate",
@@ -9,6 +9,7 @@ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
9
9
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
10
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
12
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
12
13
  import { fg } from '@atlaskit/platform-feature-flags/fg';
13
14
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
15
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
@@ -183,6 +184,9 @@ class CodeBlockAdvancedNodeView {
183
184
  (_this$cleanupBorderAr2 = this.cleanupBorderAreaClick) === null || _this$cleanupBorderAr2 === void 0 ? void 0 : _this$cleanupBorderAr2.call(this);
184
185
  (_this$cleanupDisabled = this.cleanupDisabledState) === null || _this$cleanupDisabled === void 0 ? void 0 : _this$cleanupDisabled.call(this);
185
186
  (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 ? void 0 : _this$unsubscribeCont.call(this);
187
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
188
+ this.cm.destroy();
189
+ }
186
190
  }
187
191
  forwardUpdate(update) {
188
192
  var _this$getPos, _this$getPos2;
@@ -14,6 +14,7 @@ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
14
14
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
15
15
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
16
16
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
17
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
17
18
  import { fg } from '@atlaskit/platform-feature-flags/fg';
18
19
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
20
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
@@ -203,6 +204,9 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
203
204
  (_this$cleanupBorderAr2 = this.cleanupBorderAreaClick) === null || _this$cleanupBorderAr2 === void 0 || _this$cleanupBorderAr2.call(this);
204
205
  (_this$cleanupDisabled = this.cleanupDisabledState) === null || _this$cleanupDisabled === void 0 || _this$cleanupDisabled.call(this);
205
206
  (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 || _this$unsubscribeCont.call(this);
207
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
208
+ this.cm.destroy();
209
+ }
206
210
  }
207
211
  }, {
208
212
  key: "forwardUpdate",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "23.0.0",
3
+ "version": "24.0.0",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -22,16 +22,17 @@
22
22
  "dependencies": {
23
23
  "@atlaskit/adf-schema": "^57.6.0",
24
24
  "@atlaskit/code": "^20.0.0",
25
- "@atlaskit/editor-plugin-analytics": "^23.0.0",
26
- "@atlaskit/editor-plugin-code-block": "^25.0.0",
27
- "@atlaskit/editor-plugin-editor-disabled": "^23.0.0",
28
- "@atlaskit/editor-plugin-find-replace": "^23.0.0",
29
- "@atlaskit/editor-plugin-selection": "^23.0.0",
30
- "@atlaskit/editor-plugin-selection-marker": "^23.0.0",
25
+ "@atlaskit/editor-plugin-analytics": "^24.0.0",
26
+ "@atlaskit/editor-plugin-code-block": "^26.0.0",
27
+ "@atlaskit/editor-plugin-editor-disabled": "^24.0.0",
28
+ "@atlaskit/editor-plugin-find-replace": "^24.0.0",
29
+ "@atlaskit/editor-plugin-selection": "^24.0.0",
30
+ "@atlaskit/editor-plugin-selection-marker": "^24.0.0",
31
31
  "@atlaskit/editor-prosemirror": "^9.0.0",
32
+ "@atlaskit/platform-feature-experiments": "^0.3.0",
32
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
33
34
  "@atlaskit/prosemirror-history": "^1.3.0",
34
- "@atlaskit/tmp-editor-statsig": "^219.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^220.0.0",
35
36
  "@atlaskit/tokens": "^20.1.0",
36
37
  "@babel/runtime": "^7.0.0",
37
38
  "@codemirror/autocomplete": "6.18.4",
@@ -50,7 +51,7 @@
50
51
  "codemirror-lang-mermaid": "0.4.0"
51
52
  },
52
53
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^127.0.0",
54
+ "@atlaskit/editor-common": "^128.0.0",
54
55
  "react": "^18.2.0 || ^19.2.0",
55
56
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
56
57
  },
@@ -30,6 +30,7 @@ import type {
30
30
  NodeView,
31
31
  } from '@atlaskit/editor-prosemirror/view';
32
32
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
33
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
33
34
  import { fg } from '@atlaskit/platform-feature-flags/fg';
34
35
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
35
36
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
@@ -239,6 +240,9 @@ class CodeBlockAdvancedNodeView implements NodeView {
239
240
  this.cleanupBorderAreaClick?.();
240
241
  this.cleanupDisabledState?.();
241
242
  this.unsubscribeContentFormat?.();
243
+ if (isExperimentEnabled('platform_editor_reduce_memory_leaks')) {
244
+ this.cm.destroy();
245
+ }
242
246
  }
243
247
 
244
248
  forwardUpdate(update: ViewUpdate): void {