@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`80b964e24a2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/80b964e24a2) - [ED-19205] Extract the text-formatting editor plugin to a separate package
8
+
9
+ ### Patch Changes
10
+
11
+ - [`8474692c96d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8474692c96d) - [ux] ED-18785 Place toolbar below selection if not sufficient space above
12
+ - Updated dependencies
13
+
14
+ ## 187.17.6
15
+
16
+ ### Patch Changes
17
+
18
+ - [`bdb69158e0a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bdb69158e0a) - [ED-13910] Bump ProseMirror libraries to match prosemirror-view@1.31.6 dependencies
19
+ - Updated dependencies
20
+
3
21
  ## 187.17.5
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,
@@ -50,24 +50,18 @@ var _default = function _default() {
50
50
  node.setAttribute('aria-hidden', 'true');
51
51
  node.appendChild(document.createTextNode(_utils.ZERO_WIDTH_SPACE));
52
52
  node.className = 'cursor-target';
53
- return _view.Decoration.widget(selection.from, node, {
53
+ var $from = selection.$from;
54
+ var rightPosition = $from.pos;
55
+ var leftPosition = $from.posAtIndex(Math.max($from.index() - 1, 0));
56
+ var widgetPos = side === 'left' ? leftPosition : rightPosition;
57
+ return _view.Decoration.widget(widgetPos, node, {
54
58
  raw: true,
55
- side: side === 'left' ? -1 : 1,
56
59
  key: 'inlineCursor'
57
60
  });
58
61
  };
59
62
 
60
- // Create editable decoration widgets either side of the cursor to allow
61
- // text input.
62
- // We check beforeInput events below to prevent content
63
- // being added to the decorations.
64
- //
65
- // This prevents issues with the cursor disappearing
66
- // or appearing in the wrong place when;
67
- // - positioned between inline nodes (chrome + firefox)
68
- // - positioned between the beginning of another node and an inline node (firefox)
69
- // - positioned between an inline node and the end of a node (chrome)
70
- if (!_utils.browser.safari && (hasInlineNodeViewAfter || isAtEndAndInlineNodeViewBefore) && (hasInlineNodeViewBefore || isAtStartAndInlineNodeViewAfter)) {
63
+ // Create editable decoration widgets around the current inline node to allow proper cursor navigation.
64
+ if ((hasInlineNodeViewAfter || isAtEndAndInlineNodeViewBefore) && (hasInlineNodeViewBefore || isAtStartAndInlineNodeViewAfter)) {
71
65
  return {
72
66
  cursorTarget: {
73
67
  decorations: [createWidget('left'), createWidget('right')],
@@ -78,34 +72,6 @@ var _default = function _default() {
78
72
  }
79
73
  };
80
74
  }
81
-
82
- // Only create one widget on the left or right of the cursor in Safari.
83
- // This is to prevent the left key from being blocked when at the start of a paragraph,
84
- // and the right key from being blocked when at the end of a paragraph. This also
85
- // improves click and drag selections, making it easier to select the first node.
86
- if (_utils.browser.safari) {
87
- if (isAtEndAndInlineNodeViewBefore || hasInlineNodeViewBefore && hasInlineNodeViewAfter) {
88
- return {
89
- cursorTarget: {
90
- decorations: [createWidget('left')],
91
- positions: {
92
- from: $from.pos,
93
- to: $to.pos
94
- }
95
- }
96
- };
97
- } else if (isAtStartAndInlineNodeViewAfter) {
98
- return {
99
- cursorTarget: {
100
- decorations: [createWidget('right')],
101
- positions: {
102
- from: $from.pos,
103
- to: $to.pos
104
- }
105
- }
106
- };
107
- }
108
- }
109
75
  }
110
76
  return {
111
77
  cursorTarget: undefined
@@ -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"));
@@ -15,9 +15,6 @@ var serializePlaceholderNode = function serializePlaceholderNode(node) {
15
15
 
16
16
  // the inline node api test suite requires the following class name
17
17
  element.classList.add('placeholderView-content-wrap');
18
- if (_utils.browser.gecko) {
19
- element.setAttribute('contenteditable', 'true');
20
- }
21
18
  element.innerText = _utils.ZERO_WIDTH_SPACE;
22
19
  var elementChildren = document.createElement('span');
23
20
  elementChildren.classList.add('pm-placeholder__text');
@@ -94,24 +94,38 @@ var plugin = new _safePlugin.SafePlugin({
94
94
  }
95
95
  return null;
96
96
  },
97
- // there's no space between top level nodes and the wrapping ProseMirror contenteditable area and handleClick won't capture clicks, there's nothing to click on
98
- // it handles only attempts to set gap cursor for nested nodes, where we have space between parent and child nodes
99
- // top level nodes are handled by <ClickAreaBlock>
100
- handleClick: function handleClick(view, position, event) {
97
+ handleClick: function handleClick(view, nodePos, event) {
98
+ var _$pos$parent;
101
99
  var posAtCoords = view.posAtCoords({
102
100
  left: event.clientX,
103
101
  top: event.clientY
104
102
  });
105
-
106
- // this helps to ignore all of the clicks outside of the parent (e.g. nodeView controls)
107
- if (posAtCoords && posAtCoords.inside !== position && !(0, _utils2.isIgnoredClick)(event.target)) {
108
- // max available space between parent and child from the left side in px
109
- // this ensures the correct side of the gap cursor in case of clicking in between two block nodes
110
- var leftSideOffsetX = 20;
111
- var side = event.offsetX > leftSideOffsetX ? _selection.Side.RIGHT : _selection.Side.LEFT;
112
- return (0, _actions.setGapCursorAtPos)(position, side)(view.state, view.dispatch);
103
+ if (!posAtCoords || (0, _utils2.isIgnoredClick)(event.target)) {
104
+ return false;
113
105
  }
114
- return false;
106
+ var isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
107
+ if (isInsideTheTarget) {
108
+ return false;
109
+ }
110
+ var leftSideOffsetX = 20;
111
+ var side = event.offsetX > leftSideOffsetX ? _selection.Side.RIGHT : _selection.Side.LEFT;
112
+ var $pos = view.state.doc.resolve(nodePos);
113
+ // In the new prosemirror-view posAtCoords is not returning a precise value for our media nodes
114
+ if (((_$pos$parent = $pos.parent) === null || _$pos$parent === void 0 ? void 0 : _$pos$parent.type.name) === 'mediaSingle') {
115
+ var $insidePos = view.state.doc.resolve(Math.max(posAtCoords.inside, 0));
116
+ // We don't have GapCursors problems when the node target is inside the root level
117
+ if ($insidePos.depth <= 1) {
118
+ return false;
119
+ }
120
+ var mediaGapCursor = !$pos.nodeBefore ? $pos.before() : $pos.after();
121
+ return (0, _actions.setGapCursorAtPos)(mediaGapCursor, side)(view.state, view.dispatch);
122
+ }
123
+ var docSize = view.state.doc.content.size;
124
+ var nodeInside = posAtCoords.inside <= 0 || posAtCoords.inside > docSize ? null : view.state.doc.nodeAt(posAtCoords.inside);
125
+ if (nodeInside !== null && nodeInside !== void 0 && nodeInside.isAtom) {
126
+ return false;
127
+ }
128
+ return (0, _actions.setGapCursorAtPos)(nodePos, side)(view.state, view.dispatch);
115
129
  },
116
130
  handleDOMEvents: {
117
131
  /**
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.17.5";
9
+ var version = "187.18.0";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.17.5",
3
+ "version": "187.18.0",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import pastePlugin from '../../../plugins/paste';
4
4
  import blockTypePlugin from '../../../plugins/block-type';
5
5
  import clearMarksOnChangeToEmptyDocumentPlugin from '../../../plugins/clear-marks-on-change-to-empty-document';
6
6
  import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
- import textFormattingPlugin from '../../../plugins/text-formatting';
7
+ import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
8
8
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
9
9
  import unsupportedContentPlugin from '../../../plugins/unsupported-content';
10
10
  import basePlugin from '../../../plugins/base';
@@ -24,6 +24,15 @@ export const annotationMessages = defineMessages({
24
24
  description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
25
25
  }
26
26
  });
27
+ /**
28
+ * Returns the coordintes at the bottom the selection.
29
+ */
30
+ const getCoordsBelowSelection = (bottomCoords, toolbarRect) => {
31
+ return {
32
+ top: (bottomCoords.top || 0) + toolbarRect.height / 1.15,
33
+ left: bottomCoords.right - toolbarRect.width / 2
34
+ };
35
+ };
27
36
 
28
37
  /*
29
38
  Calculates the position of the floating toolbar relative to the selection.
@@ -61,7 +70,7 @@ const calculateToolbarPositionAboveSelection = toolbarTitle => (editorView, next
61
70
  } = editorView.state.selection;
62
71
  const topCoords = editorView.coordsAtPos(Math.min(head, anchor));
63
72
  const bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
64
- const top = (topCoords.top || 0) - toolbarRect.height * 1.5;
73
+ let top = (topCoords.top || 0) - toolbarRect.height * 1.5;
65
74
  let left = 0;
66
75
 
67
76
  // If not on the same line
@@ -74,13 +83,13 @@ const calculateToolbarPositionAboveSelection = toolbarTitle => (editorView, next
74
83
  }
75
84
 
76
85
  /*
77
- short selection above a long paragraph
78
- eg. short {<}heading
79
- The purpose of this text is to show the selection range{>}.
80
- The horizontal positioning should center around "heading",
81
- not where it ends at "range".
82
- Note: if it was "head<b>ing</b>" then it would only center
83
- around "head". Undesireable but matches the current renderer.
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.
84
93
  */
85
94
  const cliffPosition = range.getClientRects()[0];
86
95
  if (cliffPosition.right < left) {
@@ -92,6 +101,14 @@ const calculateToolbarPositionAboveSelection = toolbarTitle => (editorView, next
92
101
  }
93
102
  left -= toolbarRect.width / 2;
94
103
 
104
+ // Place toolbar below selection if not sufficient space above
105
+ if (top < wrapperBounds.top) {
106
+ ({
107
+ top,
108
+ left
109
+ } = getCoordsBelowSelection(bottomCoords, toolbarRect));
110
+ }
111
+
95
112
  // remap positions from browser document to wrapperBounds
96
113
  return {
97
114
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
@@ -144,7 +161,15 @@ const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, nextPos)
144
161
  } else {
145
162
  top = (topCoords.top || 0) - toolbarRect.height * 1.5;
146
163
  }
147
- const left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
164
+ let left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
165
+
166
+ // Place toolbar below selection if not sufficient space above
167
+ if (top < wrapperBounds.top) {
168
+ ({
169
+ top,
170
+ left
171
+ } = getCoordsBelowSelection(bottomCoords, toolbarRect));
172
+ }
148
173
 
149
174
  // remap positions from browser document to wrapperBounds
150
175
  return {
@@ -44,24 +44,20 @@ export default (() => {
44
44
  node.setAttribute('aria-hidden', 'true');
45
45
  node.appendChild(document.createTextNode(ZERO_WIDTH_SPACE));
46
46
  node.className = 'cursor-target';
47
- return Decoration.widget(selection.from, node, {
47
+ const {
48
+ $from
49
+ } = selection;
50
+ const rightPosition = $from.pos;
51
+ const leftPosition = $from.posAtIndex(Math.max($from.index() - 1, 0));
52
+ const widgetPos = side === 'left' ? leftPosition : rightPosition;
53
+ return Decoration.widget(widgetPos, node, {
48
54
  raw: true,
49
- side: side === 'left' ? -1 : 1,
50
55
  key: 'inlineCursor'
51
56
  });
52
57
  };
53
58
 
54
- // Create editable decoration widgets either side of the cursor to allow
55
- // text input.
56
- // We check beforeInput events below to prevent content
57
- // being added to the decorations.
58
- //
59
- // This prevents issues with the cursor disappearing
60
- // or appearing in the wrong place when;
61
- // - positioned between inline nodes (chrome + firefox)
62
- // - positioned between the beginning of another node and an inline node (firefox)
63
- // - positioned between an inline node and the end of a node (chrome)
64
- if (!browser.safari && (hasInlineNodeViewAfter || isAtEndAndInlineNodeViewBefore) && (hasInlineNodeViewBefore || isAtStartAndInlineNodeViewAfter)) {
59
+ // Create editable decoration widgets around the current inline node to allow proper cursor navigation.
60
+ if ((hasInlineNodeViewAfter || isAtEndAndInlineNodeViewBefore) && (hasInlineNodeViewBefore || isAtStartAndInlineNodeViewAfter)) {
65
61
  return {
66
62
  cursorTarget: {
67
63
  decorations: [createWidget('left'), createWidget('right')],
@@ -72,34 +68,6 @@ export default (() => {
72
68
  }
73
69
  };
74
70
  }
75
-
76
- // Only create one widget on the left or right of the cursor in Safari.
77
- // This is to prevent the left key from being blocked when at the start of a paragraph,
78
- // and the right key from being blocked when at the end of a paragraph. This also
79
- // improves click and drag selections, making it easier to select the first node.
80
- if (browser.safari) {
81
- if (isAtEndAndInlineNodeViewBefore || hasInlineNodeViewBefore && hasInlineNodeViewAfter) {
82
- return {
83
- cursorTarget: {
84
- decorations: [createWidget('left')],
85
- positions: {
86
- from: $from.pos,
87
- to: $to.pos
88
- }
89
- }
90
- };
91
- } else if (isAtStartAndInlineNodeViewAfter) {
92
- return {
93
- cursorTarget: {
94
- decorations: [createWidget('right')],
95
- positions: {
96
- from: $from.pos,
97
- to: $to.pos
98
- }
99
- }
100
- };
101
- }
102
- }
103
71
  }
104
72
  return {
105
73
  cursorTarget: undefined
@@ -30,7 +30,6 @@ export { default as saveOnEnterPlugin } from './save-on-enter';
30
30
  export { default as submitEditorPlugin } from './submit-editor';
31
31
  export { default as tasksAndDecisionsPlugin } from './tasks-and-decisions';
32
32
  export { default as textColorPlugin } from './text-color';
33
- export { default as textFormattingPlugin } from './text-formatting';
34
33
  export { default as typeAheadPlugin } from './type-ahead';
35
34
  export { default as unsupportedContentPlugin } from './unsupported-content';
36
35
  export { default as floatingToolbarPlugin } from './floating-toolbar';
@@ -6,9 +6,6 @@ const serializePlaceholderNode = node => {
6
6
 
7
7
  // the inline node api test suite requires the following class name
8
8
  element.classList.add('placeholderView-content-wrap');
9
- if (browser.gecko) {
10
- element.setAttribute('contenteditable', 'true');
11
- }
12
9
  element.innerText = ZERO_WIDTH_SPACE;
13
10
  const elementChildren = document.createElement('span');
14
11
  elementChildren.classList.add('pm-placeholder__text');
@@ -89,24 +89,38 @@ const plugin = new SafePlugin({
89
89
  }
90
90
  return null;
91
91
  },
92
- // there's no space between top level nodes and the wrapping ProseMirror contenteditable area and handleClick won't capture clicks, there's nothing to click on
93
- // it handles only attempts to set gap cursor for nested nodes, where we have space between parent and child nodes
94
- // top level nodes are handled by <ClickAreaBlock>
95
- handleClick(view, position, event) {
92
+ handleClick(view, nodePos, event) {
93
+ var _$pos$parent;
96
94
  const posAtCoords = view.posAtCoords({
97
95
  left: event.clientX,
98
96
  top: event.clientY
99
97
  });
100
-
101
- // this helps to ignore all of the clicks outside of the parent (e.g. nodeView controls)
102
- if (posAtCoords && posAtCoords.inside !== position && !isIgnoredClick(event.target)) {
103
- // max available space between parent and child from the left side in px
104
- // this ensures the correct side of the gap cursor in case of clicking in between two block nodes
105
- const leftSideOffsetX = 20;
106
- const side = event.offsetX > leftSideOffsetX ? Side.RIGHT : Side.LEFT;
107
- return setGapCursorAtPos(position, side)(view.state, view.dispatch);
98
+ if (!posAtCoords || isIgnoredClick(event.target)) {
99
+ return false;
100
+ }
101
+ const isInsideTheTarget = posAtCoords.pos === posAtCoords.inside;
102
+ if (isInsideTheTarget) {
103
+ return false;
104
+ }
105
+ const leftSideOffsetX = 20;
106
+ const side = event.offsetX > leftSideOffsetX ? Side.RIGHT : Side.LEFT;
107
+ const $pos = view.state.doc.resolve(nodePos);
108
+ // In the new prosemirror-view posAtCoords is not returning a precise value for our media nodes
109
+ if (((_$pos$parent = $pos.parent) === null || _$pos$parent === void 0 ? void 0 : _$pos$parent.type.name) === 'mediaSingle') {
110
+ const $insidePos = view.state.doc.resolve(Math.max(posAtCoords.inside, 0));
111
+ // We don't have GapCursors problems when the node target is inside the root level
112
+ if ($insidePos.depth <= 1) {
113
+ return false;
114
+ }
115
+ const mediaGapCursor = !$pos.nodeBefore ? $pos.before() : $pos.after();
116
+ return setGapCursorAtPos(mediaGapCursor, side)(view.state, view.dispatch);
117
+ }
118
+ const docSize = view.state.doc.content.size;
119
+ const nodeInside = posAtCoords.inside <= 0 || posAtCoords.inside > docSize ? null : view.state.doc.nodeAt(posAtCoords.inside);
120
+ if (nodeInside !== null && nodeInside !== void 0 && nodeInside.isAtom) {
121
+ return false;
108
122
  }
109
- return false;
123
+ return setGapCursorAtPos(nodePos, side)(view.state, view.dispatch);
110
124
  },
111
125
  handleDOMEvents: {
112
126
  /**
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.17.5";
2
+ export const version = "187.18.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.17.5",
3
+ "version": "187.18.0",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import pastePlugin from '../../../plugins/paste';
4
4
  import blockTypePlugin from '../../../plugins/block-type';
5
5
  import clearMarksOnChangeToEmptyDocumentPlugin from '../../../plugins/clear-marks-on-change-to-empty-document';
6
6
  import { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
- import textFormattingPlugin from '../../../plugins/text-formatting';
7
+ import { textFormattingPlugin } from '@atlaskit/editor-plugin-text-formatting';
8
8
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
9
9
  import unsupportedContentPlugin from '../../../plugins/unsupported-content';
10
10
  import basePlugin from '../../../plugins/base';
@@ -24,6 +24,15 @@ export var annotationMessages = defineMessages({
24
24
  description: 'A label for a toolbar (UI element) that creates annotations/comments in the document'
25
25
  }
26
26
  });
27
+ /**
28
+ * Returns the coordintes at the bottom the selection.
29
+ */
30
+ var getCoordsBelowSelection = function getCoordsBelowSelection(bottomCoords, toolbarRect) {
31
+ return {
32
+ top: (bottomCoords.top || 0) + toolbarRect.height / 1.15,
33
+ left: bottomCoords.right - toolbarRect.width / 2
34
+ };
35
+ };
27
36
 
28
37
  /*
29
38
  Calculates the position of the floating toolbar relative to the selection.
@@ -74,13 +83,13 @@ var calculateToolbarPositionAboveSelection = function calculateToolbarPositionAb
74
83
  }
75
84
 
76
85
  /*
77
- short selection above a long paragraph
78
- eg. short {<}heading
79
- The purpose of this text is to show the selection range{>}.
80
- The horizontal positioning should center around "heading",
81
- not where it ends at "range".
82
- Note: if it was "head<b>ing</b>" then it would only center
83
- around "head". Undesireable but matches the current renderer.
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.
84
93
  */
85
94
  var cliffPosition = range.getClientRects()[0];
86
95
  if (cliffPosition.right < left) {
@@ -92,6 +101,13 @@ var calculateToolbarPositionAboveSelection = function calculateToolbarPositionAb
92
101
  }
93
102
  left -= toolbarRect.width / 2;
94
103
 
104
+ // Place toolbar below selection if not sufficient space above
105
+ if (top < wrapperBounds.top) {
106
+ var _getCoordsBelowSelect = getCoordsBelowSelection(bottomCoords, toolbarRect);
107
+ top = _getCoordsBelowSelect.top;
108
+ left = _getCoordsBelowSelect.left;
109
+ }
110
+
95
111
  // remap positions from browser document to wrapperBounds
96
112
  return {
97
113
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,
@@ -147,6 +163,13 @@ var calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHe
147
163
  }
148
164
  var left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
149
165
 
166
+ // Place toolbar below selection if not sufficient space above
167
+ if (top < wrapperBounds.top) {
168
+ var _getCoordsBelowSelect2 = getCoordsBelowSelection(bottomCoords, toolbarRect);
169
+ top = _getCoordsBelowSelect2.top;
170
+ left = _getCoordsBelowSelect2.left;
171
+ }
172
+
150
173
  // remap positions from browser document to wrapperBounds
151
174
  return {
152
175
  top: top - wrapperBounds.top + scrollWrapper.scrollTop,