@atlaskit/editor-plugin-code-block-advanced 10.1.1 → 10.1.3

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,19 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 10.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6b9ee34bdd875`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b9ee34bdd875) -
8
+ Fix wrapped code block first paint
9
+ - Updated dependencies
10
+
11
+ ## 10.1.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 10.1.1
4
18
 
5
19
  ### Patch Changes
@@ -20,6 +20,7 @@ var codeBlockClassNames = {
20
20
  start: _styles.CodeBlockSharedCssClassName.CODEBLOCK_START,
21
21
  end: _styles.CodeBlockSharedCssClassName.CODEBLOCK_END,
22
22
  contentWrapper: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER,
23
+ contentWrapped: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED,
23
24
  content: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
24
25
  };
25
26
  var MATCH_NEWLINES = new RegExp('\n', 'gu');
@@ -93,8 +94,10 @@ var _toDOM = function toDOM(node, formattedAriaLabel, config) {
93
94
  return i + 1;
94
95
  }).join('\n');
95
96
  var gutters = getGutters(content, config, hideLineNumbers);
97
+ var isCodeBlockWrapped = (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && node.attrs.wrap === true;
98
+ var className = [codeBlockClassNames.container, isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined].filter(Boolean).join(' ');
96
99
  return ['pre', _objectSpread({
97
- class: codeBlockClassNames.container,
100
+ class: className,
98
101
  style: "--lineNumberGutterWidth:".concat(maxDigits, "ch;"),
99
102
  'data-language': node.attrs.language || ''
100
103
  }, (0, _expValEquals.expValEquals)('platform_editor_code_block_q4_lovability', 'isEnabled', true) && _objectSpread({
@@ -9,6 +9,7 @@ const codeBlockClassNames = {
9
9
  start: CodeBlockSharedCssClassName.CODEBLOCK_START,
10
10
  end: CodeBlockSharedCssClassName.CODEBLOCK_END,
11
11
  contentWrapper: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER,
12
+ contentWrapped: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED,
12
13
  content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
13
14
  };
14
15
  const MATCH_NEWLINES = new RegExp('\n', 'gu');
@@ -72,8 +73,10 @@ const toDOM = (node, formattedAriaLabel, config) => {
72
73
  const maxDigits = totalLineCount.toString().length;
73
74
  const content = node.textContent.split('\n').map((_, i) => i + 1).join('\n');
74
75
  const gutters = getGutters(content, config, hideLineNumbers);
76
+ const isCodeBlockWrapped = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && node.attrs.wrap === true;
77
+ const className = [codeBlockClassNames.container, isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined].filter(Boolean).join(' ');
75
78
  return ['pre', {
76
- class: codeBlockClassNames.container,
79
+ class: className,
77
80
  style: `--lineNumberGutterWidth:${maxDigits}ch;`,
78
81
  'data-language': node.attrs.language || '',
79
82
  ...(expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {
@@ -13,6 +13,7 @@ var codeBlockClassNames = {
13
13
  start: CodeBlockSharedCssClassName.CODEBLOCK_START,
14
14
  end: CodeBlockSharedCssClassName.CODEBLOCK_END,
15
15
  contentWrapper: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER,
16
+ contentWrapped: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED,
16
17
  content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
17
18
  };
18
19
  var MATCH_NEWLINES = new RegExp('\n', 'gu');
@@ -86,8 +87,10 @@ var _toDOM = function toDOM(node, formattedAriaLabel, config) {
86
87
  return i + 1;
87
88
  }).join('\n');
88
89
  var gutters = getGutters(content, config, hideLineNumbers);
90
+ var isCodeBlockWrapped = expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && node.attrs.wrap === true;
91
+ var className = [codeBlockClassNames.container, isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined].filter(Boolean).join(' ');
89
92
  return ['pre', _objectSpread({
90
- class: codeBlockClassNames.container,
93
+ class: className,
91
94
  style: "--lineNumberGutterWidth:".concat(maxDigits, "ch;"),
92
95
  'data-language': node.attrs.language || ''
93
96
  }, expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && _objectSpread({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "10.1.1",
3
+ "version": "10.1.3",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/editor-prosemirror": "^7.3.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/prosemirror-history": "^0.2.0",
41
- "@atlaskit/tmp-editor-statsig": "^80.3.0",
41
+ "@atlaskit/tmp-editor-statsig": "^81.0.0",
42
42
  "@atlaskit/tokens": "^13.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@codemirror/autocomplete": "6.18.4",
@@ -20,6 +20,7 @@ const codeBlockClassNames = {
20
20
  start: CodeBlockSharedCssClassName.CODEBLOCK_START,
21
21
  end: CodeBlockSharedCssClassName.CODEBLOCK_END,
22
22
  contentWrapper: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER,
23
+ contentWrapped: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPED,
23
24
  content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT,
24
25
  };
25
26
 
@@ -85,11 +86,7 @@ const getFoldOnlyGutter = (): DOMOutputSpec => [
85
86
  },
86
87
  ];
87
88
 
88
- const getGutters = (
89
- content: string,
90
- config: Config,
91
- hideLineNumbers: boolean,
92
- ): DOMOutputSpec[] => {
89
+ const getGutters = (content: string, config: Config, hideLineNumbers: boolean): DOMOutputSpec[] => {
93
90
  if (!hideLineNumbers) {
94
91
  return [getGuttersWithLineNumbers(content, config)];
95
92
  }
@@ -120,11 +117,20 @@ const toDOM = (node: Node, formattedAriaLabel: string, config: Config): DOMOutpu
120
117
  .map((_, i) => i + 1)
121
118
  .join('\n');
122
119
  const gutters = getGutters(content, config, hideLineNumbers);
120
+ const isCodeBlockWrapped =
121
+ expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) &&
122
+ node.attrs.wrap === true;
123
+ const className = [
124
+ codeBlockClassNames.container,
125
+ isCodeBlockWrapped ? codeBlockClassNames.contentWrapped : undefined,
126
+ ]
127
+ .filter(Boolean)
128
+ .join(' ');
123
129
 
124
130
  return [
125
131
  'pre',
126
132
  {
127
- class: codeBlockClassNames.container,
133
+ class: className,
128
134
  style: `--lineNumberGutterWidth:${maxDigits}ch;`,
129
135
  'data-language': node.attrs.language || '',
130
136
  ...(expValEquals('platform_editor_code_block_q4_lovability', 'isEnabled', true) && {