@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
@@ -5,16 +5,175 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.LinkToolbarIconDropdown = exports.ICON_WIDTH = exports.ICON_HEIGHT = void 0;
9
9
 
10
- var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
13
 
12
14
  var _react = _interopRequireDefault(require("react"));
13
15
 
14
- var LinkToolbarIconDropdown = function LinkToolbarIconDropdown(_ref) {
15
- (0, _objectDestructuringEmpty2.default)(_ref);
16
- return /*#__PURE__*/_react.default.createElement("span", null);
16
+ var _react2 = require("@emotion/react");
17
+
18
+ var _menu = require("@atlaskit/menu");
19
+
20
+ var _constants = require("@atlaskit/theme/constants");
21
+
22
+ var _colors = require("@atlaskit/theme/colors");
23
+
24
+ var _tokens = require("@atlaskit/tokens");
25
+
26
+ var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
27
+
28
+ var _Dropdown = _interopRequireDefault(require("../../floating-toolbar/ui/Dropdown"));
29
+
30
+ var _excluded = ["options"];
31
+ var ICON_HEIGHT = 40;
32
+ exports.ICON_HEIGHT = ICON_HEIGHT;
33
+ var ICON_WIDTH = 40;
34
+ exports.ICON_WIDTH = ICON_WIDTH;
35
+ var iconBoxStyles = (0, _react2.css)({
36
+ width: ICON_HEIGHT,
37
+ height: ICON_WIDTH,
38
+ overflow: 'hidden',
39
+ border: '1px solid rgba(223, 225, 229, 0.5)'
40
+ /* N60 at 50% */
41
+ ,
42
+ borderRadius: (0, _constants.borderRadius)(),
43
+ boxSizing: 'border-box',
44
+ display: 'flex',
45
+ justifyContent: 'center',
46
+ alignItems: 'center',
47
+ backgroundColor: (0, _tokens.token)('color.background.default', 'white')
48
+ });
49
+ var primitiveStyles = (0, _react2.css)({
50
+ padding: '0.75rem',
51
+ alignItems: 'flex-start'
52
+ });
53
+ var interactiveStyles = (0, _react2.css)({
54
+ '&:active': {
55
+ backgroundColor: (0, _tokens.token)('color.background.brand.pressed', _colors.B50),
56
+ color: (0, _tokens.token)('color.text.accent.blue', _colors.B400)
57
+ }
58
+ });
59
+ var unselectedStyles = (0, _react2.css)({
60
+ '&:hover': {
61
+ backgroundColor: (0, _tokens.token)('color.background.neutral.subtle.hovered', _colors.N20),
62
+ color: (0, _tokens.token)('color.text.brand', 'currentColor')
63
+ }
64
+ });
65
+ var selectedOptionStyles = (0, _react2.css)({
66
+ backgroundColor: (0, _tokens.token)('color.background.brand.pressed', _colors.B50),
67
+ color: (0, _tokens.token)('color.text.brand', 'currentColor'),
68
+ '&:hover': {
69
+ backgroundColor: (0, _tokens.token)('color.background.brand.pressed', _colors.B50),
70
+ color: (0, _tokens.token)('color.text.brand', 'currentColor')
71
+ }
72
+ });
73
+ var titleOffsetStyles = (0, _react2.css)({
74
+ marginTop: '0.125rem'
75
+ });
76
+
77
+ var getCustomStyles = function getCustomStyles(selected, disabled) {
78
+ if (disabled) {
79
+ return [primitiveStyles];
80
+ }
81
+
82
+ if (selected) {
83
+ return [primitiveStyles, selectedOptionStyles, interactiveStyles];
84
+ }
85
+
86
+ return [primitiveStyles, unselectedStyles, interactiveStyles];
87
+ };
88
+
89
+ var OptionRoot = function OptionRoot(props) {
90
+ return (0, _react2.jsx)("div", (0, _extends2.default)({}, props, {
91
+ tabIndex: 0
92
+ }));
93
+ };
94
+
95
+ var Option = function Option(_ref) {
96
+ var title = _ref.title,
97
+ description = _ref.description,
98
+ selected = _ref.selected,
99
+ disabled = _ref.disabled,
100
+ _onClick = _ref.onClick,
101
+ Icon = _ref.icon,
102
+ testId = _ref.testId,
103
+ tooltipContent = _ref.tooltipContent,
104
+ hide = _ref.hide;
105
+ var option = (0, _react2.jsx)(_menu.CustomItem, {
106
+ "aria-label": title,
107
+ component: OptionRoot,
108
+ iconBefore: (0, _react2.jsx)("div", {
109
+ css: iconBoxStyles
110
+ }, (0, _react2.jsx)(Icon, {
111
+ width: 38,
112
+ height: 38,
113
+ label: title
114
+ })),
115
+ css: getCustomStyles(selected, disabled),
116
+ description: description,
117
+ testId: testId,
118
+ onClick: function onClick(event) {
119
+ event.preventDefault();
120
+
121
+ if (!disabled) {
122
+ _onClick();
123
+
124
+ hide();
125
+ }
126
+ },
127
+ onKeyDown: function onKeyDown(event) {
128
+ if (event.key === 'Enter' || event.key === 'Space') {
129
+ event.preventDefault();
130
+
131
+ if (!disabled) {
132
+ _onClick();
133
+
134
+ hide();
135
+ }
136
+ }
137
+ },
138
+ role: "option",
139
+ "aria-selected": selected,
140
+ isSelected: selected,
141
+ isDisabled: disabled,
142
+ shouldDescriptionWrap: true
143
+ }, (0, _react2.jsx)("div", {
144
+ css: titleOffsetStyles
145
+ }, title));
146
+
147
+ if (tooltipContent) {
148
+ return (0, _react2.jsx)(_tooltip.default, {
149
+ content: tooltipContent
150
+ }, option);
151
+ }
152
+
153
+ return option;
154
+ };
155
+
156
+ var LinkToolbarIconDropdown = function LinkToolbarIconDropdown(_ref2) {
157
+ var options = _ref2.options,
158
+ rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
159
+ return (0, _react2.jsx)(_Dropdown.default, (0, _extends2.default)({}, rest, {
160
+ options: {
161
+ render: function render(_ref3) {
162
+ var hide = _ref3.hide;
163
+ return (0, _react2.jsx)(_menu.MenuGroup, null, (0, _react2.jsx)("div", {
164
+ role: "listbox"
165
+ }, (0, _react2.jsx)(_menu.Section, null, options.map(function (props) {
166
+ return (0, _react2.jsx)(Option, (0, _extends2.default)({
167
+ key: props.testId
168
+ }, props, {
169
+ hide: hide
170
+ }));
171
+ }))));
172
+ },
173
+ width: 320,
174
+ height: 200
175
+ }
176
+ }));
17
177
  };
18
178
 
19
- var _default = LinkToolbarIconDropdown;
20
- exports.default = _default;
179
+ exports.LinkToolbarIconDropdown = LinkToolbarIconDropdown;
@@ -25,13 +25,15 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
25
25
 
26
26
  var _react = _interopRequireDefault(require("react"));
27
27
 
28
+ var _react2 = require("@emotion/react");
29
+
28
30
  var _prosemirrorUtils = require("prosemirror-utils");
29
31
 
30
32
  var _ui = require("@atlaskit/editor-common/ui");
31
33
 
32
34
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
33
35
 
34
- var _embeds = require("@atlaskit/media-ui/embeds");
36
+ var _smartCard = require("@atlaskit/smart-card");
35
37
 
36
38
  var _styled = require("../../../ui/Resizer/styled");
37
39
 
@@ -358,11 +360,11 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
358
360
  // paddingBottom = (y + 32) / x
359
361
  // which can be achieved with css calc() as (1 / (x/y)) * 100)% + 32px
360
362
  heightDefiningStyles = {
361
- paddingBottom: "calc(".concat((1 / aspectRatio * 100).toFixed(3), "% + ").concat(_embeds.embedHeaderHeight, "px)")
363
+ paddingBottom: "calc(".concat((1 / aspectRatio * 100).toFixed(3), "% + ").concat(_smartCard.embedHeaderHeight, "px)")
362
364
  };
363
365
  }
364
366
 
365
- return /*#__PURE__*/_react.default.createElement("span", {
367
+ return (0, _react2.jsx)("span", {
366
368
  "data-testid": 'resizable-embed-card-height-definer',
367
369
  style: _objectSpread({
368
370
  display: 'block',
@@ -398,9 +400,10 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
398
400
  }
399
401
  });
400
402
 
401
- return /*#__PURE__*/_react.default.createElement(_styled2.EmbedSpacing, {
403
+ return (0, _react2.jsx)("div", {
404
+ css: _styled2.embedSpacingStyles,
402
405
  "data-testid": "resizable-embed-card-spacing"
403
- }, /*#__PURE__*/_react.default.createElement(_styled.Wrapper, {
406
+ }, (0, _react2.jsx)(_styled.Wrapper, {
404
407
  layout: layout,
405
408
  isResized: !!pctWidth,
406
409
  containerWidth: containerWidth || _editorSharedStyles.DEFAULT_EMBED_CARD_WIDTH,
@@ -408,7 +411,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
408
411
  return _this2.wrapper = elem;
409
412
  },
410
413
  fullWidthMode: fullWidthMode
411
- }, /*#__PURE__*/_react.default.createElement(_Resizer.default, (0, _extends2.default)({}, this.props, {
414
+ }, (0, _react2.jsx)(_Resizer.default, (0, _extends2.default)({}, this.props, {
412
415
  width: initialWidth // Starting or initial width of embed <iframe> itself.
413
416
  ,
414
417
  enable: enable,
@@ -24,7 +24,7 @@ var IconCardGlyph = function IconCardGlyph(props) {
24
24
  fillRule: "evenodd",
25
25
  clipRule: "evenodd",
26
26
  d: "M8 9c-1.10457 0-2 .89543-2 2v10c0 1.1046.89543 2 2 2h16c1.1046 0 2-.8954 2-2V11c0-1.10457-.8954-2-2-2H8Zm0 3c0-.5523.44772-1 1-1h2c.5523 0 1 .4477 1 1v2c0 .5523-.4477 1-1 1H9c-.55228 0-1-.4477-1-1v-2Zm5 1c0-.2761.2239-.5.5-.5h10c.2761 0 .5.2239.5.5s-.2239.5-.5.5h-10c-.2761 0-.5-.2239-.5-.5Zm-4 3c-.55228 0-1 .4477-1 1s.44772 1 1 1h14c.5523 0 1-.4477 1-1s-.4477-1-1-1H9Zm-1 4c0-.5523.44772-1 1-1h6c.5523 0 1 .4477 1 1s-.4477 1-1 1H9c-.55228 0-1-.4477-1-1Z",
27
- fill: "#42526E"
27
+ fill: "currentColor"
28
28
  }));
29
29
  };
30
30
 
@@ -24,7 +24,7 @@ var IconEmbedGlyph = function IconEmbedGlyph(props) {
24
24
  fillRule: "evenodd",
25
25
  clipRule: "evenodd",
26
26
  d: "M8 6c-1.10457 0-2 .89543-2 2v16c0 1.1046.89543 2 2 2h16c1.1046 0 2-.8954 2-2V8c0-1.10457-.8954-2-2-2H8Zm1 2c-.55228 0-1 .44772-1 1v2c0 .5523.44772 1 1 1h2c.5523 0 1-.4477 1-1V9c0-.55228-.4477-1-1-1H9Zm4.5 1.5c-.2761 0-.5.22386-.5.5 0 .2761.2239.5.5.5h10c.2761 0 .5-.2239.5-.5 0-.27614-.2239-.5-.5-.5h-10ZM9 14c-.55228 0-1 .4477-1 1v8c0 .5523.44772 1 1 1h14c.5523 0 1-.4477 1-1v-8c0-.5523-.4477-1-1-1H9Zm6 2.5c0 .8284-.6716 1.5-1.5 1.5s-1.5-.6716-1.5-1.5.6716-1.5 1.5-1.5 1.5.6716 1.5 1.5Zm0 5.5-1-1-2 2h8v-1.8L18 19l-3 3Z",
27
- fill: "#42526E"
27
+ fill: "currentColor"
28
28
  }));
29
29
  };
30
30
 
@@ -24,7 +24,7 @@ var IconInlineGlyph = function IconInlineGlyph(props) {
24
24
  fillRule: "evenodd",
25
25
  clipRule: "evenodd",
26
26
  d: "M8 12c-1.10457 0-2 .8954-2 2v4c0 1.1046.89543 2 2 2h16c1.1046 0 2-.8954 2-2v-4c0-1.1046-.8954-2-2-2H8Zm0 3c0-.5523.44772-1 1-1h2c.5523 0 1 .4477 1 1v2c0 .5523-.4477 1-1 1H9c-.55228 0-1-.4477-1-1v-2Zm5 1c0-.2761.2239-.5.5-.5h10c.2761 0 .5.2239.5.5s-.2239.5-.5.5h-10c-.2761 0-.5-.2239-.5-.5Z",
27
- fill: "#42526E"
27
+ fill: "currentColor"
28
28
  }));
29
29
  };
30
30
 
@@ -26,7 +26,7 @@ var IconUrlGlyph = function IconUrlGlyph(props) {
26
26
  width: "20",
27
27
  height: "2",
28
28
  rx: "1",
29
- fill: "#42526E"
29
+ fill: "currentColor"
30
30
  }));
31
31
  };
32
32
 
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getButtonGroupOption = void 0;
7
+
8
+ var _messages = require("../messages");
9
+
10
+ var _card = require("./assets/card");
11
+
12
+ var _embed = require("./assets/embed");
13
+
14
+ var _inline = require("./assets/inline");
15
+
16
+ var _url = require("./assets/url");
17
+
18
+ var appearancePropsMap = {
19
+ url: {
20
+ title: _messages.messages.urlTitle,
21
+ icon: _url.IconUrl
22
+ },
23
+ inline: {
24
+ title: _messages.messages.inlineTitle,
25
+ icon: _inline.IconInline
26
+ },
27
+ block: {
28
+ title: _messages.messages.blockTitle,
29
+ icon: _card.IconCard
30
+ },
31
+ embed: {
32
+ title: _messages.messages.embedTitle,
33
+ icon: _embed.IconEmbed
34
+ }
35
+ };
36
+
37
+ var getButtonGroupOption = function getButtonGroupOption(intl, dispatchCommand, _ref) {
38
+ var disabled = _ref.disabled,
39
+ _onClick = _ref.onClick,
40
+ selected = _ref.selected,
41
+ appearance = _ref.appearance,
42
+ testId = _ref.testId,
43
+ tooltip = _ref.tooltip;
44
+ var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
45
+ title = _appearancePropsMap.title,
46
+ icon = _appearancePropsMap.icon;
47
+ return {
48
+ title: intl.formatMessage(title),
49
+ icon: icon,
50
+ onClick: function onClick() {
51
+ return dispatchCommand(_onClick);
52
+ },
53
+ disabled: Boolean(disabled),
54
+ tooltipContent: tooltip || null,
55
+ testId: testId,
56
+ selected: selected
57
+ };
58
+ };
59
+
60
+ exports.getButtonGroupOption = getButtonGroupOption;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getIconDropdownOption = void 0;
7
+
8
+ var _messages = require("../messages");
9
+
10
+ var _card = require("./assets/card");
11
+
12
+ var _embed = require("./assets/embed");
13
+
14
+ var _inline = require("./assets/inline");
15
+
16
+ var _url = require("./assets/url");
17
+
18
+ var appearancePropsMap = {
19
+ url: {
20
+ title: _messages.messages.urlTitle,
21
+ description: _messages.messages.urlDescription,
22
+ icon: _url.IconUrl
23
+ },
24
+ inline: {
25
+ title: _messages.messages.inlineTitle,
26
+ description: _messages.messages.inlineDescription,
27
+ icon: _inline.IconInline
28
+ },
29
+ block: {
30
+ title: _messages.messages.blockTitle,
31
+ description: _messages.messages.blockDescription,
32
+ icon: _card.IconCard
33
+ },
34
+ embed: {
35
+ title: _messages.messages.embedTitle,
36
+ description: _messages.messages.embedDescription,
37
+ icon: _embed.IconEmbed
38
+ }
39
+ };
40
+
41
+ var getIconDropdownOption = function getIconDropdownOption(intl, dispatchCommand, _ref) {
42
+ var disabled = _ref.disabled,
43
+ _onClick = _ref.onClick,
44
+ selected = _ref.selected,
45
+ appearance = _ref.appearance,
46
+ testId = _ref.testId,
47
+ tooltip = _ref.tooltip;
48
+ var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
49
+ title = _appearancePropsMap.title,
50
+ description = _appearancePropsMap.description,
51
+ icon = _appearancePropsMap.icon;
52
+ return {
53
+ title: intl.formatMessage(title),
54
+ description: intl.formatMessage(description),
55
+ icon: icon,
56
+ onClick: function onClick() {
57
+ return dispatchCommand(_onClick);
58
+ },
59
+ selected: Boolean(selected),
60
+ disabled: Boolean(disabled),
61
+ tooltipContent: tooltip,
62
+ testId: testId
63
+ };
64
+ };
65
+
66
+ exports.getIconDropdownOption = getIconDropdownOption;
@@ -2,26 +2,18 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
- exports.embedCardStyles = exports.EmbedSpacing = void 0;
8
+ exports.embedSpacingStyles = exports.embedCardStyles = void 0;
11
9
 
12
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
11
 
14
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
12
+ var _react = require("@emotion/react");
15
13
 
16
14
  var _templateObject, _templateObject2;
17
15
 
18
- 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); }
19
-
20
- 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; }
21
-
22
- var embedCardStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .embedCardView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n }\n\n .embedCardView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .embedCardView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .embedCardView-content-wrap[layout='wrap-right']\n + .embedCardView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n }\n"])));
16
+ var embedCardStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror {\n .embedCardView-content-wrap[layout^='wrap-'] {\n max-width: 100%;\n }\n\n .embedCardView-content-wrap[layout='wrap-left'] {\n float: left;\n }\n\n .embedCardView-content-wrap[layout='wrap-right'] {\n float: right;\n }\n\n .embedCardView-content-wrap[layout='wrap-right']\n + .embedCardView-content-wrap[layout='wrap-left'] {\n clear: both;\n }\n }\n"])));
23
17
  exports.embedCardStyles = embedCardStyles;
24
-
25
- var EmbedSpacing = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 10px;\n"])));
26
-
27
- exports.EmbedSpacing = EmbedSpacing;
18
+ var embedSpacingStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 10px;\n"])));
19
+ exports.embedSpacingStyles = embedSpacingStyles;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -5,10 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.sendClipboardAnalytics = exports.createPlugin = void 0;
8
+ exports.sendClipboardAnalytics = exports.createPlugin = exports.createClipboardSerializer = void 0;
9
9
 
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
 
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
12
14
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
15
 
14
16
  var _prosemirrorState = require("prosemirror-state");
@@ -19,10 +21,33 @@ var _utils = require("../../selection/utils");
19
21
 
20
22
  var _enums = require("../../analytics/types/enums");
21
23
 
24
+ var _prosemirrorModel = require("prosemirror-model");
25
+
26
+ var _prosemirrorUtils = require("prosemirror-utils");
27
+
28
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
29
+
30
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
31
+
22
32
  var createPlugin = function createPlugin(_ref) {
23
- var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
33
+ var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
34
+ schema = _ref.schema;
35
+ var editorView;
36
+
37
+ var getEditorView = function getEditorView() {
38
+ return editorView;
39
+ };
40
+
24
41
  return new _safePlugin.SafePlugin({
25
42
  key: _pluginKey.clipboardPluginKey,
43
+ view: function view(_view) {
44
+ editorView = _view;
45
+ return {
46
+ update: function update(view) {
47
+ editorView = view;
48
+ }
49
+ };
50
+ },
26
51
  props: {
27
52
  handleDOMEvents: {
28
53
  cut: function cut(view) {
@@ -31,13 +56,84 @@ var createPlugin = function createPlugin(_ref) {
31
56
  copy: function copy(view) {
32
57
  return sendClipboardAnalytics(view, dispatchAnalyticsEvent, _enums.ACTION.COPIED);
33
58
  }
34
- }
59
+ },
60
+ clipboardSerializer: createClipboardSerializer(schema, getEditorView)
35
61
  }
36
62
  });
37
63
  };
64
+ /**
65
+ * Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
66
+ * This allows us to store the original table’s attributes on the new table that the row is wrapped with when it is being copied.
67
+ * e.g. keeping the layout on a row that is copied.
68
+ * We store the default serializer in order to call it after we handle the table row case.
69
+ */
70
+
38
71
 
39
72
  exports.createPlugin = createPlugin;
40
73
 
74
+ var createClipboardSerializer = function createClipboardSerializer(schema, getEditorView) {
75
+ var oldSerializer = _prosemirrorModel.DOMSerializer.fromSchema(schema);
76
+
77
+ var newSerializer = new _prosemirrorModel.DOMSerializer(oldSerializer.nodes, oldSerializer.marks);
78
+ var originalSerializeFragment = newSerializer.serializeFragment.bind(newSerializer);
79
+
80
+ newSerializer.serializeFragment = function (content) {
81
+ var _content$firstChild;
82
+
83
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
84
+ var target = arguments.length > 2 ? arguments[2] : undefined;
85
+ var editorView = getEditorView();
86
+ var selection = editorView.state.selection; // We do not need to handle when a user copies a tableRow + other content.
87
+ // In that scenario it already wraps the Row with correct Table and attributes.
88
+
89
+ if (!options.tableWrapperExists) {
90
+ var i = 0;
91
+
92
+ while (i < content.childCount) {
93
+ var _content$maybeChild;
94
+
95
+ if (((_content$maybeChild = content.maybeChild(i)) === null || _content$maybeChild === void 0 ? void 0 : _content$maybeChild.type.name) === 'table') {
96
+ options.tableWrapperExists = true;
97
+ break;
98
+ }
99
+
100
+ i++;
101
+ }
102
+ } // When the content being copied includes a tableRow that is not already wrapped with a table,
103
+ // We will wrap it with one ourselves, while preserving the parent table's attributes.
104
+
105
+
106
+ if (((_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name) === 'tableRow' && !options.tableWrapperExists) {
107
+ // We only want 1 table wrapping the rows.
108
+ // tableWrapperExist is a custom prop added solely for the purposes of this recursive algorithm.
109
+ // The function is recursively called for each node in the tree captured in the fragment.
110
+ // For recursive logic see the bind call above and the prosemirror-model (https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L44
111
+ // and https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L87)
112
+ options.tableWrapperExists = true;
113
+ var parentTable = (0, _prosemirrorUtils.findParentNodeOfType)(schema.nodes.table)(selection);
114
+ var attributes = parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs;
115
+ var newTable = schema.nodes.table;
116
+ var newTableNode = newTable.createChecked(_objectSpread({}, attributes), content);
117
+
118
+ var newContent = _prosemirrorModel.Fragment.from(newTableNode); // Pass updated content into original ProseMirror serializeFragment function.
119
+ // Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
120
+ //@ts-ignore
121
+
122
+
123
+ return originalSerializeFragment(newContent, options, target);
124
+ } // If we're not copying any rows, just run default serializeFragment function.
125
+ // Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
126
+ //@ts-ignore
127
+
128
+
129
+ return originalSerializeFragment(content, options, target);
130
+ };
131
+
132
+ return newSerializer;
133
+ };
134
+
135
+ exports.createClipboardSerializer = createClipboardSerializer;
136
+
41
137
  var sendClipboardAnalytics = function sendClipboardAnalytics(view, dispatchAnalyticsEvent, action) {
42
138
  var clipboardAnalyticsPayload = getAnalyticsPayload(view.state, action);
43
139