@atlaskit/editor-core 187.17.5 → 187.18.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 (253) 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/base/pm-plugins/inline-cursor-target.js +7 -41
  5. package/dist/cjs/plugins/index.js +0 -7
  6. package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +0 -3
  7. package/dist/cjs/plugins/selection/pm-plugins/gap-cursor-main.js +27 -13
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/labs/next/presets/default.js +1 -1
  11. package/dist/es2019/plugins/annotation/toolbar.js +34 -9
  12. package/dist/es2019/plugins/base/pm-plugins/inline-cursor-target.js +9 -41
  13. package/dist/es2019/plugins/index.js +0 -1
  14. package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +0 -3
  15. package/dist/es2019/plugins/selection/pm-plugins/gap-cursor-main.js +27 -13
  16. package/dist/es2019/version-wrapper.js +1 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/labs/next/presets/default.js +1 -1
  19. package/dist/esm/plugins/annotation/toolbar.js +30 -7
  20. package/dist/esm/plugins/base/pm-plugins/inline-cursor-target.js +7 -41
  21. package/dist/esm/plugins/index.js +0 -1
  22. package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +0 -3
  23. package/dist/esm/plugins/selection/pm-plugins/gap-cursor-main.js +27 -13
  24. package/dist/esm/version-wrapper.js +1 -1
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/extensibility.d.ts +0 -2
  27. package/dist/types/index.d.ts +0 -5
  28. package/dist/types/labs/next/presets/default.d.ts +28 -30
  29. package/dist/types/plugins/analytics/index.d.ts +0 -2
  30. package/dist/types/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
  31. package/dist/types/plugins/annotation/types.d.ts +9 -3
  32. package/dist/types/plugins/annotation/utils.d.ts +2 -5
  33. package/dist/types/plugins/base/pm-plugins/context-identifier.d.ts +1 -1
  34. package/dist/types/plugins/block-type/commands/block-type.d.ts +0 -2
  35. package/dist/types/plugins/block-type/pm-plugins/main.d.ts +6 -1
  36. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +1 -1
  37. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +0 -2
  38. package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +5 -1
  39. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +2 -1
  40. package/dist/types/plugins/code-block/utils.d.ts +1 -1
  41. package/dist/types/plugins/collab-edit/utils.d.ts +1 -5
  42. package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +10 -1
  43. package/dist/types/plugins/copy-button/toolbar.d.ts +0 -2
  44. package/dist/types/plugins/copy-button/utils.d.ts +1 -1
  45. package/dist/types/plugins/custom-autoformat/index.d.ts +2 -1
  46. package/dist/types/plugins/date/pm-plugins/main.d.ts +0 -2
  47. package/dist/types/plugins/expand/pm-plugins/main.d.ts +1 -1
  48. package/dist/types/plugins/expand/pm-plugins/plugin-factory.d.ts +0 -2
  49. package/dist/types/plugins/extension/plugin-factory.d.ts +0 -2
  50. package/dist/types/plugins/extension/utils.d.ts +1 -1
  51. package/dist/types/plugins/find-replace/plugin.d.ts +0 -2
  52. package/dist/types/plugins/find-replace/utils/index.d.ts +1 -4
  53. package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +3 -1
  54. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +0 -2
  55. package/dist/types/plugins/index.d.ts +0 -1
  56. package/dist/types/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +1 -2
  57. package/dist/types/plugins/media/commands/helpers.d.ts +1 -1
  58. package/dist/types/plugins/media/pm-plugins/alt-text/index.d.ts +1 -3
  59. package/dist/types/plugins/media/pm-plugins/linking/index.d.ts +0 -2
  60. package/dist/types/plugins/media/toolbar/utils.d.ts +1 -3
  61. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +0 -1
  62. package/dist/types/plugins/media/ui/ResizableMediaSingle/index.d.ts +0 -1
  63. package/dist/types/plugins/mobile-dimensions/plugin-factory.d.ts +0 -2
  64. package/dist/types/plugins/panel/utils.d.ts +1 -1
  65. package/dist/types/plugins/paste/pm-plugins/main.d.ts +1 -1
  66. package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +0 -2
  67. package/dist/types/plugins/paste/util/index.d.ts +1 -1
  68. package/dist/types/plugins/selection/plugin-factory.d.ts +0 -2
  69. package/dist/types/plugins/selection/pm-plugins/gap-cursor-main.d.ts +1 -1
  70. package/dist/types/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
  71. package/dist/types/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +1 -2
  72. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  73. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  74. package/dist/types/utils/action.d.ts +1 -60
  75. package/dist/types/utils/list-commands.d.ts +0 -1
  76. package/dist/types-ts4.5/extensibility.d.ts +0 -2
  77. package/dist/types-ts4.5/index.d.ts +0 -5
  78. package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -30
  79. package/dist/types-ts4.5/plugins/analytics/index.d.ts +0 -2
  80. package/dist/types-ts4.5/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
  81. package/dist/types-ts4.5/plugins/annotation/types.d.ts +9 -3
  82. package/dist/types-ts4.5/plugins/annotation/utils.d.ts +2 -5
  83. package/dist/types-ts4.5/plugins/base/pm-plugins/context-identifier.d.ts +1 -1
  84. package/dist/types-ts4.5/plugins/block-type/commands/block-type.d.ts +0 -2
  85. package/dist/types-ts4.5/plugins/block-type/pm-plugins/main.d.ts +6 -1
  86. package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/main.d.ts +1 -1
  87. package/dist/types-ts4.5/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +0 -2
  88. package/dist/types-ts4.5/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +8 -1
  89. package/dist/types-ts4.5/plugins/code-block/pm-plugins/main.d.ts +2 -1
  90. package/dist/types-ts4.5/plugins/code-block/utils.d.ts +1 -1
  91. package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +1 -5
  92. package/dist/types-ts4.5/plugins/copy-button/pm-plugins/main.d.ts +10 -1
  93. package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +0 -2
  94. package/dist/types-ts4.5/plugins/copy-button/utils.d.ts +1 -1
  95. package/dist/types-ts4.5/plugins/custom-autoformat/index.d.ts +2 -1
  96. package/dist/types-ts4.5/plugins/date/pm-plugins/main.d.ts +0 -2
  97. package/dist/types-ts4.5/plugins/expand/pm-plugins/main.d.ts +1 -1
  98. package/dist/types-ts4.5/plugins/expand/pm-plugins/plugin-factory.d.ts +0 -2
  99. package/dist/types-ts4.5/plugins/extension/plugin-factory.d.ts +0 -2
  100. package/dist/types-ts4.5/plugins/extension/utils.d.ts +1 -1
  101. package/dist/types-ts4.5/plugins/find-replace/plugin.d.ts +0 -2
  102. package/dist/types-ts4.5/plugins/find-replace/utils/index.d.ts +1 -4
  103. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +3 -1
  104. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +0 -2
  105. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  106. package/dist/types-ts4.5/plugins/list/pm-plugins/input-rules/wrapping-join-rule.d.ts +1 -2
  107. package/dist/types-ts4.5/plugins/media/commands/helpers.d.ts +1 -1
  108. package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/index.d.ts +1 -3
  109. package/dist/types-ts4.5/plugins/media/pm-plugins/linking/index.d.ts +0 -2
  110. package/dist/types-ts4.5/plugins/media/toolbar/utils.d.ts +1 -3
  111. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +0 -1
  112. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/index.d.ts +0 -1
  113. package/dist/types-ts4.5/plugins/mobile-dimensions/plugin-factory.d.ts +0 -2
  114. package/dist/types-ts4.5/plugins/panel/utils.d.ts +1 -1
  115. package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +1 -1
  116. package/dist/types-ts4.5/plugins/paste/pm-plugins/plugin-factory.d.ts +0 -2
  117. package/dist/types-ts4.5/plugins/paste/util/index.d.ts +1 -1
  118. package/dist/types-ts4.5/plugins/selection/plugin-factory.d.ts +0 -2
  119. package/dist/types-ts4.5/plugins/selection/pm-plugins/gap-cursor-main.d.ts +1 -1
  120. package/dist/types-ts4.5/plugins/selection/pm-plugins/selection-main.d.ts +1 -1
  121. package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/helpers.d.ts +1 -2
  122. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  123. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  124. package/dist/types-ts4.5/utils/action.d.ts +1 -60
  125. package/dist/types-ts4.5/utils/list-commands.d.ts +0 -1
  126. package/package.json +5 -4
  127. package/report.api.md +1 -24
  128. package/tmp/api-report-tmp.d.ts +1 -21
  129. package/dist/cjs/plugins/text-formatting/actions.js +0 -188
  130. package/dist/cjs/plugins/text-formatting/commands/clear-formatting.js +0 -111
  131. package/dist/cjs/plugins/text-formatting/commands/text-formatting.js +0 -143
  132. package/dist/cjs/plugins/text-formatting/commands/transform-to-code.js +0 -68
  133. package/dist/cjs/plugins/text-formatting/index.js +0 -136
  134. package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -21
  135. package/dist/cjs/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -36
  136. package/dist/cjs/plugins/text-formatting/pm-plugins/cursor.js +0 -55
  137. package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +0 -276
  138. package/dist/cjs/plugins/text-formatting/pm-plugins/keymap.js +0 -52
  139. package/dist/cjs/plugins/text-formatting/pm-plugins/main.js +0 -113
  140. package/dist/cjs/plugins/text-formatting/pm-plugins/plugin-key.js +0 -9
  141. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -176
  142. package/dist/cjs/plugins/text-formatting/ui/Toolbar/constants.js +0 -19
  143. package/dist/cjs/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -86
  144. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -53
  145. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -225
  146. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -23
  147. package/dist/cjs/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -60
  148. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +0 -201
  149. package/dist/cjs/plugins/text-formatting/ui/Toolbar/more-button.js +0 -40
  150. package/dist/cjs/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -46
  151. package/dist/cjs/plugins/text-formatting/ui/Toolbar/types.js +0 -17
  152. package/dist/cjs/plugins/text-formatting/utils/cell-selection.js +0 -12
  153. package/dist/cjs/plugins/text-formatting/utils.js +0 -86
  154. package/dist/es2019/plugins/text-formatting/actions.js +0 -161
  155. package/dist/es2019/plugins/text-formatting/commands/clear-formatting.js +0 -105
  156. package/dist/es2019/plugins/text-formatting/commands/text-formatting.js +0 -144
  157. package/dist/es2019/plugins/text-formatting/commands/transform-to-code.js +0 -71
  158. package/dist/es2019/plugins/text-formatting/index.js +0 -127
  159. package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -10
  160. package/dist/es2019/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -26
  161. package/dist/es2019/plugins/text-formatting/pm-plugins/cursor.js +0 -52
  162. package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +0 -244
  163. package/dist/es2019/plugins/text-formatting/pm-plugins/keymap.js +0 -43
  164. package/dist/es2019/plugins/text-formatting/pm-plugins/main.js +0 -109
  165. package/dist/es2019/plugins/text-formatting/pm-plugins/plugin-key.js +0 -2
  166. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -155
  167. package/dist/es2019/plugins/text-formatting/ui/Toolbar/constants.js +0 -20
  168. package/dist/es2019/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -66
  169. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -42
  170. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -210
  171. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -11
  172. package/dist/es2019/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -48
  173. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +0 -168
  174. package/dist/es2019/plugins/text-formatting/ui/Toolbar/more-button.js +0 -32
  175. package/dist/es2019/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -36
  176. package/dist/es2019/plugins/text-formatting/ui/Toolbar/types.js +0 -10
  177. package/dist/es2019/plugins/text-formatting/utils/cell-selection.js +0 -5
  178. package/dist/es2019/plugins/text-formatting/utils.js +0 -74
  179. package/dist/esm/plugins/text-formatting/actions.js +0 -168
  180. package/dist/esm/plugins/text-formatting/commands/clear-formatting.js +0 -101
  181. package/dist/esm/plugins/text-formatting/commands/text-formatting.js +0 -134
  182. package/dist/esm/plugins/text-formatting/commands/transform-to-code.js +0 -61
  183. package/dist/esm/plugins/text-formatting/index.js +0 -128
  184. package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting-keymap.js +0 -10
  185. package/dist/esm/plugins/text-formatting/pm-plugins/clear-formatting.js +0 -28
  186. package/dist/esm/plugins/text-formatting/pm-plugins/cursor.js +0 -48
  187. package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +0 -259
  188. package/dist/esm/plugins/text-formatting/pm-plugins/keymap.js +0 -43
  189. package/dist/esm/plugins/text-formatting/pm-plugins/main.js +0 -98
  190. package/dist/esm/plugins/text-formatting/pm-plugins/plugin-key.js +0 -2
  191. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +0 -169
  192. package/dist/esm/plugins/text-formatting/ui/Toolbar/constants.js +0 -8
  193. package/dist/esm/plugins/text-formatting/ui/Toolbar/dropdown-menu.js +0 -75
  194. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.js +0 -45
  195. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.js +0 -213
  196. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/menu-state.js +0 -15
  197. package/dist/esm/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.js +0 -50
  198. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +0 -191
  199. package/dist/esm/plugins/text-formatting/ui/Toolbar/more-button.js +0 -31
  200. package/dist/esm/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.js +0 -35
  201. package/dist/esm/plugins/text-formatting/ui/Toolbar/types.js +0 -10
  202. package/dist/esm/plugins/text-formatting/utils/cell-selection.js +0 -5
  203. package/dist/esm/plugins/text-formatting/utils.js +0 -75
  204. package/dist/types/plugins/text-formatting/actions.d.ts +0 -22
  205. package/dist/types/plugins/text-formatting/commands/clear-formatting.d.ts +0 -6
  206. package/dist/types/plugins/text-formatting/commands/text-formatting.d.ts +0 -5
  207. package/dist/types/plugins/text-formatting/commands/transform-to-code.d.ts +0 -2
  208. package/dist/types/plugins/text-formatting/index.d.ts +0 -17
  209. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +0 -4
  210. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -8
  211. package/dist/types/plugins/text-formatting/pm-plugins/cursor.d.ts +0 -3
  212. package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +0 -24
  213. package/dist/types/plugins/text-formatting/pm-plugins/keymap.d.ts +0 -4
  214. package/dist/types/plugins/text-formatting/pm-plugins/main.d.ts +0 -7
  215. package/dist/types/plugins/text-formatting/pm-plugins/plugin-key.d.ts +0 -3
  216. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +0 -3
  217. package/dist/types/plugins/text-formatting/ui/Toolbar/constants.d.ts +0 -6
  218. package/dist/types/plugins/text-formatting/ui/Toolbar/dropdown-menu.d.ts +0 -15
  219. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +0 -7
  220. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +0 -14
  221. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/menu-state.d.ts +0 -1
  222. package/dist/types/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +0 -20
  223. package/dist/types/plugins/text-formatting/ui/Toolbar/index.d.ts +0 -26
  224. package/dist/types/plugins/text-formatting/ui/Toolbar/more-button.d.ts +0 -13
  225. package/dist/types/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.d.ts +0 -9
  226. package/dist/types/plugins/text-formatting/ui/Toolbar/types.d.ts +0 -32
  227. package/dist/types/plugins/text-formatting/utils/cell-selection.d.ts +0 -3
  228. package/dist/types/plugins/text-formatting/utils.d.ts +0 -11
  229. package/dist/types-ts4.5/plugins/text-formatting/actions.d.ts +0 -22
  230. package/dist/types-ts4.5/plugins/text-formatting/commands/clear-formatting.d.ts +0 -6
  231. package/dist/types-ts4.5/plugins/text-formatting/commands/text-formatting.d.ts +0 -5
  232. package/dist/types-ts4.5/plugins/text-formatting/commands/transform-to-code.d.ts +0 -2
  233. package/dist/types-ts4.5/plugins/text-formatting/index.d.ts +0 -19
  234. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting-keymap.d.ts +0 -4
  235. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -8
  236. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/cursor.d.ts +0 -3
  237. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +0 -24
  238. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/keymap.d.ts +0 -4
  239. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/main.d.ts +0 -7
  240. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/plugin-key.d.ts +0 -3
  241. package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +0 -3
  242. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/constants.d.ts +0 -6
  243. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/dropdown-menu.d.ts +0 -15
  244. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/clear-formatting-icon.d.ts +0 -7
  245. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/formatting-icons.d.ts +0 -14
  246. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/menu-state.d.ts +0 -5
  247. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/hooks/responsive-toolbar-buttons.d.ts +0 -20
  248. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/index.d.ts +0 -26
  249. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/more-button.d.ts +0 -13
  250. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/single-toolbar-buttons.d.ts +0 -9
  251. package/dist/types-ts4.5/plugins/text-formatting/ui/Toolbar/types.d.ts +0 -32
  252. package/dist/types-ts4.5/plugins/text-formatting/utils/cell-selection.d.ts +0 -3
  253. package/dist/types-ts4.5/plugins/text-formatting/utils.d.ts +0 -11
@@ -1,74 +0,0 @@
1
- import { anyMarkActive } from '@atlaskit/editor-common/mark';
2
- import { FORMATTING_MARK_TYPES, FORMATTING_NODE_TYPES } from './commands/clear-formatting';
3
- export const hasCode = (state, pos) => {
4
- const {
5
- code
6
- } = state.schema.marks;
7
- const node = pos >= 0 && state.doc.nodeAt(pos);
8
- if (node) {
9
- return !!node.marks.filter(mark => mark.type === code).length;
10
- }
11
- return false;
12
- };
13
-
14
- /**
15
- * Determine if a mark (with specific attribute values) exists anywhere in the selection.
16
- */
17
- export const markActive = (state, mark) => {
18
- const {
19
- from,
20
- to,
21
- empty
22
- } = state.selection;
23
- // When the selection is empty, only the active marks apply.
24
- if (empty) {
25
- return !!mark.isInSet(state.tr.storedMarks || state.selection.$from.marks());
26
- }
27
- // For a non-collapsed selection, the marks on the nodes matter.
28
- let found = false;
29
- state.doc.nodesBetween(from, to, node => {
30
- found = found || mark.isInSet(node.marks);
31
- });
32
- return found;
33
- };
34
- const blockStylingIsPresent = state => {
35
- let {
36
- from,
37
- to
38
- } = state.selection;
39
- let isBlockStyling = false;
40
- state.doc.nodesBetween(from, to, node => {
41
- if (FORMATTING_NODE_TYPES.indexOf(node.type.name) !== -1) {
42
- isBlockStyling = true;
43
- return false;
44
- }
45
- return true;
46
- });
47
- return isBlockStyling;
48
- };
49
- const marksArePresent = state => {
50
- const activeMarkTypes = FORMATTING_MARK_TYPES.filter(mark => {
51
- if (!!state.schema.marks[mark]) {
52
- const {
53
- $from,
54
- empty
55
- } = state.selection;
56
- const {
57
- marks
58
- } = state.schema;
59
- if (empty) {
60
- return !!marks[mark].isInSet(state.storedMarks || $from.marks());
61
- }
62
- return anyMarkActive(state, marks[mark]);
63
- }
64
- return false;
65
- });
66
- return activeMarkTypes.length > 0;
67
- };
68
- export const checkFormattingIsPresent = state => {
69
- return marksArePresent(state) || blockStylingIsPresent(state);
70
- };
71
- export const compareItemsArrays = (items, prevItems) => {
72
- return items && items.filter(item => !prevItems.includes(item));
73
- };
74
- export const isArrayContainsContent = (items, content) => items.filter(item => item.content === content).length > 0;
@@ -1,168 +0,0 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
- import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
3
- import { toggleMark } from '@atlaskit/editor-common/mark';
4
- export var toggleEm = function toggleEm() {
5
- return function (state, dispatch) {
6
- var em = state.schema.marks.em;
7
- if (em) {
8
- return toggleMark(em)(state, dispatch);
9
- }
10
- return false;
11
- };
12
- };
13
- export var toggleEmWithAnalytics = function toggleEmWithAnalytics(editorAnalyticsAPI) {
14
- return function (_ref) {
15
- var inputMethod = _ref.inputMethod;
16
- return withAnalytics(editorAnalyticsAPI, {
17
- action: ACTION.FORMATTED,
18
- actionSubject: ACTION_SUBJECT.TEXT,
19
- eventType: EVENT_TYPE.TRACK,
20
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_ITALIC,
21
- attributes: {
22
- inputMethod: inputMethod
23
- }
24
- })(toggleEm());
25
- };
26
- };
27
- export var toggleStrike = function toggleStrike() {
28
- return function (state, dispatch) {
29
- var strike = state.schema.marks.strike;
30
- if (strike) {
31
- return toggleMark(strike)(state, dispatch);
32
- }
33
- return false;
34
- };
35
- };
36
- export var toggleStrikeWithAnalytics = function toggleStrikeWithAnalytics(editorAnalyticsAPI) {
37
- return function (_ref2) {
38
- var inputMethod = _ref2.inputMethod;
39
- return withAnalytics(editorAnalyticsAPI, {
40
- action: ACTION.FORMATTED,
41
- actionSubject: ACTION_SUBJECT.TEXT,
42
- eventType: EVENT_TYPE.TRACK,
43
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRIKE,
44
- attributes: {
45
- inputMethod: inputMethod
46
- }
47
- })(toggleStrike());
48
- };
49
- };
50
- export var toggleStrong = function toggleStrong() {
51
- return function (state, dispatch) {
52
- var strong = state.schema.marks.strong;
53
- if (strong) {
54
- return toggleMark(strong)(state, dispatch);
55
- }
56
- return false;
57
- };
58
- };
59
- export var toggleStrongWithAnalytics = function toggleStrongWithAnalytics(editorAnalyticsAPI) {
60
- return function (_ref3) {
61
- var inputMethod = _ref3.inputMethod;
62
- return withAnalytics(editorAnalyticsAPI, {
63
- action: ACTION.FORMATTED,
64
- actionSubject: ACTION_SUBJECT.TEXT,
65
- eventType: EVENT_TYPE.TRACK,
66
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_STRONG,
67
- attributes: {
68
- inputMethod: inputMethod
69
- }
70
- })(toggleStrong());
71
- };
72
- };
73
- export var toggleUnderline = function toggleUnderline() {
74
- return function (state, dispatch) {
75
- var underline = state.schema.marks.underline;
76
- if (underline) {
77
- return toggleMark(underline)(state, dispatch);
78
- }
79
- return false;
80
- };
81
- };
82
- export var toggleUnderlineWithAnalytics = function toggleUnderlineWithAnalytics(editorAnalyticsAPI) {
83
- return function (_ref4) {
84
- var inputMethod = _ref4.inputMethod;
85
- return withAnalytics(editorAnalyticsAPI, {
86
- action: ACTION.FORMATTED,
87
- actionSubject: ACTION_SUBJECT.TEXT,
88
- eventType: EVENT_TYPE.TRACK,
89
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
90
- attributes: {
91
- inputMethod: inputMethod
92
- }
93
- })(toggleUnderline());
94
- };
95
- };
96
- export var toggleSuperscript = function toggleSuperscript() {
97
- return function (state, dispatch) {
98
- var subsup = state.schema.marks.subsup;
99
- if (subsup) {
100
- return toggleMark(subsup, {
101
- type: 'sup'
102
- })(state, dispatch);
103
- }
104
- return false;
105
- };
106
- };
107
- export var toggleSuperscriptWithAnalytics = function toggleSuperscriptWithAnalytics(editorAnalyticsAPI) {
108
- return function (_ref5) {
109
- var inputMethod = _ref5.inputMethod;
110
- return withAnalytics(editorAnalyticsAPI, {
111
- action: ACTION.FORMATTED,
112
- actionSubject: ACTION_SUBJECT.TEXT,
113
- eventType: EVENT_TYPE.TRACK,
114
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUPER,
115
- attributes: {
116
- inputMethod: inputMethod
117
- }
118
- })(toggleSuperscript());
119
- };
120
- };
121
- export var toggleSubscript = function toggleSubscript() {
122
- return function (state, dispatch) {
123
- var subsup = state.schema.marks.subsup;
124
- if (subsup) {
125
- return toggleMark(subsup, {
126
- type: 'sub'
127
- })(state, dispatch);
128
- }
129
- return false;
130
- };
131
- };
132
- export var toggleSubscriptWithAnalytics = function toggleSubscriptWithAnalytics(editorAnalyticsAPI) {
133
- return function (_ref6) {
134
- var inputMethod = _ref6.inputMethod;
135
- return withAnalytics(editorAnalyticsAPI, {
136
- action: ACTION.FORMATTED,
137
- actionSubject: ACTION_SUBJECT.TEXT,
138
- eventType: EVENT_TYPE.TRACK,
139
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_SUB,
140
- attributes: {
141
- inputMethod: inputMethod
142
- }
143
- })(toggleSubscript());
144
- };
145
- };
146
- export var toggleCode = function toggleCode() {
147
- return function (state, dispatch) {
148
- var code = state.schema.marks.code;
149
- if (code) {
150
- return toggleMark(code)(state, dispatch);
151
- }
152
- return false;
153
- };
154
- };
155
- export var toggleCodeWithAnalytics = function toggleCodeWithAnalytics(editorAnalyticsAPI) {
156
- return function (_ref7) {
157
- var inputMethod = _ref7.inputMethod;
158
- return withAnalytics(editorAnalyticsAPI, {
159
- action: ACTION.FORMATTED,
160
- actionSubject: ACTION_SUBJECT.TEXT,
161
- eventType: EVENT_TYPE.TRACK,
162
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
163
- attributes: {
164
- inputMethod: inputMethod
165
- }
166
- })(toggleCode());
167
- };
168
- };
@@ -1,101 +0,0 @@
1
- import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
2
- import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
- import { cellSelectionNodesBetween } from '../utils/cell-selection';
5
- export var FORMATTING_NODE_TYPES = ['heading', 'blockquote'];
6
- export var FORMATTING_MARK_TYPES = ['em', 'code', 'strike', 'strong', 'underline', 'textColor', 'subsup'];
7
- var formatTypes = {
8
- em: ACTION_SUBJECT_ID.FORMAT_ITALIC,
9
- code: ACTION_SUBJECT_ID.FORMAT_CODE,
10
- strike: ACTION_SUBJECT_ID.FORMAT_STRIKE,
11
- strong: ACTION_SUBJECT_ID.FORMAT_STRONG,
12
- underline: ACTION_SUBJECT_ID.FORMAT_UNDERLINE,
13
- textColor: ACTION_SUBJECT_ID.FORMAT_COLOR,
14
- subsup: 'subsup'
15
- };
16
- export function clearFormattingWithAnalytics(inputMethod, editorAnalyticsAPI) {
17
- return clearFormatting(inputMethod, editorAnalyticsAPI);
18
- }
19
- function clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName, formattingCleared) {
20
- return function (node, pos) {
21
- if (node.type === formattedNodeType) {
22
- if (formattedNodeType.isTextblock) {
23
- tr.setNodeMarkup(pos, state.schema.nodes.paragraph);
24
- formattingCleared.push(nodeName);
25
- return false;
26
- } else {
27
- // In case of panel or blockquote
28
- var fromPos = tr.doc.resolve(pos + 1);
29
- var toPos = tr.doc.resolve(pos + node.nodeSize - 1);
30
- var nodeRange = fromPos.blockRange(toPos);
31
- if (nodeRange) {
32
- var targetLiftDepth = liftTarget(nodeRange);
33
- if (targetLiftDepth || targetLiftDepth === 0) {
34
- formattingCleared.push(nodeName);
35
- tr.lift(nodeRange, targetLiftDepth);
36
- }
37
- }
38
- }
39
- }
40
- return true;
41
- };
42
- }
43
- export function clearFormatting(inputMethod, editorAnalyticsAPI) {
44
- return function (state, dispatch) {
45
- var tr = state.tr;
46
- var formattingCleared = [];
47
- FORMATTING_MARK_TYPES.forEach(function (mark) {
48
- var _tr$selection = tr.selection,
49
- from = _tr$selection.from,
50
- to = _tr$selection.to;
51
- var markType = state.schema.marks[mark];
52
- if (!markType) {
53
- return;
54
- }
55
- if (tr.selection instanceof CellSelection) {
56
- cellSelectionNodesBetween(tr.selection, tr.doc, function (node, pos) {
57
- var isTableCell = node.type === state.schema.nodes.tableCell || node.type === state.schema.nodes.tableHeader;
58
- if (!isTableCell) {
59
- return true;
60
- }
61
- if (tr.doc.rangeHasMark(pos, pos + node.nodeSize, markType)) {
62
- formattingCleared.push(formatTypes[mark]);
63
- tr.removeMark(pos, pos + node.nodeSize, markType);
64
- }
65
- return false;
66
- });
67
- } else if (tr.doc.rangeHasMark(from, to, markType)) {
68
- formattingCleared.push(formatTypes[mark]);
69
- tr.removeMark(from, to, markType);
70
- }
71
- });
72
- FORMATTING_NODE_TYPES.forEach(function (nodeName) {
73
- var formattedNodeType = state.schema.nodes[nodeName];
74
- var _tr$selection2 = tr.selection,
75
- $from = _tr$selection2.$from,
76
- $to = _tr$selection2.$to;
77
- if (tr.selection instanceof CellSelection) {
78
- cellSelectionNodesBetween(tr.selection, tr.doc, clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName, formattingCleared));
79
- } else {
80
- tr.doc.nodesBetween($from.pos, $to.pos, clearNodeFormattingOnSelection(state, tr, formattedNodeType, nodeName, formattingCleared));
81
- }
82
- });
83
- tr.setStoredMarks([]);
84
- if (formattingCleared.length && inputMethod) {
85
- editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
86
- action: ACTION.FORMATTED,
87
- eventType: EVENT_TYPE.TRACK,
88
- actionSubject: ACTION_SUBJECT.TEXT,
89
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CLEAR,
90
- attributes: {
91
- inputMethod: inputMethod,
92
- formattingCleared: formattingCleared
93
- }
94
- })(tr);
95
- }
96
- if (dispatch) {
97
- dispatch(tr);
98
- }
99
- return true;
100
- };
101
- }
@@ -1,134 +0,0 @@
1
- import { Selection } from '@atlaskit/editor-prosemirror/state';
2
- import { applyMarkOnRange } from '@atlaskit/editor-common/mark';
3
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { hasCode, markActive } from '../utils';
5
- import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
6
- export var moveRight = function moveRight() {
7
- return function (state, dispatch) {
8
- var code = state.schema.marks.code;
9
- var _ref = state.selection,
10
- empty = _ref.empty,
11
- $cursor = _ref.$cursor;
12
- if (!empty || !$cursor) {
13
- return false;
14
- }
15
- var storedMarks = state.tr.storedMarks;
16
- if (code) {
17
- var insideCode = markActive(state, code.create());
18
- var currentPosHasCode = state.doc.rangeHasMark($cursor.pos, $cursor.pos, code);
19
- var nextPosHasCode = state.doc.rangeHasMark($cursor.pos, $cursor.pos + 1, code);
20
- var exitingCode = !currentPosHasCode && !nextPosHasCode && (!storedMarks || !!storedMarks.length);
21
- var enteringCode = !currentPosHasCode && nextPosHasCode && (!storedMarks || !storedMarks.length);
22
-
23
- // entering code mark (from the left edge): don't move the cursor, just add the mark
24
- if (!insideCode && enteringCode) {
25
- if (dispatch) {
26
- dispatch(state.tr.addStoredMark(code.create()));
27
- }
28
- return true;
29
- }
30
-
31
- // exiting code mark: don't move the cursor, just remove the mark
32
- if (insideCode && exitingCode) {
33
- if (dispatch) {
34
- dispatch(state.tr.removeStoredMark(code));
35
- }
36
- return true;
37
- }
38
- }
39
- return false;
40
- };
41
- };
42
- export var moveLeft = function moveLeft() {
43
- return function (state, dispatch) {
44
- var code = state.schema.marks.code;
45
- var _ref2 = state.selection,
46
- empty = _ref2.empty,
47
- $cursor = _ref2.$cursor;
48
- if (!empty || !$cursor) {
49
- return false;
50
- }
51
- var storedMarks = state.tr.storedMarks;
52
- if (code) {
53
- var insideCode = code && markActive(state, code.create());
54
- var currentPosHasCode = hasCode(state, $cursor.pos);
55
- var nextPosHasCode = hasCode(state, $cursor.pos - 1);
56
- var nextNextPosHasCode = hasCode(state, $cursor.pos - 2);
57
- var exitingCode = currentPosHasCode && !nextPosHasCode && Array.isArray(storedMarks);
58
- var atLeftEdge = nextPosHasCode && !nextNextPosHasCode && (storedMarks === null || Array.isArray(storedMarks) && !!storedMarks.length);
59
- var atRightEdge = (exitingCode && Array.isArray(storedMarks) && !storedMarks.length || !exitingCode && storedMarks === null) && !nextPosHasCode && nextNextPosHasCode;
60
- var enteringCode = !currentPosHasCode && nextPosHasCode && Array.isArray(storedMarks) && !storedMarks.length;
61
-
62
- // at the right edge: remove code mark and move the cursor to the left
63
- if (!insideCode && atRightEdge) {
64
- var tr = state.tr.setSelection(Selection.near(state.doc.resolve($cursor.pos - 1)));
65
- if (dispatch) {
66
- dispatch(tr.removeStoredMark(code));
67
- }
68
- return true;
69
- }
70
-
71
- // entering code mark (from right edge): don't move the cursor, just add the mark
72
- if (!insideCode && enteringCode) {
73
- if (dispatch) {
74
- dispatch(state.tr.addStoredMark(code.create()));
75
- }
76
- return true;
77
- }
78
-
79
- // at the left edge: add code mark and move the cursor to the left
80
- if (insideCode && atLeftEdge) {
81
- var _tr = state.tr.setSelection(Selection.near(state.doc.resolve($cursor.pos - 1)));
82
- if (dispatch) {
83
- dispatch(_tr.addStoredMark(code.create()));
84
- }
85
- return true;
86
- }
87
-
88
- // exiting code mark (or at the beginning of the line): don't move the cursor, just remove the mark
89
- var isFirstChild = $cursor.index($cursor.depth - 1) === 0;
90
- if (insideCode && (exitingCode || !$cursor.nodeBefore && isFirstChild)) {
91
- if (dispatch) {
92
- dispatch(state.tr.removeStoredMark(code));
93
- }
94
- return true;
95
- }
96
- }
97
- return false;
98
- };
99
- };
100
- var createInlineCodeFromTextInput = function createInlineCodeFromTextInput(from, to, text) {
101
- return function (state, dispatch) {
102
- if (state.selection.empty) {
103
- var _state$doc$resolve = state.doc.resolve(from),
104
- before = _state$doc$resolve.nodeBefore;
105
- var _state$doc$resolve2 = state.doc.resolve(to),
106
- after = _state$doc$resolve2.nodeAfter;
107
- var hasTickBefore = before && before.text && before.text.endsWith('`');
108
- var hasTickAfter = after && after.text && after.text.startsWith('`');
109
- if (hasTickBefore && hasTickAfter) {
110
- var tr = state.tr.replaceRangeWith(from - 1, to + 1, state.schema.text(text));
111
- if (dispatch) {
112
- var codeMark = state.schema.marks.code.create();
113
- tr = applyMarkOnRange(tr.mapping.map(from - 1), tr.mapping.map(to + 1), false, codeMark, tr).setStoredMarks([codeMark]);
114
- dispatch(tr);
115
- }
116
- return true;
117
- }
118
- }
119
- return false;
120
- };
121
- };
122
- export var createInlineCodeFromTextInputWithAnalytics = function createInlineCodeFromTextInputWithAnalytics(editorAnalyticsAPI) {
123
- return function (from, to, text) {
124
- return withAnalytics(editorAnalyticsAPI, {
125
- action: ACTION.FORMATTED,
126
- actionSubject: ACTION_SUBJECT.TEXT,
127
- eventType: EVENT_TYPE.TRACK,
128
- actionSubjectId: ACTION_SUBJECT_ID.FORMAT_CODE,
129
- attributes: {
130
- inputMethod: INPUT_METHOD.FORMATTING
131
- }
132
- })(createInlineCodeFromTextInput(from, to, text));
133
- };
134
- };
@@ -1,61 +0,0 @@
1
- import { filterChildrenBetween } from '@atlaskit/editor-common/mark';
2
- var SMART_TO_ASCII = {
3
- '…': '...',
4
- '→': '->',
5
- '←': '<-',
6
- '–': '--',
7
- '“': '"',
8
- '”': '"',
9
- '‘': "'",
10
- '’': "'"
11
- };
12
- var FIND_SMART_CHAR = new RegExp("[".concat(Object.keys(SMART_TO_ASCII).join(''), "]"), 'g');
13
- var replaceMentionOrEmojiForTextContent = function replaceMentionOrEmojiForTextContent(position, nodeSize, textContent, tr) {
14
- var currentPos = tr.mapping.map(position);
15
- var schema = tr.doc.type.schema;
16
- tr.replaceWith(currentPos, currentPos + nodeSize, schema.text(textContent));
17
- };
18
- var replaceSmartCharsToAscii = function replaceSmartCharsToAscii(position, textContent, tr) {
19
- var schema = tr.doc.type.schema;
20
- var match;
21
- while (match = FIND_SMART_CHAR.exec(textContent)) {
22
- var _match = match,
23
- smartChar = _match[0],
24
- offset = _match.index;
25
- var replacePos = tr.mapping.map(position + offset);
26
- var replacementText = schema.text(SMART_TO_ASCII[smartChar]);
27
- tr.replaceWith(replacePos, replacePos + smartChar.length, replacementText);
28
- }
29
- };
30
- var isNodeTextBlock = function isNodeTextBlock(schema) {
31
- var _schema$nodes = schema.nodes,
32
- mention = _schema$nodes.mention,
33
- text = _schema$nodes.text,
34
- emoji = _schema$nodes.emoji;
35
- return function (node, _, parent) {
36
- if (node.type === mention || node.type === emoji || node.type === text) {
37
- return parent === null || parent === void 0 ? void 0 : parent.isTextblock;
38
- }
39
- return;
40
- };
41
- };
42
- export var transformSmartCharsMentionsAndEmojis = function transformSmartCharsMentionsAndEmojis(from, to, tr) {
43
- var schema = tr.doc.type.schema;
44
- var _schema$nodes2 = schema.nodes,
45
- mention = _schema$nodes2.mention,
46
- text = _schema$nodes2.text,
47
- emoji = _schema$nodes2.emoji;
48
- // Traverse through all the nodes within the range and replace them with their plaintext counterpart
49
- var children = filterChildrenBetween(tr.doc, from, to, isNodeTextBlock(schema));
50
- children.forEach(function (_ref) {
51
- var node = _ref.node,
52
- pos = _ref.pos;
53
- if (node.type === mention || node.type === emoji) {
54
- replaceMentionOrEmojiForTextContent(pos, node.nodeSize, node.attrs.text, tr);
55
- } else if (node.type === text && node.text) {
56
- var replacePosition = pos > from ? pos : from;
57
- var textToReplace = pos > from ? node.text : node.text.substr(from - pos);
58
- replaceSmartCharsToAscii(replacePosition, textToReplace, tr);
59
- }
60
- });
61
- };
@@ -1,128 +0,0 @@
1
- import React from 'react';
2
- import { code, em, strike, strong, subsup, underline } from '@atlaskit/adf-schema';
3
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
4
- import { plugin as textFormattingPlugin, pluginKey as textFormattingPluginKey } from './pm-plugins/main';
5
- import { plugin as clearFormattingPlugin, pluginKey as clearFormattingPluginKey } from './pm-plugins/clear-formatting';
6
- import clearFormattingKeymapPlugin from './pm-plugins/clear-formatting-keymap';
7
- import textFormattingCursorPlugin from './pm-plugins/cursor';
8
- import textFormattingInputRulePlugin from './pm-plugins/input-rule';
9
- import keymapPlugin from './pm-plugins/keymap';
10
- import textFormattingSmartInputRulePlugin from './pm-plugins/smart-input-rule';
11
- import Toolbar from './ui/Toolbar';
12
- import { toggleSuperscriptWithAnalytics, toggleSubscriptWithAnalytics, toggleStrikeWithAnalytics, toggleCodeWithAnalytics, toggleUnderlineWithAnalytics, toggleEmWithAnalytics, toggleStrongWithAnalytics } from './actions';
13
- var textFormatting = function textFormatting() {
14
- var _api$dependencies$ana7, _api$dependencies$ana8, _api$dependencies$ana9, _api$dependencies$ana10, _api$dependencies$ana11, _api$dependencies$ana12, _api$dependencies$ana13;
15
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
16
- var api = arguments.length > 1 ? arguments[1] : undefined;
17
- return {
18
- name: 'textFormatting',
19
- marks: function marks() {
20
- return [{
21
- name: 'em',
22
- mark: em
23
- }, {
24
- name: 'strong',
25
- mark: strong
26
- }, {
27
- name: 'strike',
28
- mark: strike
29
- }].concat(options.disableCode ? [] : {
30
- name: 'code',
31
- mark: code
32
- }).concat(options.disableSuperscriptAndSubscript ? [] : {
33
- name: 'subsup',
34
- mark: subsup
35
- }).concat(options.disableUnderline ? [] : {
36
- name: 'underline',
37
- mark: underline
38
- });
39
- },
40
- pmPlugins: function pmPlugins() {
41
- return [{
42
- name: 'textFormatting',
43
- plugin: function plugin(_ref) {
44
- var _api$dependencies$ana;
45
- var dispatch = _ref.dispatch;
46
- return textFormattingPlugin(dispatch, 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);
47
- }
48
- }, {
49
- name: 'textFormattingCursor',
50
- plugin: function plugin() {
51
- return textFormattingCursorPlugin;
52
- }
53
- }, {
54
- name: 'textFormattingInputRule',
55
- // Don't remove the unused featureFlags, this gets used to test if we're properly passing them to the PM plugin
56
- plugin: function plugin(_ref2) {
57
- var _api$dependencies$ana2;
58
- var schema = _ref2.schema,
59
- featureFlags = _ref2.featureFlags;
60
- return textFormattingInputRulePlugin(schema, featureFlags, 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);
61
- }
62
- }, {
63
- name: 'textFormattingSmartRule',
64
- plugin: function plugin() {
65
- var _api$dependencies$ana3;
66
- return !options.disableSmartTextCompletion ? textFormattingSmartInputRulePlugin(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) : undefined;
67
- }
68
- }, {
69
- name: 'textFormattingClear',
70
- plugin: function plugin(_ref3) {
71
- var dispatch = _ref3.dispatch;
72
- return clearFormattingPlugin(dispatch);
73
- }
74
- }, {
75
- name: 'textFormattingClearKeymap',
76
- plugin: function plugin() {
77
- var _api$dependencies$ana4;
78
- return clearFormattingKeymapPlugin(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);
79
- }
80
- }, {
81
- name: 'textFormattingKeymap',
82
- plugin: function plugin(_ref4) {
83
- var _api$dependencies$ana5;
84
- var schema = _ref4.schema;
85
- return keymapPlugin(schema, 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);
86
- }
87
- }];
88
- },
89
- primaryToolbarComponent: function primaryToolbarComponent(_ref5) {
90
- var editorView = _ref5.editorView,
91
- popupsMountPoint = _ref5.popupsMountPoint,
92
- popupsScrollableElement = _ref5.popupsScrollableElement,
93
- isToolbarReducedSpacing = _ref5.isToolbarReducedSpacing,
94
- toolbarSize = _ref5.toolbarSize,
95
- disabled = _ref5.disabled;
96
- return /*#__PURE__*/React.createElement(WithPluginState, {
97
- plugins: {
98
- textFormattingState: textFormattingPluginKey,
99
- clearFormattingPluginState: clearFormattingPluginKey
100
- },
101
- render: function render() {
102
- var _api$dependencies$ana6;
103
- return /*#__PURE__*/React.createElement(Toolbar, {
104
- editorState: editorView.state,
105
- popupsMountPoint: popupsMountPoint,
106
- popupsScrollableElement: popupsScrollableElement,
107
- toolbarSize: toolbarSize,
108
- isReducedSpacing: isToolbarReducedSpacing,
109
- editorView: editorView,
110
- isToolbarDisabled: disabled,
111
- shouldUseResponsiveToolbar: Boolean(options.responsiveToolbarMenu),
112
- editorAnalyticsAPI: 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
113
- });
114
- }
115
- });
116
- },
117
- actions: {
118
- toggleSuperscript: toggleSuperscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana7 = api.dependencies.analytics) === null || _api$dependencies$ana7 === void 0 ? void 0 : _api$dependencies$ana7.actions),
119
- toggleSubscript: toggleSubscriptWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana8 = api.dependencies.analytics) === null || _api$dependencies$ana8 === void 0 ? void 0 : _api$dependencies$ana8.actions),
120
- toggleStrike: toggleStrikeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana9 = api.dependencies.analytics) === null || _api$dependencies$ana9 === void 0 ? void 0 : _api$dependencies$ana9.actions),
121
- toggleCode: toggleCodeWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana10 = api.dependencies.analytics) === null || _api$dependencies$ana10 === void 0 ? void 0 : _api$dependencies$ana10.actions),
122
- toggleUnderline: toggleUnderlineWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana11 = api.dependencies.analytics) === null || _api$dependencies$ana11 === void 0 ? void 0 : _api$dependencies$ana11.actions),
123
- toggleEm: toggleEmWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana12 = api.dependencies.analytics) === null || _api$dependencies$ana12 === void 0 ? void 0 : _api$dependencies$ana12.actions),
124
- toggleStrong: toggleStrongWithAnalytics(api === null || api === void 0 ? void 0 : (_api$dependencies$ana13 = api.dependencies.analytics) === null || _api$dependencies$ana13 === void 0 ? void 0 : _api$dependencies$ana13.actions)
125
- }
126
- };
127
- };
128
- export default textFormatting;
@@ -1,10 +0,0 @@
1
- import { keymap } from '@atlaskit/editor-prosemirror/keymap';
2
- import * as keymaps from '@atlaskit/editor-common/keymaps';
3
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { clearFormattingWithAnalytics } from '../commands/clear-formatting';
5
- export function keymapPlugin(editorAnalyticsAPI) {
6
- var list = {};
7
- keymaps.bindKeymapWithCommand(keymaps.clearFormatting.common, clearFormattingWithAnalytics(INPUT_METHOD.SHORTCUT, editorAnalyticsAPI), list);
8
- return keymap(list);
9
- }
10
- export default keymapPlugin;