@atlaskit/editor-common 69.2.2 → 69.3.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 (469) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/analytics/package.json +8 -0
  3. package/core-utils/package.json +8 -0
  4. package/dist/cjs/analytics/api.js +5 -0
  5. package/dist/cjs/analytics/index.js +223 -0
  6. package/dist/cjs/analytics/types/avatar.js +5 -0
  7. package/dist/cjs/analytics/types/block.js +5 -0
  8. package/dist/cjs/analytics/types/config-panel-events.js +5 -0
  9. package/dist/cjs/analytics/types/cut-copy-events.js +5 -0
  10. package/dist/cjs/analytics/types/date-events.js +5 -0
  11. package/dist/cjs/analytics/types/dispatch-analytics-event.js +5 -0
  12. package/dist/cjs/analytics/types/element-browser-events.js +5 -0
  13. package/dist/cjs/analytics/types/enums.js +350 -0
  14. package/dist/cjs/analytics/types/events.js +5 -0
  15. package/dist/cjs/analytics/types/experimental-events.js +5 -0
  16. package/dist/cjs/analytics/types/extension-events.js +22 -0
  17. package/dist/cjs/analytics/types/find-replace-events.js +5 -0
  18. package/dist/cjs/analytics/types/format-events.js +24 -0
  19. package/dist/cjs/analytics/types/general-events.js +40 -0
  20. package/dist/cjs/analytics/types/index.js +249 -0
  21. package/dist/cjs/analytics/types/inline-comment-events.js +14 -0
  22. package/dist/cjs/analytics/types/insert-events.js +51 -0
  23. package/dist/cjs/analytics/types/link-tool-bar-events.js +5 -0
  24. package/dist/cjs/analytics/types/list-events.js +25 -0
  25. package/dist/cjs/analytics/types/media-events.js +5 -0
  26. package/dist/cjs/analytics/types/node-events.js +26 -0
  27. package/dist/cjs/analytics/types/paste-events.js +55 -0
  28. package/dist/cjs/analytics/types/performance-report.js +5 -0
  29. package/dist/cjs/analytics/types/selection-events.js +5 -0
  30. package/dist/cjs/analytics/types/smart-links.js +19 -0
  31. package/dist/cjs/analytics/types/substitute-events.js +24 -0
  32. package/dist/cjs/analytics/types/table-events.js +43 -0
  33. package/dist/cjs/analytics/types/toolbar-button.js +26 -0
  34. package/dist/cjs/analytics/types/type-ahead.js +5 -0
  35. package/dist/cjs/analytics/types/utils.js +28 -0
  36. package/dist/cjs/core-utils/index.js +13 -0
  37. package/dist/cjs/core-utils/inside.js +17 -0
  38. package/dist/cjs/event-dispatcher/index.js +88 -0
  39. package/dist/cjs/keymaps/consts.js +30 -0
  40. package/dist/cjs/keymaps/index.js +362 -0
  41. package/dist/cjs/messages/index.js +137 -1
  42. package/dist/cjs/messages/insert-block.js +177 -0
  43. package/dist/cjs/node-width/index.js +85 -0
  44. package/dist/cjs/react-node-view/index.js +252 -0
  45. package/dist/cjs/react-node-view/types.js +5 -0
  46. package/dist/cjs/selection/gap-cursor/selection.js +196 -0
  47. package/dist/cjs/selection/gap-cursor/utils/index.js +21 -0
  48. package/dist/cjs/selection/gap-cursor/utils/is-ignored.js +14 -0
  49. package/dist/cjs/selection/gap-cursor/utils/is-valid-target-node.js +14 -0
  50. package/dist/cjs/selection/index.js +67 -0
  51. package/dist/cjs/selection/types.js +15 -0
  52. package/dist/cjs/selection/utils.js +50 -0
  53. package/dist/cjs/styles/index.js +29 -1
  54. package/dist/cjs/styles/shared/extension.js +13 -0
  55. package/dist/cjs/styles/shared/layout.js +13 -0
  56. package/dist/cjs/styles/shared/table.js +3 -1
  57. package/dist/cjs/transforms/expand.js +52 -0
  58. package/dist/cjs/transforms/extension.js +34 -0
  59. package/dist/cjs/transforms/index.js +59 -0
  60. package/dist/cjs/transforms/layout.js +72 -0
  61. package/dist/cjs/types/command.js +5 -0
  62. package/dist/cjs/types/context-panel.js +5 -0
  63. package/dist/cjs/types/editor-actions.js +5 -0
  64. package/dist/cjs/types/editor-appearance.js +5 -0
  65. package/dist/cjs/types/editor-container-width.js +5 -0
  66. package/dist/cjs/types/editor-plugin.js +5 -0
  67. package/dist/cjs/types/editor-react-context.js +5 -0
  68. package/dist/cjs/types/empty-state-handler.js +5 -0
  69. package/dist/cjs/types/feature-flags.js +5 -0
  70. package/dist/cjs/types/floating-toolbar.js +5 -0
  71. package/dist/cjs/types/index.js +20 -0
  72. package/dist/cjs/types/plugin-factory.js +5 -0
  73. package/dist/cjs/types/prosemirror-config.js +5 -0
  74. package/dist/cjs/types/quick-insert.js +5 -0
  75. package/dist/cjs/types/supported-browsers.js +6 -0
  76. package/dist/cjs/types/toolbar.js +39 -0
  77. package/dist/cjs/types/ui-components.js +5 -0
  78. package/dist/cjs/ui/DropList/index.js +217 -0
  79. package/dist/cjs/ui/ErrorBoundary/index.js +100 -0
  80. package/dist/cjs/ui/Layer/index.js +245 -0
  81. package/dist/cjs/ui/Layer/internal/helpers.js +70 -0
  82. package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +60 -0
  83. package/dist/cjs/ui/PortalProvider/index.js +294 -0
  84. package/dist/cjs/ui-color/ColorPalette/Color/index.js +115 -0
  85. package/dist/cjs/ui-color/ColorPalette/Color/styles.js +32 -0
  86. package/dist/cjs/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +30 -0
  87. package/dist/cjs/ui-color/ColorPalette/Palettes/common.js +37 -0
  88. package/dist/cjs/ui-color/ColorPalette/Palettes/getColorMessage.js +17 -0
  89. package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +13 -0
  90. package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessages.js +123 -0
  91. package/dist/cjs/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +164 -0
  92. package/dist/cjs/ui-color/ColorPalette/Palettes/statusColorPalette.js +72 -0
  93. package/dist/cjs/ui-color/ColorPalette/Palettes/textColorPalette.js +41 -0
  94. package/dist/cjs/ui-color/ColorPalette/Palettes/type.js +5 -0
  95. package/dist/cjs/ui-color/ColorPalette/index.js +90 -0
  96. package/dist/cjs/ui-color/ColorPalette/styles.js +19 -0
  97. package/dist/cjs/ui-color/index.js +89 -0
  98. package/dist/cjs/ui-menu/Dropdown/index.js +127 -0
  99. package/dist/cjs/ui-menu/DropdownMenu/index.js +294 -0
  100. package/dist/cjs/ui-menu/DropdownMenu/types.js +5 -0
  101. package/dist/cjs/ui-menu/ToolbarButton/index.js +127 -0
  102. package/dist/cjs/ui-menu/ToolbarButton/styles.js +26 -0
  103. package/dist/cjs/ui-menu/index.js +43 -0
  104. package/dist/cjs/ui-react/ReactEditorViewContext.js +15 -0
  105. package/dist/cjs/ui-react/index.js +23 -0
  106. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +159 -0
  107. package/dist/cjs/utils/dom.js +138 -0
  108. package/dist/cjs/utils/editor-core-utils.js +108 -0
  109. package/dist/cjs/utils/index.js +222 -0
  110. package/dist/cjs/utils/is-text-input.js +31 -0
  111. package/dist/cjs/utils/nodes.js +134 -0
  112. package/dist/cjs/utils/plugin-state-factory.js +113 -0
  113. package/dist/cjs/utils/slice.js +77 -0
  114. package/dist/cjs/version.json +1 -1
  115. package/dist/cjs/with-plugin-state/index.js +316 -0
  116. package/dist/cjs/with-plugin-state/types.js +5 -0
  117. package/dist/es2019/analytics/api.js +1 -0
  118. package/dist/es2019/analytics/index.js +1 -0
  119. package/dist/es2019/analytics/types/avatar.js +1 -0
  120. package/dist/es2019/analytics/types/block.js +1 -0
  121. package/dist/es2019/analytics/types/config-panel-events.js +1 -0
  122. package/dist/es2019/analytics/types/cut-copy-events.js +1 -0
  123. package/dist/es2019/analytics/types/date-events.js +1 -0
  124. package/dist/es2019/analytics/types/dispatch-analytics-event.js +1 -0
  125. package/dist/es2019/analytics/types/element-browser-events.js +1 -0
  126. package/dist/es2019/analytics/types/enums.js +336 -0
  127. package/dist/es2019/analytics/types/events.js +1 -0
  128. package/dist/es2019/analytics/types/experimental-events.js +1 -0
  129. package/dist/es2019/analytics/types/extension-events.js +13 -0
  130. package/dist/es2019/analytics/types/find-replace-events.js +1 -0
  131. package/dist/es2019/analytics/types/format-events.js +16 -0
  132. package/dist/es2019/analytics/types/general-events.js +30 -0
  133. package/dist/es2019/analytics/types/index.js +14 -0
  134. package/dist/es2019/analytics/types/inline-comment-events.js +7 -0
  135. package/dist/es2019/analytics/types/insert-events.js +41 -0
  136. package/dist/es2019/analytics/types/link-tool-bar-events.js +1 -0
  137. package/dist/es2019/analytics/types/list-events.js +17 -0
  138. package/dist/es2019/analytics/types/media-events.js +1 -0
  139. package/dist/es2019/analytics/types/node-events.js +18 -0
  140. package/dist/es2019/analytics/types/paste-events.js +46 -0
  141. package/dist/es2019/analytics/types/performance-report.js +1 -0
  142. package/dist/es2019/analytics/types/selection-events.js +1 -0
  143. package/dist/es2019/analytics/types/smart-links.js +12 -0
  144. package/dist/es2019/analytics/types/substitute-events.js +16 -0
  145. package/dist/es2019/analytics/types/table-events.js +34 -0
  146. package/dist/es2019/analytics/types/toolbar-button.js +19 -0
  147. package/dist/es2019/analytics/types/type-ahead.js +1 -0
  148. package/dist/es2019/analytics/types/utils.js +20 -0
  149. package/dist/es2019/core-utils/index.js +1 -0
  150. package/dist/es2019/core-utils/inside.js +8 -0
  151. package/dist/es2019/event-dispatcher/index.js +60 -0
  152. package/dist/es2019/keymaps/consts.js +12 -0
  153. package/dist/es2019/keymaps/index.js +186 -0
  154. package/dist/es2019/messages/index.js +125 -1
  155. package/dist/es2019/messages/insert-block.js +168 -0
  156. package/dist/es2019/node-width/index.js +74 -0
  157. package/dist/es2019/react-node-view/index.js +199 -0
  158. package/dist/es2019/react-node-view/types.js +1 -0
  159. package/dist/es2019/selection/gap-cursor/selection.js +136 -0
  160. package/dist/es2019/selection/gap-cursor/utils/index.js +2 -0
  161. package/dist/es2019/selection/gap-cursor/utils/is-ignored.js +5 -0
  162. package/dist/es2019/selection/gap-cursor/utils/is-valid-target-node.js +4 -0
  163. package/dist/es2019/selection/index.js +4 -0
  164. package/dist/es2019/selection/types.js +8 -0
  165. package/dist/es2019/selection/utils.js +38 -0
  166. package/dist/es2019/styles/index.js +3 -1
  167. package/dist/es2019/styles/shared/extension.js +3 -0
  168. package/dist/es2019/styles/shared/layout.js +3 -0
  169. package/dist/es2019/styles/shared/table.js +3 -1
  170. package/dist/es2019/transforms/expand.js +36 -0
  171. package/dist/es2019/transforms/extension.js +26 -0
  172. package/dist/es2019/transforms/index.js +3 -0
  173. package/dist/es2019/transforms/layout.js +54 -0
  174. package/dist/es2019/types/command.js +1 -0
  175. package/dist/es2019/types/context-panel.js +1 -0
  176. package/dist/es2019/types/editor-actions.js +1 -0
  177. package/dist/es2019/types/editor-appearance.js +1 -0
  178. package/dist/es2019/types/editor-container-width.js +1 -0
  179. package/dist/es2019/types/editor-plugin.js +1 -0
  180. package/dist/es2019/types/editor-react-context.js +1 -0
  181. package/dist/es2019/types/empty-state-handler.js +1 -0
  182. package/dist/es2019/types/feature-flags.js +1 -0
  183. package/dist/es2019/types/floating-toolbar.js +1 -0
  184. package/dist/es2019/types/index.js +2 -1
  185. package/dist/es2019/types/plugin-factory.js +1 -0
  186. package/dist/es2019/types/prosemirror-config.js +1 -0
  187. package/dist/es2019/types/quick-insert.js +1 -0
  188. package/dist/es2019/types/supported-browsers.js +2 -0
  189. package/dist/es2019/types/toolbar.js +30 -0
  190. package/dist/es2019/types/ui-components.js +1 -0
  191. package/dist/es2019/ui/DropList/index.js +187 -0
  192. package/dist/es2019/ui/ErrorBoundary/index.js +52 -0
  193. package/dist/es2019/ui/Layer/index.js +195 -0
  194. package/dist/es2019/ui/Layer/internal/helpers.js +62 -0
  195. package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +43 -0
  196. package/dist/es2019/ui/PortalProvider/index.js +193 -0
  197. package/dist/es2019/ui-color/ColorPalette/Color/index.js +72 -0
  198. package/dist/es2019/ui-color/ColorPalette/Color/styles.js +35 -0
  199. package/dist/es2019/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +15 -0
  200. package/dist/es2019/ui-color/ColorPalette/Palettes/common.js +25 -0
  201. package/dist/es2019/ui-color/ColorPalette/Palettes/getColorMessage.js +14 -0
  202. package/dist/es2019/ui-color/ColorPalette/Palettes/index.js +1 -0
  203. package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessages.js +113 -0
  204. package/dist/es2019/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +143 -0
  205. package/dist/es2019/ui-color/ColorPalette/Palettes/statusColorPalette.js +56 -0
  206. package/dist/es2019/ui-color/ColorPalette/Palettes/textColorPalette.js +25 -0
  207. package/dist/es2019/ui-color/ColorPalette/Palettes/type.js +1 -0
  208. package/dist/es2019/ui-color/ColorPalette/index.js +68 -0
  209. package/dist/es2019/ui-color/ColorPalette/styles.js +7 -0
  210. package/dist/es2019/ui-color/index.js +8 -0
  211. package/dist/es2019/ui-menu/Dropdown/index.js +83 -0
  212. package/dist/es2019/ui-menu/DropdownMenu/index.js +244 -0
  213. package/dist/es2019/ui-menu/DropdownMenu/types.js +1 -0
  214. package/dist/es2019/ui-menu/ToolbarButton/index.js +94 -0
  215. package/dist/es2019/ui-menu/ToolbarButton/styles.js +12 -0
  216. package/dist/es2019/ui-menu/index.js +3 -0
  217. package/dist/es2019/ui-react/ReactEditorViewContext.js +3 -0
  218. package/dist/es2019/ui-react/index.js +2 -0
  219. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +103 -0
  220. package/dist/es2019/utils/dom.js +113 -0
  221. package/dist/es2019/utils/editor-core-utils.js +72 -0
  222. package/dist/es2019/utils/index.js +6 -0
  223. package/dist/es2019/utils/is-text-input.js +19 -0
  224. package/dist/es2019/utils/nodes.js +88 -0
  225. package/dist/es2019/utils/plugin-state-factory.js +107 -0
  226. package/dist/es2019/utils/slice.js +56 -0
  227. package/dist/es2019/version.json +1 -1
  228. package/dist/es2019/with-plugin-state/index.js +263 -0
  229. package/dist/es2019/with-plugin-state/types.js +1 -0
  230. package/dist/esm/analytics/api.js +1 -0
  231. package/dist/esm/analytics/index.js +1 -0
  232. package/dist/esm/analytics/types/avatar.js +1 -0
  233. package/dist/esm/analytics/types/block.js +1 -0
  234. package/dist/esm/analytics/types/config-panel-events.js +1 -0
  235. package/dist/esm/analytics/types/cut-copy-events.js +1 -0
  236. package/dist/esm/analytics/types/date-events.js +1 -0
  237. package/dist/esm/analytics/types/dispatch-analytics-event.js +1 -0
  238. package/dist/esm/analytics/types/element-browser-events.js +1 -0
  239. package/dist/esm/analytics/types/enums.js +336 -0
  240. package/dist/esm/analytics/types/events.js +1 -0
  241. package/dist/esm/analytics/types/experimental-events.js +1 -0
  242. package/dist/esm/analytics/types/extension-events.js +13 -0
  243. package/dist/esm/analytics/types/find-replace-events.js +1 -0
  244. package/dist/esm/analytics/types/format-events.js +16 -0
  245. package/dist/esm/analytics/types/general-events.js +30 -0
  246. package/dist/esm/analytics/types/index.js +14 -0
  247. package/dist/esm/analytics/types/inline-comment-events.js +7 -0
  248. package/dist/esm/analytics/types/insert-events.js +41 -0
  249. package/dist/esm/analytics/types/link-tool-bar-events.js +1 -0
  250. package/dist/esm/analytics/types/list-events.js +17 -0
  251. package/dist/esm/analytics/types/media-events.js +1 -0
  252. package/dist/esm/analytics/types/node-events.js +18 -0
  253. package/dist/esm/analytics/types/paste-events.js +46 -0
  254. package/dist/esm/analytics/types/performance-report.js +1 -0
  255. package/dist/esm/analytics/types/selection-events.js +1 -0
  256. package/dist/esm/analytics/types/smart-links.js +12 -0
  257. package/dist/esm/analytics/types/substitute-events.js +16 -0
  258. package/dist/esm/analytics/types/table-events.js +34 -0
  259. package/dist/esm/analytics/types/toolbar-button.js +19 -0
  260. package/dist/esm/analytics/types/type-ahead.js +1 -0
  261. package/dist/esm/analytics/types/utils.js +20 -0
  262. package/dist/esm/core-utils/index.js +1 -0
  263. package/dist/esm/core-utils/inside.js +7 -0
  264. package/dist/esm/event-dispatcher/index.js +74 -0
  265. package/dist/esm/keymaps/consts.js +12 -0
  266. package/dist/esm/keymaps/index.js +184 -0
  267. package/dist/esm/messages/index.js +125 -1
  268. package/dist/esm/messages/insert-block.js +168 -0
  269. package/dist/esm/node-width/index.js +72 -0
  270. package/dist/esm/react-node-view/index.js +244 -0
  271. package/dist/esm/react-node-view/types.js +1 -0
  272. package/dist/esm/selection/gap-cursor/selection.js +176 -0
  273. package/dist/esm/selection/gap-cursor/utils/index.js +2 -0
  274. package/dist/esm/selection/gap-cursor/utils/is-ignored.js +5 -0
  275. package/dist/esm/selection/gap-cursor/utils/is-valid-target-node.js +4 -0
  276. package/dist/esm/selection/index.js +4 -0
  277. package/dist/esm/selection/types.js +8 -0
  278. package/dist/esm/selection/utils.js +38 -0
  279. package/dist/esm/styles/index.js +3 -1
  280. package/dist/esm/styles/shared/extension.js +3 -0
  281. package/dist/esm/styles/shared/layout.js +3 -0
  282. package/dist/esm/styles/shared/table.js +3 -1
  283. package/dist/esm/transforms/expand.js +34 -0
  284. package/dist/esm/transforms/extension.js +24 -0
  285. package/dist/esm/transforms/index.js +3 -0
  286. package/dist/esm/transforms/layout.js +58 -0
  287. package/dist/esm/types/command.js +1 -0
  288. package/dist/esm/types/context-panel.js +1 -0
  289. package/dist/esm/types/editor-actions.js +1 -0
  290. package/dist/esm/types/editor-appearance.js +1 -0
  291. package/dist/esm/types/editor-container-width.js +1 -0
  292. package/dist/esm/types/editor-plugin.js +1 -0
  293. package/dist/esm/types/editor-react-context.js +1 -0
  294. package/dist/esm/types/empty-state-handler.js +1 -0
  295. package/dist/esm/types/feature-flags.js +1 -0
  296. package/dist/esm/types/floating-toolbar.js +1 -0
  297. package/dist/esm/types/index.js +2 -1
  298. package/dist/esm/types/plugin-factory.js +1 -0
  299. package/dist/esm/types/prosemirror-config.js +1 -0
  300. package/dist/esm/types/quick-insert.js +1 -0
  301. package/dist/esm/types/supported-browsers.js +2 -0
  302. package/dist/esm/types/toolbar.js +30 -0
  303. package/dist/esm/types/ui-components.js +1 -0
  304. package/dist/esm/ui/DropList/index.js +205 -0
  305. package/dist/esm/ui/ErrorBoundary/index.js +84 -0
  306. package/dist/esm/ui/Layer/index.js +228 -0
  307. package/dist/esm/ui/Layer/internal/helpers.js +62 -0
  308. package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +43 -0
  309. package/dist/esm/ui/PortalProvider/index.js +275 -0
  310. package/dist/esm/ui-color/ColorPalette/Color/index.js +93 -0
  311. package/dist/esm/ui-color/ColorPalette/Color/styles.js +19 -0
  312. package/dist/esm/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.js +15 -0
  313. package/dist/esm/ui-color/ColorPalette/Palettes/common.js +24 -0
  314. package/dist/esm/ui-color/ColorPalette/Palettes/getColorMessage.js +10 -0
  315. package/dist/esm/ui-color/ColorPalette/Palettes/index.js +1 -0
  316. package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessages.js +113 -0
  317. package/dist/esm/ui-color/ColorPalette/Palettes/panelBackgroundPalette.js +153 -0
  318. package/dist/esm/ui-color/ColorPalette/Palettes/statusColorPalette.js +56 -0
  319. package/dist/esm/ui-color/ColorPalette/Palettes/textColorPalette.js +25 -0
  320. package/dist/esm/ui-color/ColorPalette/Palettes/type.js +1 -0
  321. package/dist/esm/ui-color/ColorPalette/index.js +70 -0
  322. package/dist/esm/ui-color/ColorPalette/styles.js +7 -0
  323. package/dist/esm/ui-color/index.js +8 -0
  324. package/dist/esm/ui-menu/Dropdown/index.js +105 -0
  325. package/dist/esm/ui-menu/DropdownMenu/index.js +265 -0
  326. package/dist/esm/ui-menu/DropdownMenu/types.js +1 -0
  327. package/dist/esm/ui-menu/ToolbarButton/index.js +102 -0
  328. package/dist/esm/ui-menu/ToolbarButton/styles.js +12 -0
  329. package/dist/esm/ui-menu/index.js +3 -0
  330. package/dist/esm/ui-react/ReactEditorViewContext.js +3 -0
  331. package/dist/esm/ui-react/index.js +2 -0
  332. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +138 -0
  333. package/dist/esm/utils/dom.js +113 -0
  334. package/dist/esm/utils/editor-core-utils.js +72 -0
  335. package/dist/esm/utils/index.js +6 -0
  336. package/dist/esm/utils/is-text-input.js +18 -0
  337. package/dist/esm/utils/nodes.js +100 -0
  338. package/dist/esm/utils/plugin-state-factory.js +106 -0
  339. package/dist/esm/utils/slice.js +59 -0
  340. package/dist/esm/version.json +1 -1
  341. package/dist/esm/with-plugin-state/index.js +311 -0
  342. package/dist/esm/with-plugin-state/types.js +1 -0
  343. package/dist/types/analytics/api.d.ts +5 -0
  344. package/dist/types/analytics/index.d.ts +3 -0
  345. package/dist/types/analytics/types/avatar.d.ts +5 -0
  346. package/dist/types/analytics/types/block.d.ts +3 -0
  347. package/dist/types/analytics/types/config-panel-events.d.ts +17 -0
  348. package/dist/types/analytics/types/cut-copy-events.d.ts +12 -0
  349. package/dist/types/analytics/types/date-events.d.ts +17 -0
  350. package/dist/types/analytics/types/dispatch-analytics-event.d.ts +2 -0
  351. package/dist/types/analytics/types/element-browser-events.d.ts +11 -0
  352. package/dist/types/analytics/types/enums.d.ts +313 -0
  353. package/dist/types/analytics/types/events.d.ts +125 -0
  354. package/dist/types/analytics/types/experimental-events.d.ts +17 -0
  355. package/dist/types/analytics/types/extension-events.d.ts +37 -0
  356. package/dist/types/analytics/types/find-replace-events.d.ts +23 -0
  357. package/dist/types/analytics/types/format-events.d.ts +49 -0
  358. package/dist/types/analytics/types/general-events.d.ts +179 -0
  359. package/dist/types/analytics/types/index.d.ts +34 -0
  360. package/dist/types/analytics/types/inline-comment-events.d.ts +17 -0
  361. package/dist/types/analytics/types/insert-events.d.ts +128 -0
  362. package/dist/types/analytics/types/link-tool-bar-events.d.ts +76 -0
  363. package/dist/types/analytics/types/list-events.d.ts +52 -0
  364. package/dist/types/analytics/types/media-events.d.ts +16 -0
  365. package/dist/types/analytics/types/node-events.d.ts +56 -0
  366. package/dist/types/analytics/types/paste-events.d.ts +39 -0
  367. package/dist/types/analytics/types/performance-report.d.ts +24 -0
  368. package/dist/types/analytics/types/selection-events.d.ts +18 -0
  369. package/dist/types/analytics/types/smart-links.d.ts +13 -0
  370. package/dist/types/analytics/types/substitute-events.d.ts +26 -0
  371. package/dist/types/analytics/types/table-events.d.ts +94 -0
  372. package/dist/types/analytics/types/toolbar-button.d.ts +22 -0
  373. package/dist/types/analytics/types/type-ahead.d.ts +27 -0
  374. package/dist/types/analytics/types/utils.d.ts +46 -0
  375. package/dist/types/core-utils/index.d.ts +1 -0
  376. package/dist/types/core-utils/inside.d.ts +2 -0
  377. package/dist/types/event-dispatcher/index.d.ts +19 -0
  378. package/dist/types/keymaps/consts.d.ts +12 -0
  379. package/dist/types/keymaps/index.d.ts +89 -0
  380. package/dist/types/messages/index.d.ts +124 -0
  381. package/dist/types/messages/insert-block.d.ts +167 -0
  382. package/dist/types/node-width/index.d.ts +7 -0
  383. package/dist/types/react-node-view/index.d.ts +52 -0
  384. package/dist/types/react-node-view/types.d.ts +12 -0
  385. package/dist/types/selection/gap-cursor/selection.d.ts +40 -0
  386. package/dist/types/selection/gap-cursor/utils/index.d.ts +2 -0
  387. package/dist/types/selection/gap-cursor/utils/is-ignored.d.ts +2 -0
  388. package/dist/types/selection/gap-cursor/utils/is-valid-target-node.d.ts +2 -0
  389. package/dist/types/selection/index.d.ts +5 -0
  390. package/dist/types/selection/types.d.ts +26 -0
  391. package/dist/types/selection/utils.d.ts +4 -0
  392. package/dist/types/styles/index.d.ts +2 -0
  393. package/dist/types/styles/shared/extension.d.ts +2 -0
  394. package/dist/types/styles/shared/layout.d.ts +2 -0
  395. package/dist/types/styles/shared/table.d.ts +2 -0
  396. package/dist/types/transforms/expand.d.ts +5 -0
  397. package/dist/types/transforms/extension.d.ts +6 -0
  398. package/dist/types/transforms/index.d.ts +3 -0
  399. package/dist/types/transforms/layout.d.ts +15 -0
  400. package/dist/types/types/command.d.ts +5 -0
  401. package/dist/types/types/context-panel.d.ts +3 -0
  402. package/dist/types/types/editor-actions.d.ts +19 -0
  403. package/dist/types/types/editor-appearance.d.ts +1 -0
  404. package/dist/types/types/editor-container-width.d.ts +6 -0
  405. package/dist/types/types/editor-plugin.d.ts +61 -0
  406. package/dist/types/types/editor-react-context.d.ts +6 -0
  407. package/dist/types/types/empty-state-handler.d.ts +7 -0
  408. package/dist/types/types/feature-flags.d.ts +344 -0
  409. package/dist/types/types/floating-toolbar.d.ts +183 -0
  410. package/dist/types/types/index.d.ts +17 -1
  411. package/dist/types/types/plugin-factory.d.ts +27 -0
  412. package/dist/types/types/prosemirror-config.d.ts +14 -0
  413. package/dist/types/types/quick-insert.d.ts +26 -0
  414. package/dist/types/types/supported-browsers.d.ts +10 -0
  415. package/dist/types/types/toolbar.d.ts +30 -0
  416. package/dist/types/types/type-ahead.d.ts +50 -1
  417. package/dist/types/types/ui-components.d.ts +22 -0
  418. package/dist/types/ui/DropList/index.d.ts +19 -0
  419. package/dist/types/ui/ErrorBoundary/index.d.ts +24 -0
  420. package/dist/types/ui/Layer/index.d.ts +47 -0
  421. package/dist/types/ui/Layer/internal/helpers.d.ts +5 -0
  422. package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +6 -0
  423. package/dist/types/ui/PortalProvider/index.d.ts +50 -0
  424. package/dist/types/ui-color/ColorPalette/Color/index.d.ts +19 -0
  425. package/dist/types/ui-color/ColorPalette/Color/styles.d.ts +4 -0
  426. package/dist/types/ui-color/ColorPalette/Palettes/cellBackgroundColorPalette.d.ts +3 -0
  427. package/dist/types/ui-color/ColorPalette/Palettes/common.d.ts +2 -0
  428. package/dist/types/ui-color/ColorPalette/Palettes/getColorMessage.d.ts +2 -0
  429. package/dist/types/ui-color/ColorPalette/Palettes/index.d.ts +2 -0
  430. package/dist/types/ui-color/ColorPalette/Palettes/paletteMessages.d.ts +113 -0
  431. package/dist/types/ui-color/ColorPalette/Palettes/panelBackgroundPalette.d.ts +4 -0
  432. package/dist/types/ui-color/ColorPalette/Palettes/statusColorPalette.d.ts +4 -0
  433. package/dist/types/ui-color/ColorPalette/Palettes/textColorPalette.d.ts +3 -0
  434. package/dist/types/ui-color/ColorPalette/Palettes/type.d.ts +8 -0
  435. package/dist/types/ui-color/ColorPalette/index.d.ts +15 -0
  436. package/dist/types/ui-color/ColorPalette/styles.d.ts +1 -0
  437. package/dist/types/ui-color/index.d.ts +9 -0
  438. package/dist/types/ui-menu/Dropdown/index.d.ts +32 -0
  439. package/dist/types/ui-menu/DropdownMenu/index.d.ts +19 -0
  440. package/dist/types/ui-menu/DropdownMenu/types.d.ts +43 -0
  441. package/dist/types/ui-menu/ToolbarButton/index.d.ts +53 -0
  442. package/dist/types/ui-menu/ToolbarButton/styles.d.ts +4 -0
  443. package/dist/types/ui-menu/index.d.ts +5 -0
  444. package/dist/types/ui-react/ReactEditorViewContext.d.ts +8 -0
  445. package/dist/types/ui-react/index.d.ts +2 -0
  446. package/dist/types/ui-react/with-react-editor-view-outer-listeners.d.ts +9 -0
  447. package/dist/types/utils/dom.d.ts +26 -0
  448. package/dist/types/utils/editor-core-utils.d.ts +23 -0
  449. package/dist/types/utils/getModeFromTheme.d.ts +1 -1
  450. package/dist/types/utils/index.d.ts +9 -0
  451. package/dist/types/utils/is-text-input.d.ts +2 -0
  452. package/dist/types/utils/nodes.d.ts +35 -0
  453. package/dist/types/utils/plugin-state-factory.d.ts +16 -0
  454. package/dist/types/utils/slice.d.ts +11 -0
  455. package/dist/types/with-plugin-state/index.d.ts +86 -0
  456. package/dist/types/with-plugin-state/types.d.ts +10 -0
  457. package/error-boundary/package.json +8 -0
  458. package/event-dispatcher/package.json +8 -0
  459. package/keymaps/package.json +8 -0
  460. package/node-width/package.json +8 -0
  461. package/package.json +27 -5
  462. package/portal-provider/package.json +8 -0
  463. package/react-node-view/package.json +8 -0
  464. package/selection/package.json +8 -0
  465. package/transforms/package.json +8 -0
  466. package/ui-color/package.json +8 -0
  467. package/ui-menu/package.json +8 -0
  468. package/ui-react/package.json +8 -0
  469. package/with-plugin-state/package.json +8 -0
@@ -0,0 +1,74 @@
1
+ import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
2
+ import { akEditorFullWidthLayoutWidth, akLayoutGutterOffset, gridMediumMaxWidth } from '@atlaskit/editor-shared-styles';
3
+ import { BODIED_EXT_PADDING } from '../styles/shared/extension';
4
+ import { LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN } from '../styles/shared/layout';
5
+ import { absoluteBreakoutWidth } from '../utils/breakout';
6
+ /**
7
+ * Calculates width of parent node of a nested node (inside layouts, extension)
8
+ * If current node selection is not nested will return undefined
9
+ */
10
+
11
+ export const getParentNodeWidth = (pos, state, containerWidth, isFullWidthModeEnabled) => {
12
+ if (!pos) {
13
+ return;
14
+ }
15
+
16
+ const node = getNestedParentNode(pos, state);
17
+
18
+ if (!node) {
19
+ return;
20
+ }
21
+
22
+ let layout = node.attrs.layout || 'default';
23
+ const {
24
+ schema
25
+ } = state;
26
+ const breakoutMark = schema.marks.breakout && schema.marks.breakout.isInSet(node.marks);
27
+
28
+ if (breakoutMark && breakoutMark.attrs.mode) {
29
+ layout = breakoutMark.attrs.mode;
30
+ }
31
+
32
+ let parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
33
+
34
+ if (node.type === schema.nodes.layoutSection) {
35
+ parentWidth += akLayoutGutterOffset * 2; // extra width that gets added to layout
36
+
37
+ if (containerWidth.width > gridMediumMaxWidth) {
38
+ parentWidth -= (LAYOUT_SECTION_MARGIN + 2) * (node.childCount - 1); // margin between sections
39
+
40
+ const $pos = state.doc.resolve(pos);
41
+ const column = findParentNodeOfTypeClosestToPos($pos, [state.schema.nodes.layoutColumn]);
42
+
43
+ if (column && column.node && !isNaN(column.node.attrs.width)) {
44
+ // get exact width of parent layout column using node attrs
45
+ parentWidth = Math.round(parentWidth * column.node.attrs.width * 0.01);
46
+ }
47
+ }
48
+ } // account for the padding of the parent node
49
+
50
+
51
+ if (node.type === schema.nodes.layoutSection) {
52
+ parentWidth -= LAYOUT_COLUMN_PADDING * 2;
53
+ } else if (node.type === schema.nodes.bodiedExtension) {
54
+ parentWidth -= BODIED_EXT_PADDING * 2;
55
+ }
56
+
57
+ parentWidth -= 2; // border
58
+
59
+ return parentWidth;
60
+ };
61
+
62
+ const getNestedParentNode = (tablePos, state) => {
63
+ if (tablePos === undefined) {
64
+ return null;
65
+ }
66
+
67
+ const $pos = state.doc.resolve(tablePos);
68
+ const parent = findParentNodeOfTypeClosestToPos($pos, [state.schema.nodes.bodiedExtension, state.schema.nodes.layoutSection, state.schema.nodes.expand]);
69
+ return parent ? parent.node : null;
70
+ };
71
+
72
+ const calcBreakoutNodeWidth = (layout, containerWidth, isFullWidthModeEnabled) => {
73
+ return isFullWidthModeEnabled ? Math.min(containerWidth.lineLength, akEditorFullWidthLayoutWidth) : absoluteBreakoutWidth(layout, containerWidth.width);
74
+ };
@@ -0,0 +1,199 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import React from 'react';
4
+ import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
5
+ import { createDispatch } from '../event-dispatcher';
6
+ import { ErrorBoundary } from '../ui/ErrorBoundary';
7
+ import { analyticsEventKey } from '../utils/analytics'; //import {
8
+ // getPerformanceOptions,
9
+ // startMeasureReactNodeViewRendered,
10
+ // stopMeasureReactNodeViewRendered,
11
+ //} from './get-performance-options';
12
+
13
+ export default class ReactNodeView {
14
+ constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, reactComponent, hasAnalyticsContext = false, viewShouldUpdate, hasIntlContext = false) {
15
+ _defineProperty(this, "handleRef", node => this._handleRef(node));
16
+
17
+ _defineProperty(this, "dispatchAnalyticsEvent", payload => {
18
+ if (this.eventDispatcher) {
19
+ const dispatch = createDispatch(this.eventDispatcher);
20
+ dispatch(analyticsEventKey, {
21
+ payload
22
+ });
23
+ }
24
+ });
25
+
26
+ this.node = _node;
27
+ this.view = view;
28
+ this.getPos = getPos;
29
+ this.portalProviderAPI = portalProviderAPI;
30
+ this.reactComponentProps = reactComponentProps || {};
31
+ this.reactComponent = reactComponent;
32
+ this.hasAnalyticsContext = hasAnalyticsContext;
33
+ this._viewShouldUpdate = viewShouldUpdate;
34
+ this.eventDispatcher = eventDispatcher;
35
+ this.hasIntlContext = hasIntlContext;
36
+ }
37
+ /**
38
+ * This method exists to move initialization logic out of the constructor,
39
+ * so object can be initialized properly before calling render first time.
40
+ *
41
+ * Example:
42
+ * Instance properties get added to an object only after super call in
43
+ * constructor, which leads to some methods being undefined during the
44
+ * first render.
45
+ */
46
+
47
+
48
+ init() {
49
+ this.domRef = this.createDomRef();
50
+ this.setDomAttrs(this.node, this.domRef);
51
+ const {
52
+ dom: contentDOMWrapper,
53
+ contentDOM
54
+ } = this.getContentDOM() || {
55
+ dom: undefined,
56
+ contentDOM: undefined
57
+ };
58
+
59
+ if (this.domRef && contentDOMWrapper) {
60
+ this.domRef.appendChild(contentDOMWrapper);
61
+ this.contentDOM = contentDOM ? contentDOM : contentDOMWrapper;
62
+ this.contentDOMWrapper = contentDOMWrapper || contentDOM;
63
+ } // @see ED-3790
64
+ // something gets messed up during mutation processing inside of a
65
+ // nodeView if DOM structure has nested plain "div"s, it doesn't see the
66
+ // difference between them and it kills the nodeView
67
+
68
+
69
+ this.domRef.classList.add(`${this.node.type.name}View-content-wrap`); // TODO: ED-15580
70
+ //const {
71
+ // samplingRate,
72
+ // slowThreshold,
73
+ // trackingEnabled,
74
+ //} = getPerformanceOptions(this.view);
75
+ //trackingEnabled &&
76
+ // startMeasureReactNodeViewRendered({ nodeTypeName: this.node.type.name });
77
+
78
+ this.renderReactComponent(() => this.render(this.reactComponentProps, this.handleRef)); //trackingEnabled &&
79
+ // stopMeasureReactNodeViewRendered({
80
+ // nodeTypeName: this.node.type.name,
81
+ // dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
82
+ // editorState: this.view.state,
83
+ // samplingRate,
84
+ // slowThreshold,
85
+ // });
86
+
87
+ return this;
88
+ }
89
+
90
+ renderReactComponent(component) {
91
+ if (!this.domRef || !component) {
92
+ return;
93
+ }
94
+
95
+ const componentWithErrorBoundary = () => {
96
+ var _this$node$type$name, _this$node, _this$node$type;
97
+
98
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
99
+ component: ACTION_SUBJECT.REACT_NODE_VIEW,
100
+ componentId: (_this$node$type$name = this === null || this === void 0 ? void 0 : (_this$node = this.node) === null || _this$node === void 0 ? void 0 : (_this$node$type = _this$node.type) === null || _this$node$type === void 0 ? void 0 : _this$node$type.name) !== null && _this$node$type$name !== void 0 ? _this$node$type$name : ACTION_SUBJECT_ID.UNKNOWN_NODE,
101
+ dispatchAnalyticsEvent: this.dispatchAnalyticsEvent
102
+ }, component());
103
+ };
104
+
105
+ this.portalProviderAPI.render(componentWithErrorBoundary, this.domRef, this.hasAnalyticsContext, this.hasIntlContext);
106
+ }
107
+
108
+ createDomRef() {
109
+ if (!this.node.isInline) {
110
+ return document.createElement('div');
111
+ }
112
+
113
+ const htmlElement = document.createElement('span');
114
+ return htmlElement;
115
+ }
116
+
117
+ getContentDOM() {
118
+ return undefined;
119
+ }
120
+
121
+ _handleRef(node) {
122
+ const contentDOM = this.contentDOMWrapper || this.contentDOM; // move the contentDOM node inside the inner reference after rendering
123
+
124
+ if (node && contentDOM && !node.contains(contentDOM)) {
125
+ node.appendChild(contentDOM);
126
+ }
127
+ }
128
+
129
+ render(props, forwardRef) {
130
+ return this.reactComponent ? /*#__PURE__*/React.createElement(this.reactComponent, _extends({
131
+ view: this.view,
132
+ getPos: this.getPos,
133
+ node: this.node,
134
+ forwardRef: forwardRef
135
+ }, props)) : null;
136
+ }
137
+
138
+ update(node, _decorations, _innerDecorations, validUpdate = () => true) {
139
+ // @see https://github.com/ProseMirror/prosemirror/issues/648
140
+ const isValidUpdate = this.node.type === node.type && validUpdate(this.node, node);
141
+
142
+ if (!isValidUpdate) {
143
+ return false;
144
+ }
145
+
146
+ if (this.domRef && !this.node.sameMarkup(node)) {
147
+ this.setDomAttrs(node, this.domRef);
148
+ } // View should not process a re-render if this is false.
149
+ // We dont want to destroy the view, so we return true.
150
+
151
+
152
+ if (!this.viewShouldUpdate(node)) {
153
+ this.node = node;
154
+ return true;
155
+ }
156
+
157
+ this.node = node;
158
+ this.renderReactComponent(() => this.render(this.reactComponentProps, this.handleRef));
159
+ return true;
160
+ }
161
+
162
+ viewShouldUpdate(nextNode) {
163
+ if (this._viewShouldUpdate) {
164
+ return this._viewShouldUpdate(nextNode);
165
+ }
166
+
167
+ return true;
168
+ }
169
+ /**
170
+ * Copies the attributes from a ProseMirror Node to a DOM node.
171
+ * @param node The Prosemirror Node from which to source the attributes
172
+ */
173
+
174
+
175
+ setDomAttrs(node, element) {
176
+ Object.keys(node.attrs || {}).forEach(attr => {
177
+ element.setAttribute(attr, node.attrs[attr]);
178
+ });
179
+ }
180
+
181
+ get dom() {
182
+ return this.domRef;
183
+ }
184
+
185
+ destroy() {
186
+ if (!this.domRef) {
187
+ return;
188
+ }
189
+
190
+ this.portalProviderAPI.remove(this.domRef);
191
+ this.domRef = undefined;
192
+ this.contentDOM = undefined;
193
+ }
194
+
195
+ static fromComponent(component, portalProviderAPI, eventDispatcher, props, viewShouldUpdate, hasIntlContext = false) {
196
+ return (node, view, getPos) => new ReactNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, props, component, false, viewShouldUpdate, hasIntlContext).init();
197
+ }
198
+
199
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,136 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { Slice } from 'prosemirror-model';
3
+ import { Selection } from 'prosemirror-state';
4
+ import { isValidTargetNode } from './utils/is-valid-target-node';
5
+ export let Side;
6
+
7
+ (function (Side) {
8
+ Side["LEFT"] = "left";
9
+ Side["RIGHT"] = "right";
10
+ })(Side || (Side = {}));
11
+
12
+ export const JSON_ID = 'gapcursor';
13
+ export class GapCursorSelection extends Selection {
14
+ /**
15
+ * Construct a GapCursorSelection
16
+ * @param {ResolvedPos} $pos resolved position
17
+ * @param {Side} side side where the gap cursor is drawn
18
+ */
19
+ constructor($pos, side = Side.LEFT) {
20
+ super($pos, $pos);
21
+
22
+ _defineProperty(this, "visible", false);
23
+
24
+ this.side = side;
25
+ }
26
+
27
+ static valid($pos) {
28
+ const {
29
+ parent,
30
+ nodeBefore,
31
+ nodeAfter
32
+ } = $pos;
33
+ const targetNode = isValidTargetNode(nodeBefore) ? nodeBefore : isValidTargetNode(nodeAfter) ? nodeAfter : null;
34
+
35
+ if (!targetNode || parent.isTextblock) {
36
+ return false;
37
+ }
38
+
39
+ const deflt = parent.contentMatchAt($pos.index()).defaultType;
40
+ return deflt && deflt.isTextblock;
41
+ }
42
+
43
+ static findFrom($pos, dir, mustMove = false) {
44
+ const side = dir === 1 ? Side.RIGHT : Side.LEFT;
45
+
46
+ if (!mustMove && GapCursorSelection.valid($pos)) {
47
+ return new GapCursorSelection($pos, side);
48
+ }
49
+
50
+ let pos = $pos.pos; // TODO: Fix any, potential issue. ED-5048
51
+
52
+ let next = null; // Scan up from this position
53
+
54
+ for (let d = $pos.depth;; d--) {
55
+ const parent = $pos.node(d);
56
+
57
+ if (side === Side.RIGHT ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
58
+ next = parent.maybeChild(side === Side.RIGHT ? $pos.indexAfter(d) : $pos.index(d) - 1);
59
+ break;
60
+ } else if (d === 0) {
61
+ return null;
62
+ }
63
+
64
+ pos += dir;
65
+ const $cur = $pos.doc.resolve(pos);
66
+
67
+ if (GapCursorSelection.valid($cur)) {
68
+ return new GapCursorSelection($cur, side);
69
+ }
70
+ } // And then down into the next node
71
+
72
+
73
+ for (;;) {
74
+ next = side === Side.RIGHT ? next.firstChild : next.lastChild;
75
+
76
+ if (next === null) {
77
+ break;
78
+ }
79
+
80
+ pos += dir;
81
+ const $cur = $pos.doc.resolve(pos);
82
+
83
+ if (GapCursorSelection.valid($cur)) {
84
+ return new GapCursorSelection($cur, side);
85
+ }
86
+ }
87
+
88
+ return null;
89
+ }
90
+
91
+ static fromJSON(doc, json) {
92
+ return new GapCursorSelection(doc.resolve(json.pos), json.side);
93
+ }
94
+
95
+ map(doc, mapping) {
96
+ const $pos = doc.resolve(mapping.map(this.head));
97
+ return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos, this.side) : Selection.near($pos);
98
+ }
99
+
100
+ eq(other) {
101
+ return other instanceof GapCursorSelection && other.head === this.head;
102
+ }
103
+
104
+ content() {
105
+ return Slice.empty;
106
+ }
107
+
108
+ getBookmark() {
109
+ return new GapBookmark(this.anchor);
110
+ }
111
+
112
+ toJSON() {
113
+ return {
114
+ pos: this.head,
115
+ type: JSON_ID,
116
+ side: this.side
117
+ };
118
+ }
119
+
120
+ }
121
+ Selection.jsonID(JSON_ID, GapCursorSelection);
122
+ export class GapBookmark {
123
+ constructor(pos) {
124
+ this.pos = pos;
125
+ }
126
+
127
+ map(mapping) {
128
+ return new GapBookmark(mapping.map(this.pos));
129
+ }
130
+
131
+ resolve(doc) {
132
+ const $pos = doc.resolve(this.pos);
133
+ return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos) : Selection.near($pos);
134
+ }
135
+
136
+ }
@@ -0,0 +1,2 @@
1
+ export { isIgnored } from './is-ignored';
2
+ export { isValidTargetNode } from './is-valid-target-node';
@@ -0,0 +1,5 @@
1
+ // we don't show gap cursor for those nodes
2
+ const IGNORED_NODES = ['paragraph', 'bulletList', 'orderedList', 'listItem', 'taskItem', 'decisionItem', 'heading', 'blockquote', 'layoutColumn', 'caption', 'media'];
3
+ export const isIgnored = node => {
4
+ return !!node && IGNORED_NODES.indexOf(node.type.name) !== -1;
5
+ };
@@ -0,0 +1,4 @@
1
+ import { isIgnored } from './is-ignored';
2
+ export const isValidTargetNode = node => {
3
+ return !!node && !isIgnored(node);
4
+ };
@@ -0,0 +1,4 @@
1
+ export { RelativeSelectionPos } from './types';
2
+ export { GapCursorSelection, Side, JSON_ID, GapBookmark } from './gap-cursor/selection';
3
+ export { isIgnored, isValidTargetNode } from './gap-cursor/utils';
4
+ export { isSelectionAtStartOfNode, isSelectionAtEndOfNode } from './utils';
@@ -0,0 +1,8 @@
1
+ export let RelativeSelectionPos;
2
+
3
+ (function (RelativeSelectionPos) {
4
+ RelativeSelectionPos["Before"] = "Before";
5
+ RelativeSelectionPos["Start"] = "Start";
6
+ RelativeSelectionPos["Inside"] = "Inside";
7
+ RelativeSelectionPos["End"] = "End";
8
+ })(RelativeSelectionPos || (RelativeSelectionPos = {}));
@@ -0,0 +1,38 @@
1
+ export const isSelectionAtStartOfNode = ($pos, parentNode) => {
2
+ if (!parentNode) {
3
+ return false;
4
+ }
5
+
6
+ for (let i = $pos.depth + 1; i > 0; i--) {
7
+ const node = $pos.node(i);
8
+
9
+ if (node && node.eq(parentNode.node)) {
10
+ break;
11
+ }
12
+
13
+ if (i > 1 && $pos.before(i) !== $pos.before(i - 1) + 1) {
14
+ return false;
15
+ }
16
+ }
17
+
18
+ return true;
19
+ };
20
+ export const isSelectionAtEndOfNode = ($pos, parentNode) => {
21
+ if (!parentNode) {
22
+ return false;
23
+ }
24
+
25
+ for (let i = $pos.depth + 1; i > 0; i--) {
26
+ const node = $pos.node(i);
27
+
28
+ if (node && node.eq(parentNode.node)) {
29
+ break;
30
+ }
31
+
32
+ if (i > 1 && $pos.after(i) !== $pos.after(i - 1) - 1) {
33
+ return false;
34
+ }
35
+ }
36
+
37
+ return true;
38
+ };
@@ -18,4 +18,6 @@ export { dateSharedStyle, DateSharedCssClassName } from './shared/date';
18
18
  export { tasksAndDecisionsStyles, TaskDecisionSharedCssClassName } from './shared/task-decision';
19
19
  export { StatusSharedCssClassName } from './shared/status';
20
20
  export { smartCardSharedStyles, SmartCardSharedCssClassName } from './shared/smart-card';
21
- export { CodeBlockSharedCssClassName, codeBlockSharedStyles } from './shared/code-block';
21
+ export { CodeBlockSharedCssClassName, codeBlockSharedStyles } from './shared/code-block';
22
+ export { LAYOUT_SECTION_MARGIN, LAYOUT_COLUMN_PADDING } from './shared/layout';
23
+ export { EXTENSION_PADDING, BODIED_EXT_PADDING } from './shared/extension';
@@ -0,0 +1,3 @@
1
+ import { gridSize } from '@atlaskit/theme/constants';
2
+ export const EXTENSION_PADDING = gridSize();
3
+ export const BODIED_EXT_PADDING = EXTENSION_PADDING * 2;
@@ -0,0 +1,3 @@
1
+ import { gridSize } from '@atlaskit/theme/constants';
2
+ export const LAYOUT_SECTION_MARGIN = gridSize();
3
+ export const LAYOUT_COLUMN_PADDING = gridSize() * 1.5;
@@ -28,7 +28,9 @@ export const TableSharedCssClassName = {
28
28
  TABLE_STICKY_SENTINEL_BOTTOM: `${tablePrefixSelector}-sticky-sentinel-bottom`,
29
29
  TABLE_CELL_NODEVIEW_CONTENT_DOM: tableCellContentDomSelector,
30
30
  TABLE_CELL_WRAPPER: tableCellSelector,
31
- TABLE_HEADER_CELL_WRAPPER: tableHeaderSelector
31
+ TABLE_HEADER_CELL_WRAPPER: tableHeaderSelector,
32
+ TABLE_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-row-controls-wrapper`,
33
+ TABLE_COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`
32
34
  };
33
35
 
34
36
  const tableSharedStyle = props => css`
@@ -0,0 +1,36 @@
1
+ import { Fragment, Slice } from 'prosemirror-model';
2
+ import { findParentNodeOfType, findSelectedNodeOfType } from 'prosemirror-utils';
3
+ import { mapChildren } from '../utils/slice';
4
+ export const findExpand = (state, selection) => {
5
+ const {
6
+ expand,
7
+ nestedExpand
8
+ } = state.schema.nodes;
9
+ return findSelectedNodeOfType([expand, nestedExpand])(selection || state.selection) || findParentNodeOfType([expand, nestedExpand])(selection || state.selection);
10
+ }; // If the top level is a single expand, and the expand is not
11
+ // a part of copied content, then return unwrap contents.
12
+ // This is needed for handling content copied from expand.
13
+ // https://product-fabric.atlassian.net/browse/ED-9146
14
+
15
+ export const transformSliceToRemoveOpenExpand = (slice, schema) => {
16
+ if (slice.openStart > 1 && slice.openEnd > 1 && slice.content.childCount === 1 && slice.content.firstChild && slice.content.firstChild.type === schema.nodes.expand) {
17
+ return new Slice(slice.content.firstChild.content, slice.openStart - 1, slice.openEnd - 1);
18
+ }
19
+
20
+ return slice;
21
+ };
22
+ export const transformSliceNestedExpandToExpand = (slice, schema) => {
23
+ const {
24
+ expand,
25
+ nestedExpand
26
+ } = schema.nodes;
27
+ const children = [];
28
+ mapChildren(slice.content, node => {
29
+ if (node.type === nestedExpand) {
30
+ children.push(expand.createChecked(node.attrs, node.content, node.marks));
31
+ } else {
32
+ children.push(node);
33
+ }
34
+ });
35
+ return new Slice(Fragment.fromArray(children), slice.openStart, slice.openEnd);
36
+ };
@@ -0,0 +1,26 @@
1
+ import { Slice } from 'prosemirror-model';
2
+ import { mapFragment } from '../utils/slice';
3
+ /**
4
+ * Lift content out of "open" top-level bodiedExtensions.
5
+ * Will not work if bodiedExtensions are nested, or when bodiedExtensions are not in the top level
6
+ */
7
+
8
+ export const transformSliceToRemoveOpenBodiedExtension = (slice, schema) => {
9
+ const {
10
+ bodiedExtension
11
+ } = schema.nodes;
12
+ const fragment = mapFragment(slice.content, (node, parent, index) => {
13
+ if (node.type === bodiedExtension && !parent) {
14
+ const currentNodeIsAtStartAndIsOpen = slice.openStart && index === 0;
15
+ const currentNodeIsAtEndAndIsOpen = slice.openEnd && index + 1 === slice.content.childCount;
16
+
17
+ if (currentNodeIsAtStartAndIsOpen || currentNodeIsAtEndAndIsOpen) {
18
+ return node.content;
19
+ }
20
+ }
21
+
22
+ return node;
23
+ }); // If the first/last child has changed - then we know we've removed a bodied extension & to decrement the open depth
24
+
25
+ return new Slice(fragment, fragment.firstChild && fragment.firstChild.type !== slice.content.firstChild.type ? slice.openStart - 1 : slice.openStart, fragment.lastChild && fragment.lastChild.type !== slice.content.lastChild.type ? slice.openEnd - 1 : slice.openEnd);
26
+ };
@@ -0,0 +1,3 @@
1
+ export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes } from './layout';
2
+ export { findExpand, transformSliceToRemoveOpenExpand, transformSliceNestedExpandToExpand } from './expand';
3
+ export { transformSliceToRemoveOpenBodiedExtension } from './extension';
@@ -0,0 +1,54 @@
1
+ import { Fragment, Slice } from 'prosemirror-model';
2
+ import { flatmap, mapFragment } from '../utils/slice';
3
+
4
+ const isLayoutNode = node => node.type === node.type.schema.nodes.layoutSection || node.type === node.type.schema.nodes.layoutColumn;
5
+
6
+ export function unwrapContentFromLayout(maybeLayoutSection) {
7
+ const fragment = mapFragment(Fragment.from(maybeLayoutSection), node => {
8
+ return isLayoutNode(node) ? node.content : node;
9
+ });
10
+ const nodes = [];
11
+ fragment.forEach(i => nodes.push(i));
12
+ return nodes;
13
+ }
14
+ export function removeLayoutFromFirstChild(node, i) {
15
+ return i === 0 ? unwrapContentFromLayout(node) : node;
16
+ }
17
+ export function removeLayoutFromLastChild(node, i, fragment) {
18
+ return i === fragment.childCount - 1 ? unwrapContentFromLayout(node) : node;
19
+ }
20
+ /**
21
+ * When we have a slice that cuts across a layoutSection/layoutColumn
22
+ * we can end up with unexpected behaviour on paste/drop where a user
23
+ * is able to add columns to a layoutSection. By 'lifting' any content
24
+ * inside an 'open' layoutSection/layoutColumn to the top level, we
25
+ * can ensure prevent this.
26
+ *
27
+ * We only care about slices with non-zero openStart / openEnd's here
28
+ * as we're totally fine for people to copy/paste a full layoutSection
29
+ */
30
+
31
+ export function transformSliceToRemoveOpenLayoutNodes(slice, schema) {
32
+ // Case 1: A slice entirely within a single layoutSection
33
+ if (slice.openStart && slice.openEnd && slice.content.childCount === 1) {
34
+ const maybeLayoutSection = slice.content.firstChild;
35
+
36
+ if (maybeLayoutSection.type === schema.nodes.layoutSection) {
37
+ return new Slice(flatmap(slice.content, removeLayoutFromFirstChild), // '-2' here because we've removed the layoutSection/layoutColumn; reducing the open depth.
38
+ slice.openStart - 2, slice.openEnd - 2);
39
+ }
40
+ } // Case 2: A slice starting inside a layoutSection and finishing outside
41
+
42
+
43
+ if (slice.openStart && slice.content.firstChild.type === schema.nodes.layoutSection) {
44
+ slice = new Slice(flatmap(slice.content, removeLayoutFromFirstChild), slice.openStart - 2, slice.openEnd);
45
+ } // Case 3: A slice starting outside a layoutSection and finishing inside
46
+
47
+
48
+ if (slice.openEnd && slice.content.lastChild.type === schema.nodes.layoutSection) {
49
+ slice = new Slice(flatmap(slice.content, removeLayoutFromLastChild), slice.openStart, slice.openEnd - 2);
50
+ } // Case 2 & 3 also handles a slice starting in one layoutSection & finishing in a different layoutSection
51
+
52
+
53
+ return slice;
54
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};