@atlaskit/editor-core 161.0.0 → 162.0.2

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 (315) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/cjs/actions/index.js +76 -48
  3. package/dist/cjs/extensibility.js +2 -2
  4. package/dist/cjs/labs/next/full-page.js +2 -2
  5. package/dist/cjs/plugins/block-type/styles.js +5 -2
  6. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/index.js +13 -11
  7. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +11 -7
  8. package/dist/cjs/plugins/card/messages.js +4 -4
  9. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +29 -11
  10. package/dist/cjs/plugins/card/ui/LinkToolbarButtonGroup.js +66 -7
  11. package/dist/cjs/plugins/card/ui/LinkToolbarIconDropdown.js +166 -7
  12. package/dist/cjs/plugins/card/ui/ResizableEmbedCard.js +9 -6
  13. package/dist/cjs/plugins/card/ui/assets/card.js +1 -1
  14. package/dist/cjs/plugins/card/ui/assets/embed.js +1 -1
  15. package/dist/cjs/plugins/card/ui/assets/inline.js +1 -1
  16. package/dist/cjs/plugins/card/ui/assets/url.js +1 -1
  17. package/dist/cjs/plugins/card/ui/link-toolbar-button-group-options.js +60 -0
  18. package/dist/cjs/plugins/card/ui/link-toolbar-icon-dropdown-options.js +66 -0
  19. package/dist/cjs/plugins/card/ui/styled.js +5 -13
  20. package/dist/cjs/plugins/card/ui/types.js +5 -0
  21. package/dist/cjs/plugins/clipboard/pm-plugins/main.js +99 -3
  22. package/dist/cjs/plugins/code-block/styles.js +45 -38
  23. package/dist/cjs/plugins/extension/plugin-factory.js +4 -1
  24. package/dist/cjs/plugins/extension/pm-plugins/main.js +34 -11
  25. package/dist/cjs/plugins/extension/utils.js +57 -12
  26. package/dist/cjs/plugins/find-replace/ui/Find.js +12 -12
  27. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +5 -5
  28. package/dist/cjs/plugins/find-replace/ui/Replace.js +5 -5
  29. package/dist/cjs/plugins/find-replace/ui/styles.js +12 -15
  30. package/dist/cjs/plugins/layout/styles.js +2 -2
  31. package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +180 -0
  32. package/dist/cjs/plugins/list/commands/index.js +35 -38
  33. package/dist/cjs/plugins/list/utils/replace-content.js +31 -0
  34. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  35. package/dist/cjs/plugins/media/styles.js +2 -2
  36. package/dist/cjs/plugins/media/utils/media-single.js +15 -2
  37. package/dist/cjs/plugins/paste/handlers.js +19 -5
  38. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +1 -1
  39. package/dist/cjs/plugins/placeholder-text/index.js +45 -1
  40. package/dist/cjs/plugins/placeholder-text/placeholder-text-nodeview.js +66 -22
  41. package/dist/cjs/plugins/placeholder-text/selection-utils.js +19 -0
  42. package/dist/cjs/plugins/placeholder-text/styles.js +3 -1
  43. package/dist/cjs/plugins/table/commands/index.js +0 -6
  44. package/dist/cjs/plugins/table/commands/insert.js +1 -1
  45. package/dist/cjs/plugins/table/commands/misc.js +5 -18
  46. package/dist/cjs/plugins/table/commands-with-analytics.js +1 -1
  47. package/dist/cjs/plugins/table/handlers.js +6 -2
  48. package/dist/cjs/plugins/table/index.js +7 -13
  49. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -2
  50. package/dist/cjs/plugins/table/nodeviews/table.js +7 -38
  51. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +2 -2
  52. package/dist/cjs/plugins/table/pm-plugins/main.js +3 -1
  53. package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +4 -7
  54. package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +11 -0
  55. package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
  56. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +3 -3
  57. package/dist/cjs/plugins/table/reducer.js +0 -7
  58. package/dist/cjs/plugins/table/toolbar.js +5 -15
  59. package/dist/cjs/plugins/table/transforms/metadata.js +2 -2
  60. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +1 -1
  61. package/dist/cjs/plugins/table/ui/FloatingContextualButton/{styles.css.js → styles.js} +0 -0
  62. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +4 -2
  63. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/{styles.css.js → styles.js} +0 -0
  64. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  65. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -2
  66. package/dist/cjs/plugins/table/ui/common-styles.js +53 -0
  67. package/dist/cjs/plugins/table/ui/ui-styles.js +109 -0
  68. package/dist/cjs/plugins/table/utils/nodes.js +15 -15
  69. package/dist/cjs/plugins/tasks-and-decisions/commands.js +15 -1
  70. package/dist/cjs/plugins/text-formatting/styles.js +5 -2
  71. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +71 -1
  72. package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
  73. package/dist/cjs/plugins/text-formatting/utils.js +30 -2
  74. package/dist/cjs/plugins/type-ahead/api.js +32 -1
  75. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -5
  76. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +12 -0
  77. package/dist/cjs/plugins/type-ahead/utils.js +22 -4
  78. package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
  79. package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +2 -2
  80. package/dist/cjs/ui/ContentStyles/index.js +33 -10
  81. package/dist/cjs/utils/index.js +1 -8
  82. package/dist/cjs/utils/insert.js +1 -9
  83. package/dist/cjs/utils/selection.js +2 -9
  84. package/dist/cjs/version-wrapper.js +1 -1
  85. package/dist/cjs/version.json +1 -1
  86. package/dist/es2019/actions/index.js +20 -23
  87. package/dist/es2019/extensibility.js +1 -1
  88. package/dist/es2019/labs/next/full-page.js +2 -2
  89. package/dist/es2019/plugins/block-type/styles.js +3 -3
  90. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +15 -12
  91. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +19 -14
  92. package/dist/es2019/plugins/card/messages.js +4 -4
  93. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +21 -9
  94. package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +54 -3
  95. package/dist/es2019/plugins/card/ui/LinkToolbarIconDropdown.js +145 -3
  96. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +10 -6
  97. package/dist/es2019/plugins/card/ui/assets/card.js +1 -1
  98. package/dist/es2019/plugins/card/ui/assets/embed.js +1 -1
  99. package/dist/es2019/plugins/card/ui/assets/inline.js +1 -1
  100. package/dist/es2019/plugins/card/ui/assets/url.js +1 -1
  101. package/dist/es2019/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
  102. package/dist/es2019/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
  103. package/dist/es2019/plugins/card/ui/styled.js +2 -2
  104. package/dist/es2019/plugins/card/ui/types.js +1 -0
  105. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +91 -9
  106. package/dist/es2019/plugins/code-block/styles.js +14 -14
  107. package/dist/es2019/plugins/extension/plugin-factory.js +3 -1
  108. package/dist/es2019/plugins/extension/pm-plugins/main.js +38 -12
  109. package/dist/es2019/plugins/extension/utils.js +37 -2
  110. package/dist/es2019/plugins/find-replace/ui/Find.js +1 -1
  111. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +1 -1
  112. package/dist/es2019/plugins/find-replace/ui/Replace.js +1 -1
  113. package/dist/es2019/plugins/find-replace/ui/styles.js +14 -9
  114. package/dist/es2019/plugins/layout/styles.js +5 -1
  115. package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +163 -0
  116. package/dist/es2019/plugins/list/commands/index.js +29 -28
  117. package/dist/es2019/plugins/list/utils/replace-content.js +22 -0
  118. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  119. package/dist/es2019/plugins/media/styles.js +1 -1
  120. package/dist/es2019/plugins/media/utils/media-single.js +14 -1
  121. package/dist/es2019/plugins/paste/handlers.js +19 -5
  122. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
  123. package/dist/es2019/plugins/placeholder-text/index.js +46 -1
  124. package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +66 -20
  125. package/dist/es2019/plugins/placeholder-text/selection-utils.js +9 -0
  126. package/dist/es2019/plugins/placeholder-text/styles.js +22 -0
  127. package/dist/es2019/plugins/table/commands/index.js +1 -1
  128. package/dist/es2019/plugins/table/commands/insert.js +1 -1
  129. package/dist/es2019/plugins/table/commands/misc.js +5 -11
  130. package/dist/es2019/plugins/table/commands-with-analytics.js +1 -1
  131. package/dist/es2019/plugins/table/handlers.js +6 -2
  132. package/dist/es2019/plugins/table/index.js +4 -8
  133. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -2
  134. package/dist/es2019/plugins/table/nodeviews/table.js +2 -16
  135. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +1 -1
  136. package/dist/es2019/plugins/table/pm-plugins/main.js +2 -1
  137. package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +1 -2
  138. package/dist/es2019/plugins/table/pm-plugins/plugin-key.js +2 -0
  139. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
  140. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
  141. package/dist/es2019/plugins/table/reducer.js +0 -9
  142. package/dist/es2019/plugins/table/toolbar.js +1 -4
  143. package/dist/es2019/plugins/table/transforms/metadata.js +1 -1
  144. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +1 -1
  145. package/dist/es2019/plugins/table/ui/FloatingContextualButton/{styles.css.js → styles.js} +0 -0
  146. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +3 -2
  147. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/{styles.css.js → styles.js} +0 -0
  148. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  149. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +1 -2
  150. package/dist/es2019/plugins/table/ui/{common-styles.css.js → common-styles.js} +57 -27
  151. package/dist/es2019/plugins/table/ui/{ui-styles.css.js → ui-styles.js} +99 -78
  152. package/dist/es2019/plugins/table/utils/nodes.js +11 -11
  153. package/dist/es2019/plugins/tasks-and-decisions/commands.js +13 -1
  154. package/dist/es2019/plugins/text-formatting/styles.js +3 -3
  155. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +61 -2
  156. package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
  157. package/dist/es2019/plugins/text-formatting/utils.js +13 -1
  158. package/dist/es2019/plugins/type-ahead/api.js +31 -2
  159. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +17 -5
  160. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +12 -0
  161. package/dist/es2019/plugins/type-ahead/utils.js +15 -0
  162. package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
  163. package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +2 -2
  164. package/dist/es2019/ui/ContentStyles/index.js +46 -24
  165. package/dist/es2019/utils/index.js +1 -1
  166. package/dist/es2019/utils/insert.js +2 -10
  167. package/dist/es2019/utils/selection.js +1 -6
  168. package/dist/es2019/version-wrapper.js +1 -1
  169. package/dist/es2019/version.json +1 -1
  170. package/dist/esm/actions/index.js +76 -48
  171. package/dist/esm/extensibility.js +1 -1
  172. package/dist/esm/labs/next/full-page.js +2 -2
  173. package/dist/esm/plugins/block-type/styles.js +4 -2
  174. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +14 -12
  175. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +9 -5
  176. package/dist/esm/plugins/card/messages.js +4 -4
  177. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +25 -9
  178. package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +57 -5
  179. package/dist/esm/plugins/card/ui/LinkToolbarIconDropdown.js +154 -5
  180. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +9 -6
  181. package/dist/esm/plugins/card/ui/assets/card.js +1 -1
  182. package/dist/esm/plugins/card/ui/assets/embed.js +1 -1
  183. package/dist/esm/plugins/card/ui/assets/inline.js +1 -1
  184. package/dist/esm/plugins/card/ui/assets/url.js +1 -1
  185. package/dist/esm/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
  186. package/dist/esm/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
  187. package/dist/esm/plugins/card/ui/styled.js +2 -2
  188. package/dist/esm/plugins/card/ui/types.js +1 -0
  189. package/dist/esm/plugins/clipboard/pm-plugins/main.js +91 -2
  190. package/dist/esm/plugins/code-block/styles.js +42 -38
  191. package/dist/esm/plugins/extension/plugin-factory.js +3 -1
  192. package/dist/esm/plugins/extension/pm-plugins/main.js +34 -11
  193. package/dist/esm/plugins/extension/utils.js +51 -9
  194. package/dist/esm/plugins/find-replace/ui/Find.js +1 -1
  195. package/dist/esm/plugins/find-replace/ui/FindReplace.js +1 -1
  196. package/dist/esm/plugins/find-replace/ui/Replace.js +1 -1
  197. package/dist/esm/plugins/find-replace/ui/styles.js +6 -10
  198. package/dist/esm/plugins/layout/styles.js +2 -2
  199. package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +168 -0
  200. package/dist/esm/plugins/list/commands/index.js +33 -34
  201. package/dist/esm/plugins/list/utils/replace-content.js +21 -0
  202. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  203. package/dist/esm/plugins/media/styles.js +1 -1
  204. package/dist/esm/plugins/media/utils/media-single.js +12 -1
  205. package/dist/esm/plugins/paste/handlers.js +19 -5
  206. package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
  207. package/dist/esm/plugins/placeholder-text/index.js +44 -1
  208. package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +67 -20
  209. package/dist/esm/plugins/placeholder-text/selection-utils.js +9 -0
  210. package/dist/esm/plugins/placeholder-text/styles.js +2 -1
  211. package/dist/esm/plugins/table/commands/index.js +1 -1
  212. package/dist/esm/plugins/table/commands/insert.js +1 -1
  213. package/dist/esm/plugins/table/commands/misc.js +5 -15
  214. package/dist/esm/plugins/table/commands-with-analytics.js +1 -1
  215. package/dist/esm/plugins/table/handlers.js +6 -2
  216. package/dist/esm/plugins/table/index.js +6 -11
  217. package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -2
  218. package/dist/esm/plugins/table/nodeviews/table.js +6 -37
  219. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +1 -1
  220. package/dist/esm/plugins/table/pm-plugins/main.js +2 -1
  221. package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +1 -2
  222. package/dist/esm/plugins/table/pm-plugins/plugin-key.js +2 -0
  223. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
  224. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
  225. package/dist/esm/plugins/table/reducer.js +0 -7
  226. package/dist/esm/plugins/table/toolbar.js +1 -10
  227. package/dist/esm/plugins/table/transforms/metadata.js +1 -1
  228. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +1 -1
  229. package/dist/esm/plugins/table/ui/FloatingContextualButton/{styles.css.js → styles.js} +0 -0
  230. package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +3 -2
  231. package/dist/esm/plugins/table/ui/FloatingContextualMenu/{styles.css.js → styles.js} +0 -0
  232. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  233. package/dist/esm/plugins/table/ui/LayoutButton/index.js +1 -2
  234. package/dist/esm/plugins/table/ui/common-styles.js +27 -0
  235. package/dist/esm/plugins/table/ui/ui-styles.js +68 -0
  236. package/dist/esm/plugins/table/utils/nodes.js +14 -14
  237. package/dist/esm/plugins/tasks-and-decisions/commands.js +13 -1
  238. package/dist/esm/plugins/text-formatting/styles.js +4 -2
  239. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +69 -2
  240. package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
  241. package/dist/esm/plugins/text-formatting/utils.js +18 -0
  242. package/dist/esm/plugins/type-ahead/api.js +30 -2
  243. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +16 -4
  244. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +12 -0
  245. package/dist/esm/plugins/type-ahead/utils.js +17 -3
  246. package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
  247. package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +2 -2
  248. package/dist/esm/ui/ContentStyles/index.js +28 -10
  249. package/dist/esm/utils/index.js +1 -1
  250. package/dist/esm/utils/insert.js +2 -10
  251. package/dist/esm/utils/selection.js +1 -6
  252. package/dist/esm/version-wrapper.js +1 -1
  253. package/dist/esm/version.json +1 -1
  254. package/dist/types/actions/index.d.ts +2 -2
  255. package/dist/types/extensibility.d.ts +1 -1
  256. package/dist/types/plugins/analytics/types/list-events.d.ts +0 -1
  257. package/dist/types/plugins/block-type/styles.d.ts +2 -1
  258. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
  259. package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +2 -7
  260. package/dist/types/plugins/card/messages.d.ts +2 -2
  261. package/dist/types/plugins/card/ui/LinkToolbarButtonGroup.d.ts +18 -2
  262. package/dist/types/plugins/card/ui/LinkToolbarIconDropdown.d.ts +23 -3
  263. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +3 -1
  264. package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +5 -0
  265. package/dist/types/plugins/card/ui/link-toolbar-icon-dropdown-options.d.ts +5 -0
  266. package/dist/types/plugins/card/ui/styled.d.ts +2 -3
  267. package/dist/types/plugins/card/ui/types.d.ts +12 -0
  268. package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +10 -1
  269. package/dist/types/plugins/code-block/styles.d.ts +3 -2
  270. package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -1
  271. package/dist/types/plugins/extension/types.d.ts +1 -0
  272. package/dist/types/plugins/extension/utils.d.ts +3 -1
  273. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +2 -1
  274. package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -5
  275. package/dist/types/plugins/layout/styles.d.ts +1 -1
  276. package/dist/types/plugins/list/actions/wrap-and-join-lists.d.ts +25 -0
  277. package/dist/types/plugins/list/commands/index.d.ts +0 -1
  278. package/dist/types/plugins/list/utils/replace-content.d.ts +8 -0
  279. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +2 -2
  280. package/dist/types/plugins/media/styles.d.ts +1 -1
  281. package/dist/types/plugins/media/utils/media-single.d.ts +1 -0
  282. package/dist/types/plugins/panel/styles.d.ts +1 -1
  283. package/dist/types/plugins/paste/handlers.d.ts +1 -1
  284. package/dist/types/plugins/placeholder-text/placeholder-text-nodeview.d.ts +3 -2
  285. package/dist/types/plugins/placeholder-text/selection-utils.d.ts +2 -0
  286. package/dist/types/plugins/rule/styles.d.ts +1 -1
  287. package/dist/types/plugins/table/commands/index.d.ts +1 -1
  288. package/dist/types/plugins/table/commands/misc.d.ts +0 -1
  289. package/dist/types/plugins/table/nodeviews/table.d.ts +0 -1
  290. package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +1 -4
  291. package/dist/types/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
  292. package/dist/types/plugins/table/types.d.ts +1 -8
  293. package/dist/types/plugins/table/ui/FloatingContextualButton/{styles.css.d.ts → styles.d.ts} +0 -0
  294. package/dist/types/plugins/table/ui/FloatingContextualMenu/{styles.css.d.ts → styles.d.ts} +0 -0
  295. package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +0 -1
  296. package/dist/types/plugins/table/ui/common-styles.d.ts +6 -0
  297. package/dist/types/plugins/table/ui/ui-styles.d.ts +15 -0
  298. package/dist/types/plugins/table/utils/nodes.d.ts +6 -6
  299. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
  300. package/dist/types/plugins/text-formatting/styles.d.ts +2 -1
  301. package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +30 -0
  302. package/dist/types/plugins/text-formatting/utils.d.ts +4 -0
  303. package/dist/types/plugins/type-ahead/api.d.ts +11 -1
  304. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +1 -0
  305. package/dist/types/plugins/type-ahead/utils.d.ts +4 -0
  306. package/dist/types/ui/ContentStyles/index.d.ts +1 -0
  307. package/dist/types/utils/index.d.ts +1 -1
  308. package/dist/types/utils/selection.d.ts +0 -1
  309. package/package.json +28 -26
  310. package/dist/cjs/plugins/table/ui/common-styles.css.js +0 -44
  311. package/dist/cjs/plugins/table/ui/ui-styles.css.js +0 -95
  312. package/dist/esm/plugins/table/ui/common-styles.css.js +0 -23
  313. package/dist/esm/plugins/table/ui/ui-styles.css.js +0 -59
  314. package/dist/types/plugins/table/ui/common-styles.css.d.ts +0 -3
  315. package/dist/types/plugins/table/ui/ui-styles.css.d.ts +0 -14
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.autoJoin = autoJoin;
7
+ exports.wrapInList = wrapInList;
8
+ exports.wrapInListAndJoin = wrapInListAndJoin;
9
+
10
+ var _prosemirrorModel = require("prosemirror-model");
11
+
12
+ var _prosemirrorTransform = require("prosemirror-transform");
13
+
14
+ /**
15
+ * Wraps the selection in a list with the given type. If this results in
16
+ * two adjacent lists of the same type, those will be joined together.
17
+ */
18
+ function wrapInListAndJoin(nodeType, tr) {
19
+ wrapInList(nodeType)(tr);
20
+ autoJoin(tr, function (before, after) {
21
+ return before.type === after.type && before.type === nodeType;
22
+ });
23
+ }
24
+ /**
25
+ * Wraps the selection in a list with the given type and attributes.
26
+ *
27
+ * Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L64-L89
28
+ */
29
+
30
+
31
+ function wrapInList(listType, attrs) {
32
+ return function (tr) {
33
+ var _tr$selection = tr.selection,
34
+ $from = _tr$selection.$from,
35
+ $to = _tr$selection.$to;
36
+ var range = $from.blockRange($to);
37
+ var doJoin = false;
38
+ var outerRange = range;
39
+
40
+ if (!range) {
41
+ return false;
42
+ } // This is at the top of an existing list item
43
+
44
+
45
+ if (range.depth >= 2 && // @ts-ignore - missing type for compatibleContent
46
+ $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex === 0) {
47
+ // Don't do anything if this is the top of the list
48
+ if ($from.index(range.depth - 1) === 0) {
49
+ return false;
50
+ }
51
+
52
+ var $insert = tr.doc.resolve(range.start - 2);
53
+ outerRange = new _prosemirrorModel.NodeRange($insert, $insert, range.depth);
54
+
55
+ if (range.endIndex < range.parent.childCount) {
56
+ range = new _prosemirrorModel.NodeRange($from, tr.doc.resolve($to.end(range.depth)), range.depth);
57
+ }
58
+
59
+ doJoin = true;
60
+ }
61
+
62
+ var wrap = (0, _prosemirrorTransform.findWrapping)(outerRange, listType, attrs, range);
63
+
64
+ if (!wrap) {
65
+ return false;
66
+ }
67
+
68
+ tr = doWrapInList(tr, range, wrap, doJoin, listType);
69
+ return true;
70
+ };
71
+ }
72
+ /**
73
+ * Internal function used by wrapInList
74
+ *
75
+ * Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L91-L112
76
+ */
77
+
78
+
79
+ function doWrapInList(tr, range, wrappers, joinBefore, listType) {
80
+ var content = _prosemirrorModel.Fragment.empty;
81
+
82
+ for (var i = wrappers.length - 1; i >= 0; i--) {
83
+ content = _prosemirrorModel.Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
84
+ }
85
+
86
+ tr.step(new _prosemirrorTransform.ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new _prosemirrorModel.Slice(content, 0, 0), wrappers.length, true));
87
+ var found = 0;
88
+
89
+ for (var _i = 0; _i < wrappers.length; _i++) {
90
+ if (wrappers[_i].type === listType) {
91
+ found = _i + 1;
92
+ }
93
+ }
94
+
95
+ var splitDepth = wrappers.length - found;
96
+ var splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0);
97
+ var parent = range.parent;
98
+
99
+ for (var _i2 = range.startIndex, e = range.endIndex, first = true; _i2 < e; _i2++, first = false) {
100
+ if (!first && (0, _prosemirrorTransform.canSplit)(tr.doc, splitPos, splitDepth)) {
101
+ tr.split(splitPos, splitDepth);
102
+ splitPos += 2 * splitDepth;
103
+ }
104
+
105
+ splitPos += parent.child(_i2).nodeSize;
106
+ }
107
+
108
+ return tr;
109
+ }
110
+ /**
111
+ * Checks whether two adjacent nodes can be joined. If so, the document
112
+ * will be updated to join those nodes. If not, the original transaction
113
+ * remains untouched.
114
+ *
115
+ * Nodes are considered joinable if the `isJoinable` predicate returns true.
116
+ *
117
+ * Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
118
+ */
119
+
120
+
121
+ function autoJoin(tr, isJoinable) {
122
+ if (!tr.isGeneric) {
123
+ return;
124
+ }
125
+
126
+ var ranges = [];
127
+
128
+ for (var i = 0; i < tr.mapping.maps.length; i++) {
129
+ var map = tr.mapping.maps[i];
130
+
131
+ for (var j = 0; j < ranges.length; j++) {
132
+ ranges[j] = map.map(ranges[j]);
133
+ }
134
+
135
+ map.forEach(function (_s, _e, from, to) {
136
+ return ranges.push(from, to);
137
+ });
138
+ } // Figure out which joinable points exist inside those ranges,
139
+ // by checking all node boundaries in their parent nodes.
140
+
141
+
142
+ var joinable = [];
143
+
144
+ for (var _i3 = 0; _i3 < ranges.length; _i3 += 2) {
145
+ var from = ranges[_i3];
146
+ var to = ranges[_i3 + 1];
147
+ var $from = tr.doc.resolve(from);
148
+ var depth = $from.sharedDepth(to);
149
+ var parent = $from.node(depth);
150
+
151
+ for (var index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
152
+ var _after = parent.maybeChild(index);
153
+
154
+ if (!_after) {
155
+ break;
156
+ }
157
+
158
+ if (index && joinable.indexOf(pos) === -1) {
159
+ var _before = parent.child(index - 1);
160
+
161
+ if (_before.type === _after.type && isJoinable(_before, _after)) {
162
+ joinable.push(pos);
163
+ }
164
+ }
165
+
166
+ pos += _after.nodeSize;
167
+ }
168
+ } // Join the joinable points
169
+
170
+
171
+ joinable.sort(function (a, b) {
172
+ return a - b;
173
+ });
174
+
175
+ for (var _i4 = joinable.length - 1; _i4 >= 0; _i4--) {
176
+ if ((0, _prosemirrorTransform.canJoin)(tr.doc, joinable[_i4])) {
177
+ tr.join(joinable[_i4]);
178
+ }
179
+ }
180
+ }
@@ -24,18 +24,13 @@ exports.rootListDepth = void 0;
24
24
  exports.toggleBulletList = toggleBulletList;
25
25
  exports.toggleList = toggleList;
26
26
  exports.toggleOrderedList = toggleOrderedList;
27
- exports.wrapInList = wrapInList;
28
27
 
29
28
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
30
29
 
31
30
  var _prosemirrorModel = require("prosemirror-model");
32
31
 
33
- var _prosemirrorTransform = require("prosemirror-transform");
34
-
35
32
  var baseCommand = _interopRequireWildcard(require("prosemirror-commands"));
36
33
 
37
- var baseListCommand = _interopRequireWildcard(require("prosemirror-schema-list"));
38
-
39
34
  var _prosemirrorUtils = require("prosemirror-utils");
40
35
 
41
36
  var _document = require("../../../utils/document");
@@ -60,10 +55,14 @@ var _joinListItemForward = require("./join-list-item-forward");
60
55
 
61
56
  var _conversions = require("../actions/conversions");
62
57
 
58
+ var _wrapAndJoinLists = require("../actions/wrap-and-join-lists");
59
+
63
60
  var _outdentList = require("./outdent-list");
64
61
 
65
62
  var _indentList = require("./indent-list");
66
63
 
64
+ var _replaceContent = require("../utils/replace-content");
65
+
67
66
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
68
67
 
69
68
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -147,8 +146,8 @@ function untoggleSelectedList(tr) {
147
146
 
148
147
  function toggleList(inputMethod, listType) {
149
148
  return function (state, dispatch) {
150
- var customTr = state.tr;
151
- var listInsideSelection = (0, _selection.selectionContainsList)(customTr);
149
+ var tr = state.tr;
150
+ var listInsideSelection = (0, _selection.selectionContainsList)(tr);
152
151
  var listNodeType = state.schema.nodes[listType];
153
152
  var actionSubjectId = listType === 'bulletList' ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
154
153
 
@@ -159,9 +158,9 @@ function toggleList(inputMethod, listType) {
159
158
  var transformedFrom = listInsideSelection.type.name === 'bulletList' ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
160
159
 
161
160
  if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
162
- var tr = state.tr;
163
- untoggleSelectedList(tr);
164
- (0, _analytics.addAnalytics)(state, tr, {
161
+ var _tr2 = state.tr;
162
+ untoggleSelectedList(_tr2);
163
+ (0, _analytics.addAnalytics)(state, _tr2, {
165
164
  action: _analytics.ACTION.CONVERTED,
166
165
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
167
166
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.TEXT,
@@ -173,17 +172,17 @@ function toggleList(inputMethod, listType) {
173
172
  });
174
173
 
175
174
  if (dispatch) {
176
- dispatch(tr);
175
+ dispatch(_tr2);
177
176
  }
178
177
 
179
178
  return true;
180
179
  }
181
180
 
182
181
  (0, _conversions.convertListType)({
183
- tr: customTr,
182
+ tr: tr,
184
183
  nextListNodeType: listNodeType
185
184
  });
186
- (0, _analytics.addAnalytics)(state, customTr, {
185
+ (0, _analytics.addAnalytics)(state, tr, {
187
186
  action: _analytics.ACTION.CONVERTED,
188
187
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
189
188
  actionSubjectId: actionSubjectId,
@@ -194,17 +193,11 @@ function toggleList(inputMethod, listType) {
194
193
  })
195
194
  });
196
195
  } else {
197
- var replaceCurrentTr = function replaceCurrentTr(tr) {
198
- customTr = tr;
199
- }; // NOTE: replaceCurrentTr is supplied here instead of the usual dispatch function
200
- // to 'mutate' the transaction without actually dispatching (as it is more performant
201
- // if we only dispatch once at the end). This means customTr should not be modified
202
- // until after wrapInList, since any changes made to it will be discarded when it
203
- // gets replaced with the transaction generated by wrapInList.
204
-
205
-
206
- wrapInList(listNodeType)(state, replaceCurrentTr);
207
- (0, _analytics.addAnalytics)(state, customTr, {
196
+ // Need to have this before wrapInList so the wrapping is done with valid content
197
+ // For example, if trying to convert centre or right aligned paragraphs to lists
198
+ (0, _utils.sanitiseMarksInSelection)(tr, listNodeType);
199
+ (0, _wrapAndJoinLists.wrapInListAndJoin)(listNodeType, tr);
200
+ (0, _analytics.addAnalytics)(state, tr, {
208
201
  action: _analytics.ACTION.INSERTED,
209
202
  actionSubject: _analytics.ACTION_SUBJECT.LIST,
210
203
  actionSubjectId: actionSubjectId,
@@ -213,18 +206,16 @@ function toggleList(inputMethod, listType) {
213
206
  inputMethod: inputMethod
214
207
  }
215
208
  });
216
- } // if document wasn't changed, that means setNodeMarkup step didn't work, so
217
- // return false from the command to indicate that the editing action failed
209
+ } // If document wasn't changed, return false from the command to indicate that the
210
+ // editing action failed
218
211
 
219
212
 
220
- if (!customTr.docChanged) {
213
+ if (!tr.docChanged) {
221
214
  return false;
222
215
  }
223
216
 
224
- (0, _utils.sanitiseMarksInSelection)(customTr, listNodeType);
225
-
226
217
  if (dispatch) {
227
- dispatch(customTr);
218
+ dispatch(tr);
228
219
  }
229
220
 
230
221
  return true;
@@ -240,12 +231,6 @@ function toggleOrderedList(view) {
240
231
  var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
241
232
  return toggleList(inputMethod, 'orderedList')(view.state, view.dispatch);
242
233
  }
243
-
244
- function wrapInList(nodeType) {
245
- return baseCommand.autoJoin(baseListCommand.wrapInList(nodeType), function (before, after) {
246
- return before.type === after.type && before.type === nodeType;
247
- });
248
- }
249
234
  /**
250
235
  * Implementation taken and modified for our needs from PM
251
236
  * @param itemType Node
@@ -377,8 +362,20 @@ var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
377
362
  var list = $cut.nodeBefore.copy($cut.nodeBefore.content.append(_prosemirrorModel.Fragment.from(listItem.createChecked({}, $cut.nodeAfter))));
378
363
  tr.replaceWith(nodeBeforePos, $from.pos + $cut.nodeAfter.nodeSize, list);
379
364
  } else {
380
- // take the text content of the paragraph and insert after the paragraph up until before the the cut
381
- tr = state.tr.step(new _prosemirrorTransform.ReplaceAroundStep($lastNode.pos, $cut.pos + $cut.nodeAfter.nodeSize, $cut.pos + 1, $cut.pos + $cut.nodeAfter.nodeSize - 1, state.tr.doc.slice($lastNode.pos, $cut.pos), 0, true));
365
+ var step = (0, _replaceContent.moveTargetIntoList)({
366
+ insertPosition: $lastNode.pos,
367
+ $target: $cut
368
+ }); // ED-13966: check if the step will cause an ProseMirror error
369
+ // if there's an error don't apply the step as it will might lead into a data loss.
370
+ // It doesn't play well with media being a leaf node.
371
+
372
+ var stepResult = state.tr.maybeStep(step);
373
+
374
+ if (stepResult.failed) {
375
+ return false;
376
+ } else {
377
+ tr = state.tr.step(step);
378
+ }
382
379
  } // find out if there's now another list following and join them
383
380
  // as in, [list, p, list] => [list with p, list], and we want [joined list]
384
381
 
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.moveTargetIntoList = void 0;
7
+
8
+ var _prosemirrorTransform = require("prosemirror-transform");
9
+
10
+ var moveTargetIntoList = function moveTargetIntoList(_ref) {
11
+ var _$target$nodeAfter;
12
+
13
+ var insertPosition = _ref.insertPosition,
14
+ $target = _ref.$target;
15
+ // take the text content of the paragraph and insert after the paragraph up until before the the cut
16
+ var from = insertPosition;
17
+ var to = $target.pos + (((_$target$nodeAfter = $target.nodeAfter) === null || _$target$nodeAfter === void 0 ? void 0 : _$target$nodeAfter.nodeSize) || 0); //$cut.pos + $cut.nodeAfter.nodeSize;
18
+
19
+ var gapFrom = $target.posAtIndex(0, $target.depth + 1); // start pos of the child
20
+
21
+ var gapTo = $target.doc.resolve(gapFrom).end(); // end pos of the paragraph
22
+
23
+ if (gapTo - gapFrom === 0) {
24
+ return new _prosemirrorTransform.ReplaceStep(from, to, $target.doc.slice(insertPosition, $target.pos));
25
+ }
26
+
27
+ var step = new _prosemirrorTransform.ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
28
+ return step;
29
+ };
30
+
31
+ exports.moveTargetIntoList = moveTargetIntoList;
@@ -192,7 +192,7 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
192
192
 
193
193
  case 2:
194
194
  contextIdentifierProvider = _context3.sent;
195
- return _context3.abrupt("return", contextIdentifierProvider && contextIdentifierProvider.objectId);
195
+ return _context3.abrupt("return", (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null);
196
196
 
197
197
  case 4:
198
198
  case "end":
@@ -278,10 +278,10 @@ var MediaNodeUpdater = /*#__PURE__*/function () {
278
278
  var attrs = _this.getAttrs();
279
279
 
280
280
  if (!attrs || attrs.type !== 'file') {
281
- return undefined;
281
+ return null;
282
282
  }
283
283
 
284
- return attrs.__contextId;
284
+ return attrs.__contextId || null;
285
285
  });
286
286
  (0, _defineProperty2.default)(this, "updateDimensions", function (dimensions) {
287
287
  (0, _helpers.updateAllMediaNodesAttrs)(dimensions.id, {
@@ -9,7 +9,7 @@ exports.mediaStyles = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
11
 
12
- var _styledComponents = require("styled-components");
12
+ var _react = require("@emotion/react");
13
13
 
14
14
  var _styles = require("@atlaskit/editor-common/styles");
15
15
 
@@ -21,7 +21,7 @@ var _mediaCard = require("@atlaskit/media-card");
21
21
 
22
22
  var _templateObject;
23
23
 
24
- var mediaStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s;\n transition: box-shadow 0s;\n }\n .mediaGroupView-content-wrap.danger {\n /* Media inline */\n .", "::after {\n border: 1px solid ", ";\n }\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px ", " !important;\n }\n /* Media resize handlers */\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: rgb(255, 189, 173, 0.5); /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n"])), _styles.mediaSingleSharedStyle, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _styles.richMediaClassName, _styles.richMediaClassName, _colors.N60, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _colors.B200, _editorSharedStyles.akEditorDeleteBackground, _editorSharedStyles.akEditorSelectedBorderBoldSize, _editorSharedStyles.akEditorDeleteBorder, _mediaCard.fileCardImageViewSelectedSelector, _editorSharedStyles.akEditorDeleteIconColor, _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, _editorSharedStyles.akEditorDeleteIconColor, _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, _editorSharedStyles.akEditorDeleteIconColor, _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, _editorSharedStyles.akEditorDeleteIconColor, _editorSharedStyles.akEditorDeleteIconColor);
24
+ var mediaStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n ", " & [layout='full-width'] .", ",\n & [layout='wide'] .", " {\n margin-left: 50%;\n transform: translateX(-50%);\n }\n\n & [layout^='wrap-'] + [layout^='wrap-'] {\n clear: none;\n & + p,\n & + div[class^='fabric-editor-align'],\n & + ul,\n & + ol,\n & + h1,\n & + h2,\n & + h3,\n & + h4,\n & + h5,\n & + h6 {\n clear: both !important;\n }\n & .", " {\n margin-left: 0;\n margin-right: 0;\n }\n }\n\n .mediaSingleView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n // overwrite default Prosemirror setting making it clear: both\n clear: inherit;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .mediaSingleView-content-wrap[layout='wrap-right']\n + .mediaSingleView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n\n /* Larger margins for resize handlers when at depth 0 of the document */\n & > .mediaSingleView-content-wrap {\n .richMedia-resize-handle-right {\n margin-right: -", "px;\n }\n .richMedia-resize-handle-left {\n margin-left: -", "px;\n }\n }\n }\n\n .richMedia-resize-handle-right,\n .richMedia-resize-handle-left {\n display: flex;\n flex-direction: column;\n\n /* vertical align */\n justify-content: center;\n }\n\n .richMedia-resize-handle-right {\n align-items: flex-end;\n padding-right: 12px;\n margin-right: -", "px;\n }\n\n .richMedia-resize-handle-left {\n align-items: flex-start;\n padding-left: 12px;\n margin-left: -", "px;\n }\n\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n content: ' ';\n display: flex;\n width: 3px;\n height: 64px;\n\n border-radius: 6px;\n }\n\n .", ":hover .richMedia-resize-handle-left::after,\n .", ":hover .richMedia-resize-handle-right::after {\n background: ", ";\n }\n\n .", " .richMedia-resize-handle-right::after,\n .", " .richMedia-resize-handle-left::after,\n .", " .richMedia-resize-handle-right:hover::after,\n .", " .richMedia-resize-handle-left:hover::after,\n .", ".is-resizing .richMedia-resize-handle-right::after,\n .", ".is-resizing .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n .__resizable_base__ {\n left: unset !important;\n width: auto !important;\n height: auto !important;\n }\n\n /* Danger when top level node for smart cards / inline links */\n .danger > div > div > .media-card-frame,\n .danger > span > a {\n background-color: ", ";\n box-shadow: 0px 0px 0px ", "px\n ", ";\n transition: background-color 0s;\n transition: box-shadow 0s;\n }\n .mediaGroupView-content-wrap.danger {\n /* Media inline */\n .", "::after {\n border: 1px solid ", ";\n }\n }\n /* Danger when nested node or common */\n .danger {\n /* Media single */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* Media single video player */\n .", " .", "::after {\n border: 1px solid ", ";\n }\n /* New file experience */\n .", " .", " {\n box-shadow: 0 0 0 1px ", " !important;\n }\n /* Media resize handlers */\n .richMedia-resize-handle-right::after,\n .richMedia-resize-handle-left::after {\n background: ", ";\n }\n\n /* Smart cards */\n div div .media-card-frame,\n .inlineCardView-content-wrap > span > a {\n background-color: rgb(255, 189, 173, 0.5); /* R75 with 50% opactiy */\n transition: background-color 0s;\n }\n\n div div .media-card-frame::after {\n box-shadow: none;\n }\n }\n"])), _styles.mediaSingleSharedStyle, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _editorSharedStyles.akEditorMediaResizeHandlerPadding, _styles.richMediaClassName, _styles.richMediaClassName, _colors.N60, _editorSharedStyles.akEditorSelectedNodeClassName, _editorSharedStyles.akEditorSelectedNodeClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _styles.richMediaClassName, _colors.B200, _editorSharedStyles.akEditorDeleteBackground, _editorSharedStyles.akEditorSelectedBorderBoldSize, _editorSharedStyles.akEditorDeleteBorder, _mediaCard.fileCardImageViewSelectedSelector, _editorSharedStyles.akEditorDeleteIconColor, _styles.richMediaClassName, _mediaCard.fileCardImageViewSelector, _editorSharedStyles.akEditorDeleteIconColor, _styles.richMediaClassName, _mediaCard.inlinePlayerClassName, _editorSharedStyles.akEditorDeleteIconColor, _styles.richMediaClassName, _mediaCard.newFileExperienceClassName, _editorSharedStyles.akEditorDeleteIconColor, _editorSharedStyles.akEditorDeleteIconColor);
25
25
  /* `left: unset` above is to work around Chrome bug where rendering a div with
26
26
  * that style applied inside a container that has a scroll, causes any svgs on
27
27
  * the page, without a border, that are inside a flexbox, to no longer align to
@@ -5,7 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.isMediaSingle = exports.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.createMediaSingleNode = exports.calcMediaPxWidth = void 0;
8
+ exports.insertMediaSingleNode = exports.insertMediaAsMediaSingle = exports.createMediaSingleNode = exports.calcMediaPxWidth = void 0;
9
+ exports.isCaptionNode = isCaptionNode;
10
+ exports.isMediaSingle = void 0;
9
11
  exports.transformSliceForMedia = transformSliceForMedia;
10
12
 
11
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -288,4 +290,15 @@ exports.calcMediaPxWidth = calcMediaPxWidth;
288
290
 
289
291
  var calcPctWidth = function calcPctWidth(containerWidth, pctWidth, origWidth, origHeight) {
290
292
  return pctWidth && origWidth && origHeight && Math.ceil((0, _ui.calcPxFromPct)(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
291
- };
293
+ };
294
+
295
+ function isCaptionNode(editorView) {
296
+ var $from = editorView.state.selection.$from;
297
+ var immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
298
+
299
+ if (immediateWrapperParentNode && immediateWrapperParentNode.type.name === 'caption') {
300
+ return true;
301
+ }
302
+
303
+ return false;
304
+ }
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.flattenNestedListInSlice = flattenNestedListInSlice;
9
9
  exports.handleCodeBlock = handleCodeBlock;
10
- exports.handleExpand = handleExpand;
10
+ exports.handleExpandPasteInTable = handleExpandPasteInTable;
11
11
  exports.handleMacroAutoConvert = handleMacroAutoConvert;
12
12
  exports.handleMarkdown = handleMarkdown;
13
13
  exports.handleMediaSingle = handleMediaSingle;
@@ -105,8 +105,10 @@ function handlePasteIntoTaskAndDecision(slice) {
105
105
  taskList = _schema$nodes.taskList,
106
106
  taskItem = _schema$nodes.taskItem,
107
107
  text = _schema$nodes.text;
108
+ var isDecisionOrTaskNodeSelection = state.selection instanceof _prosemirrorState.NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
109
+ var hasParentDecisionOrTaskItem = (0, _prosemirrorUtils.hasParentNodeOfType)([decisionItem, taskItem])(state.selection);
108
110
 
109
- if (!decisionItem || !decisionList || !taskList || !taskItem || !(0, _prosemirrorUtils.hasParentNodeOfType)([decisionItem, taskItem])(state.selection)) {
111
+ if (!decisionItem || !decisionList || !taskList || !taskItem || !hasParentDecisionOrTaskItem && !isDecisionOrTaskNodeSelection) {
110
112
  return false;
111
113
  }
112
114
 
@@ -122,7 +124,15 @@ function handlePasteIntoTaskAndDecision(slice) {
122
124
 
123
125
  var transformedSlice = _utils.compose.apply(null, filters)(slice);
124
126
 
125
- var tr = (0, _prosemirrorHistory.closeHistory)(state.tr).replaceSelection(transformedSlice).scrollIntoView();
127
+ var tr = (0, _prosemirrorHistory.closeHistory)(state.tr);
128
+ var transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(transformedSlice.content.firstChild.type.name);
129
+
130
+ if (transformedSliceIsValidNode || isDecisionOrTaskNodeSelection) {
131
+ tr.replaceSelection(transformedSlice).scrollIntoView();
132
+ } else {
133
+ (0, _prosemirrorUtils.safeInsert)(transformedSlice.content)(tr).scrollIntoView();
134
+ }
135
+
126
136
  (0, _doc.queueCardsFromChangedTr)(state, tr, _analytics.INPUT_METHOD.CLIPBOARD);
127
137
 
128
138
  if (dispatch) {
@@ -448,9 +458,13 @@ function handleMediaSingle(inputMethod) {
448
458
  };
449
459
  }
450
460
 
451
- function handleExpand(slice) {
461
+ function handleExpandPasteInTable(slice) {
452
462
  return function (state, dispatch) {
453
- if (!(0, _utils.insideTable)(state)) {
463
+ var _slice$content$firstC;
464
+
465
+ // Do not handle expand if it's not being pasted into a table
466
+ // OR if it's nested within another node when being pasted into a table
467
+ if (!(0, _utils.insideTable)(state) || ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) !== 'expand') {
454
468
  return false;
455
469
  }
456
470
 
@@ -295,7 +295,7 @@ var handleRichTextWithAnalytics = function handleRichTextWithAnalytics(view, eve
295
295
  exports.handleRichTextWithAnalytics = handleRichTextWithAnalytics;
296
296
 
297
297
  var handleExpandWithAnalytics = function handleExpandWithAnalytics(view, event, slice) {
298
- return (0, _utils.pipe)(_handlers.handleExpand, pasteCommandWithAnalytics(view, event, slice, {
298
+ return (0, _utils.pipe)(_handlers.handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
299
299
  type: _analytics.PasteTypes.richText
300
300
  }))(slice);
301
301
  };
@@ -36,6 +36,24 @@ var _analytics = require("../analytics");
36
36
 
37
37
  var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
38
38
 
39
+ var _selectionUtils = require("./selection-utils");
40
+
41
+ var _api = require("../type-ahead/api");
42
+
43
+ var getOpenTypeAhead = function getOpenTypeAhead(view, content) {
44
+ var typeAheadAPI = (0, _api.createInternalTypeAheadTools)(view);
45
+ var typeAheadHandler = typeAheadAPI.findTypeAheadHandler(content);
46
+
47
+ if (!typeAheadHandler || !typeAheadHandler.id) {
48
+ return null;
49
+ }
50
+
51
+ return typeAheadAPI.openTypeAheadHandler({
52
+ triggerHandler: typeAheadHandler,
53
+ inputMethod: _analytics.INPUT_METHOD.KEYBOARD
54
+ });
55
+ };
56
+
39
57
  function createPlugin(dispatch, options) {
40
58
  var allowInserting = !!options.allowInserting;
41
59
  return new _safePlugin.SafePlugin({
@@ -106,6 +124,32 @@ function createPlugin(dispatch, options) {
106
124
  return;
107
125
  },
108
126
  props: {
127
+ handleDOMEvents: {
128
+ beforeinput: function beforeinput(view, event) {
129
+ var state = view.state;
130
+
131
+ if (event instanceof InputEvent && !event.isComposing && event.inputType === 'insertText' && (0, _selectionUtils.isSelectionAtPlaceholder)(view.state.selection)) {
132
+ event.stopPropagation();
133
+ event.preventDefault();
134
+ var startNodePosition = state.selection.from;
135
+ var content = event.data || '';
136
+ var tr = view.state.tr;
137
+ tr.delete(startNodePosition, startNodePosition + 1);
138
+ var openTypeAhead = getOpenTypeAhead(view, content);
139
+
140
+ if (openTypeAhead) {
141
+ openTypeAhead(tr);
142
+ } else {
143
+ tr.insertText(content);
144
+ }
145
+
146
+ view.dispatch(tr);
147
+ return true;
148
+ }
149
+
150
+ return false;
151
+ }
152
+ },
109
153
  nodeViews: {
110
154
  placeholder: function placeholder(node, view, getPos) {
111
155
  return new _placeholderTextNodeview.PlaceholderTextNodeView(node, view, getPos);
@@ -207,7 +251,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
207
251
  });
208
252
  },
209
253
  action: function action(insert, state) {
210
- var tr = insert(state.schema.nodes.placeholder.createChecked());
254
+ var tr = state.tr;
211
255
  tr.setMeta(_pluginKey.pluginKey, {
212
256
  showInsertPanelAt: tr.selection.anchor
213
257
  });