@atlaskit/editor-plugin-code-block-advanced 12.0.8 → 12.0.10
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 +14 -0
- package/dist/cjs/nodeviews/codeBlockAdvanced.js +1 -1
- package/dist/cjs/nodeviews/codeBlockNodeWithToDOMFixed.js +3 -2
- package/dist/cjs/ui/theme.js +2 -1
- package/dist/es2019/nodeviews/codeBlockAdvanced.js +1 -1
- package/dist/es2019/nodeviews/codeBlockNodeWithToDOMFixed.js +3 -2
- package/dist/es2019/ui/theme.js +2 -1
- package/dist/esm/nodeviews/codeBlockAdvanced.js +1 -1
- package/dist/esm/nodeviews/codeBlockNodeWithToDOMFixed.js +3 -2
- package/dist/esm/ui/theme.js +2 -1
- package/package.json +3 -3
- package/src/nodeviews/codeBlockAdvanced.ts +1 -1
- package/src/nodeviews/codeBlockNodeWithToDOMFixed.ts +3 -2
- package/src/ui/theme.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 12.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 12.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`49b8e9a322976`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/49b8e9a322976) -
|
|
14
|
+
Reduce q4 lovability experiment exposure noise in code block setup and bookkeeping paths
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 12.0.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -478,7 +478,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
478
478
|
// Updates bundled for performance (to avoid multiple-dispatches)
|
|
479
479
|
var changes = (0, _updateCMSelection.getCMSelectionChanges)(curText, newText);
|
|
480
480
|
var wordWrapEffect = this.getWordWrapEffects(node);
|
|
481
|
-
var lineNumbersEffect = (0,
|
|
481
|
+
var lineNumbersEffect = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? this.getLineNumbersEffects(node) : undefined;
|
|
482
482
|
var prosemirrorDecorationsEffect = this.getProseMirrorDecorationEffects(innerDecorations);
|
|
483
483
|
if (changes || wordWrapEffect || lineNumbersEffect || prosemirrorDecorationsEffect) {
|
|
484
484
|
this.updating = true;
|
|
@@ -13,6 +13,7 @@ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
|
13
13
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
16
17
|
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; }
|
|
17
18
|
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; }
|
|
18
19
|
var codeBlockClassNames = {
|
|
@@ -94,13 +95,13 @@ var _toDOM = function toDOM(node, formattedAriaLabel, config) {
|
|
|
94
95
|
return i + 1;
|
|
95
96
|
}).join('\n');
|
|
96
97
|
var gutters = getGutters(content, config, hideLineNumbers);
|
|
97
|
-
var isCodeBlockWrapped = (0,
|
|
98
|
+
var isCodeBlockWrapped = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && node.attrs.wrap === true;
|
|
98
99
|
var className = [codeBlockClassNames.container, isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined].filter(Boolean).join(' ');
|
|
99
100
|
return ['pre', _objectSpread({
|
|
100
101
|
class: className,
|
|
101
102
|
style: "--lineNumberGutterWidth:".concat(maxDigits, "ch;"),
|
|
102
103
|
'data-language': node.attrs.language || ''
|
|
103
|
-
}, (0,
|
|
104
|
+
}, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && _objectSpread({
|
|
104
105
|
'data-wrap': node.attrs.wrap ? 'true' : 'false'
|
|
105
106
|
}, hideLineNumbers && {
|
|
106
107
|
'data-hide-line-numbers': 'true'
|
package/dist/cjs/ui/theme.js
CHANGED
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _view = require("@codemirror/view");
|
|
10
10
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
11
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
12
13
|
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; }
|
|
13
14
|
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; }
|
|
14
15
|
var shouldUseCompactTypography = function shouldUseCompactTypography(contentMode) {
|
|
@@ -74,7 +75,7 @@ var cmTheme = exports.cmTheme = function cmTheme(options) {
|
|
|
74
75
|
border: 'none',
|
|
75
76
|
padding: "var(--ds-space-0, 0px)",
|
|
76
77
|
color: "var(--ds-text-subtlest, #6B6E76)"
|
|
77
|
-
}, (0,
|
|
78
|
+
}, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
|
|
78
79
|
// CodeMirror defaults this to height: 100%, which can resolve against an indefinite
|
|
79
80
|
// parent height in content-height editor and prevent flex stretching when gutter
|
|
80
81
|
// content is sparse, such as fold-only gutters.
|
|
@@ -416,7 +416,7 @@ class CodeBlockAdvancedNodeView {
|
|
|
416
416
|
// Updates bundled for performance (to avoid multiple-dispatches)
|
|
417
417
|
const changes = getCMSelectionChanges(curText, newText);
|
|
418
418
|
const wordWrapEffect = this.getWordWrapEffects(node);
|
|
419
|
-
const lineNumbersEffect =
|
|
419
|
+
const lineNumbersEffect = expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? this.getLineNumbersEffects(node) : undefined;
|
|
420
420
|
const prosemirrorDecorationsEffect = this.getProseMirrorDecorationEffects(innerDecorations);
|
|
421
421
|
if (changes || wordWrapEffect || lineNumbersEffect || prosemirrorDecorationsEffect) {
|
|
422
422
|
this.updating = true;
|
|
@@ -4,6 +4,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
4
4
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
8
|
const codeBlockClassNames = {
|
|
8
9
|
container: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER,
|
|
9
10
|
start: CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
@@ -73,13 +74,13 @@ const toDOM = (node, formattedAriaLabel, config) => {
|
|
|
73
74
|
const maxDigits = totalLineCount.toString().length;
|
|
74
75
|
const content = node.textContent.split('\n').map((_, i) => i + 1).join('\n');
|
|
75
76
|
const gutters = getGutters(content, config, hideLineNumbers);
|
|
76
|
-
const isCodeBlockWrapped =
|
|
77
|
+
const isCodeBlockWrapped = expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && node.attrs.wrap === true;
|
|
77
78
|
const className = [codeBlockClassNames.container, isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined].filter(Boolean).join(' ');
|
|
78
79
|
return ['pre', {
|
|
79
80
|
class: className,
|
|
80
81
|
style: `--lineNumberGutterWidth:${maxDigits}ch;`,
|
|
81
82
|
'data-language': node.attrs.language || '',
|
|
82
|
-
...(
|
|
83
|
+
...(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
|
|
83
84
|
'data-wrap': node.attrs.wrap ? 'true' : 'false',
|
|
84
85
|
...(hideLineNumbers && {
|
|
85
86
|
'data-hide-line-numbers': 'true'
|
package/dist/es2019/ui/theme.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
5
|
const shouldUseCompactTypography = contentMode => contentMode === 'compact' || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp');
|
|
5
6
|
const getLineHeight = contentMode => shouldUseCompactTypography(contentMode) ? '1.5em' : '1.5rem';
|
|
6
7
|
const getFontSize = contentMode => shouldUseCompactTypography(contentMode) ? '0.875em' : '0.875rem';
|
|
@@ -57,7 +58,7 @@ export const cmTheme = options => CodeMirror.theme({
|
|
|
57
58
|
border: 'none',
|
|
58
59
|
padding: "var(--ds-space-0, 0px)",
|
|
59
60
|
color: "var(--ds-text-subtlest, #6B6E76)",
|
|
60
|
-
...(
|
|
61
|
+
...(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
|
|
61
62
|
// CodeMirror defaults this to height: 100%, which can resolve against an indefinite
|
|
62
63
|
// parent height in content-height editor and prevent flex stretching when gutter
|
|
63
64
|
// content is sparse, such as fold-only gutters.
|
|
@@ -472,7 +472,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
|
|
|
472
472
|
// Updates bundled for performance (to avoid multiple-dispatches)
|
|
473
473
|
var changes = getCMSelectionChanges(curText, newText);
|
|
474
474
|
var wordWrapEffect = this.getWordWrapEffects(node);
|
|
475
|
-
var lineNumbersEffect =
|
|
475
|
+
var lineNumbersEffect = expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) ? this.getLineNumbersEffects(node) : undefined;
|
|
476
476
|
var prosemirrorDecorationsEffect = this.getProseMirrorDecorationEffects(innerDecorations);
|
|
477
477
|
if (changes || wordWrapEffect || lineNumbersEffect || prosemirrorDecorationsEffect) {
|
|
478
478
|
this.updating = true;
|
|
@@ -8,6 +8,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
8
8
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
11
12
|
var codeBlockClassNames = {
|
|
12
13
|
container: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER,
|
|
13
14
|
start: CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
@@ -87,13 +88,13 @@ var _toDOM = function toDOM(node, formattedAriaLabel, config) {
|
|
|
87
88
|
return i + 1;
|
|
88
89
|
}).join('\n');
|
|
89
90
|
var gutters = getGutters(content, config, hideLineNumbers);
|
|
90
|
-
var isCodeBlockWrapped =
|
|
91
|
+
var isCodeBlockWrapped = expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && node.attrs.wrap === true;
|
|
91
92
|
var className = [codeBlockClassNames.container, isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined].filter(Boolean).join(' ');
|
|
92
93
|
return ['pre', _objectSpread({
|
|
93
94
|
class: className,
|
|
94
95
|
style: "--lineNumberGutterWidth:".concat(maxDigits, "ch;"),
|
|
95
96
|
'data-language': node.attrs.language || ''
|
|
96
|
-
},
|
|
97
|
+
}, expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && _objectSpread({
|
|
97
98
|
'data-wrap': node.attrs.wrap ? 'true' : 'false'
|
|
98
99
|
}, hideLineNumbers && {
|
|
99
100
|
'data-hide-line-numbers': 'true'
|
package/dist/esm/ui/theme.js
CHANGED
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
8
|
var shouldUseCompactTypography = function shouldUseCompactTypography(contentMode) {
|
|
8
9
|
return contentMode === 'compact' || expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp');
|
|
9
10
|
};
|
|
@@ -67,7 +68,7 @@ export var cmTheme = function cmTheme(options) {
|
|
|
67
68
|
border: 'none',
|
|
68
69
|
padding: "var(--ds-space-0, 0px)",
|
|
69
70
|
color: "var(--ds-text-subtlest, #6B6E76)"
|
|
70
|
-
},
|
|
71
|
+
}, expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
|
|
71
72
|
// CodeMirror defaults this to height: 100%, which can resolve against an indefinite
|
|
72
73
|
// parent height in content-height editor and prevent flex stretching when gutter
|
|
73
74
|
// content is sparse, such as fold-only gutters.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.10",
|
|
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": "^
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^112.0.0",
|
|
35
35
|
"@atlaskit/tokens": "^15.0.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.
|
|
52
|
+
"@atlaskit/editor-common": "^116.12.0",
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
55
55
|
},
|
|
@@ -521,7 +521,7 @@ class CodeBlockAdvancedNodeView implements NodeView {
|
|
|
521
521
|
// Updates bundled for performance (to avoid multiple-dispatches)
|
|
522
522
|
const changes = getCMSelectionChanges(curText, newText);
|
|
523
523
|
const wordWrapEffect = this.getWordWrapEffects(node);
|
|
524
|
-
const lineNumbersEffect =
|
|
524
|
+
const lineNumbersEffect = expValEqualsNoExposure(
|
|
525
525
|
'platform_editor_code_block_q4_lovability',
|
|
526
526
|
'isEnabled',
|
|
527
527
|
true,
|
|
@@ -5,6 +5,7 @@ import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
|
5
5
|
import type { NodeSpec, DOMOutputSpec, Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
8
9
|
import { token } from '@atlaskit/tokens';
|
|
9
10
|
|
|
10
11
|
interface Config {
|
|
@@ -114,7 +115,7 @@ const toDOM = (node: Node, formattedAriaLabel: string, config: Config): DOMOutpu
|
|
|
114
115
|
.join('\n');
|
|
115
116
|
const gutters = getGutters(content, config, hideLineNumbers);
|
|
116
117
|
const isCodeBlockWrapped =
|
|
117
|
-
|
|
118
|
+
expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) &&
|
|
118
119
|
node.attrs.wrap === true;
|
|
119
120
|
const className = [
|
|
120
121
|
codeBlockClassNames.container,
|
|
@@ -129,7 +130,7 @@ const toDOM = (node: Node, formattedAriaLabel: string, config: Config): DOMOutpu
|
|
|
129
130
|
class: className,
|
|
130
131
|
style: `--lineNumberGutterWidth:${maxDigits}ch;`,
|
|
131
132
|
'data-language': node.attrs.language || '',
|
|
132
|
-
...(
|
|
133
|
+
...(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
|
|
133
134
|
'data-wrap': node.attrs.wrap ? 'true' : 'false',
|
|
134
135
|
...(hideLineNumbers && { 'data-hide-line-numbers': 'true' }),
|
|
135
136
|
}),
|
package/src/ui/theme.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { EditorView as CodeMirror } from '@codemirror/view';
|
|
|
4
4
|
import type { EditorContentMode } from '@atlaskit/editor-common/types';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
7
8
|
import { token } from '@atlaskit/tokens';
|
|
8
9
|
|
|
9
10
|
const shouldUseCompactTypography = (contentMode?: EditorContentMode) =>
|
|
@@ -75,7 +76,7 @@ export const cmTheme = (options?: ThemeOptions): Extension =>
|
|
|
75
76
|
border: 'none',
|
|
76
77
|
padding: token('space.0'),
|
|
77
78
|
color: token('color.text.subtlest'),
|
|
78
|
-
...(
|
|
79
|
+
...(expValEqualsNoExposure('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
|
|
79
80
|
// CodeMirror defaults this to height: 100%, which can resolve against an indefinite
|
|
80
81
|
// parent height in content-height editor and prevent flex stretching when gutter
|
|
81
82
|
// content is sparse, such as fold-only gutters.
|