@atlaskit/editor-core 187.17.6 → 187.18.1

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 (181) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -2
  3. package/dist/cjs/plugins/annotation/toolbar.js +31 -8
  4. package/dist/cjs/plugins/help-dialog/ui/index.js +26 -27
  5. package/dist/cjs/plugins/index.js +0 -7
  6. package/dist/cjs/plugins/list/index.js +5 -5
  7. package/dist/cjs/plugins/list/transforms.js +1 -223
  8. package/dist/cjs/plugins/paste/commands.js +224 -2
  9. package/dist/cjs/plugins/paste/pm-plugins/main.js +3 -3
  10. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +3 -3
  11. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +4 -4
  12. package/dist/cjs/version-wrapper.js +1 -1
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/labs/next/presets/default.js +1 -1
  15. package/dist/es2019/plugins/annotation/toolbar.js +34 -9
  16. package/dist/es2019/plugins/help-dialog/ui/index.js +1 -2
  17. package/dist/es2019/plugins/index.js +0 -1
  18. package/dist/es2019/plugins/list/index.js +1 -1
  19. package/dist/es2019/plugins/list/transforms.js +2 -210
  20. package/dist/es2019/plugins/paste/commands.js +210 -2
  21. package/dist/es2019/plugins/paste/pm-plugins/main.js +1 -1
  22. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -1
  23. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
  24. package/dist/es2019/version-wrapper.js +1 -1
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/labs/next/presets/default.js +1 -1
  27. package/dist/esm/plugins/annotation/toolbar.js +30 -7
  28. package/dist/esm/plugins/help-dialog/ui/index.js +1 -2
  29. package/dist/esm/plugins/index.js +0 -1
  30. package/dist/esm/plugins/list/index.js +1 -1
  31. package/dist/esm/plugins/list/transforms.js +2 -219
  32. package/dist/esm/plugins/paste/commands.js +218 -1
  33. package/dist/esm/plugins/paste/pm-plugins/main.js +1 -1
  34. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +1 -1
  35. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
  36. package/dist/esm/version-wrapper.js +1 -1
  37. package/dist/esm/version.json +1 -1
  38. package/dist/types/index.d.ts +0 -5
  39. package/dist/types/labs/next/presets/default.d.ts +28 -28
  40. package/dist/types/plugins/annotation/types.d.ts +9 -3
  41. package/dist/types/plugins/index.d.ts +0 -1
  42. package/dist/types/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +1 -2
  43. package/dist/types/plugins/list/transforms.d.ts +0 -13
  44. package/dist/types/plugins/paste/commands.d.ts +14 -0
  45. package/dist/types/plugins/paste/index.d.ts +2 -0
  46. package/dist/types-ts4.5/index.d.ts +0 -5
  47. package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -28
  48. package/dist/types-ts4.5/plugins/annotation/types.d.ts +9 -3
  49. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  50. package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +1 -2
  51. package/dist/types-ts4.5/plugins/list/transforms.d.ts +0 -13
  52. package/dist/types-ts4.5/plugins/paste/commands.d.ts +14 -0
  53. package/dist/types-ts4.5/plugins/paste/index.d.ts +2 -0
  54. package/package.json +3 -2
  55. package/report.api.md +1 -24
  56. package/tmp/api-report-tmp.d.ts +1 -21
  57. package/dist/cjs/plugins/text-formatting/actions.js +0 -188
  58. package/dist/cjs/plugins/text-formatting/commands/clear-formatting.js +0 -111
  59. package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +0 -143
  60. package/dist/cjs/plugins/text-formatting/commands/transform-to-code.js +0 -68
  61. package/dist/cjs/plugins/text-formatting/index.js +0 -136
  62. package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -21
  63. package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -36
  64. package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +0 -55
  65. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +0 -276
  66. package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +0 -52
  67. package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +0 -113
  68. package/dist/cjs/plugins/text-formatting/pm-plugins/plugin-key.js +0 -9
  69. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -176
  70. package/dist/cjs/plugins/text-formatting/ui/Toolbar/constants.js +0 -19
  71. package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -86
  72. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -53
  73. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -225
  74. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -23
  75. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -60
  76. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +0 -201
  77. package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +0 -40
  78. package/dist/cjs/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -46
  79. package/dist/cjs/plugins/text-formatting/ui/Toolbar/types.js +0 -17
  80. package/dist/cjs/plugins/text-formatting/utils/cell-selection.js +0 -12
  81. package/dist/cjs/plugins/text-formatting/utils.js +0 -86
  82. package/dist/es2019/plugins/text-formatting/actions.js +0 -161
  83. package/dist/es2019/plugins/text-formatting/commands/clear-formatting.js +0 -105
  84. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +0 -144
  85. package/dist/es2019/plugins/text-formatting/commands/transform-to-code.js +0 -71
  86. package/dist/es2019/plugins/text-formatting/index.js +0 -127
  87. package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -10
  88. package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -26
  89. package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +0 -52
  90. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +0 -244
  91. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +0 -43
  92. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +0 -109
  93. package/dist/es2019/plugins/text-formatting/pm-plugins/plugin-key.js +0 -2
  94. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -155
  95. package/dist/es2019/plugins/text-formatting/ui/Toolbar/constants.js +0 -20
  96. package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -66
  97. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -42
  98. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -210
  99. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -11
  100. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -48
  101. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +0 -168
  102. package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +0 -32
  103. package/dist/es2019/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -36
  104. package/dist/es2019/plugins/text-formatting/ui/Toolbar/types.js +0 -10
  105. package/dist/es2019/plugins/text-formatting/utils/cell-selection.js +0 -5
  106. package/dist/es2019/plugins/text-formatting/utils.js +0 -74
  107. package/dist/esm/plugins/text-formatting/actions.js +0 -168
  108. package/dist/esm/plugins/text-formatting/commands/clear-formatting.js +0 -101
  109. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +0 -134
  110. package/dist/esm/plugins/text-formatting/commands/transform-to-code.js +0 -61
  111. package/dist/esm/plugins/text-formatting/index.js +0 -128
  112. package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -10
  113. package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -28
  114. package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +0 -48
  115. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +0 -259
  116. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +0 -43
  117. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +0 -98
  118. package/dist/esm/plugins/text-formatting/pm-plugins/plugin-key.js +0 -2
  119. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -169
  120. package/dist/esm/plugins/text-formatting/ui/Toolbar/constants.js +0 -8
  121. package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -75
  122. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -45
  123. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -213
  124. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -15
  125. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -50
  126. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +0 -191
  127. package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +0 -31
  128. package/dist/esm/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -35
  129. package/dist/esm/plugins/text-formatting/ui/Toolbar/types.js +0 -10
  130. package/dist/esm/plugins/text-formatting/utils/cell-selection.js +0 -5
  131. package/dist/esm/plugins/text-formatting/utils.js +0 -75
  132. package/dist/types/plugins/text-formatting/actions.d.ts +0 -22
  133. package/dist/types/plugins/text-formatting/commands/clear-formatting.d.ts +0 -6
  134. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -5
  135. package/dist/types/plugins/text-formatting/commands/transform-to-code.d.ts +0 -2
  136. package/dist/types/plugins/text-formatting/index.d.ts +0 -17
  137. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +0 -4
  138. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -8
  139. package/dist/types/plugins/text-formatting/pm-plugins/cursor.d.ts +0 -3
  140. package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +0 -24
  141. package/dist/types/plugins/text-formatting/pm-plugins/keymap.d.ts +0 -4
  142. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +0 -7
  143. package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +0 -3
  144. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +0 -3
  145. package/dist/types/plugins/text-formatting/ui/Toolbar/constants.d.ts +0 -6
  146. package/dist/types/plugins/text-formatting/ui/Toolbar/dropdown-menu.d.ts +0 -15
  147. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +0 -7
  148. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +0 -14
  149. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/menu-state.d.ts +0 -1
  150. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +0 -20
  151. package/dist/types/plugins/text-formatting/ui/Toolbar/index.d.ts +0 -26
  152. package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +0 -13
  153. package/dist/types/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.d.ts +0 -9
  154. package/dist/types/plugins/text-formatting/ui/Toolbar/types.d.ts +0 -32
  155. package/dist/types/plugins/text-formatting/utils/cell-selection.d.ts +0 -3
  156. package/dist/types/plugins/text-formatting/utils.d.ts +0 -11
  157. package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +0 -22
  158. package/dist/types-ts4.5/plugins/text-formatting/commands/clear-formatting.d.ts +0 -6
  159. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -5
  160. package/dist/types-ts4.5/plugins/text-formatting/commands/transform-to-code.d.ts +0 -2
  161. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +0 -19
  162. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +0 -4
  163. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -8
  164. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/cursor.d.ts +0 -3
  165. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +0 -24
  166. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/keymap.d.ts +0 -4
  167. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +0 -7
  168. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +0 -3
  169. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +0 -3
  170. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/constants.d.ts +0 -6
  171. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/dropdown-menu.d.ts +0 -15
  172. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +0 -7
  173. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +0 -14
  174. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/menu-state.d.ts +0 -5
  175. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +0 -20
  176. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/index.d.ts +0 -26
  177. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/more-button.d.ts +0 -13
  178. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.d.ts +0 -9
  179. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/types.d.ts +0 -32
  180. package/dist/types-ts4.5/plugins/text-formatting/utils/cell-selection.d.ts +0 -3
  181. package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.18.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7e77fe6f2ed`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7e77fe6f2ed) - ED-19330 Decouple list plugin from editor-core
8
+ - Updated dependencies
9
+
10
+ ## 187.18.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`80b964e24a2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/80b964e24a2) - [ED-19205] Extract the text-formatting editor plugin to a separate package
15
+
16
+ ### Patch Changes
17
+
18
+ - [`8474692c96d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8474692c96d) - [ux] ED-18785 Place toolbar below selection if not sufficient space above
19
+ - Updated dependencies
20
+
3
21
  ## 187.17.6
4
22
 
5
23
  ### Patch Changes
@@ -10,7 +10,7 @@ var _paste = _interopRequireDefault(require("../../../plugins/paste"));
10
10
  var _blockType = _interopRequireDefault(require("../../../plugins/block-type"));
11
11
  var _clearMarksOnChangeToEmptyDocument = _interopRequireDefault(require("../../../plugins/clear-marks-on-change-to-empty-document"));
12
12
  var _editorPluginHyperlink = require("@atlaskit/editor-plugin-hyperlink");
13
- var _textFormatting = _interopRequireDefault(require("../../../plugins/text-formatting"));
13
+ var _editorPluginTextFormatting = require("@atlaskit/editor-plugin-text-formatting");
14
14
  var _editorPluginWidth = require("@atlaskit/editor-plugin-width");
15
15
  var _unsupportedContent = _interopRequireDefault(require("../../../plugins/unsupported-content"));
16
16
  var _base = _interopRequireDefault(require("../../../plugins/base"));
@@ -73,7 +73,7 @@ function createDefaultPreset(options) {
73
73
  return builder.add([p, options.annotationProviders]);
74
74
  }
75
75
  return builder;
76
- }).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_textFormatting.default, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_quickInsert.default, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
76
+ }).add([_editorPluginHyperlink.hyperlinkPlugin, options.hyperlinkOptions]).add([_editorPluginTextFormatting.textFormattingPlugin, options.textFormatting]).add(_editorPluginWidth.widthPlugin).add([_quickInsert.default, options.quickInsert]).add([_typeAhead.default, options.typeAhead || {
77
77
  createAnalyticsEvent: options.createAnalyticsEvent
78
78
  }]).add(_unsupportedContent.default).add(_editorPluginEditorDisabled.editorDisabledPlugin).add([_submitEditor.default, options.submitEditor]).add(_fakeTextCursor.default).add(_floatingToolbar.default).add([_selection.default, options.selection]).add([_codeBlock.default, options.codeBlock || {
79
79
  appearance: 'full-page'
@@ -32,6 +32,16 @@ var annotationMessages = (0, _reactIntlNext.defineMessages)({
32
32
  description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
33
33
  }
34
34
  });
35
+ /**
36
+ * Returns the coordintes at the bottom the selection.
37
+ */
38
+ exports.annotationMessages = annotationMessages;
39
+ var getCoordsBelowSelection = function getCoordsBelowSelection(bottomCoords, toolbarRect) {
40
+ return {
41
+ top: (bottomCoords.top || 0) + toolbarRect.height / 1.15,
42
+ left: bottomCoords.right - toolbarRect.width / 2
43
+ };
44
+ };
35
45
 
36
46
  /*
37
47
  Calculates the position of the floating toolbar relative to the selection.
@@ -47,7 +57,6 @@ var annotationMessages = (0, _reactIntlNext.defineMessages)({
47
57
  - use wrapperBounds to clamp values
48
58
  - editorView.dom bounds differ to wrapperBounds, convert at the end
49
59
  */
50
- exports.annotationMessages = annotationMessages;
51
60
  var calculateToolbarPositionAboveSelection = function calculateToolbarPositionAboveSelection(toolbarTitle) {
52
61
  return function (editorView, nextPos) {
53
62
  var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
@@ -83,13 +92,13 @@ var calculateToolbarPositionAboveSelection = function calculateToolbarPositionAb
83
92
  }
84
93
 
85
94
  /*
86
- short selection above a long paragraph
87
- eg. short {<}heading
88
- The purpose of this text is to show the selection range{>}.
89
- The horizontal positioning should center around "heading",
90
- not where it ends at "range".
91
- Note: if it was "head<b>ing</b>" then it would only center
92
- around "head". Undesireable but matches the current renderer.
95
+ short selection above a long paragraph
96
+ eg. short {<}heading
97
+ The purpose of this text is to show the selection range{>}.
98
+ The horizontal positioning should center around "heading",
99
+ not where it ends at "range".
100
+ Note: if it was "head<b>ing</b>" then it would only center
101
+ around "head". Undesireable but matches the current renderer.
93
102
  */
94
103
  var cliffPosition = range.getClientRects()[0];
95
104
  if (cliffPosition.right < left) {
@@ -101,6 +110,13 @@ var calculateToolbarPositionAboveSelection = function calculateToolbarPositionAb
101
110
  }
102
111
  left -= toolbarRect.width / 2;
103
112
 
113
+ // Place toolbar below selection if not sufficient space above
114
+ if (top < wrapperBounds.top) {
115
+ var _getCoordsBelowSelect = getCoordsBelowSelection(bottomCoords, toolbarRect);
116
+ top = _getCoordsBelowSelect.top;
117
+ left = _getCoordsBelowSelect.left;
118
+ }
119
+
104
120
  // remap positions from browser document to wrapperBounds
105
121
  return {
106
122
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
@@ -156,6 +172,13 @@ var calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHe
156
172
  }
157
173
  var left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
158
174
 
175
+ // Place toolbar below selection if not sufficient space above
176
+ if (top < wrapperBounds.top) {
177
+ var _getCoordsBelowSelect2 = getCoordsBelowSelection(bottomCoords, toolbarRect);
178
+ top = _getCoordsBelowSelect2.top;
179
+ left = _getCoordsBelowSelect2.left;
180
+ }
181
+
159
182
  // remap positions from browser document to wrapperBounds
160
183
  return {
161
184
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
@@ -25,11 +25,10 @@ var _styles = require("./styles");
25
25
  var keymaps = _interopRequireWildcard(require("../../../keymaps"));
26
26
  var _ToolbarButton = _interopRequireDefault(require("../../../ui/ToolbarButton"));
27
27
  var _messages = require("@atlaskit/editor-common/messages");
28
- var _messages2 = require("../../list/messages");
29
- var _messages3 = require("../../insert-block/ui/ToolbarInsertBlock/messages");
30
- var _messages4 = require("../../block-type/messages");
31
- var _messages5 = require("../../undo-redo/messages");
32
- var _messages6 = require("../../../ui/Alignment/messages");
28
+ var _messages2 = require("../../insert-block/ui/ToolbarInsertBlock/messages");
29
+ var _messages3 = require("../../block-type/messages");
30
+ var _messages4 = require("../../undo-redo/messages");
31
+ var _messages5 = require("../../../ui/Alignment/messages");
33
32
  var _commands = require("../commands");
34
33
  var _toolbar = require("../../annotation/toolbar");
35
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -149,7 +148,7 @@ var formatting = function formatting(_ref2) {
149
148
  return keymaps.toggleSuperscript;
150
149
  }
151
150
  }, {
152
- name: formatMessage(_messages4.messages.heading1),
151
+ name: formatMessage(_messages3.messages.heading1),
153
152
  type: 'heading',
154
153
  keymap: function keymap() {
155
154
  return keymaps.toggleHeading1;
@@ -162,7 +161,7 @@ var formatting = function formatting(_ref2) {
162
161
  }, "Space"));
163
162
  }
164
163
  }, {
165
- name: formatMessage(_messages4.messages.heading2),
164
+ name: formatMessage(_messages3.messages.heading2),
166
165
  type: 'heading',
167
166
  keymap: function keymap() {
168
167
  return keymaps.toggleHeading2;
@@ -175,7 +174,7 @@ var formatting = function formatting(_ref2) {
175
174
  }, "Space"));
176
175
  }
177
176
  }, {
178
- name: formatMessage(_messages4.messages.heading3),
177
+ name: formatMessage(_messages3.messages.heading3),
179
178
  type: 'heading',
180
179
  keymap: function keymap() {
181
180
  return keymaps.toggleHeading3;
@@ -188,7 +187,7 @@ var formatting = function formatting(_ref2) {
188
187
  }, "Space"));
189
188
  }
190
189
  }, {
191
- name: formatMessage(_messages4.messages.heading4),
190
+ name: formatMessage(_messages3.messages.heading4),
192
191
  type: 'heading',
193
192
  keymap: function keymap() {
194
193
  return keymaps.toggleHeading4;
@@ -201,7 +200,7 @@ var formatting = function formatting(_ref2) {
201
200
  }, "Space"));
202
201
  }
203
202
  }, {
204
- name: formatMessage(_messages4.messages.heading5),
203
+ name: formatMessage(_messages3.messages.heading5),
205
204
  type: 'heading',
206
205
  keymap: function keymap() {
207
206
  return keymaps.toggleHeading5;
@@ -214,7 +213,7 @@ var formatting = function formatting(_ref2) {
214
213
  }, "Space"));
215
214
  }
216
215
  }, {
217
- name: formatMessage(_messages4.messages.heading6),
216
+ name: formatMessage(_messages3.messages.heading6),
218
217
  type: 'heading',
219
218
  keymap: function keymap() {
220
219
  return keymaps.toggleHeading6;
@@ -227,13 +226,13 @@ var formatting = function formatting(_ref2) {
227
226
  }, "Space"));
228
227
  }
229
228
  }, {
230
- name: formatMessage(_messages4.messages.normal),
229
+ name: formatMessage(_messages3.messages.normal),
231
230
  type: 'paragraph',
232
231
  keymap: function keymap() {
233
232
  return keymaps.setNormalText;
234
233
  }
235
234
  }, {
236
- name: formatMessage(_messages2.messages.orderedList),
235
+ name: formatMessage(_messages.listMessages.orderedList),
237
236
  type: 'orderedList',
238
237
  keymap: function keymap() {
239
238
  return keymaps.toggleOrderedList;
@@ -246,7 +245,7 @@ var formatting = function formatting(_ref2) {
246
245
  }, "Space"));
247
246
  }
248
247
  }, {
249
- name: formatMessage(_messages2.messages.unorderedList),
248
+ name: formatMessage(_messages.listMessages.unorderedList),
250
249
  type: 'bulletList',
251
250
  keymap: function keymap() {
252
251
  return keymaps.toggleBulletList;
@@ -259,7 +258,7 @@ var formatting = function formatting(_ref2) {
259
258
  }, "Space"));
260
259
  }
261
260
  }, {
262
- name: formatMessage(_messages4.messages.blockquote),
261
+ name: formatMessage(_messages3.messages.blockquote),
263
262
  type: 'blockquote',
264
263
  keymap: function keymap() {
265
264
  return keymaps.toggleBlockQuote;
@@ -272,7 +271,7 @@ var formatting = function formatting(_ref2) {
272
271
  }, "Space"));
273
272
  }
274
273
  }, {
275
- name: formatMessage(_messages4.messages.codeblock),
274
+ name: formatMessage(_messages3.messages.codeblock),
276
275
  type: 'codeBlock',
277
276
  autoFormatting: function autoFormatting() {
278
277
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
@@ -280,7 +279,7 @@ var formatting = function formatting(_ref2) {
280
279
  }, "```"));
281
280
  }
282
281
  }, {
283
- name: formatMessage(_messages3.messages.horizontalRule),
282
+ name: formatMessage(_messages2.messages.horizontalRule),
284
283
  type: 'rule',
285
284
  keymap: function keymap() {
286
285
  return keymaps.insertRule;
@@ -291,7 +290,7 @@ var formatting = function formatting(_ref2) {
291
290
  }, "---"));
292
291
  }
293
292
  }, {
294
- name: formatMessage(_messages3.messages.link),
293
+ name: formatMessage(_messages2.messages.link),
295
294
  type: 'link',
296
295
  keymap: function keymap() {
297
296
  return keymaps.addLink;
@@ -299,7 +298,7 @@ var formatting = function formatting(_ref2) {
299
298
  autoFormatting: function autoFormatting() {
300
299
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
301
300
  css: _styles.codeLg
302
- }, "[", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages3.messages.link), "](http://a.com)"));
301
+ }, "[", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages2.messages.link), "](http://a.com)"));
303
302
  }
304
303
  }, {
305
304
  name: formatMessage(_messages.toolbarMessages.code),
@@ -313,7 +312,7 @@ var formatting = function formatting(_ref2) {
313
312
  }, "`", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarMessages.code), "`"));
314
313
  }
315
314
  }, {
316
- name: formatMessage(_messages3.messages.action),
315
+ name: formatMessage(_messages2.messages.action),
317
316
  type: 'taskItem',
318
317
  autoFormatting: function autoFormatting() {
319
318
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
@@ -323,7 +322,7 @@ var formatting = function formatting(_ref2) {
323
322
  }, "Space"));
324
323
  }
325
324
  }, {
326
- name: formatMessage(_messages3.messages.decision),
325
+ name: formatMessage(_messages2.messages.decision),
327
326
  type: 'decisionItem',
328
327
  autoFormatting: function autoFormatting() {
329
328
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
@@ -333,7 +332,7 @@ var formatting = function formatting(_ref2) {
333
332
  }, "Space"));
334
333
  }
335
334
  }, {
336
- name: formatMessage(_messages3.messages.emoji),
335
+ name: formatMessage(_messages2.messages.emoji),
337
336
  type: 'emoji',
338
337
  autoFormatting: function autoFormatting() {
339
338
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
@@ -341,7 +340,7 @@ var formatting = function formatting(_ref2) {
341
340
  }, ":"));
342
341
  }
343
342
  }, {
344
- name: formatMessage(_messages3.messages.mention),
343
+ name: formatMessage(_messages2.messages.mention),
345
344
  type: 'mention',
346
345
  autoFormatting: function autoFormatting() {
347
346
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
@@ -349,13 +348,13 @@ var formatting = function formatting(_ref2) {
349
348
  }, "@"));
350
349
  }
351
350
  }, {
352
- name: formatMessage(_messages6.alignmentMessages.alignLeft),
351
+ name: formatMessage(_messages5.alignmentMessages.alignLeft),
353
352
  type: 'alignment',
354
353
  keymap: function keymap() {
355
354
  return keymaps.alignLeft;
356
355
  }
357
356
  }, {
358
- name: formatMessage(_messages6.alignmentMessages.alignRight),
357
+ name: formatMessage(_messages5.alignmentMessages.alignRight),
359
358
  type: 'alignment'
360
359
  }];
361
360
  };
@@ -370,13 +369,13 @@ var otherFormatting = function otherFormatting(_ref3) {
370
369
  return keymaps.clearFormatting;
371
370
  }
372
371
  }, {
373
- name: formatMessage(_messages5.messages.undo),
372
+ name: formatMessage(_messages4.messages.undo),
374
373
  type: 'undo',
375
374
  keymap: function keymap() {
376
375
  return keymaps.undo;
377
376
  }
378
377
  }, {
379
- name: formatMessage(_messages5.messages.redo),
378
+ name: formatMessage(_messages4.messages.redo),
380
379
  type: 'redo',
381
380
  keymap: function keymap() {
382
381
  return keymaps.redo;
@@ -347,12 +347,6 @@ Object.defineProperty(exports, "textColorPlugin", {
347
347
  return _textColor.default;
348
348
  }
349
349
  });
350
- Object.defineProperty(exports, "textFormattingPlugin", {
351
- enumerable: true,
352
- get: function get() {
353
- return _textFormatting.default;
354
- }
355
- });
356
350
  Object.defineProperty(exports, "toolbarListsIndentationPlugin", {
357
351
  enumerable: true,
358
352
  get: function get() {
@@ -414,7 +408,6 @@ var _saveOnEnter = _interopRequireDefault(require("./save-on-enter"));
414
408
  var _submitEditor = _interopRequireDefault(require("./submit-editor"));
415
409
  var _tasksAndDecisions = _interopRequireDefault(require("./tasks-and-decisions"));
416
410
  var _textColor = _interopRequireDefault(require("./text-color"));
417
- var _textFormatting = _interopRequireDefault(require("./text-formatting"));
418
411
  var _typeAhead = _interopRequireDefault(require("./type-ahead"));
419
412
  var _unsupportedContent = _interopRequireDefault(require("./unsupported-content"));
420
413
  var _floatingToolbar = _interopRequireDefault(require("./floating-toolbar"));
@@ -10,7 +10,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _main = require("./pm-plugins/main");
11
11
  var _inputRules = _interopRequireDefault(require("./pm-plugins/input-rules"));
12
12
  var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
13
- var _messages = require("./messages");
13
+ var _messages = require("@atlaskit/editor-common/messages");
14
14
  var _analytics = require("../analytics");
15
15
  var _keymaps = require("../../keymaps");
16
16
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
@@ -63,8 +63,8 @@ var listPlugin = function listPlugin(options, api) {
63
63
  var formatMessage = _ref3.formatMessage;
64
64
  return [{
65
65
  id: 'unorderedList',
66
- title: formatMessage(_messages.messages.unorderedList),
67
- description: formatMessage(_messages.messages.unorderedListDescription),
66
+ title: formatMessage(_messages.listMessages.unorderedList),
67
+ description: formatMessage(_messages.listMessages.unorderedListDescription),
68
68
  keywords: ['ul', 'unordered'],
69
69
  priority: 1100,
70
70
  keyshortcut: (0, _keymaps.tooltip)(_keymaps.toggleBulletList),
@@ -86,8 +86,8 @@ var listPlugin = function listPlugin(options, api) {
86
86
  }
87
87
  }, {
88
88
  id: 'orderedList',
89
- title: formatMessage(_messages.messages.orderedList),
90
- description: formatMessage(_messages.messages.orderedListDescription),
89
+ title: formatMessage(_messages.listMessages.orderedList),
90
+ description: formatMessage(_messages.listMessages.orderedListDescription),
91
91
  keywords: ['ol', 'ordered'],
92
92
  priority: 1200,
93
93
  keyshortcut: (0, _keymaps.tooltip)(_keymaps.toggleOrderedList),
@@ -1,21 +1,14 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.liftFollowingList = liftFollowingList;
8
7
  exports.liftNodeSelectionList = liftNodeSelectionList;
9
8
  exports.liftTextSelectionList = liftTextSelectionList;
10
- exports.upgradeTextToLists = exports.splitParagraphs = exports.splitIntoParagraphs = void 0;
11
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
9
  var _model = require("@atlaskit/editor-prosemirror/model");
14
10
  var _state = require("@atlaskit/editor-prosemirror/state");
15
11
  var _transform = require("@atlaskit/editor-prosemirror/transform");
16
- var _commands = require("@atlaskit/editor-prosemirror/commands");
17
- var _utils = require("@atlaskit/editor-common/utils");
18
- var _slice = require("../../utils/slice");
19
12
  var _indentation = require("./utils/indentation");
20
13
  function liftListItem(selection, tr) {
21
14
  var $from = selection.$from,
@@ -104,219 +97,4 @@ function liftTextSelectionList(selection, tr) {
104
97
  }
105
98
  }
106
99
  return tr;
107
- }
108
-
109
- // matchers for text lists
110
- var bullets = /^\s*[\*\-\u2022](\s+|\s+$)/;
111
- var numbers = /^\s*\d[\.\)](\s+|$)/;
112
- var getListType = function getListType(node, schema) {
113
- if (!node.text) {
114
- return null;
115
- }
116
- var _schema$nodes = schema.nodes,
117
- bulletList = _schema$nodes.bulletList,
118
- orderedList = _schema$nodes.orderedList;
119
- return [{
120
- node: bulletList,
121
- matcher: bullets
122
- }, {
123
- node: orderedList,
124
- matcher: numbers
125
- }].reduce(function (lastMatch, listType) {
126
- if (lastMatch) {
127
- return lastMatch;
128
- }
129
- var match = node.text.match(listType.matcher);
130
- return match ? [listType.node, match[0].length] : lastMatch;
131
- }, null);
132
- };
133
- var extractListFromParagraph = function extractListFromParagraph(node, parent, schema) {
134
- var _schema$nodes2 = schema.nodes,
135
- hardBreak = _schema$nodes2.hardBreak,
136
- bulletList = _schema$nodes2.bulletList,
137
- orderedList = _schema$nodes2.orderedList;
138
- var content = (0, _slice.mapChildren)(node.content, function (node) {
139
- return node;
140
- });
141
- var listTypes = [bulletList, orderedList];
142
-
143
- // wrap each line into a listItem and a containing list
144
- var listified = content.map(function (child, index) {
145
- var listMatch = getListType(child, schema);
146
- var prevChild = index > 0 && content[index - 1];
147
-
148
- // only extract list when preceded by a hardbreak
149
- if (prevChild && prevChild.type !== hardBreak) {
150
- return child;
151
- }
152
- if (!listMatch || !child.text) {
153
- return child;
154
- }
155
- var _listMatch = (0, _slicedToArray2.default)(listMatch, 2),
156
- nodeType = _listMatch[0],
157
- length = _listMatch[1];
158
-
159
- // convert to list item
160
- var newText = child.text.substr(length);
161
- var listItemNode = schema.nodes.listItem.createAndFill(undefined, schema.nodes.paragraph.createChecked(undefined, newText.length ? schema.text(newText) : undefined));
162
- if (!listItemNode) {
163
- return child;
164
- }
165
- var newList = nodeType.createChecked(undefined, [listItemNode]);
166
- // Check whether our new list is valid content in our current structure,
167
- // otherwise dont convert.
168
- if (parent && !parent.type.validContent(_model.Fragment.from(newList))) {
169
- return child;
170
- }
171
- return newList;
172
- }).filter(function (child, idx, arr) {
173
- // remove hardBreaks that have a list node on either side
174
-
175
- // wasn't hardBreak, leave as-is
176
- if (child.type !== hardBreak) {
177
- return child;
178
- }
179
- if (idx > 0 && listTypes.indexOf(arr[idx - 1].type) > -1) {
180
- // list node on the left
181
- return null;
182
- }
183
- if (idx < arr.length - 1 && listTypes.indexOf(arr[idx + 1].type) > -1) {
184
- // list node on the right
185
- return null;
186
- }
187
- return child;
188
- });
189
-
190
- // try to join
191
- var mockState = _state.EditorState.create({
192
- schema: schema
193
- });
194
- var joinedListsTr;
195
- var mockDispatch = function mockDispatch(tr) {
196
- joinedListsTr = tr;
197
- };
198
- (0, _commands.autoJoin)(function (state, dispatch) {
199
- if (!dispatch) {
200
- return false;
201
- }
202
-
203
- // Return false to prevent replaceWith from wrapping the text node in a paragraph
204
- // paragraph since that will be done later. If it's done here, it will fail
205
- // the paragraph.validContent check.
206
- // Dont return false if there are lists, as they arent validContent for paragraphs
207
- // and will result in hanging textNodes
208
- var containsList = listified.some(function (node) {
209
- return node.type === bulletList || node.type === orderedList;
210
- });
211
- if (listified.some(function (node) {
212
- return node.isText;
213
- }) && !containsList) {
214
- return false;
215
- }
216
- dispatch(state.tr.replaceWith(0, 2, listified));
217
- return true;
218
- }, function (before, after) {
219
- return (0, _utils.isListNode)(before) && (0, _utils.isListNode)(after);
220
- })(mockState, mockDispatch);
221
- var fragment = joinedListsTr ? joinedListsTr.doc.content : _model.Fragment.from(listified);
222
-
223
- // try to re-wrap fragment in paragraph (which is the original node we unwrapped)
224
- var paragraph = schema.nodes.paragraph;
225
- if (paragraph.validContent(fragment)) {
226
- return _model.Fragment.from(paragraph.create(node.attrs, fragment, node.marks));
227
- }
228
-
229
- // fragment now contains other nodes, get Prosemirror to wrap with ContentMatch later
230
- return fragment;
231
- };
232
-
233
- /**
234
- * Walks the slice, creating paragraphs that were previously separated by hardbreaks.
235
- * Returns the original paragraph node (as a fragment), or a fragment containing multiple nodes.
236
- */
237
- var splitIntoParagraphs = function splitIntoParagraphs(_ref) {
238
- var fragment = _ref.fragment,
239
- _ref$blockMarks = _ref.blockMarks,
240
- blockMarks = _ref$blockMarks === void 0 ? [] : _ref$blockMarks,
241
- schema = _ref.schema;
242
- var paragraphs = [];
243
- var curChildren = [];
244
- var lastNode = null;
245
- var _schema$nodes3 = schema.nodes,
246
- hardBreak = _schema$nodes3.hardBreak,
247
- paragraph = _schema$nodes3.paragraph;
248
- fragment.forEach(function (node, i) {
249
- var isNodeValidContentForParagraph = schema.nodes.paragraph.validContent(_model.Fragment.from(node));
250
- if (!isNodeValidContentForParagraph) {
251
- paragraphs.push(node);
252
- return;
253
- }
254
- // ED-14725 Fixed the issue that it make duplicated line
255
- // when pasting <br /> from google docs.
256
- if (i === 0 && node.type === hardBreak) {
257
- paragraphs.push(paragraph.createChecked(undefined, curChildren, (0, _toConsumableArray2.default)(blockMarks)));
258
- lastNode = node;
259
- return;
260
- } else if (lastNode && lastNode.type === hardBreak && node.type === hardBreak) {
261
- // double hardbreak
262
-
263
- // backtrack a little; remove the trailing hardbreak we added last loop
264
- curChildren.pop();
265
-
266
- // create a new paragraph
267
- paragraphs.push(paragraph.createChecked(undefined, curChildren, (0, _toConsumableArray2.default)(blockMarks)));
268
- curChildren = [];
269
- return;
270
- }
271
-
272
- // add to this paragraph
273
- curChildren.push(node);
274
- lastNode = node;
275
- });
276
- if (curChildren.length) {
277
- paragraphs.push(paragraph.createChecked(undefined, curChildren, (0, _toConsumableArray2.default)(blockMarks)));
278
- }
279
- return _model.Fragment.from(paragraphs.length ? paragraphs : [paragraph.createAndFill(undefined, undefined, (0, _toConsumableArray2.default)(blockMarks))]);
280
- };
281
- exports.splitIntoParagraphs = splitIntoParagraphs;
282
- var splitParagraphs = function splitParagraphs(slice, schema) {
283
- // exclude Text nodes with a code mark, since we transform those later
284
- // into a codeblock
285
- var hasCodeMark = false;
286
- slice.content.forEach(function (child) {
287
- hasCodeMark = hasCodeMark || child.marks.some(function (mark) {
288
- return mark.type === schema.marks.code;
289
- });
290
- });
291
-
292
- // slice might just be a raw text string
293
- if (schema.nodes.paragraph.validContent(slice.content) && !hasCodeMark) {
294
- var replSlice = splitIntoParagraphs({
295
- fragment: slice.content,
296
- schema: schema
297
- });
298
- return new _model.Slice(replSlice, slice.openStart + 1, slice.openEnd + 1);
299
- }
300
- return (0, _slice.mapSlice)(slice, function (node) {
301
- if (node.type === schema.nodes.paragraph) {
302
- return splitIntoParagraphs({
303
- fragment: node.content,
304
- blockMarks: node.marks,
305
- schema: schema
306
- });
307
- }
308
- return node;
309
- });
310
- };
311
-
312
- // above will wrap everything in paragraphs for us
313
- exports.splitParagraphs = splitParagraphs;
314
- var upgradeTextToLists = function upgradeTextToLists(slice, schema) {
315
- return (0, _slice.mapSlice)(slice, function (node, parent) {
316
- if (node.type === schema.nodes.paragraph) {
317
- return extractListFromParagraph(node, parent, schema);
318
- }
319
- return node;
320
- });
321
- };
322
- exports.upgradeTextToLists = upgradeTextToLists;
100
+ }