@atlaskit/editor-plugin-code-block-advanced 6.2.6 → 6.2.8
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 +13 -0
- package/dist/cjs/nodeviews/codeBlockNodeWithToDOMFixed.js +5 -1
- package/dist/es2019/nodeviews/codeBlockNodeWithToDOMFixed.js +3 -1
- package/dist/esm/nodeviews/codeBlockNodeWithToDOMFixed.js +5 -1
- package/package.json +4 -4
- package/src/nodeviews/codeBlockNodeWithToDOMFixed.ts +8 -1
- package/afm-post-office/tsconfig.json +0 -65
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 6.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 6.2.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`3649625800804`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3649625800804) -
|
|
14
|
+
Fix the codeblock shift on initial load
|
|
15
|
+
|
|
3
16
|
## 6.2.6
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -10,6 +10,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
10
10
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
11
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
14
|
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; }
|
|
14
15
|
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; }
|
|
15
16
|
var codeBlockClassNames = {
|
|
@@ -20,6 +21,9 @@ var codeBlockClassNames = {
|
|
|
20
21
|
content: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
|
|
21
22
|
};
|
|
22
23
|
var MATCH_NEWLINES = new RegExp('\n', 'gu');
|
|
24
|
+
var getFontSize = function getFontSize() {
|
|
25
|
+
return (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
|
|
26
|
+
};
|
|
23
27
|
|
|
24
28
|
// Based on: `packages/editor/editor-plugin-code-block/src/nodeviews/code-block.ts`
|
|
25
29
|
var _toDOM = function toDOM(node, formattedAriaLabel, config) {
|
|
@@ -53,7 +57,7 @@ var _toDOM = function toDOM(node, formattedAriaLabel, config) {
|
|
|
53
57
|
/* top and bottom | left and right */
|
|
54
58
|
padding: config.allowCodeFolding ? "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)", " ", "var(--ds-space-100, 8px)", " ", "var(--ds-space-075, 6px)") : "var(--ds-space-100, 8px)",
|
|
55
59
|
flexShrink: 0,
|
|
56
|
-
fontSize:
|
|
60
|
+
fontSize: getFontSize(),
|
|
57
61
|
boxSizing: 'content-box'
|
|
58
62
|
}),
|
|
59
63
|
contenteditable: 'false'
|
|
@@ -2,6 +2,7 @@ import { codeBlock, codeBlockWithLocalId } from '@atlaskit/adf-schema';
|
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
3
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
const codeBlockClassNames = {
|
|
6
7
|
container: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER,
|
|
7
8
|
start: CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
@@ -10,6 +11,7 @@ const codeBlockClassNames = {
|
|
|
10
11
|
content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
|
|
11
12
|
};
|
|
12
13
|
const MATCH_NEWLINES = new RegExp('\n', 'gu');
|
|
14
|
+
const getFontSize = () => expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
|
|
13
15
|
|
|
14
16
|
// Based on: `packages/editor/editor-plugin-code-block/src/nodeviews/code-block.ts`
|
|
15
17
|
const toDOM = (node, formattedAriaLabel, config) => {
|
|
@@ -41,7 +43,7 @@ const toDOM = (node, formattedAriaLabel, config) => {
|
|
|
41
43
|
/* top and bottom | left and right */
|
|
42
44
|
padding: config.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)",
|
|
43
45
|
flexShrink: 0,
|
|
44
|
-
fontSize:
|
|
46
|
+
fontSize: getFontSize(),
|
|
45
47
|
boxSizing: 'content-box'
|
|
46
48
|
}),
|
|
47
49
|
contenteditable: 'false'
|
|
@@ -5,6 +5,7 @@ import { codeBlock, codeBlockWithLocalId } from '@atlaskit/adf-schema';
|
|
|
5
5
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
6
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
var codeBlockClassNames = {
|
|
9
10
|
container: CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER,
|
|
10
11
|
start: CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
@@ -13,6 +14,9 @@ var codeBlockClassNames = {
|
|
|
13
14
|
content: CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
|
|
14
15
|
};
|
|
15
16
|
var MATCH_NEWLINES = new RegExp('\n', 'gu');
|
|
17
|
+
var getFontSize = function getFontSize() {
|
|
18
|
+
return expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
|
|
19
|
+
};
|
|
16
20
|
|
|
17
21
|
// Based on: `packages/editor/editor-plugin-code-block/src/nodeviews/code-block.ts`
|
|
18
22
|
var _toDOM = function toDOM(node, formattedAriaLabel, config) {
|
|
@@ -46,7 +50,7 @@ var _toDOM = function toDOM(node, formattedAriaLabel, config) {
|
|
|
46
50
|
/* top and bottom | left and right */
|
|
47
51
|
padding: config.allowCodeFolding ? "var(--ds-space-100, 8px)".concat(" ", "var(--ds-space-250, 20px)", " ", "var(--ds-space-100, 8px)", " ", "var(--ds-space-075, 6px)") : "var(--ds-space-100, 8px)",
|
|
48
52
|
flexShrink: 0,
|
|
49
|
-
fontSize:
|
|
53
|
+
fontSize: getFontSize(),
|
|
50
54
|
boxSizing: 'content-box'
|
|
51
55
|
}),
|
|
52
56
|
contenteditable: 'false'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.8",
|
|
4
4
|
"description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@atlaskit/icon": "^28.5.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
42
42
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
43
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
44
|
-
"@atlaskit/tokens": "^
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^13.32.0",
|
|
44
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"@codemirror/autocomplete": "6.18.4",
|
|
47
47
|
"@codemirror/commands": "6.7.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"codemirror-lang-elixir": "4.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^110.
|
|
60
|
+
"@atlaskit/editor-common": "^110.24.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
63
63
|
},
|
|
@@ -3,6 +3,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
3
3
|
import { CodeBlockSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import type { NodeSpec, DOMOutputSpec, Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
7
|
import { token } from '@atlaskit/tokens';
|
|
7
8
|
|
|
8
9
|
interface Config {
|
|
@@ -19,6 +20,12 @@ const codeBlockClassNames = {
|
|
|
19
20
|
|
|
20
21
|
const MATCH_NEWLINES = new RegExp('\n', 'gu');
|
|
21
22
|
|
|
23
|
+
const getFontSize = () =>
|
|
24
|
+
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
|
|
25
|
+
fg('platform_editor_content_mode_button_mvp')
|
|
26
|
+
? '0.875em'
|
|
27
|
+
: '0.875rem';
|
|
28
|
+
|
|
22
29
|
// Based on: `packages/editor/editor-plugin-code-block/src/nodeviews/code-block.ts`
|
|
23
30
|
const toDOM = (node: Node, formattedAriaLabel: string, config: Config): DOMOutputSpec => {
|
|
24
31
|
let totalLineCount = 1;
|
|
@@ -64,7 +71,7 @@ const toDOM = (node: Node, formattedAriaLabel: string, config: Config): DOMOutpu
|
|
|
64
71
|
? `${token('space.100')} ${token('space.250')} ${token('space.100')} ${token('space.075')}`
|
|
65
72
|
: token('space.100'),
|
|
66
73
|
flexShrink: 0,
|
|
67
|
-
fontSize:
|
|
74
|
+
fontSize: getFontSize(),
|
|
68
75
|
boxSizing: 'content-box',
|
|
69
76
|
}),
|
|
70
77
|
contenteditable: 'false',
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.entry-points.post-office.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-plugin-code-block-advanced/app",
|
|
6
|
-
"rootDir": "../",
|
|
7
|
-
"composite": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*",
|
|
18
|
-
"../src/**/examples/*",
|
|
19
|
-
"../src/**/examples/**/*",
|
|
20
|
-
"../src/**/*.stories.*",
|
|
21
|
-
"../src/**/stories/*",
|
|
22
|
-
"../src/**/stories/**/*"
|
|
23
|
-
],
|
|
24
|
-
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../editor-plugin-block-menu/afm-post-office/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../editor-plugin-code-block/afm-post-office/tsconfig.json"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"path": "../../editor-plugin-editor-disabled/afm-post-office/tsconfig.json"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"path": "../../editor-plugin-find-replace/afm-post-office/tsconfig.json"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "../../editor-plugin-selection/afm-post-office/tsconfig.json"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"path": "../../editor-plugin-selection-marker/afm-post-office/tsconfig.json"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"path": "../../editor-toolbar/afm-post-office/tsconfig.json"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"path": "../../../design-system/icon/afm-post-office/tsconfig.json"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"path": "../../../platform/feature-flags/afm-post-office/tsconfig.json"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"path": "../../prosemirror-history/afm-post-office/tsconfig.json"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"path": "../../tmp-editor-statsig/afm-post-office/tsconfig.json"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"path": "../../../design-system/tokens/afm-post-office/tsconfig.json"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"path": "../../editor-common/afm-post-office/tsconfig.json"
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|