@atlaskit/editor-plugin-code-block-advanced 6.1.1 → 6.2.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 +19 -1
- package/dist/cjs/ui/theme.js +22 -6
- package/dist/es2019/ui/theme.js +11 -4
- package/dist/esm/ui/theme.js +21 -6
- package/package.json +9 -6
- package/src/ui/theme.ts +23 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5167552fe1a93`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5167552fe1a93) -
|
|
8
|
+
[EDITOR-2339] Bump @atlaskit/adf-schema to 51.3.0
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [`685d27211d400`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/685d27211d400) -
|
|
13
|
+
[ux] Adjust codeblock font size relative to parent
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 6.1.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 6.1.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -341,7 +360,6 @@
|
|
|
341
360
|
shared context or singletons.
|
|
342
361
|
|
|
343
362
|
**HOW TO ADJUST:**
|
|
344
|
-
|
|
345
363
|
- Consumers must now explicitly install `@atlaskit/editor-common` in their own project if they use
|
|
346
364
|
any of these editor plugins.
|
|
347
365
|
- Ensure the version you install matches the version required by the plugins.
|
package/dist/cjs/ui/theme.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.codeFoldingTheme = exports.cmTheme = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _view = require("@codemirror/view");
|
|
8
|
-
var
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
+
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
|
+
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
|
+
var getLineHeight = function getLineHeight() {
|
|
15
|
+
return (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') ? '1.5em' : '1.5rem';
|
|
16
|
+
};
|
|
17
|
+
var getMaxGutterHeight = function getMaxGutterHeight() {
|
|
18
|
+
return (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') ? '1.5em' : undefined;
|
|
19
|
+
};
|
|
20
|
+
var getFontSize = function getFontSize() {
|
|
21
|
+
return (0, _expValEquals.expValEquals)('cc_editor_ai_content_mode', 'variant', 'test') && (0, _platformFeatureFlags.fg)('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
|
|
22
|
+
};
|
|
9
23
|
var cmTheme = exports.cmTheme = _view.EditorView.theme({
|
|
10
24
|
'&': {
|
|
11
25
|
backgroundColor: "var(--ds-background-neutral, #091E420F)",
|
|
@@ -13,10 +27,10 @@ var cmTheme = exports.cmTheme = _view.EditorView.theme({
|
|
|
13
27
|
marginTop: "var(--ds-space-100, 8px)",
|
|
14
28
|
marginBottom: "var(--ds-space-100, 8px)",
|
|
15
29
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
16
|
-
fontSize:
|
|
30
|
+
fontSize: getFontSize(),
|
|
17
31
|
// Custom syntax styling to match existing styling
|
|
18
32
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
19
|
-
lineHeight:
|
|
33
|
+
lineHeight: getLineHeight()
|
|
20
34
|
},
|
|
21
35
|
'&.cm-focused': {
|
|
22
36
|
outline: 'none'
|
|
@@ -69,10 +83,12 @@ var cmTheme = exports.cmTheme = _view.EditorView.theme({
|
|
|
69
83
|
// codemirror is calculating (which happens after an animation frame).
|
|
70
84
|
// Example problem: https://github.com/codemirror/dev/issues/1076
|
|
71
85
|
// Ignore the first gutter element as it is a special hidden element.
|
|
72
|
-
'.cm-gutterElement:not(:first-child)': {
|
|
86
|
+
'.cm-gutterElement:not(:first-child)': _objectSpread({
|
|
73
87
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
74
|
-
minHeight:
|
|
75
|
-
}
|
|
88
|
+
minHeight: getLineHeight()
|
|
89
|
+
}, getMaxGutterHeight() && {
|
|
90
|
+
maxHeight: getMaxGutterHeight()
|
|
91
|
+
})
|
|
76
92
|
});
|
|
77
93
|
var codeFoldingTheme = exports.codeFoldingTheme = _view.EditorView.theme({
|
|
78
94
|
'.cm-gutter': {
|
package/dist/es2019/ui/theme.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
2
|
-
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
const getLineHeight = () => expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '1.5em' : '1.5rem';
|
|
5
|
+
const getMaxGutterHeight = () => expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '1.5em' : undefined;
|
|
6
|
+
const getFontSize = () => expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
|
|
3
7
|
export const cmTheme = CodeMirror.theme({
|
|
4
8
|
'&': {
|
|
5
9
|
backgroundColor: "var(--ds-background-neutral, #091E420F)",
|
|
@@ -7,10 +11,10 @@ export const cmTheme = CodeMirror.theme({
|
|
|
7
11
|
marginTop: "var(--ds-space-100, 8px)",
|
|
8
12
|
marginBottom: "var(--ds-space-100, 8px)",
|
|
9
13
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
10
|
-
fontSize:
|
|
14
|
+
fontSize: getFontSize(),
|
|
11
15
|
// Custom syntax styling to match existing styling
|
|
12
16
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
13
|
-
lineHeight:
|
|
17
|
+
lineHeight: getLineHeight()
|
|
14
18
|
},
|
|
15
19
|
'&.cm-focused': {
|
|
16
20
|
outline: 'none'
|
|
@@ -65,7 +69,10 @@ export const cmTheme = CodeMirror.theme({
|
|
|
65
69
|
// Ignore the first gutter element as it is a special hidden element.
|
|
66
70
|
'.cm-gutterElement:not(:first-child)': {
|
|
67
71
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
68
|
-
minHeight:
|
|
72
|
+
minHeight: getLineHeight(),
|
|
73
|
+
...(getMaxGutterHeight() && {
|
|
74
|
+
maxHeight: getMaxGutterHeight()
|
|
75
|
+
})
|
|
69
76
|
}
|
|
70
77
|
});
|
|
71
78
|
export const codeFoldingTheme = CodeMirror.theme({
|
package/dist/esm/ui/theme.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
1
4
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
2
|
-
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
+
var getLineHeight = function getLineHeight() {
|
|
8
|
+
return expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '1.5em' : '1.5rem';
|
|
9
|
+
};
|
|
10
|
+
var getMaxGutterHeight = function getMaxGutterHeight() {
|
|
11
|
+
return expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '1.5em' : undefined;
|
|
12
|
+
};
|
|
13
|
+
var getFontSize = function getFontSize() {
|
|
14
|
+
return expValEquals('cc_editor_ai_content_mode', 'variant', 'test') && fg('platform_editor_content_mode_button_mvp') ? '0.875em' : '0.875rem';
|
|
15
|
+
};
|
|
3
16
|
export var cmTheme = CodeMirror.theme({
|
|
4
17
|
'&': {
|
|
5
18
|
backgroundColor: "var(--ds-background-neutral, #091E420F)",
|
|
@@ -7,10 +20,10 @@ export var cmTheme = CodeMirror.theme({
|
|
|
7
20
|
marginTop: "var(--ds-space-100, 8px)",
|
|
8
21
|
marginBottom: "var(--ds-space-100, 8px)",
|
|
9
22
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
10
|
-
fontSize:
|
|
23
|
+
fontSize: getFontSize(),
|
|
11
24
|
// Custom syntax styling to match existing styling
|
|
12
25
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
13
|
-
lineHeight:
|
|
26
|
+
lineHeight: getLineHeight()
|
|
14
27
|
},
|
|
15
28
|
'&.cm-focused': {
|
|
16
29
|
outline: 'none'
|
|
@@ -63,10 +76,12 @@ export var cmTheme = CodeMirror.theme({
|
|
|
63
76
|
// codemirror is calculating (which happens after an animation frame).
|
|
64
77
|
// Example problem: https://github.com/codemirror/dev/issues/1076
|
|
65
78
|
// Ignore the first gutter element as it is a special hidden element.
|
|
66
|
-
'.cm-gutterElement:not(:first-child)': {
|
|
79
|
+
'.cm-gutterElement:not(:first-child)': _objectSpread({
|
|
67
80
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
68
|
-
minHeight:
|
|
69
|
-
}
|
|
81
|
+
minHeight: getLineHeight()
|
|
82
|
+
}, getMaxGutterHeight() && {
|
|
83
|
+
maxHeight: getMaxGutterHeight()
|
|
84
|
+
})
|
|
70
85
|
});
|
|
71
86
|
export var codeFoldingTheme = CodeMirror.theme({
|
|
72
87
|
'.cm-gutter': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"atlaskit:src": "src/index.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@atlaskit/adf-schema": "^51.
|
|
31
|
+
"@atlaskit/adf-schema": "^51.3.0",
|
|
32
32
|
"@atlaskit/editor-plugin-block-menu": "^4.0.0",
|
|
33
|
-
"@atlaskit/editor-plugin-code-block": "^8.
|
|
33
|
+
"@atlaskit/editor-plugin-code-block": "^8.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-editor-disabled": "^6.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-find-replace": "^6.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-selection": "^6.1.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.13.0",
|
|
44
|
+
"@atlaskit/tokens": "^7.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.14.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
63
63
|
},
|
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
},
|
|
107
107
|
"platform_editor_block_menu_format_rank_revised": {
|
|
108
108
|
"type": "boolean"
|
|
109
|
+
},
|
|
110
|
+
"platform_editor_content_mode_button_mvp": {
|
|
111
|
+
"type": "boolean"
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
}
|
package/src/ui/theme.ts
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
2
2
|
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
5
|
import { token } from '@atlaskit/tokens';
|
|
4
6
|
|
|
5
|
-
const
|
|
7
|
+
const getLineHeight = () =>
|
|
8
|
+
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
|
|
9
|
+
fg('platform_editor_content_mode_button_mvp')
|
|
10
|
+
? '1.5em'
|
|
11
|
+
: '1.5rem';
|
|
12
|
+
|
|
13
|
+
const getMaxGutterHeight = () =>
|
|
14
|
+
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
|
|
15
|
+
fg('platform_editor_content_mode_button_mvp')
|
|
16
|
+
? '1.5em'
|
|
17
|
+
: undefined;
|
|
18
|
+
|
|
19
|
+
const getFontSize = () =>
|
|
20
|
+
expValEquals('cc_editor_ai_content_mode', 'variant', 'test') &&
|
|
21
|
+
fg('platform_editor_content_mode_button_mvp')
|
|
22
|
+
? '0.875em'
|
|
23
|
+
: '0.875rem';
|
|
6
24
|
|
|
7
25
|
export const cmTheme = CodeMirror.theme({
|
|
8
26
|
'&': {
|
|
@@ -11,10 +29,10 @@ export const cmTheme = CodeMirror.theme({
|
|
|
11
29
|
marginTop: token('space.100'),
|
|
12
30
|
marginBottom: token('space.100'),
|
|
13
31
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
14
|
-
fontSize:
|
|
32
|
+
fontSize: getFontSize(),
|
|
15
33
|
// Custom syntax styling to match existing styling
|
|
16
34
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
17
|
-
lineHeight:
|
|
35
|
+
lineHeight: getLineHeight(),
|
|
18
36
|
},
|
|
19
37
|
'&.cm-focused': {
|
|
20
38
|
outline: 'none',
|
|
@@ -69,7 +87,8 @@ export const cmTheme = CodeMirror.theme({
|
|
|
69
87
|
// Ignore the first gutter element as it is a special hidden element.
|
|
70
88
|
'.cm-gutterElement:not(:first-child)': {
|
|
71
89
|
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
72
|
-
minHeight:
|
|
90
|
+
minHeight: getLineHeight(),
|
|
91
|
+
...(getMaxGutterHeight() && { maxHeight: getMaxGutterHeight() }),
|
|
73
92
|
},
|
|
74
93
|
});
|
|
75
94
|
|