@atlaskit/editor-plugin-code-block 3.5.15 → 3.5.16

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,17 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 3.5.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#100411](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100411)
8
+ [`14499ab145534`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/14499ab145534) -
9
+ [ux] Introduces advanced code block as per:
10
+ https://hello.atlassian.net/wiki/spaces/EDITOR/pages/4632293323/Editor+RFC+063+Advanced+code+blocks.
11
+ This can be added to an existing editor preset to enrich the code block experience with syntax
12
+ highlighting and can be extended for other features via CodeMirror extensions (ie. autocompletion,
13
+ code folding etc.).
14
+
3
15
  ## 3.5.15
4
16
 
5
17
  ### Patch Changes
@@ -105,7 +105,11 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
105
105
  var codeBlockNodes = (0, _platformFeatureFlags.fg)('editor_code_wrapping_perf_improvement_ed-25141') ? (0, _utils.getAllChangedCodeBlocksInTransaction)(tr) : (0, _utils.getAllCodeBlockNodesInDoc)(newState);
106
106
  if (codeBlockNodes) {
107
107
  (0, _codeBlock.updateCodeBlockWrappedStateNodeKeys)(codeBlockNodes, _oldState);
108
- updatedDecorationSet = (0, _decorators.updateCodeBlockDecorations)(tr, codeBlockNodes, updatedDecorationSet);
108
+ // Disabled when using advanced code block for performance reasons
109
+ // @ts-expect-error Code block advanced cannot depend on code block
110
+ if ((api === null || api === void 0 ? void 0 : api.codeBlockAdvanced) === undefined) {
111
+ updatedDecorationSet = (0, _decorators.updateCodeBlockDecorations)(tr, codeBlockNodes, updatedDecorationSet);
112
+ }
109
113
  }
110
114
  var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
111
115
  pos: _node ? _node.pos : null,
@@ -95,7 +95,11 @@ export const createPlugin = ({
95
95
  const codeBlockNodes = fg('editor_code_wrapping_perf_improvement_ed-25141') ? getAllChangedCodeBlocksInTransaction(tr) : getAllCodeBlockNodesInDoc(newState);
96
96
  if (codeBlockNodes) {
97
97
  updateCodeBlockWrappedStateNodeKeys(codeBlockNodes, _oldState);
98
- updatedDecorationSet = updateCodeBlockDecorations(tr, codeBlockNodes, updatedDecorationSet);
98
+ // Disabled when using advanced code block for performance reasons
99
+ // @ts-expect-error Code block advanced cannot depend on code block
100
+ if ((api === null || api === void 0 ? void 0 : api.codeBlockAdvanced) === undefined) {
101
+ updatedDecorationSet = updateCodeBlockDecorations(tr, codeBlockNodes, updatedDecorationSet);
102
+ }
99
103
  }
100
104
  const newPluginState = {
101
105
  ...pluginState,
@@ -100,7 +100,11 @@ export var createPlugin = function createPlugin(_ref) {
100
100
  var codeBlockNodes = fg('editor_code_wrapping_perf_improvement_ed-25141') ? getAllChangedCodeBlocksInTransaction(tr) : getAllCodeBlockNodesInDoc(newState);
101
101
  if (codeBlockNodes) {
102
102
  updateCodeBlockWrappedStateNodeKeys(codeBlockNodes, _oldState);
103
- updatedDecorationSet = updateCodeBlockDecorations(tr, codeBlockNodes, updatedDecorationSet);
103
+ // Disabled when using advanced code block for performance reasons
104
+ // @ts-expect-error Code block advanced cannot depend on code block
105
+ if ((api === null || api === void 0 ? void 0 : api.codeBlockAdvanced) === undefined) {
106
+ updatedDecorationSet = updateCodeBlockDecorations(tr, codeBlockNodes, updatedDecorationSet);
107
+ }
104
108
  }
105
109
  var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
106
110
  pos: _node ? _node.pos : null,
@@ -6,16 +6,18 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
6
6
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
7
7
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { CodeBlockOptions } from './types';
9
+ type CodeBlockDependencies = [
10
+ DecorationsPlugin,
11
+ CompositionPlugin,
12
+ OptionalPlugin<AnalyticsPlugin>,
13
+ OptionalPlugin<EditorDisabledPlugin>,
14
+ OptionalPlugin<FeatureFlagsPlugin>
15
+ ];
9
16
  export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
10
17
  pluginConfiguration: CodeBlockOptions | undefined;
11
- dependencies: [
12
- DecorationsPlugin,
13
- CompositionPlugin,
14
- OptionalPlugin<AnalyticsPlugin>,
15
- OptionalPlugin<EditorDisabledPlugin>,
16
- OptionalPlugin<FeatureFlagsPlugin>
17
- ];
18
+ dependencies: CodeBlockDependencies;
18
19
  actions: {
19
20
  insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
20
21
  };
21
22
  }>;
23
+ export {};
@@ -6,16 +6,18 @@ import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
6
6
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
7
7
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
8
  import type { CodeBlockOptions } from './types';
9
+ type CodeBlockDependencies = [
10
+ DecorationsPlugin,
11
+ CompositionPlugin,
12
+ OptionalPlugin<AnalyticsPlugin>,
13
+ OptionalPlugin<EditorDisabledPlugin>,
14
+ OptionalPlugin<FeatureFlagsPlugin>
15
+ ];
9
16
  export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
10
17
  pluginConfiguration: CodeBlockOptions | undefined;
11
- dependencies: [
12
- DecorationsPlugin,
13
- CompositionPlugin,
14
- OptionalPlugin<AnalyticsPlugin>,
15
- OptionalPlugin<EditorDisabledPlugin>,
16
- OptionalPlugin<FeatureFlagsPlugin>
17
- ];
18
+ dependencies: CodeBlockDependencies;
18
19
  actions: {
19
20
  insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
20
21
  };
21
22
  }>;
23
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "3.5.15",
3
+ "version": "3.5.16",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
35
  "@atlaskit/code": "^15.6.0",
36
- "@atlaskit/editor-common": "^99.0.0",
36
+ "@atlaskit/editor-common": "^99.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
38
38
  "@atlaskit/editor-plugin-composition": "^1.2.0",
39
39
  "@atlaskit/editor-plugin-decorations": "^1.3.0",