@atlaskit/editor-core 187.9.2 → 187.10.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.
Files changed (128) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/commands/index.js +8 -134
  3. package/dist/cjs/plugins/base/index.js +2 -2
  4. package/dist/cjs/plugins/block-type/commands/block-type.js +34 -36
  5. package/dist/cjs/plugins/block-type/commands/transform-to-code-block.js +1 -2
  6. package/dist/cjs/plugins/block-type/index.js +16 -13
  7. package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +19 -18
  8. package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +12 -14
  9. package/dist/cjs/plugins/block-type/pm-plugins/main.js +9 -9
  10. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +7 -7
  11. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +3 -4
  12. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +13 -5
  13. package/dist/cjs/plugins/block-type/utils.js +73 -2
  14. package/dist/cjs/plugins/caption/pm-plugins/keymap.js +2 -2
  15. package/dist/cjs/plugins/media/utils/media-common.js +5 -5
  16. package/dist/cjs/plugins/undo-redo/pm-plugins/keymaps.js +2 -2
  17. package/dist/cjs/ui/styles.js +4 -11
  18. package/dist/cjs/utils/index.js +4 -80
  19. package/dist/cjs/utils/input-rules.js +6 -66
  20. package/dist/cjs/utils/mark.js +2 -38
  21. package/dist/cjs/version-wrapper.js +1 -1
  22. package/dist/cjs/version.json +1 -1
  23. package/dist/es2019/commands/index.js +1 -128
  24. package/dist/es2019/plugins/base/index.js +1 -1
  25. package/dist/es2019/plugins/block-type/commands/block-type.js +11 -13
  26. package/dist/es2019/plugins/block-type/commands/transform-to-code-block.js +1 -2
  27. package/dist/es2019/plugins/block-type/index.js +21 -12
  28. package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +18 -18
  29. package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +8 -9
  30. package/dist/es2019/plugins/block-type/pm-plugins/main.js +9 -9
  31. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
  32. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
  33. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +21 -2
  34. package/dist/es2019/plugins/block-type/utils.js +70 -1
  35. package/dist/es2019/plugins/caption/pm-plugins/keymap.js +1 -1
  36. package/dist/es2019/plugins/media/utils/media-common.js +1 -1
  37. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
  38. package/dist/es2019/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
  39. package/dist/es2019/ui/styles.js +0 -16
  40. package/dist/es2019/utils/index.js +0 -80
  41. package/dist/es2019/utils/input-rules.js +4 -61
  42. package/dist/es2019/utils/mark.js +0 -33
  43. package/dist/es2019/version-wrapper.js +1 -1
  44. package/dist/es2019/version.json +1 -1
  45. package/dist/esm/commands/index.js +7 -125
  46. package/dist/esm/plugins/base/index.js +1 -1
  47. package/dist/esm/plugins/block-type/commands/block-type.js +11 -13
  48. package/dist/esm/plugins/block-type/commands/transform-to-code-block.js +1 -2
  49. package/dist/esm/plugins/block-type/index.js +15 -12
  50. package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +18 -18
  51. package/dist/esm/plugins/block-type/pm-plugins/keymap.js +8 -9
  52. package/dist/esm/plugins/block-type/pm-plugins/main.js +9 -9
  53. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/blocktype-button.js +2 -2
  54. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +2 -3
  55. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +8 -4
  56. package/dist/esm/plugins/block-type/utils.js +69 -1
  57. package/dist/esm/plugins/caption/pm-plugins/keymap.js +1 -1
  58. package/dist/esm/plugins/media/utils/media-common.js +1 -1
  59. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -1
  60. package/dist/esm/plugins/undo-redo/pm-plugins/keymaps.js +1 -1
  61. package/dist/esm/ui/styles.js +3 -6
  62. package/dist/esm/utils/index.js +3 -77
  63. package/dist/esm/utils/input-rules.js +4 -61
  64. package/dist/esm/utils/mark.js +0 -35
  65. package/dist/esm/version-wrapper.js +1 -1
  66. package/dist/esm/version.json +1 -1
  67. package/dist/types/commands/index.d.ts +0 -6
  68. package/dist/types/plugins/block-type/commands/block-type.d.ts +5 -6
  69. package/dist/types/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
  70. package/dist/types/plugins/block-type/commands/delete-block-content.d.ts +1 -1
  71. package/dist/types/plugins/block-type/index.d.ts +1 -1
  72. package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
  73. package/dist/types/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
  74. package/dist/types/plugins/block-type/pm-plugins/main.d.ts +2 -1
  75. package/dist/types/plugins/block-type/styles.d.ts +1 -1
  76. package/dist/types/plugins/block-type/types.d.ts +2 -3
  77. package/dist/types/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
  78. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
  79. package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
  80. package/dist/types/plugins/block-type/utils.d.ts +15 -1
  81. package/dist/types/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
  82. package/dist/types/types/index.d.ts +1 -1
  83. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  84. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  85. package/dist/types/ui/styles.d.ts +0 -3
  86. package/dist/types/utils/index.d.ts +0 -6
  87. package/dist/types/utils/input-rules.d.ts +4 -16
  88. package/dist/types/utils/mark.d.ts +0 -1
  89. package/dist/types-ts4.5/commands/index.d.ts +0 -6
  90. package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +5 -6
  91. package/dist/types-ts4.5/plugins/block-type/commands/delete-and-move-cursor.d.ts +1 -1
  92. package/dist/types-ts4.5/plugins/block-type/commands/delete-block-content.d.ts +1 -1
  93. package/dist/types-ts4.5/plugins/block-type/index.d.ts +1 -1
  94. package/dist/types-ts4.5/plugins/block-type/pm-plugins/input-rule.d.ts +3 -2
  95. package/dist/types-ts4.5/plugins/block-type/pm-plugins/keymap.d.ts +2 -2
  96. package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +2 -1
  97. package/dist/types-ts4.5/plugins/block-type/styles.d.ts +1 -1
  98. package/dist/types-ts4.5/plugins/block-type/types.d.ts +2 -3
  99. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/blocktype-button.d.ts +1 -2
  100. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/index.d.ts +2 -2
  101. package/dist/types-ts4.5/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +5 -1
  102. package/dist/types-ts4.5/plugins/block-type/utils.d.ts +15 -1
  103. package/dist/types-ts4.5/plugins/undo-redo/pm-plugins/keymaps.d.ts +1 -1
  104. package/dist/types-ts4.5/types/index.d.ts +1 -1
  105. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  106. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  107. package/dist/types-ts4.5/ui/styles.d.ts +0 -3
  108. package/dist/types-ts4.5/utils/index.d.ts +0 -6
  109. package/dist/types-ts4.5/utils/input-rules.d.ts +4 -16
  110. package/dist/types-ts4.5/utils/mark.d.ts +0 -1
  111. package/package.json +4 -4
  112. package/report.api.md +6 -16
  113. package/tmp/api-report-tmp.d.ts +5 -16
  114. package/dist/cjs/types/allowed-block-types.js +0 -5
  115. package/dist/cjs/utils/keymap.js +0 -38
  116. package/dist/es2019/types/allowed-block-types.js +0 -1
  117. package/dist/es2019/utils/keymap.js +0 -33
  118. package/dist/esm/types/allowed-block-types.js +0 -1
  119. package/dist/esm/utils/keymap.js +0 -33
  120. package/dist/types/types/allowed-block-types.d.ts +0 -1
  121. package/dist/types/utils/keymap.d.ts +0 -11
  122. package/dist/types-ts4.5/types/allowed-block-types.d.ts +0 -1
  123. package/dist/types-ts4.5/utils/keymap.d.ts +0 -11
  124. /package/dist/cjs/{keymaps → plugins/block-type}/consts.js +0 -0
  125. /package/dist/es2019/{keymaps → plugins/block-type}/consts.js +0 -0
  126. /package/dist/esm/{keymaps → plugins/block-type}/consts.js +0 -0
  127. /package/dist/types/{keymaps → plugins/block-type}/consts.d.ts +0 -0
  128. /package/dist/types-ts4.5/{keymaps → plugins/block-type}/consts.d.ts +0 -0
@@ -1,132 +1,5 @@
1
- import { Fragment } from '@atlaskit/editor-prosemirror/model';
2
- import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
1
+ import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
2
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, withAnalytics } from '../plugins/analytics';
5
- import { canMoveDown, canMoveUp } from '../utils';
6
- export function preventDefault() {
7
- return function () {
8
- return true;
9
- };
10
- }
11
- export function insertNewLine() {
12
- return function (state, dispatch) {
13
- const {
14
- $from
15
- } = state.selection;
16
- const parent = $from.parent;
17
- const {
18
- hardBreak
19
- } = state.schema.nodes;
20
- if (hardBreak) {
21
- const hardBreakNode = hardBreak.createChecked();
22
- if (parent && parent.type.validContent(Fragment.from(hardBreakNode))) {
23
- if (dispatch) {
24
- dispatch(state.tr.replaceSelectionWith(hardBreakNode, false));
25
- }
26
- return true;
27
- }
28
- }
29
- if (state.selection instanceof TextSelection) {
30
- if (dispatch) {
31
- dispatch(state.tr.insertText('\n'));
32
- }
33
- return true;
34
- }
35
- return false;
36
- };
37
- }
38
- export const insertNewLineWithAnalytics = withAnalytics({
39
- action: ACTION.INSERTED,
40
- actionSubject: ACTION_SUBJECT.TEXT,
41
- actionSubjectId: ACTION_SUBJECT_ID.LINE_BREAK,
42
- eventType: EVENT_TYPE.TRACK
43
- })(insertNewLine());
44
- export const createNewParagraphAbove = (state, dispatch) => {
45
- const append = false;
46
- if (!canMoveUp(state) && canCreateParagraphNear(state)) {
47
- createParagraphNear(append)(state, dispatch);
48
- return true;
49
- }
50
- return false;
51
- };
52
- export const createNewParagraphBelow = (state, dispatch) => {
53
- const append = true;
54
- if (!canMoveDown(state) && canCreateParagraphNear(state)) {
55
- createParagraphNear(append)(state, dispatch);
56
- return true;
57
- }
58
- return false;
59
- };
60
- function canCreateParagraphNear(state) {
61
- const {
62
- selection: {
63
- $from
64
- }
65
- } = state;
66
- const node = $from.node($from.depth);
67
- const insideCodeBlock = !!node && node.type === state.schema.nodes.codeBlock;
68
- const isNodeSelection = state.selection instanceof NodeSelection;
69
- return $from.depth > 1 || isNodeSelection || insideCodeBlock;
70
- }
71
- export function createParagraphNear(append = true) {
72
- return function (state, dispatch) {
73
- const paragraph = state.schema.nodes.paragraph;
74
- if (!paragraph) {
75
- return false;
76
- }
77
- let insertPos;
78
- if (state.selection instanceof TextSelection) {
79
- if (topLevelNodeIsEmptyTextBlock(state)) {
80
- return false;
81
- }
82
- insertPos = getInsertPosFromTextBlock(state, append);
83
- } else {
84
- insertPos = getInsertPosFromNonTextBlock(state, append);
85
- }
86
- const tr = state.tr.insert(insertPos, paragraph.createAndFill());
87
- tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
88
- if (dispatch) {
89
- dispatch(tr);
90
- }
91
- return true;
92
- };
93
- }
94
- function getInsertPosFromTextBlock(state, append) {
95
- const {
96
- $from,
97
- $to
98
- } = state.selection;
99
- let pos;
100
- if (!append) {
101
- pos = $from.start(0);
102
- } else {
103
- pos = $to.end(0);
104
- }
105
- return pos;
106
- }
107
- function getInsertPosFromNonTextBlock(state, append) {
108
- const {
109
- $from,
110
- $to
111
- } = state.selection;
112
- const nodeAtSelection = state.selection instanceof NodeSelection && state.doc.nodeAt(state.selection.$anchor.pos);
113
- const isMediaSelection = nodeAtSelection && nodeAtSelection.type.name === 'mediaGroup';
114
- let pos;
115
- if (!append) {
116
- // The start position is different with text block because it starts from 0
117
- pos = $from.start($from.depth);
118
- // The depth is different with text block because it starts from 0
119
- pos = $from.depth > 0 && !isMediaSelection ? pos - 1 : pos;
120
- } else {
121
- pos = $to.end($to.depth);
122
- pos = $to.depth > 0 && !isMediaSelection ? pos + 1 : pos;
123
- }
124
- return pos;
125
- }
126
- function topLevelNodeIsEmptyTextBlock(state) {
127
- const topLevelNode = state.selection.$from.node(1);
128
- return topLevelNode.isTextblock && topLevelNode.type !== state.schema.nodes.codeBlock && topLevelNode.nodeSize === 2;
129
- }
130
3
  export function addParagraphAtEnd(tr) {
131
4
  const {
132
5
  doc: {
@@ -11,7 +11,7 @@ import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
11
11
  import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
12
12
  import betterTypeHistoryPlugin from './pm-plugins/better-type-history';
13
13
  import scrollGutter from './pm-plugins/scroll-gutter';
14
- import { keymap } from '../../utils/keymap';
14
+ import { keymap } from '@atlaskit/editor-common/keymaps';
15
15
  import frozenEditor from './pm-plugins/frozen-editor';
16
16
  import compositionPlugin from './pm-plugins/composition';
17
17
  // Chrome >= 88
@@ -1,14 +1,12 @@
1
1
  import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
2
2
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
3
- import { CODE_BLOCK, BLOCK_QUOTE, PANEL, HEADINGS_BY_NAME, NORMAL_TEXT } from '../types';
4
- import { removeBlockMarks } from '../../../utils/mark';
3
+ import { PanelType } from '@atlaskit/adf-schema';
4
+ import { CellSelection } from '@atlaskit/editor-tables';
5
5
  import { shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
6
- import { withAnalytics as withAnalyticsDeprecated } from '../../analytics';
7
6
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
7
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
9
- import { filterChildrenBetween } from '@atlaskit/editor-common/mark';
10
- import { PanelType } from '@atlaskit/adf-schema';
11
- import { CellSelection } from '@atlaskit/editor-tables';
8
+ import { filterChildrenBetween, removeBlockMarks } from '@atlaskit/editor-common/utils';
9
+ import { CODE_BLOCK, BLOCK_QUOTE, PANEL, HEADINGS_BY_NAME, NORMAL_TEXT } from '../types';
12
10
  import { transformToCodeBlockAction } from './transform-to-code-block';
13
11
  export function setBlockType(name) {
14
12
  return (state, dispatch) => {
@@ -25,17 +23,17 @@ export function setBlockType(name) {
25
23
  return false;
26
24
  };
27
25
  }
28
- export function setBlockTypeWithAnalytics(name, inputMethod) {
26
+ export function setBlockTypeWithAnalytics(name, inputMethod, editorAnalyticsApi) {
29
27
  return (state, dispatch) => {
30
28
  const {
31
29
  nodes
32
30
  } = state.schema;
33
31
  if (name === NORMAL_TEXT.name && nodes.paragraph) {
34
- return setNormalTextWithAnalytics(inputMethod)(state, dispatch);
32
+ return setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi)(state, dispatch);
35
33
  }
36
34
  const headingBlockType = HEADINGS_BY_NAME[name];
37
35
  if (headingBlockType && nodes.heading && headingBlockType.level) {
38
- return setHeadingWithAnalytics(headingBlockType.level, inputMethod)(state, dispatch);
36
+ return setHeadingWithAnalytics(headingBlockType.level, inputMethod, editorAnalyticsApi)(state, dispatch);
39
37
  }
40
38
  return false;
41
39
  };
@@ -86,8 +84,8 @@ function withCurrentHeadingLevel(fn) {
86
84
  return fn(level)(state, dispatch, view);
87
85
  };
88
86
  }
89
- export function setNormalTextWithAnalytics(inputMethod) {
90
- return withCurrentHeadingLevel(previousHeadingLevel => withAnalyticsDeprecated({
87
+ export function setNormalTextWithAnalytics(inputMethod, editorAnalyticsApi) {
88
+ return withCurrentHeadingLevel(previousHeadingLevel => withAnalytics(editorAnalyticsApi, {
91
89
  action: ACTION.FORMATTED,
92
90
  actionSubject: ACTION_SUBJECT.TEXT,
93
91
  eventType: EVENT_TYPE.TRACK,
@@ -121,8 +119,8 @@ export function setHeading(level) {
121
119
  return true;
122
120
  };
123
121
  }
124
- export const setHeadingWithAnalytics = (newHeadingLevel, inputMethod) => {
125
- return withCurrentHeadingLevel(previousHeadingLevel => withAnalyticsDeprecated({
122
+ export const setHeadingWithAnalytics = (newHeadingLevel, inputMethod, editorAnalyticsApi) => {
123
+ return withCurrentHeadingLevel(previousHeadingLevel => withAnalytics(editorAnalyticsApi, {
126
124
  action: ACTION.FORMATTED,
127
125
  actionSubject: ACTION_SUBJECT.TEXT,
128
126
  eventType: EVENT_TYPE.TRACK,
@@ -1,7 +1,6 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
- import { mapSlice } from '../../../utils/slice';
3
2
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
- import { timestampToString } from '@atlaskit/editor-common/utils';
3
+ import { timestampToString, mapSlice } from '@atlaskit/editor-common/utils';
5
4
  export function transformToCodeBlockAction(state, start, attrs) {
6
5
  const startOfCodeBlockText = state.selection.$from;
7
6
  const endPosition = state.selection.empty ? startOfCodeBlockText.end() : state.selection.$to.pos;
@@ -1,16 +1,16 @@
1
1
  import React from 'react';
2
2
  import { blockquote, hardBreak, heading } from '@atlaskit/adf-schema';
3
+ import { ToolbarSize } from '@atlaskit/editor-common/types';
4
+ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
5
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
+ import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
7
+ import * as keymaps from '@atlaskit/editor-common/keymaps';
3
8
  import { createPlugin, pluginKey } from './pm-plugins/main';
4
9
  import keymapPlugin from './pm-plugins/keymap';
5
10
  import inputRulePlugin from './pm-plugins/input-rule';
6
11
  import ToolbarBlockType from './ui/ToolbarBlockType';
7
- import WithPluginState from '../../ui/WithPluginState';
8
12
  import { setBlockTypeWithAnalytics } from './commands';
9
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
10
- import * as keymaps from '../../keymaps';
11
- import { IconHeading, IconQuote } from '@atlaskit/editor-common/quick-insert';
12
13
  import { messages } from './messages';
13
- import { ToolbarSize } from '../../ui/Toolbar/types';
14
14
  const headingPluginOptions = ({
15
15
  formatMessage
16
16
  }, isAllowed, editorAnalyticsApi) => {
@@ -105,13 +105,19 @@ const blockTypePlugin = (options, api) => ({
105
105
  name: 'blockType',
106
106
  plugin: ({
107
107
  dispatch
108
- }) => createPlugin(dispatch, options && options.lastNodeMustBeParagraph)
108
+ }) => {
109
+ var _api$dependencies$ana;
110
+ return createPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions, dispatch, options && options.lastNodeMustBeParagraph);
111
+ }
109
112
  }, {
110
113
  name: 'blockTypeInputRule',
111
114
  plugin: ({
112
115
  schema,
113
116
  featureFlags
114
- }) => inputRulePlugin(schema, featureFlags)
117
+ }) => {
118
+ var _api$dependencies$ana2;
119
+ return inputRulePlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions, schema, featureFlags);
120
+ }
115
121
  },
116
122
  // Needs to be lower priority than editor-tables.tableEditing
117
123
  // plugin as it is currently swallowing right/down arrow events inside tables
@@ -121,8 +127,8 @@ const blockTypePlugin = (options, api) => ({
121
127
  schema,
122
128
  featureFlags
123
129
  }) => {
124
- var _api$dependencies$ana;
125
- return keymapPlugin(schema, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions);
130
+ var _api$dependencies$ana3;
131
+ return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions, schema, featureFlags);
126
132
  }
127
133
  }];
128
134
  },
@@ -137,7 +143,10 @@ const blockTypePlugin = (options, api) => ({
137
143
  eventDispatcher
138
144
  }) {
139
145
  const isSmall = options && options.isUndoRedoButtonsEnabled ? toolbarSize < ToolbarSize.XXL : toolbarSize < ToolbarSize.XL;
140
- const boundSetBlockType = name => setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
146
+ const boundSetBlockType = name => {
147
+ var _api$dependencies$ana4;
148
+ return setBlockTypeWithAnalytics(name, INPUT_METHOD.TOOLBAR, api === null || api === void 0 ? void 0 : (_api$dependencies$ana4 = api.dependencies.analytics) === null || _api$dependencies$ana4 === void 0 ? void 0 : _api$dependencies$ana4.actions)(editorView.state, editorView.dispatch);
149
+ };
141
150
  return /*#__PURE__*/React.createElement(WithPluginState, {
142
151
  editorView: editorView,
143
152
  eventDispatcher: eventDispatcher,
@@ -162,9 +171,9 @@ const blockTypePlugin = (options, api) => ({
162
171
  },
163
172
  pluginsOptions: {
164
173
  quickInsert: intl => {
165
- var _api$dependencies$ana2, _api$dependencies$ana3;
174
+ var _api$dependencies$ana5, _api$dependencies$ana6;
166
175
  const exclude = options && options.allowBlockType && options.allowBlockType.exclude ? options.allowBlockType.exclude : [];
167
- return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana2 = api.dependencies.analytics) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana3 = api.dependencies.analytics) === null || _api$dependencies$ana3 === void 0 ? void 0 : _api$dependencies$ana3.actions)];
176
+ return [...blockquotePluginOptions(intl, exclude.indexOf('blockquote') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana5 = api.dependencies.analytics) === null || _api$dependencies$ana5 === void 0 ? void 0 : _api$dependencies$ana5.actions), ...headingPluginOptions(intl, exclude.indexOf('heading') === -1, api === null || api === void 0 ? void 0 : (_api$dependencies$ana6 = api.dependencies.analytics) === null || _api$dependencies$ana6 === void 0 ? void 0 : _api$dependencies$ana6.actions)];
168
177
  }
169
178
  }
170
179
  });
@@ -1,10 +1,10 @@
1
- import { createJoinNodesRule, createWrappingTextBlockRule, ruleWithAnalytics } from '../../../utils/input-rules';
2
- import { createRule, createPlugin } from '@atlaskit/prosemirror-input-rules';
3
- import { leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
4
- import { isConvertableToCodeBlock, transformToCodeBlockAction } from '../commands/transform-to-code-block';
5
- import { insertBlock } from '../commands/insert-block';
6
1
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
2
+ import { createRule, createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
7
3
  import { INPUT_METHOD, ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
4
+ import { inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
5
+ import { isConvertableToCodeBlock, transformToCodeBlockAction } from '../commands/transform-to-code-block';
6
+ import { insertBlock } from '../commands/insert-block';
7
+ import { createJoinNodesRule, createWrappingTextBlockRule } from '../utils';
8
8
  const MAX_HEADING_LEVEL = 6;
9
9
  function getHeadingLevel(match) {
10
10
  return {
@@ -28,7 +28,7 @@ function blockQuoteRule(nodeType) {
28
28
  * @param {Schema} schema
29
29
  * @returns {InputRuleWithHandler[]}
30
30
  */
31
- function getHeadingRules(schema) {
31
+ function getHeadingRules(editorAnalyticsAPI, schema) {
32
32
  // '# ' for h1, '## ' for h2 and etc
33
33
  const hashRule = headingRule(schema.nodes.heading, MAX_HEADING_LEVEL);
34
34
  const leftNodeReplacementHashRule = createRule(new RegExp(`${leafNodeReplacementCharacter}(#{1,6})\\s$`), (state, match, start, end) => {
@@ -39,7 +39,7 @@ function getHeadingRules(schema) {
39
39
  });
40
40
 
41
41
  // New analytics handler
42
- const ruleWithHeadingAnalytics = ruleWithAnalytics((_state, matchResult) => ({
42
+ const ruleWithHeadingAnalytics = inputRuleWithAnalytics((_state, matchResult) => ({
43
43
  action: ACTION.FORMATTED,
44
44
  actionSubject: ACTION_SUBJECT.TEXT,
45
45
  eventType: EVENT_TYPE.TRACK,
@@ -48,7 +48,7 @@ function getHeadingRules(schema) {
48
48
  inputMethod: INPUT_METHOD.FORMATTING,
49
49
  newHeadingLevel: getHeadingLevel(matchResult).level
50
50
  }
51
- }));
51
+ }), editorAnalyticsAPI);
52
52
  return [ruleWithHeadingAnalytics(hashRule), ruleWithHeadingAnalytics(leftNodeReplacementHashRule)];
53
53
  }
54
54
 
@@ -58,7 +58,7 @@ function getHeadingRules(schema) {
58
58
  * @param {Schema} schema
59
59
  * @returns {InputRuleWithHandler[]}
60
60
  */
61
- function getBlockQuoteRules(schema) {
61
+ function getBlockQuoteRules(editorAnalyticsAPI, schema) {
62
62
  // '> ' for blockquote
63
63
  const greatherThanRule = blockQuoteRule(schema.nodes.blockquote);
64
64
  const leftNodeReplacementGreatherRule = createRule(new RegExp(`${leafNodeReplacementCharacter}\\s*>\\s$`), (state, _match, start, end) => {
@@ -66,7 +66,7 @@ function getBlockQuoteRules(schema) {
66
66
  });
67
67
 
68
68
  // Analytics V3 handler
69
- const ruleWithBlockQuoteAnalytics = ruleWithAnalytics({
69
+ const ruleWithBlockQuoteAnalytics = inputRuleWithAnalytics({
70
70
  action: ACTION.FORMATTED,
71
71
  actionSubject: ACTION_SUBJECT.TEXT,
72
72
  eventType: EVENT_TYPE.TRACK,
@@ -74,7 +74,7 @@ function getBlockQuoteRules(schema) {
74
74
  attributes: {
75
75
  inputMethod: INPUT_METHOD.FORMATTING
76
76
  }
77
- });
77
+ }, editorAnalyticsAPI);
78
78
  return [ruleWithBlockQuoteAnalytics(greatherThanRule), ruleWithBlockQuoteAnalytics(leftNodeReplacementGreatherRule)];
79
79
  }
80
80
 
@@ -84,8 +84,8 @@ function getBlockQuoteRules(schema) {
84
84
  * @param {Schema} schema
85
85
  * @returns {InputRuleWithHandler[]}
86
86
  */
87
- function getCodeBlockRules(schema) {
88
- const ruleAnalytics = ruleWithAnalytics({
87
+ function getCodeBlockRules(editorAnalyticsAPI, schema) {
88
+ const ruleAnalytics = inputRuleWithAnalytics({
89
89
  action: ACTION.INSERTED,
90
90
  actionSubject: ACTION_SUBJECT.DOCUMENT,
91
91
  actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
@@ -93,7 +93,7 @@ function getCodeBlockRules(schema) {
93
93
  inputMethod: INPUT_METHOD.FORMATTING
94
94
  },
95
95
  eventType: EVENT_TYPE.TRACK
96
- });
96
+ }, editorAnalyticsAPI);
97
97
  const validMatchLength = match => match.length > 0 && match[0].length === 3;
98
98
  const threeTildeRule = createRule(/(?!\s)(`{3,})$/, (state, match, start, end) => {
99
99
  if (!validMatchLength(match)) {
@@ -125,16 +125,16 @@ function getCodeBlockRules(schema) {
125
125
  });
126
126
  return [ruleAnalytics(threeTildeRule), ruleAnalytics(leftNodeReplacementThreeTildeRule)];
127
127
  }
128
- function inputRulePlugin(schema, featureFlags) {
128
+ function inputRulePlugin(editorAnalyticsAPI, schema, featureFlags) {
129
129
  const rules = [];
130
130
  if (schema.nodes.heading) {
131
- rules.push(...getHeadingRules(schema));
131
+ rules.push(...getHeadingRules(editorAnalyticsAPI, schema));
132
132
  }
133
133
  if (schema.nodes.blockquote) {
134
- rules.push(...getBlockQuoteRules(schema));
134
+ rules.push(...getBlockQuoteRules(editorAnalyticsAPI, schema));
135
135
  }
136
136
  if (schema.nodes.codeBlock) {
137
- rules.push(...getCodeBlockRules(schema));
137
+ rules.push(...getCodeBlockRules(editorAnalyticsAPI, schema));
138
138
  }
139
139
  if (rules.length !== 0) {
140
140
  return createPlugin('block-type', rules, {
@@ -1,20 +1,19 @@
1
1
  import { redo, undo } from '@atlaskit/editor-prosemirror/history';
2
2
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
3
- import * as keymaps from '../../../keymaps';
4
- import * as commands from '../../../commands';
3
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
+ import * as keymaps from '@atlaskit/editor-common/keymaps';
5
+ import { keymap } from '@atlaskit/editor-common/keymaps';
6
+ import { insertNewLineWithAnalytics, createNewParagraphAbove, createNewParagraphBelow, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
5
7
  import * as blockTypes from '../types';
6
- import { keymap } from '../../../utils/keymap';
7
8
  import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockTypesWithAnalytics } from '../commands';
8
- import { deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
9
- import { INPUT_METHOD } from '../../analytics';
10
9
  import { isNodeAWrappingBlockNode } from '../utils';
11
10
  const backspace = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
12
11
  const del = chainCommands(deleteEmptyParagraphAndMoveBlockUp(isNodeAWrappingBlockNode), deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
13
- export default function keymapPlugin(schema, featureFlags, editorAnalyticsApi) {
12
+ export default function keymapPlugin(editorAnalyticsApi, schema, _featureFlags) {
14
13
  const list = {};
15
- keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, commands.insertNewLineWithAnalytics, list);
16
- keymaps.bindKeymapWithCommand(keymaps.moveUp.common, commands.createNewParagraphAbove, list);
17
- keymaps.bindKeymapWithCommand(keymaps.moveDown.common, commands.createNewParagraphBelow, list);
14
+ keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, insertNewLineWithAnalytics(editorAnalyticsApi), list);
15
+ keymaps.bindKeymapWithCommand(keymaps.moveUp.common, createNewParagraphAbove, list);
16
+ keymaps.bindKeymapWithCommand(keymaps.moveDown.common, createNewParagraphBelow, list);
18
17
  keymaps.bindKeymapWithCommand(keymaps.findKeyMapForBrowser(keymaps.redo), redo, list);
19
18
  keymaps.bindKeymapWithCommand(keymaps.undo.common, undo, list);
20
19
  keymaps.bindKeymapWithCommand(keymaps.backspace.common, backspace, list);
@@ -1,11 +1,11 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
3
  import { browser } from '@atlaskit/editor-common/utils';
4
+ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
5
  import { NORMAL_TEXT, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6, BLOCK_QUOTE, CODE_BLOCK, PANEL, OTHER, TEXT_BLOCK_TYPES, WRAPPER_BLOCK_TYPES, HEADINGS_BY_LEVEL } from '../types';
5
- import { areBlockTypesDisabled } from '../../../utils';
6
+ import { HEADING_KEYS } from '../consts';
6
7
  import { setHeadingWithAnalytics, setNormalTextWithAnalytics } from '../commands';
7
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
8
- import { HEADING_KEYS } from '../../../keymaps/consts';
8
+ import { areBlockTypesDisabled } from '../utils';
9
9
  const blockTypeForNode = (node, schema) => {
10
10
  if (node.type === schema.nodes.heading) {
11
11
  const maybeNode = HEADINGS_BY_LEVEL[node.attrs['level']];
@@ -59,16 +59,16 @@ const detectBlockType = (availableBlockTypes, state) => {
59
59
  });
60
60
  return blockType || OTHER;
61
61
  };
62
- const autoformatHeading = (headingLevel, view) => {
62
+ const autoformatHeading = (headingLevel, view, editorAnalyticsApi) => {
63
63
  if (headingLevel === 0) {
64
- setNormalTextWithAnalytics(INPUT_METHOD.FORMATTING)(view.state, view.dispatch);
64
+ setNormalTextWithAnalytics(INPUT_METHOD.FORMATTING, editorAnalyticsApi)(view.state, view.dispatch);
65
65
  } else {
66
- setHeadingWithAnalytics(headingLevel, INPUT_METHOD.FORMATTING)(view.state, view.dispatch);
66
+ setHeadingWithAnalytics(headingLevel, INPUT_METHOD.FORMATTING, editorAnalyticsApi)(view.state, view.dispatch);
67
67
  }
68
68
  return true;
69
69
  };
70
70
  export const pluginKey = new PluginKey('blockTypePlugin');
71
- export const createPlugin = (dispatch, lastNodeMustBeParagraph) => {
71
+ export const createPlugin = (editorAnalyticsApi, dispatch, lastNodeMustBeParagraph) => {
72
72
  let altKeyLocation = 0;
73
73
  return new SafePlugin({
74
74
  appendTransaction(_transactions, _oldState, newState) {
@@ -118,9 +118,9 @@ export const createPlugin = (dispatch, lastNodeMustBeParagraph) => {
118
118
  const headingLevel = HEADING_KEYS.indexOf(event.keyCode);
119
119
  if (headingLevel > -1 && event.altKey) {
120
120
  if (browser.mac && event.metaKey) {
121
- return autoformatHeading(headingLevel, view);
121
+ return autoformatHeading(headingLevel, view, editorAnalyticsApi);
122
122
  } else if (!browser.mac && event.ctrlKey && altKeyLocation !== event.DOM_KEY_LOCATION_RIGHT) {
123
- return autoformatHeading(headingLevel, view);
123
+ return autoformatHeading(headingLevel, view, editorAnalyticsApi);
124
124
  }
125
125
  } else if (event.key === 'Alt') {
126
126
  // event.location is for the current key only; when a user hits Ctrl-Alt-1 the
@@ -4,10 +4,10 @@ import { jsx } from '@emotion/react';
4
4
  import { FormattedMessage, defineMessages } from 'react-intl-next';
5
5
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
6
6
  import TextStyleIcon from '@atlaskit/icon/glyph/editor/text-style';
7
- import ToolbarButton from '../../../../ui/ToolbarButton';
8
- import { buttonContentStyle, buttonContentReducedSpacingStyle, wrapperSmallStyle, expandIconWrapperStyle } from '../../../../ui/styles';
9
7
  import { wrapperStyle } from '@atlaskit/editor-common/styles';
8
+ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
10
9
  import { NORMAL_TEXT } from '../../types';
10
+ import { buttonContentStyle, buttonContentReducedSpacingStyle, wrapperSmallStyle, expandIconWrapperStyle } from './styled';
11
11
  export const messages = defineMessages({
12
12
  textStyles: {
13
13
  id: 'fabric.editor.textStyles',
@@ -4,12 +4,11 @@ import React from 'react';
4
4
  import { jsx } from '@emotion/react';
5
5
  import { injectIntl } from 'react-intl-next';
6
6
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
7
- import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
7
+ import { getAriaKeyshortcuts, tooltip, findKeymapByDescription } from '@atlaskit/editor-common/keymaps';
8
8
  import { separatorStyles, wrapperStyle } from '@atlaskit/editor-common/styles';
9
+ import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
9
10
  import { blockTypeMenuItemStyle, keyboardShortcut, keyboardShortcutSelect } from './styled';
10
- import { tooltip, findKeymapByDescription } from '../../../../keymaps';
11
11
  import { BlockTypeButton } from './blocktype-button';
12
- import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
13
12
  class ToolbarBlockType extends React.PureComponent {
14
13
  constructor(...args) {
15
14
  super(...args);
@@ -2,7 +2,7 @@
2
2
  import { css } from '@emotion/react';
3
3
  import { N400 } from '@atlaskit/theme/colors';
4
4
  import { headingsSharedStyles } from '@atlaskit/editor-common/styles';
5
- import { shortcutStyle } from '../../../../ui/styles';
5
+ import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
6
6
  export const blockTypeMenuItemStyle = (tagName, selected) => {
7
7
  // TEMP FIX: See https://product-fabric.atlassian.net/browse/ED-13878
8
8
  const selectedStyle = selected ? `${tagName} { color: ${"var(--ds-text, white)"} !important; }` : '';
@@ -23,8 +23,27 @@ export const blockTypeMenuItemStyle = (tagName, selected) => {
23
23
  };
24
24
  export const keyboardShortcut = css`
25
25
  ${shortcutStyle}
26
- margin-left: 16px;
26
+ margin-left: ${"var(--ds-space-200, 16px)"};
27
27
  `;
28
28
  export const keyboardShortcutSelect = css`
29
29
  color: ${`var(--ds-icon, ${N400})`};
30
+ `;
31
+ export const buttonContentStyle = css`
32
+ display: flex;
33
+ min-width: 80px;
34
+ align-items: center;
35
+ overflow: hidden;
36
+ justify-content: center;
37
+ flex-direction: column;
38
+ padding: ${"var(--ds-space-075, 6px)"};
39
+ `;
40
+ export const buttonContentReducedSpacingStyle = css`
41
+ padding: ${"var(--ds-space-100, 8px)"};
42
+ `;
43
+ export const wrapperSmallStyle = css`
44
+ margin-left: ${"var(--ds-space-050, 4px)"};
45
+ min-width: 40px;
46
+ `;
47
+ export const expandIconWrapperStyle = css`
48
+ margin-left: -8px;
30
49
  `;
@@ -1,7 +1,76 @@
1
+ import { createRule } from '@atlaskit/prosemirror-input-rules';
2
+ import { createWrappingJoinRule } from '@atlaskit/editor-common/utils';
1
3
  import { WRAPPER_BLOCK_TYPES } from './types';
2
4
  export const isNodeAWrappingBlockNode = node => {
3
5
  if (!node) {
4
6
  return false;
5
7
  }
6
8
  return WRAPPER_BLOCK_TYPES.some(blockNode => blockNode.name === node.type.name);
7
- };
9
+ };
10
+ export const createJoinNodesRule = (match, nodeType) => {
11
+ return createWrappingJoinRule({
12
+ nodeType,
13
+ match,
14
+ getAttrs: {},
15
+ joinPredicate: (_, node) => node.type === nodeType
16
+ });
17
+ };
18
+ export const createWrappingTextBlockRule = ({
19
+ match,
20
+ nodeType,
21
+ getAttrs
22
+ }) => {
23
+ const handler = (state, match, start, end) => {
24
+ const fixedStart = Math.max(start, 1);
25
+ const $start = state.doc.resolve(fixedStart);
26
+ const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;
27
+ const nodeBefore = $start.node(-1);
28
+ if (nodeBefore && !nodeBefore.canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType)) {
29
+ return null;
30
+ }
31
+ return state.tr.delete(fixedStart, end).setBlockType(fixedStart, fixedStart, nodeType, attrs);
32
+ };
33
+ return createRule(match, handler);
34
+ };
35
+
36
+ /**
37
+ * Function will create a list of wrapper blocks present in a selection.
38
+ */
39
+ function getSelectedWrapperNodes(state) {
40
+ const nodes = [];
41
+ if (state.selection) {
42
+ const {
43
+ $from,
44
+ $to
45
+ } = state.selection;
46
+ const {
47
+ blockquote,
48
+ panel,
49
+ orderedList,
50
+ bulletList,
51
+ listItem,
52
+ codeBlock,
53
+ decisionItem,
54
+ decisionList,
55
+ taskItem,
56
+ taskList
57
+ } = state.schema.nodes;
58
+ state.doc.nodesBetween($from.pos, $to.pos, node => {
59
+ if (node.isBlock && [blockquote, panel, orderedList, bulletList, listItem, codeBlock, decisionItem, decisionList, taskItem, taskList].indexOf(node.type) >= 0) {
60
+ nodes.push(node.type);
61
+ }
62
+ });
63
+ }
64
+ return nodes;
65
+ }
66
+
67
+ /**
68
+ * Function will check if changing block types: Paragraph, Heading is enabled.
69
+ */
70
+ export function areBlockTypesDisabled(state) {
71
+ const nodesTypes = getSelectedWrapperNodes(state);
72
+ const {
73
+ panel
74
+ } = state.schema.nodes;
75
+ return nodesTypes.filter(type => type !== panel).length > 0;
76
+ }
@@ -2,7 +2,7 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
2
  import { Selection } from '@atlaskit/editor-prosemirror/state';
3
3
  import * as keymaps from '../../../keymaps';
4
4
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
- import { createNewParagraphBelow } from '../../../commands';
5
+ import { createNewParagraphBelow } from '@atlaskit/editor-common/utils';
6
6
  import { GapCursorSelection } from '../../selection/gap-cursor/selection';
7
7
  export function captionKeymap() {
8
8
  const list = {};
@@ -1,7 +1,7 @@
1
1
  import { deleteSelection, splitBlock } from '@atlaskit/editor-prosemirror/commands';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
4
- import { createParagraphNear, createNewParagraphBelow } from '../../../commands';
4
+ import { createParagraphNear, createNewParagraphBelow } from '@atlaskit/editor-common/utils';
5
5
  import { isTemporary } from '../../../utils';
6
6
  import { mapSlice } from '../../../utils/slice';
7
7
  import { walkUpTreeUntil, removeNestedEmptyEls, unwrap } from '../../../utils/dom';