@atlaskit/editor-plugin-code-block-advanced 3.0.2 → 3.0.4

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,26 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 3.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#191913](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/191913)
8
+ [`6d1e56695e91d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6d1e56695e91d) -
9
+ EDITOR-1131 Bump adf-schema package to 50.0.0
10
+ - [#193159](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/193159)
11
+ [`b004f44506551`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b004f44506551) -
12
+ [ED-28680] Fix a11y violation for aria-input-field-name in advanced code blocks
13
+ - Updated dependencies
14
+
15
+ ## 3.0.3
16
+
17
+ ### Patch Changes
18
+
19
+ - [#187144](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/187144)
20
+ [`a16147d8fbdfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a16147d8fbdfe) -
21
+ Bump @atlaskit/adf-schema to v49.0.5
22
+ - Updated dependencies
23
+
3
24
  ## 3.0.2
4
25
 
5
26
  ### Patch Changes
@@ -1,48 +1,48 @@
1
1
  {
2
- "extends": "../../../../tsconfig.entry-points.confluence.json",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "composite": true,
6
- "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-code-block-advanced",
7
- "rootDir": "../"
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
- ],
19
- "references": [
20
- {
21
- "path": "../../editor-plugin-code-block/afm-cc/tsconfig.json"
22
- },
23
- {
24
- "path": "../../editor-plugin-editor-disabled/afm-cc/tsconfig.json"
25
- },
26
- {
27
- "path": "../../editor-plugin-find-replace/afm-cc/tsconfig.json"
28
- },
29
- {
30
- "path": "../../editor-plugin-selection/afm-cc/tsconfig.json"
31
- },
32
- {
33
- "path": "../../editor-plugin-selection-marker/afm-cc/tsconfig.json"
34
- },
35
- {
36
- "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
37
- },
38
- {
39
- "path": "../../tmp-editor-statsig/afm-cc/tsconfig.json"
40
- },
41
- {
42
- "path": "../../../design-system/tokens/afm-cc/tsconfig.json"
43
- },
44
- {
45
- "path": "../../editor-common/afm-cc/tsconfig.json"
46
- }
47
- ]
2
+ "extends": "../../../../tsconfig.entry-points.confluence.json",
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "composite": true,
6
+ "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-code-block-advanced",
7
+ "rootDir": "../"
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
+ ],
19
+ "references": [
20
+ {
21
+ "path": "../../editor-plugin-code-block/afm-cc/tsconfig.json"
22
+ },
23
+ {
24
+ "path": "../../editor-plugin-editor-disabled/afm-cc/tsconfig.json"
25
+ },
26
+ {
27
+ "path": "../../editor-plugin-find-replace/afm-cc/tsconfig.json"
28
+ },
29
+ {
30
+ "path": "../../editor-plugin-selection/afm-cc/tsconfig.json"
31
+ },
32
+ {
33
+ "path": "../../editor-plugin-selection-marker/afm-cc/tsconfig.json"
34
+ },
35
+ {
36
+ "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
37
+ },
38
+ {
39
+ "path": "../../tmp-editor-statsig/afm-cc/tsconfig.json"
40
+ },
41
+ {
42
+ "path": "../../../design-system/tokens/afm-cc/tsconfig.json"
43
+ },
44
+ {
45
+ "path": "../../editor-common/afm-cc/tsconfig.json"
46
+ }
47
+ ]
48
48
  }
@@ -0,0 +1,48 @@
1
+ {
2
+ "extends": "../../../../tsconfig.entry-points.townsquare.json",
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "outDir": "../../../../../townsquare/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
+ ],
19
+ "references": [
20
+ {
21
+ "path": "../../editor-plugin-code-block/afm-townsquare/tsconfig.json"
22
+ },
23
+ {
24
+ "path": "../../editor-plugin-editor-disabled/afm-townsquare/tsconfig.json"
25
+ },
26
+ {
27
+ "path": "../../editor-plugin-find-replace/afm-townsquare/tsconfig.json"
28
+ },
29
+ {
30
+ "path": "../../editor-plugin-selection/afm-townsquare/tsconfig.json"
31
+ },
32
+ {
33
+ "path": "../../editor-plugin-selection-marker/afm-townsquare/tsconfig.json"
34
+ },
35
+ {
36
+ "path": "../../../platform/feature-flags/afm-townsquare/tsconfig.json"
37
+ },
38
+ {
39
+ "path": "../../tmp-editor-statsig/afm-townsquare/tsconfig.json"
40
+ },
41
+ {
42
+ "path": "../../../design-system/tokens/afm-townsquare/tsconfig.json"
43
+ },
44
+ {
45
+ "path": "../../editor-common/afm-townsquare/tsconfig.json"
46
+ }
47
+ ]
48
+ }
@@ -20,11 +20,13 @@ var codeBlockAdvancedPlugin = exports.codeBlockAdvancedPlugin = function codeBlo
20
20
  pmPlugins: function pmPlugins() {
21
21
  return [{
22
22
  name: 'codeBlockAdvancedPlugin',
23
- plugin: function plugin() {
23
+ plugin: function plugin(_ref2) {
24
24
  var _config$extensions;
25
+ var getIntl = _ref2.getIntl;
25
26
  return (0, _main.createPlugin)({
26
27
  api: api,
27
- extensions: (_config$extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config$extensions !== void 0 ? _config$extensions : []
28
+ extensions: (_config$extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config$extensions !== void 0 ? _config$extensions : [],
29
+ getIntl: getIntl
28
30
  });
29
31
  }
30
32
  }];
@@ -14,6 +14,7 @@ var _language = require("@codemirror/language");
14
14
  var _state = require("@codemirror/state");
15
15
  var _view = require("@codemirror/view");
16
16
  var _codeBlock = require("@atlaskit/editor-common/code-block");
17
+ var _messages = require("@atlaskit/editor-common/messages");
17
18
  var _whitespace = require("@atlaskit/editor-common/whitespace");
18
19
  var _state2 = require("@atlaskit/editor-prosemirror/state");
19
20
  var _view2 = require("@atlaskit/editor-prosemirror/view");
@@ -64,6 +65,9 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
64
65
  });
65
66
  _this.updating = false;
66
67
  });
68
+ var _config$getIntl = config.getIntl(),
69
+ formatMessage = _config$getIntl.formatMessage;
70
+ var formattedAriaLabel = formatMessage(_messages.blockTypeMessages.codeblock);
67
71
  this.cm = new _view.EditorView({
68
72
  doc: this.node.textContent,
69
73
  extensions: [].concat((0, _toConsumableArray2.default)(config.extensions), [this.lineWrappingCompartment.of((0, _codeBlock.isCodeBlockWordWrapEnabled)(node) ? _view.EditorView.lineWrapping : []), this.languageCompartment.of([]), this.pmDecorationsCompartment.of(this.pmFacet.compute([], function () {
@@ -94,7 +98,9 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
94
98
  contentEditable: "".concat(this.view.editable)
95
99
  })]), (0, _autocomplete.closeBrackets)(), _view.EditorView.editorAttributes.of({
96
100
  class: 'code-block'
97
- }), (0, _manageSelectionMarker.manageSelectionMarker)(config.api), (0, _prosemirrorDecorations.prosemirrorDecorationPlugin)(this.pmFacet, view, getPos), (0, _tripleClickExtension.tripleClickSelectAllExtension)(), (0, _firstCodeBlockInDocument.firstCodeBlockInDocument)(getPos)])
101
+ }), (0, _manageSelectionMarker.manageSelectionMarker)(config.api), (0, _prosemirrorDecorations.prosemirrorDecorationPlugin)(this.pmFacet, view, getPos), (0, _tripleClickExtension.tripleClickSelectAllExtension)(), (0, _firstCodeBlockInDocument.firstCodeBlockInDocument)(getPos), _view.EditorView.contentAttributes.of({
102
+ 'aria-label': formattedAriaLabel
103
+ })])
98
104
  });
99
105
 
100
106
  // We append an additional element that fixes a selection bug on chrome if the code block
@@ -14,11 +14,14 @@ export const codeBlockAdvancedPlugin = ({
14
14
  pmPlugins() {
15
15
  return [{
16
16
  name: 'codeBlockAdvancedPlugin',
17
- plugin: () => {
17
+ plugin: ({
18
+ getIntl
19
+ }) => {
18
20
  var _config$extensions;
19
21
  return createPlugin({
20
22
  api,
21
- extensions: (_config$extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config$extensions !== void 0 ? _config$extensions : []
23
+ extensions: (_config$extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config$extensions !== void 0 ? _config$extensions : [],
24
+ getIntl
22
25
  });
23
26
  }
24
27
  }];
@@ -4,6 +4,7 @@ import { syntaxHighlighting, bracketMatching } from '@codemirror/language';
4
4
  import { Compartment, EditorSelection, Facet, EditorState as CodeMirrorState } from '@codemirror/state';
5
5
  import { EditorView as CodeMirror, lineNumbers, gutters } from '@codemirror/view';
6
6
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
7
+ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
7
8
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
8
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
10
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -46,6 +47,10 @@ class CodeBlockAdvancedNodeView {
46
47
  });
47
48
  this.updating = false;
48
49
  });
50
+ const {
51
+ formatMessage
52
+ } = config.getIntl();
53
+ const formattedAriaLabel = formatMessage(blockTypeMessages.codeblock);
49
54
  this.cm = new CodeMirror({
50
55
  doc: this.node.textContent,
51
56
  extensions: [...config.extensions, this.lineWrappingCompartment.of(isCodeBlockWordWrapEnabled(node) ? CodeMirror.lineWrapping : []), this.languageCompartment.of([]), this.pmDecorationsCompartment.of(this.pmFacet.compute([], () => innerDecorations)), keymapExtension({
@@ -72,7 +77,9 @@ class CodeBlockAdvancedNodeView {
72
77
  contentEditable: `${this.view.editable}`
73
78
  })]), closeBrackets(), CodeMirror.editorAttributes.of({
74
79
  class: 'code-block'
75
- }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension(), firstCodeBlockInDocument(getPos)]
80
+ }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension(), firstCodeBlockInDocument(getPos), CodeMirror.contentAttributes.of({
81
+ 'aria-label': formattedAriaLabel
82
+ })]
76
83
  });
77
84
 
78
85
  // We append an additional element that fixes a selection bug on chrome if the code block
@@ -14,11 +14,13 @@ export var codeBlockAdvancedPlugin = function codeBlockAdvancedPlugin(_ref) {
14
14
  pmPlugins: function pmPlugins() {
15
15
  return [{
16
16
  name: 'codeBlockAdvancedPlugin',
17
- plugin: function plugin() {
17
+ plugin: function plugin(_ref2) {
18
18
  var _config$extensions;
19
+ var getIntl = _ref2.getIntl;
19
20
  return createPlugin({
20
21
  api: api,
21
- extensions: (_config$extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config$extensions !== void 0 ? _config$extensions : []
22
+ extensions: (_config$extensions = config === null || config === void 0 ? void 0 : config.extensions) !== null && _config$extensions !== void 0 ? _config$extensions : [],
23
+ getIntl: getIntl
22
24
  });
23
25
  }
24
26
  }];
@@ -7,6 +7,7 @@ import { syntaxHighlighting, bracketMatching } from '@codemirror/language';
7
7
  import { Compartment, EditorSelection, Facet, EditorState as CodeMirrorState } from '@codemirror/state';
8
8
  import { EditorView as CodeMirror, lineNumbers, gutters } from '@codemirror/view';
9
9
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
10
+ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
10
11
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
11
12
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
12
13
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -57,6 +58,9 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
57
58
  });
58
59
  _this.updating = false;
59
60
  });
61
+ var _config$getIntl = config.getIntl(),
62
+ formatMessage = _config$getIntl.formatMessage;
63
+ var formattedAriaLabel = formatMessage(blockTypeMessages.codeblock);
60
64
  this.cm = new CodeMirror({
61
65
  doc: this.node.textContent,
62
66
  extensions: [].concat(_toConsumableArray(config.extensions), [this.lineWrappingCompartment.of(isCodeBlockWordWrapEnabled(node) ? CodeMirror.lineWrapping : []), this.languageCompartment.of([]), this.pmDecorationsCompartment.of(this.pmFacet.compute([], function () {
@@ -87,7 +91,9 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
87
91
  contentEditable: "".concat(this.view.editable)
88
92
  })]), closeBrackets(), CodeMirror.editorAttributes.of({
89
93
  class: 'code-block'
90
- }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension(), firstCodeBlockInDocument(getPos)])
94
+ }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension(), firstCodeBlockInDocument(getPos), CodeMirror.contentAttributes.of({
95
+ 'aria-label': formattedAriaLabel
96
+ })])
91
97
  });
92
98
 
93
99
  // We append an additional element that fixes a selection bug on chrome if the code block
@@ -1,5 +1,6 @@
1
1
  import { type Extension } from '@codemirror/state';
2
2
  import { type ViewUpdate } from '@codemirror/view';
3
+ import type { IntlShape } from 'react-intl-next';
3
4
  import type { getPosHandler, getPosHandlerNode, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
6
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
@@ -7,6 +8,7 @@ import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
7
8
  interface ConfigProps {
8
9
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
9
10
  extensions: Extension[];
11
+ getIntl: () => IntlShape;
10
12
  }
11
13
  declare class CodeBlockAdvancedNodeView implements NodeView {
12
14
  dom: Node;
@@ -1,9 +1,11 @@
1
1
  import { type Extension } from '@codemirror/state';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
4
  import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
4
5
  interface Props {
5
6
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
6
7
  extensions: Extension[];
8
+ getIntl: () => IntlShape;
7
9
  }
8
10
  export declare const lazyCodeBlockView: (props: Props) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
9
11
  export {};
@@ -1,10 +1,12 @@
1
1
  import type { Extension } from '@codemirror/state';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
5
6
  interface Props {
6
7
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
7
8
  extensions: Extension[];
9
+ getIntl: () => IntlShape;
8
10
  }
9
11
  export declare const createPlugin: (props: Props) => SafePlugin<any>;
10
12
  export {};
@@ -1,5 +1,6 @@
1
1
  import { type Extension } from '@codemirror/state';
2
2
  import { type ViewUpdate } from '@codemirror/view';
3
+ import type { IntlShape } from 'react-intl-next';
3
4
  import type { getPosHandler, getPosHandlerNode, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
6
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
@@ -7,6 +8,7 @@ import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
7
8
  interface ConfigProps {
8
9
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
9
10
  extensions: Extension[];
11
+ getIntl: () => IntlShape;
10
12
  }
11
13
  declare class CodeBlockAdvancedNodeView implements NodeView {
12
14
  dom: Node;
@@ -1,9 +1,11 @@
1
1
  import { type Extension } from '@codemirror/state';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
4
  import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
4
5
  interface Props {
5
6
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
6
7
  extensions: Extension[];
8
+ getIntl: () => IntlShape;
7
9
  }
8
10
  export declare const lazyCodeBlockView: (props: Props) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
9
11
  export {};
@@ -1,10 +1,12 @@
1
1
  import type { Extension } from '@codemirror/state';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
4
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
5
  import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
5
6
  interface Props {
6
7
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
7
8
  extensions: Extension[];
9
+ getIntl: () => IntlShape;
8
10
  }
9
11
  export declare const createPlugin: (props: Props) => SafePlugin<any>;
10
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,16 +31,16 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^47.6.0",
34
+ "@atlaskit/adf-schema": "^50.0.1",
35
35
  "@atlaskit/editor-plugin-code-block": "^5.0.0",
36
36
  "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
37
- "@atlaskit/editor-plugin-find-replace": "^3.0.0",
37
+ "@atlaskit/editor-plugin-find-replace": "^3.2.0",
38
38
  "@atlaskit/editor-plugin-selection": "^3.0.0",
39
39
  "@atlaskit/editor-plugin-selection-marker": "^3.0.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^9.0.0",
43
- "@atlaskit/tokens": "^5.4.0",
42
+ "@atlaskit/tmp-editor-statsig": "^9.17.0",
43
+ "@atlaskit/tokens": "^5.6.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@codemirror/autocomplete": "6.18.4",
46
46
  "@codemirror/commands": "6.7.1",
@@ -54,7 +54,7 @@
54
54
  "codemirror-lang-elixir": "4.0.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^107.7.0",
57
+ "@atlaskit/editor-common": "^107.12.0",
58
58
  "react": "^18.2.0"
59
59
  },
60
60
  "devDependencies": {
@@ -18,7 +18,8 @@ export const codeBlockAdvancedPlugin: CodeBlockAdvancedPlugin = ({ api, config }
18
18
  return [
19
19
  {
20
20
  name: 'codeBlockAdvancedPlugin',
21
- plugin: () => createPlugin({ api, extensions: config?.extensions ?? [] }),
21
+ plugin: ({ getIntl }) =>
22
+ createPlugin({ api, extensions: config?.extensions ?? [], getIntl }),
22
23
  },
23
24
  ];
24
25
  },
@@ -9,8 +9,10 @@ import {
9
9
  type StateEffect,
10
10
  } from '@codemirror/state';
11
11
  import { EditorView as CodeMirror, lineNumbers, type ViewUpdate, gutters } from '@codemirror/view';
12
+ import type { IntlShape } from 'react-intl-next';
12
13
 
13
14
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
15
+ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
14
16
  import { type RelativeSelectionPos } from '@atlaskit/editor-common/selection';
15
17
  import type {
16
18
  getPosHandler,
@@ -47,6 +49,7 @@ import { LanguageLoader } from './languages/loader';
47
49
  interface ConfigProps {
48
50
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
49
51
  extensions: Extension[];
52
+ getIntl: () => IntlShape;
50
53
  }
51
54
 
52
55
  // Based on: https://prosemirror.net/examples/codemirror/
@@ -90,6 +93,8 @@ class CodeBlockAdvancedNodeView implements NodeView {
90
93
  });
91
94
  this.updating = false;
92
95
  });
96
+ const { formatMessage } = config.getIntl();
97
+ const formattedAriaLabel = formatMessage(blockTypeMessages.codeblock);
93
98
 
94
99
  this.cm = new CodeMirror({
95
100
  doc: this.node.textContent,
@@ -136,6 +141,7 @@ class CodeBlockAdvancedNodeView implements NodeView {
136
141
  prosemirrorDecorationPlugin(this.pmFacet, view, getPos),
137
142
  tripleClickSelectAllExtension(),
138
143
  firstCodeBlockInDocument(getPos),
144
+ CodeMirror.contentAttributes.of({ 'aria-label': formattedAriaLabel }),
139
145
  ],
140
146
  });
141
147
 
@@ -1,4 +1,5 @@
1
1
  import { type Extension } from '@codemirror/state';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
 
3
4
  import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
4
5
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
@@ -10,6 +11,7 @@ import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
10
11
  interface Props {
11
12
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
12
13
  extensions: Extension[];
14
+ getIntl: () => IntlShape;
13
15
  }
14
16
 
15
17
  export const lazyCodeBlockView = (props: Props) => {
@@ -1,4 +1,5 @@
1
1
  import type { Extension } from '@codemirror/state';
2
+ import type { IntlShape } from 'react-intl-next';
2
3
 
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
@@ -12,6 +13,7 @@ import { shiftArrowDownWorkaround, shiftArrowUpWorkaround } from './shiftArrowKe
12
13
  interface Props {
13
14
  api: ExtractInjectionAPI<CodeBlockAdvancedPlugin> | undefined;
14
15
  extensions: Extension[];
16
+ getIntl: () => IntlShape;
15
17
  }
16
18
 
17
19
  export const createPlugin = (props: Props) => {
package/tsconfig.json CHANGED
@@ -5,6 +5,5 @@
5
5
  "src/**/*.tsx"
6
6
  ],
7
7
  "compilerOptions": {
8
- "baseUrl": ""
9
8
  }
10
9
  }