@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
@@ -19,8 +19,10 @@ import Dropdown from '../../floating-toolbar/ui/Dropdown';
19
19
  import { messages } from '../messages';
20
20
  import nodeNames from '../../../messages';
21
21
  import { getFeatureFlags } from '../../../plugins/feature-flags-context';
22
- import LinkToolbarIconDropdown from './LinkToolbarIconDropdown';
23
- import LinkToolbarButtonGroup from './LinkToolbarButtonGroup';
22
+ import { LinkToolbarIconDropdown } from './LinkToolbarIconDropdown';
23
+ import { LinkToolbarButtonGroup } from './LinkToolbarButtonGroup';
24
+ import { getButtonGroupOption } from './link-toolbar-button-group-options';
25
+ import { getIconDropdownOption } from './link-toolbar-icon-dropdown-options';
24
26
  export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
25
27
  _inherits(LinkToolbarAppearance, _React$Component);
26
28
 
@@ -60,6 +62,7 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
60
62
  var isSmartLinkSupportedInParent = isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance);
61
63
  var tooltip = isSmartLinkSupportedInParent ? undefined : parentNodeName(editorState, intl);
62
64
  var embedOption = allowEmbeds && preview && {
65
+ appearance: 'embed',
63
66
  title: intl.formatMessage(messages.embed),
64
67
  onClick: setSelectedCardAppearance('embed'),
65
68
  selected: currentAppearance === 'embed',
@@ -76,24 +79,27 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
76
79
  selected: !currentAppearance,
77
80
  testId: 'url-appearance'
78
81
  }, {
82
+ appearance: 'inline',
79
83
  title: intl.formatMessage(messages.inline),
80
84
  onClick: setSelectedCardAppearance('inline'),
81
85
  selected: currentAppearance === 'inline',
82
- hidden: false,
83
86
  testId: 'inline-appearance'
84
87
  }, {
88
+ appearance: 'block',
85
89
  title: intl.formatMessage(messages.block),
86
90
  onClick: setSelectedCardAppearance('block'),
87
91
  selected: currentAppearance === 'block',
88
- hidden: false,
89
92
  testId: 'block-appearance',
90
93
  disabled: !isSmartLinkSupportedInParent,
91
94
  tooltip: tooltip
92
95
  }];
93
- var title = intl.formatMessage(currentAppearance ? messages[currentAppearance] : messages.url);
94
96
 
95
97
  var dispatchCommand = function dispatchCommand(fn) {
96
- fn && fn(editorState, view && view.dispatch);
98
+ fn && fn(editorState, view && view.dispatch); // Refocus the view to ensure the editor has focus
99
+
100
+ if (view && !view.hasFocus()) {
101
+ view.focus();
102
+ }
97
103
  };
98
104
 
99
105
  if (embedOption) {
@@ -105,18 +111,28 @@ export var LinkToolbarAppearance = /*#__PURE__*/function (_React$Component) {
105
111
 
106
112
  if (viewChangingExperimentToolbarStyle === 'toolbarIcons') {
107
113
  return /*#__PURE__*/React.createElement(LinkToolbarButtonGroup, {
108
- key: "link-toolbar-button-group"
114
+ key: "link-toolbar-button-group",
115
+ options: options.map(function (option) {
116
+ return getButtonGroupOption(intl, dispatchCommand, option);
117
+ })
109
118
  });
110
119
  }
111
120
 
112
121
  if (viewChangingExperimentToolbarStyle === 'newDropdown') {
113
122
  return /*#__PURE__*/React.createElement(LinkToolbarIconDropdown, {
114
- key: "link-toolbar-icon-dropdown"
123
+ key: "link-toolbar-icon-dropdown",
124
+ title: "Change view",
125
+ buttonTestId: "link-toolbar-appearance-button",
126
+ dispatchCommand: dispatchCommand,
127
+ options: options.map(function (option) {
128
+ return getIconDropdownOption(intl, dispatchCommand, option);
129
+ })
115
130
  });
116
131
  }
117
132
 
133
+ var title = intl.formatMessage(currentAppearance ? messages[currentAppearance] : messages.url);
118
134
  return /*#__PURE__*/React.createElement(Dropdown, {
119
- key: 'link-toolbar',
135
+ key: "link-toolbar",
120
136
  buttonTestId: "link-toolbar-appearance-button",
121
137
  title: title,
122
138
  dispatchCommand: dispatchCommand,
@@ -1,10 +1,62 @@
1
- import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
+ var _excluded = ["disabled"];
4
+
5
+ var _templateObject, _templateObject2;
6
+
2
7
  import React from 'react';
8
+ import styled from 'styled-components';
9
+ import { ButtonGroup } from '@atlaskit/button';
10
+ import Button from '../../floating-toolbar/ui/Button';
11
+ /**
12
+ * Applying `pointer-events: none;` when disabled allows the Tooltip to be displayed
13
+ */
3
14
 
4
- var LinkToolbarButtonGroup = function LinkToolbarButtonGroup(_ref) {
5
- _objectDestructuringEmpty(_ref);
15
+ export var StyledButton = styled(Button)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: ", ";\n"])), function (_ref) {
16
+ var disabled = _ref.disabled;
17
+ return disabled ? 'none' : 'auto';
18
+ });
6
19
 
7
- return /*#__PURE__*/React.createElement("span", null);
20
+ var DisallowedWrapper = function DisallowedWrapper(_ref2) {
21
+ var disabled = _ref2.disabled,
22
+ props = _objectWithoutProperties(_ref2, _excluded);
23
+
24
+ return /*#__PURE__*/React.createElement("div", props);
8
25
  };
26
+ /**
27
+ * The button requires `pointer-events: none;` in order to fix the tooltip, hence
28
+ * leaving us without a disabled cursor, the following fixes this:
29
+ */
30
+
9
31
 
10
- export default LinkToolbarButtonGroup;
32
+ var StyledDisallowedWrapper = styled(DisallowedWrapper)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: ", ";\n"])), function (_ref3) {
33
+ var disabled = _ref3.disabled;
34
+ return disabled ? 'not-allowed' : 'pointer';
35
+ });
36
+ export var LinkToolbarButtonGroup = function LinkToolbarButtonGroup(_ref4) {
37
+ var options = _ref4.options;
38
+ return /*#__PURE__*/React.createElement(ButtonGroup, null, options.map(function (_ref5) {
39
+ var onClick = _ref5.onClick,
40
+ selected = _ref5.selected,
41
+ disabled = _ref5.disabled,
42
+ testId = _ref5.testId,
43
+ tooltipContent = _ref5.tooltipContent,
44
+ title = _ref5.title,
45
+ Icon = _ref5.icon;
46
+ return /*#__PURE__*/React.createElement(StyledDisallowedWrapper, {
47
+ key: testId,
48
+ disabled: disabled
49
+ }, /*#__PURE__*/React.createElement(StyledButton, {
50
+ title: title,
51
+ icon: /*#__PURE__*/React.createElement(Icon, {
52
+ size: "medium",
53
+ label: title
54
+ }),
55
+ selected: selected,
56
+ onClick: onClick,
57
+ testId: testId,
58
+ disabled: disabled,
59
+ tooltipContent: tooltipContent
60
+ }));
61
+ }));
62
+ };
@@ -1,10 +1,159 @@
1
- import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ var _excluded = ["options"];
4
+
5
+ /** @jsx jsx */
2
6
  import React from 'react';
7
+ import { css, jsx } from '@emotion/react';
8
+ import { MenuGroup, Section, CustomItem } from '@atlaskit/menu';
9
+ import { borderRadius } from '@atlaskit/theme/constants';
10
+ import { B50, N20, B400 } from '@atlaskit/theme/colors';
11
+ import { token } from '@atlaskit/tokens';
12
+ import Tooltip from '@atlaskit/tooltip';
13
+ import Dropdown from '../../floating-toolbar/ui/Dropdown';
14
+ export var ICON_HEIGHT = 40;
15
+ export var ICON_WIDTH = 40;
16
+ var iconBoxStyles = css({
17
+ width: ICON_HEIGHT,
18
+ height: ICON_WIDTH,
19
+ overflow: 'hidden',
20
+ border: '1px solid rgba(223, 225, 229, 0.5)'
21
+ /* N60 at 50% */
22
+ ,
23
+ borderRadius: borderRadius(),
24
+ boxSizing: 'border-box',
25
+ display: 'flex',
26
+ justifyContent: 'center',
27
+ alignItems: 'center',
28
+ backgroundColor: token('color.background.default', 'white')
29
+ });
30
+ var primitiveStyles = css({
31
+ padding: '0.75rem',
32
+ alignItems: 'flex-start'
33
+ });
34
+ var interactiveStyles = css({
35
+ '&:active': {
36
+ backgroundColor: token('color.background.brand.pressed', B50),
37
+ color: token('color.text.accent.blue', B400)
38
+ }
39
+ });
40
+ var unselectedStyles = css({
41
+ '&:hover': {
42
+ backgroundColor: token('color.background.neutral.subtle.hovered', N20),
43
+ color: token('color.text.brand', 'currentColor')
44
+ }
45
+ });
46
+ var selectedOptionStyles = css({
47
+ backgroundColor: token('color.background.brand.pressed', B50),
48
+ color: token('color.text.brand', 'currentColor'),
49
+ '&:hover': {
50
+ backgroundColor: token('color.background.brand.pressed', B50),
51
+ color: token('color.text.brand', 'currentColor')
52
+ }
53
+ });
54
+ var titleOffsetStyles = css({
55
+ marginTop: '0.125rem'
56
+ });
57
+
58
+ var getCustomStyles = function getCustomStyles(selected, disabled) {
59
+ if (disabled) {
60
+ return [primitiveStyles];
61
+ }
3
62
 
4
- var LinkToolbarIconDropdown = function LinkToolbarIconDropdown(_ref) {
5
- _objectDestructuringEmpty(_ref);
63
+ if (selected) {
64
+ return [primitiveStyles, selectedOptionStyles, interactiveStyles];
65
+ }
66
+
67
+ return [primitiveStyles, unselectedStyles, interactiveStyles];
68
+ };
6
69
 
7
- return /*#__PURE__*/React.createElement("span", null);
70
+ var OptionRoot = function OptionRoot(props) {
71
+ return jsx("div", _extends({}, props, {
72
+ tabIndex: 0
73
+ }));
8
74
  };
9
75
 
10
- export default LinkToolbarIconDropdown;
76
+ var Option = function Option(_ref) {
77
+ var title = _ref.title,
78
+ description = _ref.description,
79
+ selected = _ref.selected,
80
+ disabled = _ref.disabled,
81
+ _onClick = _ref.onClick,
82
+ Icon = _ref.icon,
83
+ testId = _ref.testId,
84
+ tooltipContent = _ref.tooltipContent,
85
+ hide = _ref.hide;
86
+ var option = jsx(CustomItem, {
87
+ "aria-label": title,
88
+ component: OptionRoot,
89
+ iconBefore: jsx("div", {
90
+ css: iconBoxStyles
91
+ }, jsx(Icon, {
92
+ width: 38,
93
+ height: 38,
94
+ label: title
95
+ })),
96
+ css: getCustomStyles(selected, disabled),
97
+ description: description,
98
+ testId: testId,
99
+ onClick: function onClick(event) {
100
+ event.preventDefault();
101
+
102
+ if (!disabled) {
103
+ _onClick();
104
+
105
+ hide();
106
+ }
107
+ },
108
+ onKeyDown: function onKeyDown(event) {
109
+ if (event.key === 'Enter' || event.key === 'Space') {
110
+ event.preventDefault();
111
+
112
+ if (!disabled) {
113
+ _onClick();
114
+
115
+ hide();
116
+ }
117
+ }
118
+ },
119
+ role: "option",
120
+ "aria-selected": selected,
121
+ isSelected: selected,
122
+ isDisabled: disabled,
123
+ shouldDescriptionWrap: true
124
+ }, jsx("div", {
125
+ css: titleOffsetStyles
126
+ }, title));
127
+
128
+ if (tooltipContent) {
129
+ return jsx(Tooltip, {
130
+ content: tooltipContent
131
+ }, option);
132
+ }
133
+
134
+ return option;
135
+ };
136
+
137
+ export var LinkToolbarIconDropdown = function LinkToolbarIconDropdown(_ref2) {
138
+ var options = _ref2.options,
139
+ rest = _objectWithoutProperties(_ref2, _excluded);
140
+
141
+ return jsx(Dropdown, _extends({}, rest, {
142
+ options: {
143
+ render: function render(_ref3) {
144
+ var hide = _ref3.hide;
145
+ return jsx(MenuGroup, null, jsx("div", {
146
+ role: "listbox"
147
+ }, jsx(Section, null, options.map(function (props) {
148
+ return jsx(Option, _extends({
149
+ key: props.testId
150
+ }, props, {
151
+ hide: hide
152
+ }));
153
+ }))));
154
+ },
155
+ width: 320,
156
+ height: 200
157
+ }
158
+ }));
159
+ };
@@ -15,16 +15,18 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
15
15
 
16
16
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
17
 
18
+ /** @jsx jsx */
18
19
  import React from 'react';
20
+ import { jsx } from '@emotion/react';
19
21
  import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from 'prosemirror-utils';
20
22
  import { calcColumnsFromPx, calcPctFromPx, calcPxFromColumns, wrappedLayouts } from '@atlaskit/editor-common/ui';
21
23
  import { akEditorMediaResizeHandlerPaddingWide, akEditorBreakoutPadding, akEditorWideLayoutWidth, breakoutWideScaleRatio, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
22
- import { embedHeaderHeight } from '@atlaskit/media-ui/embeds';
24
+ import { embedHeaderHeight } from '@atlaskit/smart-card';
23
25
  import { Wrapper } from '../../../ui/Resizer/styled';
24
26
  import Resizer from '../../../ui/Resizer';
25
27
  import { handleSides, imageAlignmentMap, snapTo } from '../../../ui/Resizer/utils';
26
28
  import { calcMediaPxWidth } from '../../../plugins/media/utils/media-single';
27
- import { EmbedSpacing } from './styled';
29
+ import { embedSpacingStyles } from './styled';
28
30
 
29
31
  var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
30
32
  _inherits(ResizableEmbedCard, _React$Component);
@@ -344,7 +346,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
344
346
  };
345
347
  }
346
348
 
347
- return /*#__PURE__*/React.createElement("span", {
349
+ return jsx("span", {
348
350
  "data-testid": 'resizable-embed-card-height-definer',
349
351
  style: _objectSpread({
350
352
  display: 'block',
@@ -376,9 +378,10 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
376
378
  enable[side] = false;
377
379
  }
378
380
  });
379
- return /*#__PURE__*/React.createElement(EmbedSpacing, {
381
+ return jsx("div", {
382
+ css: embedSpacingStyles,
380
383
  "data-testid": "resizable-embed-card-spacing"
381
- }, /*#__PURE__*/React.createElement(Wrapper, {
384
+ }, jsx(Wrapper, {
382
385
  layout: layout,
383
386
  isResized: !!pctWidth,
384
387
  containerWidth: containerWidth || DEFAULT_EMBED_CARD_WIDTH,
@@ -386,7 +389,7 @@ var ResizableEmbedCard = /*#__PURE__*/function (_React$Component) {
386
389
  return _this2.wrapper = elem;
387
390
  },
388
391
  fullWidthMode: fullWidthMode
389
- }, /*#__PURE__*/React.createElement(Resizer, _extends({}, this.props, {
392
+ }, jsx(Resizer, _extends({}, this.props, {
390
393
  width: initialWidth // Starting or initial width of embed <iframe> itself.
391
394
  ,
392
395
  enable: enable,
@@ -13,7 +13,7 @@ var IconCardGlyph = function IconCardGlyph(props) {
13
13
  fillRule: "evenodd",
14
14
  clipRule: "evenodd",
15
15
  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",
16
- fill: "#42526E"
16
+ fill: "currentColor"
17
17
  }));
18
18
  };
19
19
 
@@ -13,7 +13,7 @@ var IconEmbedGlyph = function IconEmbedGlyph(props) {
13
13
  fillRule: "evenodd",
14
14
  clipRule: "evenodd",
15
15
  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",
16
- fill: "#42526E"
16
+ fill: "currentColor"
17
17
  }));
18
18
  };
19
19
 
@@ -13,7 +13,7 @@ var IconInlineGlyph = function IconInlineGlyph(props) {
13
13
  fillRule: "evenodd",
14
14
  clipRule: "evenodd",
15
15
  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",
16
- fill: "#42526E"
16
+ fill: "currentColor"
17
17
  }));
18
18
  };
19
19
 
@@ -15,7 +15,7 @@ var IconUrlGlyph = function IconUrlGlyph(props) {
15
15
  width: "20",
16
16
  height: "2",
17
17
  rx: "1",
18
- fill: "#42526E"
18
+ fill: "currentColor"
19
19
  }));
20
20
  };
21
21
 
@@ -0,0 +1,45 @@
1
+ import { messages } from '../messages';
2
+ import { IconCard } from './assets/card';
3
+ import { IconEmbed } from './assets/embed';
4
+ import { IconInline } from './assets/inline';
5
+ import { IconUrl } from './assets/url';
6
+ var appearancePropsMap = {
7
+ url: {
8
+ title: messages.urlTitle,
9
+ icon: IconUrl
10
+ },
11
+ inline: {
12
+ title: messages.inlineTitle,
13
+ icon: IconInline
14
+ },
15
+ block: {
16
+ title: messages.blockTitle,
17
+ icon: IconCard
18
+ },
19
+ embed: {
20
+ title: messages.embedTitle,
21
+ icon: IconEmbed
22
+ }
23
+ };
24
+ export var getButtonGroupOption = function getButtonGroupOption(intl, dispatchCommand, _ref) {
25
+ var disabled = _ref.disabled,
26
+ _onClick = _ref.onClick,
27
+ selected = _ref.selected,
28
+ appearance = _ref.appearance,
29
+ testId = _ref.testId,
30
+ tooltip = _ref.tooltip;
31
+ var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
32
+ title = _appearancePropsMap.title,
33
+ icon = _appearancePropsMap.icon;
34
+ return {
35
+ title: intl.formatMessage(title),
36
+ icon: icon,
37
+ onClick: function onClick() {
38
+ return dispatchCommand(_onClick);
39
+ },
40
+ disabled: Boolean(disabled),
41
+ tooltipContent: tooltip || null,
42
+ testId: testId,
43
+ selected: selected
44
+ };
45
+ };
@@ -0,0 +1,51 @@
1
+ import { messages } from '../messages';
2
+ import { IconCard } from './assets/card';
3
+ import { IconEmbed } from './assets/embed';
4
+ import { IconInline } from './assets/inline';
5
+ import { IconUrl } from './assets/url';
6
+ var appearancePropsMap = {
7
+ url: {
8
+ title: messages.urlTitle,
9
+ description: messages.urlDescription,
10
+ icon: IconUrl
11
+ },
12
+ inline: {
13
+ title: messages.inlineTitle,
14
+ description: messages.inlineDescription,
15
+ icon: IconInline
16
+ },
17
+ block: {
18
+ title: messages.blockTitle,
19
+ description: messages.blockDescription,
20
+ icon: IconCard
21
+ },
22
+ embed: {
23
+ title: messages.embedTitle,
24
+ description: messages.embedDescription,
25
+ icon: IconEmbed
26
+ }
27
+ };
28
+ export var getIconDropdownOption = function getIconDropdownOption(intl, dispatchCommand, _ref) {
29
+ var disabled = _ref.disabled,
30
+ _onClick = _ref.onClick,
31
+ selected = _ref.selected,
32
+ appearance = _ref.appearance,
33
+ testId = _ref.testId,
34
+ tooltip = _ref.tooltip;
35
+ var _appearancePropsMap = appearancePropsMap[appearance !== null && appearance !== void 0 ? appearance : 'url'],
36
+ title = _appearancePropsMap.title,
37
+ description = _appearancePropsMap.description,
38
+ icon = _appearancePropsMap.icon;
39
+ return {
40
+ title: intl.formatMessage(title),
41
+ description: intl.formatMessage(description),
42
+ icon: icon,
43
+ onClick: function onClick() {
44
+ return dispatchCommand(_onClick);
45
+ },
46
+ selected: Boolean(selected),
47
+ disabled: Boolean(disabled),
48
+ tooltipContent: tooltip,
49
+ testId: testId
50
+ };
51
+ };
@@ -2,6 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject, _templateObject2;
4
4
 
5
- import styled, { css } from 'styled-components';
5
+ import { css } from '@emotion/react';
6
6
  export var embedCardStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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"])));
7
- export var EmbedSpacing = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 10px;\n"])));
7
+ export var embedSpacingStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0 10px;\n"])));
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,37 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+
4
+ 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; }
5
+
6
+ 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) { _defineProperty(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; }
7
+
2
8
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
9
  import { TextSelection } from 'prosemirror-state';
4
10
  import { clipboardPluginKey } from '../plugin-key';
5
11
  import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '../../selection/utils';
6
12
  import { EVENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../../analytics/types/enums';
13
+ import { DOMSerializer } from 'prosemirror-model';
14
+ import { findParentNodeOfType } from 'prosemirror-utils';
15
+ import { Fragment } from 'prosemirror-model';
7
16
  export var createPlugin = function createPlugin(_ref) {
8
- var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
17
+ var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
18
+ schema = _ref.schema;
19
+ var editorView;
20
+
21
+ var getEditorView = function getEditorView() {
22
+ return editorView;
23
+ };
24
+
9
25
  return new SafePlugin({
10
26
  key: clipboardPluginKey,
27
+ view: function view(_view) {
28
+ editorView = _view;
29
+ return {
30
+ update: function update(view) {
31
+ editorView = view;
32
+ }
33
+ };
34
+ },
11
35
  props: {
12
36
  handleDOMEvents: {
13
37
  cut: function cut(view) {
@@ -16,10 +40,75 @@ export var createPlugin = function createPlugin(_ref) {
16
40
  copy: function copy(view) {
17
41
  return sendClipboardAnalytics(view, dispatchAnalyticsEvent, ACTION.COPIED);
18
42
  }
19
- }
43
+ },
44
+ clipboardSerializer: createClipboardSerializer(schema, getEditorView)
20
45
  }
21
46
  });
22
47
  };
48
+ /**
49
+ * Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
50
+ * 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.
51
+ * e.g. keeping the layout on a row that is copied.
52
+ * We store the default serializer in order to call it after we handle the table row case.
53
+ */
54
+
55
+ export var createClipboardSerializer = function createClipboardSerializer(schema, getEditorView) {
56
+ var oldSerializer = DOMSerializer.fromSchema(schema);
57
+ var newSerializer = new DOMSerializer(oldSerializer.nodes, oldSerializer.marks);
58
+ var originalSerializeFragment = newSerializer.serializeFragment.bind(newSerializer);
59
+
60
+ newSerializer.serializeFragment = function (content) {
61
+ var _content$firstChild;
62
+
63
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
64
+ var target = arguments.length > 2 ? arguments[2] : undefined;
65
+ var editorView = getEditorView();
66
+ var selection = editorView.state.selection; // We do not need to handle when a user copies a tableRow + other content.
67
+ // In that scenario it already wraps the Row with correct Table and attributes.
68
+
69
+ if (!options.tableWrapperExists) {
70
+ var i = 0;
71
+
72
+ while (i < content.childCount) {
73
+ var _content$maybeChild;
74
+
75
+ if (((_content$maybeChild = content.maybeChild(i)) === null || _content$maybeChild === void 0 ? void 0 : _content$maybeChild.type.name) === 'table') {
76
+ options.tableWrapperExists = true;
77
+ break;
78
+ }
79
+
80
+ i++;
81
+ }
82
+ } // When the content being copied includes a tableRow that is not already wrapped with a table,
83
+ // We will wrap it with one ourselves, while preserving the parent table's attributes.
84
+
85
+
86
+ if (((_content$firstChild = content.firstChild) === null || _content$firstChild === void 0 ? void 0 : _content$firstChild.type.name) === 'tableRow' && !options.tableWrapperExists) {
87
+ // We only want 1 table wrapping the rows.
88
+ // tableWrapperExist is a custom prop added solely for the purposes of this recursive algorithm.
89
+ // The function is recursively called for each node in the tree captured in the fragment.
90
+ // 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
91
+ // and https://github.com/ProseMirror/prosemirror-model/blob/master/src/to_dom.js#L87)
92
+ options.tableWrapperExists = true;
93
+ var parentTable = findParentNodeOfType(schema.nodes.table)(selection);
94
+ var attributes = parentTable === null || parentTable === void 0 ? void 0 : parentTable.node.attrs;
95
+ var newTable = schema.nodes.table;
96
+ var newTableNode = newTable.createChecked(_objectSpread({}, attributes), content);
97
+ var newContent = Fragment.from(newTableNode); // Pass updated content into original ProseMirror serializeFragment function.
98
+ // Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
99
+ //@ts-ignore
100
+
101
+ return originalSerializeFragment(newContent, options, target);
102
+ } // If we're not copying any rows, just run default serializeFragment function.
103
+ // Currently incorrectly typed in @Types. See this GitHub thread: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57668
104
+ //@ts-ignore
105
+
106
+
107
+ return originalSerializeFragment(content, options, target);
108
+ };
109
+
110
+ return newSerializer;
111
+ };
23
112
  export var sendClipboardAnalytics = function sendClipboardAnalytics(view, dispatchAnalyticsEvent, action) {
24
113
  var clipboardAnalyticsPayload = getAnalyticsPayload(view.state, action);
25
114