@atlaskit/editor-plugin-code-block-advanced 12.0.15 → 12.0.17

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-plugin-code-block-advanced
2
2
 
3
+ ## 12.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 12.0.16
10
+
11
+ ### Patch Changes
12
+
13
+ - [`46ee61dd53e91`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/46ee61dd53e91) -
14
+ Remove stale experiment confluence_compact_text_format (FFCLEANUP-85812): inline final values
15
+ (flag enabled), simplify conditions, remove experiment config entries.
16
+ - Updated dependencies
17
+
3
18
  ## 12.0.15
4
19
 
5
20
  ### Patch Changes
@@ -38,13 +38,8 @@ var _prosemirrorDecorations = require("./extensions/prosemirrorDecorations");
38
38
  var _tripleClickExtension = require("./extensions/tripleClickExtension");
39
39
  var _getLanguageName = _interopRequireDefault(require("./languages/getLanguageName"));
40
40
  var _loader = require("./languages/loader");
41
- 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; } } }; }
42
- 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; } }
43
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
44
41
  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; }
45
42
  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) { (0, _defineProperty2.default)(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; }
46
- // Store last observed heights of code blocks
47
- var codeBlockHeights = new WeakMap();
48
43
  // Based on: https://prosemirror.net/examples/codemirror/
49
44
  var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
50
45
  function CodeBlockAdvancedNodeView(node, view, getPos, innerDecorations, config) {
@@ -116,8 +111,8 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
116
111
  this.node = node;
117
112
  this.view = view;
118
113
  this.getPos = getPos;
119
- var contentFormatSharedState = (0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) ? (_config$api = config.api) === null || _config$api === void 0 || (_config$api = _config$api.contentFormat) === null || _config$api === void 0 ? void 0 : _config$api.sharedState : undefined;
120
- this.contentMode = (0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) ? contentFormatSharedState === null || contentFormatSharedState === void 0 || (_contentFormatSharedS = contentFormatSharedState.currentState) === null || _contentFormatSharedS === void 0 || (_contentFormatSharedS = _contentFormatSharedS.call(contentFormatSharedState)) === null || _contentFormatSharedS === void 0 ? void 0 : _contentFormatSharedS.contentMode : undefined;
114
+ var contentFormatSharedState = (_config$api = config.api) === null || _config$api === void 0 || (_config$api = _config$api.contentFormat) === null || _config$api === void 0 ? void 0 : _config$api.sharedState;
115
+ this.contentMode = contentFormatSharedState === null || contentFormatSharedState === void 0 || (_contentFormatSharedS = contentFormatSharedState.currentState) === null || _contentFormatSharedS === void 0 || (_contentFormatSharedS = _contentFormatSharedS.call(contentFormatSharedState)) === null || _contentFormatSharedS === void 0 ? void 0 : _contentFormatSharedS.contentMode;
121
116
  this.selectionAPI = (_config$api2 = config.api) === null || _config$api2 === void 0 || (_config$api2 = _config$api2.selection) === null || _config$api2 === void 0 ? void 0 : _config$api2.actions;
122
117
  var getNode = function getNode() {
123
118
  return _this.node;
@@ -153,7 +148,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
153
148
  }),
154
149
  // Goes before cmTheme to override styles
155
150
  config.allowCodeFolding ? [_theme.codeFoldingTheme] : [], this.themeCompartment.of((0, _theme.cmTheme)({
156
- contentMode: (0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) ? this.contentMode : undefined
151
+ contentMode: this.contentMode
157
152
  })), (0, _language.syntaxHighlighting)(_syntaxHighlightingTheme.highlightStyle), (0, _language.bracketMatching)(), (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? this.lineNumbersCompartment.of(this.getLineNumberVisibilityExtensions(node)) : this.getLineNumberExtensions(),
158
153
  // Explicitly disable "sticky" positioning on all gutters to match
159
154
  // Renderer behaviour.
@@ -204,41 +199,6 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
204
199
  _this.cm.requestMeasure();
205
200
  });
206
201
  }
207
-
208
- // Observe size changes of the CodeMirror DOM and request a measurement pass
209
- if (!(0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) && (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp')) {
210
- this.ro = new ResizeObserver(function (entries) {
211
- // Skip measurements when:
212
- // 1. Currently updating (prevents feedback loops)
213
- // 2. CodeMirror has focus (user is actively typing/editing)
214
- if (_this.updating || _this.cm.hasFocus) {
215
- return;
216
- }
217
-
218
- // Only trigger on height changes, not width or other dimension changes
219
- var _iterator = _createForOfIteratorHelper(entries),
220
- _step;
221
- try {
222
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
223
- var entry = _step.value;
224
- var currentHeight = entry.contentRect.height;
225
- var lastHeight = codeBlockHeights.get(_this.cm.contentDOM);
226
- if (lastHeight !== undefined && lastHeight === currentHeight) {
227
- return;
228
- }
229
- codeBlockHeights.set(_this.cm.contentDOM, currentHeight);
230
- }
231
-
232
- // CodeMirror to re-measure when its content size changes
233
- } catch (err) {
234
- _iterator.e(err);
235
- } finally {
236
- _iterator.f();
237
- }
238
- _this.cm.requestMeasure();
239
- });
240
- this.ro.observe(this.cm.contentDOM);
241
- }
242
202
  if ((0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
243
203
  this.cleanupBorderAreaMouseDown = (0, _bindEventListener.bind)(this.cm.scrollDOM, {
244
204
  type: 'mousedown',
@@ -282,7 +242,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
282
242
  return (0, _createClass2.default)(CodeBlockAdvancedNodeView, [{
283
243
  key: "destroy",
284
244
  value: function destroy() {
285
- var _this$cleanupBorderAr, _this$cleanupBorderAr2, _this$cleanupDisabled;
245
+ var _this$cleanupBorderAr, _this$cleanupBorderAr2, _this$cleanupDisabled, _this$unsubscribeCont;
286
246
  // ED-27428: CodeMirror gets into an infinite loop as it detects mutations on removed
287
247
  // decorations. When we change the breakout we destroy the node and cleanup these decorations from
288
248
  // codemirror
@@ -290,14 +250,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
290
250
  (_this$cleanupBorderAr = this.cleanupBorderAreaMouseDown) === null || _this$cleanupBorderAr === void 0 || _this$cleanupBorderAr.call(this);
291
251
  (_this$cleanupBorderAr2 = this.cleanupBorderAreaClick) === null || _this$cleanupBorderAr2 === void 0 || _this$cleanupBorderAr2.call(this);
292
252
  (_this$cleanupDisabled = this.cleanupDisabledState) === null || _this$cleanupDisabled === void 0 || _this$cleanupDisabled.call(this);
293
- if ((0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true)) {
294
- var _this$unsubscribeCont;
295
- (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 || _this$unsubscribeCont.call(this);
296
- }
297
- if (!(0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) && (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp')) {
298
- var _this$ro;
299
- (_this$ro = this.ro) === null || _this$ro === void 0 || _this$ro.disconnect();
300
- }
253
+ (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 || _this$unsubscribeCont.call(this);
301
254
  }
302
255
  }, {
303
256
  key: "forwardUpdate",
@@ -25,16 +25,13 @@ var codeBlockClassNames = {
25
25
  content: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
26
26
  };
27
27
  var MATCH_NEWLINES = new RegExp('\n', 'gu');
28
- var getFontSize = function getFontSize() {
29
- return (0, _expValEquals.expValEquals)('confluence_compact_text_format', 'isEnabled', true) || (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
30
- };
31
28
  var getGutterBaseStyle = function getGutterBaseStyle() {
32
29
  return {
33
30
  backgroundColor: "var(--ds-background-neutral, #0515240F)",
34
31
  position: 'relative',
35
32
  flexShrink: 0,
36
33
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
37
- fontSize: getFontSize(),
34
+ fontSize: '0.875em',
38
35
  boxSizing: 'content-box'
39
36
  };
40
37
  };
@@ -28,9 +28,6 @@ import { prosemirrorDecorationPlugin } from './extensions/prosemirrorDecorations
28
28
  import { tripleClickSelectAllExtension } from './extensions/tripleClickExtension';
29
29
  import getLanguageName from './languages/getLanguageName';
30
30
  import { LanguageLoader } from './languages/loader';
31
-
32
- // Store last observed heights of code blocks
33
- const codeBlockHeights = new WeakMap();
34
31
  // Based on: https://prosemirror.net/examples/codemirror/
35
32
  class CodeBlockAdvancedNodeView {
36
33
  constructor(node, view, getPos, innerDecorations, config) {
@@ -96,8 +93,8 @@ class CodeBlockAdvancedNodeView {
96
93
  this.node = node;
97
94
  this.view = view;
98
95
  this.getPos = getPos;
99
- const contentFormatSharedState = expValEquals('confluence_compact_text_format', 'isEnabled', true) ? (_config$api = config.api) === null || _config$api === void 0 ? void 0 : (_config$api$contentFo = _config$api.contentFormat) === null || _config$api$contentFo === void 0 ? void 0 : _config$api$contentFo.sharedState : undefined;
100
- this.contentMode = expValEquals('confluence_compact_text_format', 'isEnabled', true) ? contentFormatSharedState === null || contentFormatSharedState === void 0 ? void 0 : (_contentFormatSharedS = contentFormatSharedState.currentState) === null || _contentFormatSharedS === void 0 ? void 0 : (_contentFormatSharedS2 = _contentFormatSharedS.call(contentFormatSharedState)) === null || _contentFormatSharedS2 === void 0 ? void 0 : _contentFormatSharedS2.contentMode : undefined;
96
+ const contentFormatSharedState = (_config$api = config.api) === null || _config$api === void 0 ? void 0 : (_config$api$contentFo = _config$api.contentFormat) === null || _config$api$contentFo === void 0 ? void 0 : _config$api$contentFo.sharedState;
97
+ this.contentMode = contentFormatSharedState === null || contentFormatSharedState === void 0 ? void 0 : (_contentFormatSharedS = contentFormatSharedState.currentState) === null || _contentFormatSharedS === void 0 ? void 0 : (_contentFormatSharedS2 = _contentFormatSharedS.call(contentFormatSharedState)) === null || _contentFormatSharedS2 === void 0 ? void 0 : _contentFormatSharedS2.contentMode;
101
98
  this.selectionAPI = (_config$api2 = config.api) === null || _config$api2 === void 0 ? void 0 : (_config$api2$selectio = _config$api2.selection) === null || _config$api2$selectio === void 0 ? void 0 : _config$api2$selectio.actions;
102
99
  const getNode = () => this.node;
103
100
  const onMaybeNodeSelection = () => this.maybeTryingToReachNodeSelection = true;
@@ -128,7 +125,7 @@ class CodeBlockAdvancedNodeView {
128
125
  }),
129
126
  // Goes before cmTheme to override styles
130
127
  config.allowCodeFolding ? [codeFoldingTheme] : [], this.themeCompartment.of(cmTheme({
131
- contentMode: expValEquals('confluence_compact_text_format', 'isEnabled', true) ? this.contentMode : undefined
128
+ contentMode: this.contentMode
132
129
  })), syntaxHighlighting(highlightStyle), bracketMatching(), expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? this.lineNumbersCompartment.of(this.getLineNumberVisibilityExtensions(node)) : this.getLineNumberExtensions(),
133
130
  // Explicitly disable "sticky" positioning on all gutters to match
134
131
  // Renderer behaviour.
@@ -181,32 +178,6 @@ class CodeBlockAdvancedNodeView {
181
178
  this.cm.requestMeasure();
182
179
  });
183
180
  }
184
-
185
- // Observe size changes of the CodeMirror DOM and request a measurement pass
186
- if (!expValEquals('confluence_compact_text_format', 'isEnabled', true) && expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) {
187
- this.ro = new ResizeObserver(entries => {
188
- // Skip measurements when:
189
- // 1. Currently updating (prevents feedback loops)
190
- // 2. CodeMirror has focus (user is actively typing/editing)
191
- if (this.updating || this.cm.hasFocus) {
192
- return;
193
- }
194
-
195
- // Only trigger on height changes, not width or other dimension changes
196
- for (const entry of entries) {
197
- const currentHeight = entry.contentRect.height;
198
- const lastHeight = codeBlockHeights.get(this.cm.contentDOM);
199
- if (lastHeight !== undefined && lastHeight === currentHeight) {
200
- return;
201
- }
202
- codeBlockHeights.set(this.cm.contentDOM, currentHeight);
203
- }
204
-
205
- // CodeMirror to re-measure when its content size changes
206
- this.cm.requestMeasure();
207
- });
208
- this.ro.observe(this.cm.contentDOM);
209
- }
210
181
  if (expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
211
182
  this.cleanupBorderAreaMouseDown = bind(this.cm.scrollDOM, {
212
183
  type: 'mousedown',
@@ -248,7 +219,7 @@ class CodeBlockAdvancedNodeView {
248
219
  }
249
220
  }
250
221
  destroy() {
251
- var _this$cleanupBorderAr, _this$cleanupBorderAr2, _this$cleanupDisabled;
222
+ var _this$cleanupBorderAr, _this$cleanupBorderAr2, _this$cleanupDisabled, _this$unsubscribeCont;
252
223
  // ED-27428: CodeMirror gets into an infinite loop as it detects mutations on removed
253
224
  // decorations. When we change the breakout we destroy the node and cleanup these decorations from
254
225
  // codemirror
@@ -256,14 +227,7 @@ class CodeBlockAdvancedNodeView {
256
227
  (_this$cleanupBorderAr = this.cleanupBorderAreaMouseDown) === null || _this$cleanupBorderAr === void 0 ? void 0 : _this$cleanupBorderAr.call(this);
257
228
  (_this$cleanupBorderAr2 = this.cleanupBorderAreaClick) === null || _this$cleanupBorderAr2 === void 0 ? void 0 : _this$cleanupBorderAr2.call(this);
258
229
  (_this$cleanupDisabled = this.cleanupDisabledState) === null || _this$cleanupDisabled === void 0 ? void 0 : _this$cleanupDisabled.call(this);
259
- if (expValEquals('confluence_compact_text_format', 'isEnabled', true)) {
260
- var _this$unsubscribeCont;
261
- (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 ? void 0 : _this$unsubscribeCont.call(this);
262
- }
263
- if (!expValEquals('confluence_compact_text_format', 'isEnabled', true) && expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) {
264
- var _this$ro;
265
- (_this$ro = this.ro) === null || _this$ro === void 0 ? void 0 : _this$ro.disconnect();
266
- }
230
+ (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 ? void 0 : _this$unsubscribeCont.call(this);
267
231
  }
268
232
  forwardUpdate(update) {
269
233
  var _this$getPos, _this$getPos2;
@@ -14,13 +14,12 @@ const codeBlockClassNames = {
14
14
  content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
15
15
  };
16
16
  const MATCH_NEWLINES = new RegExp('\n', 'gu');
17
- const getFontSize = () => expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
18
17
  const getGutterBaseStyle = () => ({
19
18
  backgroundColor: "var(--ds-background-neutral, #0515240F)",
20
19
  position: 'relative',
21
20
  flexShrink: 0,
22
21
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
23
- fontSize: getFontSize(),
22
+ fontSize: '0.875em',
24
23
  boxSizing: 'content-box'
25
24
  });
26
25
  const getGutterPadding = allowCodeFolding => allowCodeFolding ? `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-250, 20px)"} ${"var(--ds-space-100, 8px)"} ${"var(--ds-space-075, 6px)"}` : "var(--ds-space-100, 8px)";
@@ -2,9 +2,6 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- 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; } } }; }
6
- 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; } }
7
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
5
  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; }
9
6
  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; }
10
7
  import { closeBrackets } from '@codemirror/autocomplete';
@@ -36,9 +33,6 @@ import { prosemirrorDecorationPlugin } from './extensions/prosemirrorDecorations
36
33
  import { tripleClickSelectAllExtension } from './extensions/tripleClickExtension';
37
34
  import getLanguageName from './languages/getLanguageName';
38
35
  import { LanguageLoader } from './languages/loader';
39
-
40
- // Store last observed heights of code blocks
41
- var codeBlockHeights = new WeakMap();
42
36
  // Based on: https://prosemirror.net/examples/codemirror/
43
37
  var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
44
38
  function CodeBlockAdvancedNodeView(node, view, getPos, innerDecorations, config) {
@@ -110,8 +104,8 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
110
104
  this.node = node;
111
105
  this.view = view;
112
106
  this.getPos = getPos;
113
- var contentFormatSharedState = expValEquals('confluence_compact_text_format', 'isEnabled', true) ? (_config$api = config.api) === null || _config$api === void 0 || (_config$api = _config$api.contentFormat) === null || _config$api === void 0 ? void 0 : _config$api.sharedState : undefined;
114
- this.contentMode = expValEquals('confluence_compact_text_format', 'isEnabled', true) ? contentFormatSharedState === null || contentFormatSharedState === void 0 || (_contentFormatSharedS = contentFormatSharedState.currentState) === null || _contentFormatSharedS === void 0 || (_contentFormatSharedS = _contentFormatSharedS.call(contentFormatSharedState)) === null || _contentFormatSharedS === void 0 ? void 0 : _contentFormatSharedS.contentMode : undefined;
107
+ var contentFormatSharedState = (_config$api = config.api) === null || _config$api === void 0 || (_config$api = _config$api.contentFormat) === null || _config$api === void 0 ? void 0 : _config$api.sharedState;
108
+ this.contentMode = contentFormatSharedState === null || contentFormatSharedState === void 0 || (_contentFormatSharedS = contentFormatSharedState.currentState) === null || _contentFormatSharedS === void 0 || (_contentFormatSharedS = _contentFormatSharedS.call(contentFormatSharedState)) === null || _contentFormatSharedS === void 0 ? void 0 : _contentFormatSharedS.contentMode;
115
109
  this.selectionAPI = (_config$api2 = config.api) === null || _config$api2 === void 0 || (_config$api2 = _config$api2.selection) === null || _config$api2 === void 0 ? void 0 : _config$api2.actions;
116
110
  var getNode = function getNode() {
117
111
  return _this.node;
@@ -147,7 +141,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
147
141
  }),
148
142
  // Goes before cmTheme to override styles
149
143
  config.allowCodeFolding ? [codeFoldingTheme] : [], this.themeCompartment.of(cmTheme({
150
- contentMode: expValEquals('confluence_compact_text_format', 'isEnabled', true) ? this.contentMode : undefined
144
+ contentMode: this.contentMode
151
145
  })), syntaxHighlighting(highlightStyle), bracketMatching(), expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? this.lineNumbersCompartment.of(this.getLineNumberVisibilityExtensions(node)) : this.getLineNumberExtensions(),
152
146
  // Explicitly disable "sticky" positioning on all gutters to match
153
147
  // Renderer behaviour.
@@ -198,41 +192,6 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
198
192
  _this.cm.requestMeasure();
199
193
  });
200
194
  }
201
-
202
- // Observe size changes of the CodeMirror DOM and request a measurement pass
203
- if (!expValEquals('confluence_compact_text_format', 'isEnabled', true) && expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) {
204
- this.ro = new ResizeObserver(function (entries) {
205
- // Skip measurements when:
206
- // 1. Currently updating (prevents feedback loops)
207
- // 2. CodeMirror has focus (user is actively typing/editing)
208
- if (_this.updating || _this.cm.hasFocus) {
209
- return;
210
- }
211
-
212
- // Only trigger on height changes, not width or other dimension changes
213
- var _iterator = _createForOfIteratorHelper(entries),
214
- _step;
215
- try {
216
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
217
- var entry = _step.value;
218
- var currentHeight = entry.contentRect.height;
219
- var lastHeight = codeBlockHeights.get(_this.cm.contentDOM);
220
- if (lastHeight !== undefined && lastHeight === currentHeight) {
221
- return;
222
- }
223
- codeBlockHeights.set(_this.cm.contentDOM, currentHeight);
224
- }
225
-
226
- // CodeMirror to re-measure when its content size changes
227
- } catch (err) {
228
- _iterator.e(err);
229
- } finally {
230
- _iterator.f();
231
- }
232
- _this.cm.requestMeasure();
233
- });
234
- this.ro.observe(this.cm.contentDOM);
235
- }
236
195
  if (expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
237
196
  this.cleanupBorderAreaMouseDown = bind(this.cm.scrollDOM, {
238
197
  type: 'mousedown',
@@ -276,7 +235,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
276
235
  return _createClass(CodeBlockAdvancedNodeView, [{
277
236
  key: "destroy",
278
237
  value: function destroy() {
279
- var _this$cleanupBorderAr, _this$cleanupBorderAr2, _this$cleanupDisabled;
238
+ var _this$cleanupBorderAr, _this$cleanupBorderAr2, _this$cleanupDisabled, _this$unsubscribeCont;
280
239
  // ED-27428: CodeMirror gets into an infinite loop as it detects mutations on removed
281
240
  // decorations. When we change the breakout we destroy the node and cleanup these decorations from
282
241
  // codemirror
@@ -284,14 +243,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
284
243
  (_this$cleanupBorderAr = this.cleanupBorderAreaMouseDown) === null || _this$cleanupBorderAr === void 0 || _this$cleanupBorderAr.call(this);
285
244
  (_this$cleanupBorderAr2 = this.cleanupBorderAreaClick) === null || _this$cleanupBorderAr2 === void 0 || _this$cleanupBorderAr2.call(this);
286
245
  (_this$cleanupDisabled = this.cleanupDisabledState) === null || _this$cleanupDisabled === void 0 || _this$cleanupDisabled.call(this);
287
- if (expValEquals('confluence_compact_text_format', 'isEnabled', true)) {
288
- var _this$unsubscribeCont;
289
- (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 || _this$unsubscribeCont.call(this);
290
- }
291
- if (!expValEquals('confluence_compact_text_format', 'isEnabled', true) && expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp')) {
292
- var _this$ro;
293
- (_this$ro = this.ro) === null || _this$ro === void 0 || _this$ro.disconnect();
294
- }
246
+ (_this$unsubscribeCont = this.unsubscribeContentFormat) === null || _this$unsubscribeCont === void 0 || _this$unsubscribeCont.call(this);
295
247
  }
296
248
  }, {
297
249
  key: "forwardUpdate",
@@ -18,16 +18,13 @@ var codeBlockClassNames = {
18
18
  content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
19
19
  };
20
20
  var MATCH_NEWLINES = new RegExp('\n', 'gu');
21
- var getFontSize = function getFontSize() {
22
- return expValEquals('confluence_compact_text_format', 'isEnabled', true) || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
23
- };
24
21
  var getGutterBaseStyle = function getGutterBaseStyle() {
25
22
  return {
26
23
  backgroundColor: "var(--ds-background-neutral, #0515240F)",
27
24
  position: 'relative',
28
25
  flexShrink: 0,
29
26
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
30
- fontSize: getFontSize(),
27
+ fontSize: '0.875em',
31
28
  boxSizing: 'content-box'
32
29
  };
33
30
  };
@@ -32,7 +32,6 @@ declare class CodeBlockAdvancedNodeView implements NodeView {
32
32
  private cleanupDisabledState;
33
33
  private languageLoader;
34
34
  private pmFacet;
35
- private ro?;
36
35
  private unsubscribeContentFormat;
37
36
  private invisibleAriaDescription?;
38
37
  private config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "12.0.15",
3
+ "version": "12.0.17",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/editor-prosemirror": "^8.0.0",
32
32
  "@atlaskit/platform-feature-flags": "^2.0.0",
33
33
  "@atlaskit/prosemirror-history": "^1.0.0",
34
- "@atlaskit/tmp-editor-statsig": "^117.0.0",
34
+ "@atlaskit/tmp-editor-statsig": "^119.0.0",
35
35
  "@atlaskit/tokens": "^15.3.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "@codemirror/autocomplete": "6.18.4",
@@ -49,7 +49,7 @@
49
49
  "codemirror-lang-elixir": "4.0.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^116.18.0",
52
+ "@atlaskit/editor-common": "^116.19.0",
53
53
  "react": "^18.2.0",
54
54
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
55
55
  },
@@ -57,9 +57,6 @@ import { tripleClickSelectAllExtension } from './extensions/tripleClickExtension
57
57
  import getLanguageName from './languages/getLanguageName';
58
58
  import { LanguageLoader } from './languages/loader';
59
59
 
60
- // Store last observed heights of code blocks
61
- const codeBlockHeights = new WeakMap<HTMLElement, number>();
62
-
63
60
  export interface ConfigProps {
64
61
  allowCodeFolding: boolean;
65
62
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
@@ -89,7 +86,6 @@ class CodeBlockAdvancedNodeView implements NodeView {
89
86
  private cleanupDisabledState: (() => void) | undefined;
90
87
  private languageLoader: LanguageLoader;
91
88
  private pmFacet = Facet.define<DecorationSource>();
92
- private ro?: ResizeObserver;
93
89
  private unsubscribeContentFormat: (() => void) | undefined;
94
90
  private invisibleAriaDescription?: HTMLSpanElement;
95
91
  private config: ConfigProps;
@@ -108,16 +104,8 @@ class CodeBlockAdvancedNodeView implements NodeView {
108
104
 
109
105
  this.view = view;
110
106
  this.getPos = getPos;
111
- const contentFormatSharedState = expValEquals(
112
- 'confluence_compact_text_format',
113
- 'isEnabled',
114
- true,
115
- )
116
- ? config.api?.contentFormat?.sharedState
117
- : undefined;
118
- this.contentMode = expValEquals('confluence_compact_text_format', 'isEnabled', true)
119
- ? contentFormatSharedState?.currentState?.()?.contentMode
120
- : undefined;
107
+ const contentFormatSharedState = config.api?.contentFormat?.sharedState;
108
+ this.contentMode = contentFormatSharedState?.currentState?.()?.contentMode;
121
109
 
122
110
  this.selectionAPI = config.api?.selection?.actions;
123
111
  const getNode = () => this.node;
@@ -159,9 +147,7 @@ class CodeBlockAdvancedNodeView implements NodeView {
159
147
  config.allowCodeFolding ? [codeFoldingTheme] : [],
160
148
  this.themeCompartment.of(
161
149
  cmTheme({
162
- contentMode: expValEquals('confluence_compact_text_format', 'isEnabled', true)
163
- ? this.contentMode
164
- : undefined,
150
+ contentMode: this.contentMode,
165
151
  }),
166
152
  ),
167
153
  syntaxHighlighting(highlightStyle),
@@ -242,36 +228,6 @@ class CodeBlockAdvancedNodeView implements NodeView {
242
228
  );
243
229
  }
244
230
 
245
- // Observe size changes of the CodeMirror DOM and request a measurement pass
246
- if (
247
- !expValEquals('confluence_compact_text_format', 'isEnabled', true) &&
248
- expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
249
- fg('platform_editor_content_mode_button_mvp')
250
- ) {
251
- this.ro = new ResizeObserver((entries) => {
252
- // Skip measurements when:
253
- // 1. Currently updating (prevents feedback loops)
254
- // 2. CodeMirror has focus (user is actively typing/editing)
255
- if (this.updating || this.cm.hasFocus) {
256
- return;
257
- }
258
-
259
- // Only trigger on height changes, not width or other dimension changes
260
- for (const entry of entries) {
261
- const currentHeight = entry.contentRect.height;
262
- const lastHeight = codeBlockHeights.get(this.cm.contentDOM);
263
- if (lastHeight !== undefined && lastHeight === currentHeight) {
264
- return;
265
- }
266
- codeBlockHeights.set(this.cm.contentDOM, currentHeight);
267
- }
268
-
269
- // CodeMirror to re-measure when its content size changes
270
- this.cm.requestMeasure();
271
- });
272
- this.ro.observe(this.cm.contentDOM);
273
- }
274
-
275
231
  if (expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true)) {
276
232
  this.cleanupBorderAreaMouseDown = bind(this.cm.scrollDOM, {
277
233
  type: 'mousedown',
@@ -326,16 +282,7 @@ class CodeBlockAdvancedNodeView implements NodeView {
326
282
  this.cleanupBorderAreaMouseDown?.();
327
283
  this.cleanupBorderAreaClick?.();
328
284
  this.cleanupDisabledState?.();
329
- if (expValEquals('confluence_compact_text_format', 'isEnabled', true)) {
330
- this.unsubscribeContentFormat?.();
331
- }
332
- if (
333
- !expValEquals('confluence_compact_text_format', 'isEnabled', true) &&
334
- expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
335
- fg('platform_editor_content_mode_button_mvp')
336
- ) {
337
- this.ro?.disconnect();
338
- }
285
+ this.unsubscribeContentFormat?.();
339
286
  }
340
287
 
341
288
  forwardUpdate(update: ViewUpdate): void {
@@ -23,19 +23,12 @@ const codeBlockClassNames = {
23
23
 
24
24
  const MATCH_NEWLINES = new RegExp('\n', 'gu');
25
25
 
26
- const getFontSize = () =>
27
- expValEquals('confluence_compact_text_format', 'isEnabled', true) ||
28
- (expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
29
- fg('platform_editor_content_mode_button_mvp'))
30
- ? '0.875em'
31
- : '0.875rem';
32
-
33
26
  const getGutterBaseStyle = () => ({
34
27
  backgroundColor: token('color.background.neutral'),
35
28
  position: 'relative',
36
29
  flexShrink: 0,
37
30
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
38
- fontSize: getFontSize(),
31
+ fontSize: '0.875em',
39
32
  boxSizing: 'content-box',
40
33
  });
41
34