@atlaskit/editor-plugin-code-block 3.5.1 → 3.5.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,29 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 3.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#154664](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154664)
8
+ [`365f9b8ae8789`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/365f9b8ae8789) -
9
+ [ux] [ED-23241] Reverted
10
+ [previous bugfix](https://stash.atlassian.com/projects/ATLASSIAN/repos/atlassian-frontend-monorepo/pull-requests/95492/overview)
11
+ for codeblock -> paragraph behaviour as it is handled by the Prosemirror schema now, using the
12
+ linebreakReplacement setting
13
+ - [#154186](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154186)
14
+ [`5c316170d29dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5c316170d29dd) -
15
+ Bump @atlaskit/adf-schema to 42.3.1
16
+ - Updated dependencies
17
+
18
+ ## 3.5.2
19
+
20
+ ### Patch Changes
21
+
22
+ - [#152510](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152510)
23
+ [`dcf9edde7ac7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf9edde7ac7b) -
24
+ bump adf-schema to 42.0.1
25
+ - Updated dependencies
26
+
3
27
  ## 3.5.1
4
28
 
5
29
  ### Patch Changes
@@ -9,6 +9,7 @@ var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _utils3 = require("../utils");
13
14
  var deleteCurrentItem = function deleteCurrentItem($from) {
14
15
  return function (tr) {
@@ -58,7 +59,8 @@ function keymapPlugin(schema) {
58
59
  codeBlock = _state$schema$nodes2.codeBlock,
59
60
  listItem = _state$schema$nodes2.listItem,
60
61
  table = _state$schema$nodes2.table,
61
- layoutColumn = _state$schema$nodes2.layoutColumn;
62
+ layoutColumn = _state$schema$nodes2.layoutColumn,
63
+ paragraph = _state$schema$nodes2.paragraph;
62
64
  if (!$cursor || $cursor.parent.type !== codeBlock || !dispatch) {
63
65
  return false;
64
66
  }
@@ -67,7 +69,11 @@ function keymapPlugin(schema) {
67
69
  if (!node) {
68
70
  return false;
69
71
  }
70
- replaceWithParagraph(node.node, node.pos, $cursor, state, dispatch);
72
+ if ((0, _platformFeatureFlags.fg)('platform_editor_utilize_linebreakreplacement')) {
73
+ dispatch(state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, []).setBlockType($cursor.pos, $cursor.pos, paragraph));
74
+ } else {
75
+ replaceWithParagraph(node.node, node.pos, $cursor, state, dispatch);
76
+ }
71
77
  return true;
72
78
  }
73
79
  if ($cursor.node && (0, _utils.isEmptyNode)(schema)($cursor.node()) && ((0, _utils2.hasParentNodeOfType)(layoutColumn)(state.selection) || (0, _utils2.hasParentNodeOfType)(table)(state.selection))) {
@@ -2,6 +2,7 @@ import { isEmptyNode } from '@atlaskit/editor-common/utils';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { getCursor } from '../utils';
6
7
  const deleteCurrentItem = $from => tr => {
7
8
  return tr.delete($from.before($from.depth), $from.after($from.depth));
@@ -50,7 +51,8 @@ export function keymapPlugin(schema) {
50
51
  codeBlock,
51
52
  listItem,
52
53
  table,
53
- layoutColumn
54
+ layoutColumn,
55
+ paragraph
54
56
  } = state.schema.nodes;
55
57
  if (!$cursor || $cursor.parent.type !== codeBlock || !dispatch) {
56
58
  return false;
@@ -60,7 +62,11 @@ export function keymapPlugin(schema) {
60
62
  if (!node) {
61
63
  return false;
62
64
  }
63
- replaceWithParagraph(node.node, node.pos, $cursor, state, dispatch);
65
+ if (fg('platform_editor_utilize_linebreakreplacement')) {
66
+ dispatch(state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, []).setBlockType($cursor.pos, $cursor.pos, paragraph));
67
+ } else {
68
+ replaceWithParagraph(node.node, node.pos, $cursor, state, dispatch);
69
+ }
64
70
  return true;
65
71
  }
66
72
  if ($cursor.node && isEmptyNode(schema)($cursor.node()) && (hasParentNodeOfType(layoutColumn)(state.selection) || hasParentNodeOfType(table)(state.selection))) {
@@ -2,6 +2,7 @@ import { isEmptyNode } from '@atlaskit/editor-common/utils';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { getCursor } from '../utils';
6
7
  var deleteCurrentItem = function deleteCurrentItem($from) {
7
8
  return function (tr) {
@@ -51,7 +52,8 @@ export function keymapPlugin(schema) {
51
52
  codeBlock = _state$schema$nodes2.codeBlock,
52
53
  listItem = _state$schema$nodes2.listItem,
53
54
  table = _state$schema$nodes2.table,
54
- layoutColumn = _state$schema$nodes2.layoutColumn;
55
+ layoutColumn = _state$schema$nodes2.layoutColumn,
56
+ paragraph = _state$schema$nodes2.paragraph;
55
57
  if (!$cursor || $cursor.parent.type !== codeBlock || !dispatch) {
56
58
  return false;
57
59
  }
@@ -60,7 +62,11 @@ export function keymapPlugin(schema) {
60
62
  if (!node) {
61
63
  return false;
62
64
  }
63
- replaceWithParagraph(node.node, node.pos, $cursor, state, dispatch);
65
+ if (fg('platform_editor_utilize_linebreakreplacement')) {
66
+ dispatch(state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, []).setBlockType($cursor.pos, $cursor.pos, paragraph));
67
+ } else {
68
+ replaceWithParagraph(node.node, node.pos, $cursor, state, dispatch);
69
+ }
64
70
  return true;
65
71
  }
66
72
  if ($cursor.node && isEmptyNode(schema)($cursor.node()) && (hasParentNodeOfType(layoutColumn)(state.selection) || hasParentNodeOfType(table)(state.selection))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,15 +31,15 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^40.9.4",
34
+ "@atlaskit/adf-schema": "^42.3.1",
35
35
  "@atlaskit/code": "^15.6.0",
36
- "@atlaskit/editor-common": "^93.4.0",
36
+ "@atlaskit/editor-common": "^94.0.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",
40
40
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
41
41
  "@atlaskit/editor-prosemirror": "6.0.0",
42
- "@atlaskit/icon": "^22.22.0",
42
+ "@atlaskit/icon": "^22.23.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
44
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
45
45
  "@babel/runtime": "^7.0.0",
@@ -105,6 +105,9 @@
105
105
  },
106
106
  "editor_code_wrapping_perf_improvement_ed-25141": {
107
107
  "type": "boolean"
108
+ },
109
+ "platform_editor_utilize_linebreakreplacement": {
110
+ "type": "boolean"
108
111
  }
109
112
  }
110
113
  }