@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
@@ -1,7 +1,5 @@
1
1
  import { Fragment, Slice } from 'prosemirror-model';
2
- import { ReplaceAroundStep } from 'prosemirror-transform';
3
2
  import * as baseCommand from 'prosemirror-commands';
4
- import * as baseListCommand from 'prosemirror-schema-list';
5
3
  import { hasParentNodeOfType, findPositionOfNodeBefore } from 'prosemirror-utils';
6
4
  import { hasVisibleContent, isNodeEmpty } from '../../../utils/document';
7
5
  import { findCutBefore, isEmptySelectionAtStart, isFirstChildOfParent, filter } from '../../../utils/commands';
@@ -14,8 +12,10 @@ import { getCommonListAnalyticsAttributes } from '../utils/analytics';
14
12
  import { listBackspace } from './listBackspace';
15
13
  import { joinListItemForward } from './join-list-item-forward';
16
14
  import { convertListType } from '../actions/conversions';
15
+ import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
17
16
  import { outdentList } from './outdent-list';
18
17
  import { indentList } from './indent-list';
18
+ import { moveTargetIntoList } from '../utils/replace-content';
19
19
  export { outdentList, indentList };
20
20
  export const enterKeyCommand = (state, dispatch) => {
21
21
  const {
@@ -91,8 +91,8 @@ function untoggleSelectedList(tr) {
91
91
 
92
92
  export function toggleList(inputMethod, listType) {
93
93
  return function (state, dispatch) {
94
- let customTr = state.tr;
95
- const listInsideSelection = selectionContainsList(customTr);
94
+ let tr = state.tr;
95
+ const listInsideSelection = selectionContainsList(tr);
96
96
  const listNodeType = state.schema.nodes[listType];
97
97
  const actionSubjectId = listType === 'bulletList' ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
98
98
 
@@ -126,10 +126,10 @@ export function toggleList(inputMethod, listType) {
126
126
  }
127
127
 
128
128
  convertListType({
129
- tr: customTr,
129
+ tr,
130
130
  nextListNodeType: listNodeType
131
131
  });
132
- addAnalytics(state, customTr, {
132
+ addAnalytics(state, tr, {
133
133
  action: ACTION.CONVERTED,
134
134
  actionSubject: ACTION_SUBJECT.LIST,
135
135
  actionSubjectId,
@@ -140,17 +140,11 @@ export function toggleList(inputMethod, listType) {
140
140
  }
141
141
  });
142
142
  } else {
143
- const replaceCurrentTr = tr => {
144
- customTr = tr;
145
- }; // NOTE: replaceCurrentTr is supplied here instead of the usual dispatch function
146
- // to 'mutate' the transaction without actually dispatching (as it is more performant
147
- // if we only dispatch once at the end). This means customTr should not be modified
148
- // until after wrapInList, since any changes made to it will be discarded when it
149
- // gets replaced with the transaction generated by wrapInList.
150
-
151
-
152
- wrapInList(listNodeType)(state, replaceCurrentTr);
153
- addAnalytics(state, customTr, {
143
+ // Need to have this before wrapInList so the wrapping is done with valid content
144
+ // For example, if trying to convert centre or right aligned paragraphs to lists
145
+ sanitiseMarksInSelection(tr, listNodeType);
146
+ wrapInListAndJoin(listNodeType, tr);
147
+ addAnalytics(state, tr, {
154
148
  action: ACTION.INSERTED,
155
149
  actionSubject: ACTION_SUBJECT.LIST,
156
150
  actionSubjectId,
@@ -159,18 +153,16 @@ export function toggleList(inputMethod, listType) {
159
153
  inputMethod
160
154
  }
161
155
  });
162
- } // if document wasn't changed, that means setNodeMarkup step didn't work, so
163
- // return false from the command to indicate that the editing action failed
156
+ } // If document wasn't changed, return false from the command to indicate that the
157
+ // editing action failed
164
158
 
165
159
 
166
- if (!customTr.docChanged) {
160
+ if (!tr.docChanged) {
167
161
  return false;
168
162
  }
169
163
 
170
- sanitiseMarksInSelection(customTr, listNodeType);
171
-
172
164
  if (dispatch) {
173
- dispatch(customTr);
165
+ dispatch(tr);
174
166
  }
175
167
 
176
168
  return true;
@@ -182,9 +174,6 @@ export function toggleBulletList(view, inputMethod = INPUT_METHOD.TOOLBAR) {
182
174
  export function toggleOrderedList(view, inputMethod = INPUT_METHOD.TOOLBAR) {
183
175
  return toggleList(inputMethod, 'orderedList')(view.state, view.dispatch);
184
176
  }
185
- export function wrapInList(nodeType) {
186
- return baseCommand.autoJoin(baseListCommand.wrapInList(nodeType), (before, after) => before.type === after.type && before.type === nodeType);
187
- }
188
177
  /**
189
178
  * Implementation taken and modified for our needs from PM
190
179
  * @param itemType Node
@@ -326,8 +315,20 @@ const joinToPreviousListItem = (state, dispatch) => {
326
315
  const list = $cut.nodeBefore.copy($cut.nodeBefore.content.append(Fragment.from(listItem.createChecked({}, $cut.nodeAfter))));
327
316
  tr.replaceWith(nodeBeforePos, $from.pos + $cut.nodeAfter.nodeSize, list);
328
317
  } else {
329
- // take the text content of the paragraph and insert after the paragraph up until before the the cut
330
- tr = state.tr.step(new ReplaceAroundStep($lastNode.pos, $cut.pos + $cut.nodeAfter.nodeSize, $cut.pos + 1, $cut.pos + $cut.nodeAfter.nodeSize - 1, state.tr.doc.slice($lastNode.pos, $cut.pos), 0, true));
318
+ const step = moveTargetIntoList({
319
+ insertPosition: $lastNode.pos,
320
+ $target: $cut
321
+ }); // ED-13966: check if the step will cause an ProseMirror error
322
+ // if there's an error don't apply the step as it will might lead into a data loss.
323
+ // It doesn't play well with media being a leaf node.
324
+
325
+ const stepResult = state.tr.maybeStep(step);
326
+
327
+ if (stepResult.failed) {
328
+ return false;
329
+ } else {
330
+ tr = state.tr.step(step);
331
+ }
331
332
  } // find out if there's now another list following and join them
332
333
  // as in, [list, p, list] => [list with p, list], and we want [joined list]
333
334
 
@@ -0,0 +1,22 @@
1
+ import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform';
2
+ export const moveTargetIntoList = ({
3
+ insertPosition,
4
+ $target
5
+ }) => {
6
+ var _$target$nodeAfter;
7
+
8
+ // take the text content of the paragraph and insert after the paragraph up until before the the cut
9
+ const from = insertPosition;
10
+ const to = $target.pos + (((_$target$nodeAfter = $target.nodeAfter) === null || _$target$nodeAfter === void 0 ? void 0 : _$target$nodeAfter.nodeSize) || 0); //$cut.pos + $cut.nodeAfter.nodeSize;
11
+
12
+ const gapFrom = $target.posAtIndex(0, $target.depth + 1); // start pos of the child
13
+
14
+ const gapTo = $target.doc.resolve(gapFrom).end(); // end pos of the paragraph
15
+
16
+ if (gapTo - gapFrom === 0) {
17
+ return new ReplaceStep(from, to, $target.doc.slice(insertPosition, $target.pos));
18
+ }
19
+
20
+ const step = new ReplaceAroundStep(from, to, gapFrom, gapTo, $target.doc.slice(insertPosition, $target.pos), 0, true);
21
+ return step;
22
+ };
@@ -86,7 +86,7 @@ export class MediaNodeUpdater {
86
86
 
87
87
  _defineProperty(this, "getObjectId", async () => {
88
88
  const contextIdentifierProvider = await this.props.contextIdentifierProvider;
89
- return contextIdentifierProvider && contextIdentifierProvider.objectId;
89
+ return (contextIdentifierProvider === null || contextIdentifierProvider === void 0 ? void 0 : contextIdentifierProvider.objectId) || null;
90
90
  });
91
91
 
92
92
  _defineProperty(this, "uploadExternalMedia", async getPos => {
@@ -135,10 +135,10 @@ export class MediaNodeUpdater {
135
135
  const attrs = this.getAttrs();
136
136
 
137
137
  if (!attrs || attrs.type !== 'file') {
138
- return undefined;
138
+ return null;
139
139
  }
140
140
 
141
- return attrs.__contextId;
141
+ return attrs.__contextId || null;
142
142
  });
143
143
 
144
144
  _defineProperty(this, "updateDimensions", dimensions => {
@@ -1,4 +1,4 @@
1
- import { css } from 'styled-components';
1
+ import { css } from '@emotion/react';
2
2
  import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
4
4
  import { N60, B200 } from '@atlaskit/theme/colors';
@@ -252,4 +252,17 @@ export const calcMediaPxWidth = opts => {
252
252
  return origWidth;
253
253
  };
254
254
 
255
- const calcPctWidth = (containerWidth, pctWidth, origWidth, origHeight) => pctWidth && origWidth && origHeight && Math.ceil(calcPxFromPct(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
255
+ const calcPctWidth = (containerWidth, pctWidth, origWidth, origHeight) => pctWidth && origWidth && origHeight && Math.ceil(calcPxFromPct(pctWidth / 100, containerWidth.lineLength || containerWidth.width));
256
+
257
+ export function isCaptionNode(editorView) {
258
+ const {
259
+ $from
260
+ } = editorView.state.selection;
261
+ const immediateWrapperParentNode = editorView.state.doc.nodeAt($from.before(Math.max($from.depth, 1)));
262
+
263
+ if (immediateWrapperParentNode && immediateWrapperParentNode.type.name === 'caption') {
264
+ return true;
265
+ }
266
+
267
+ return false;
268
+ }
@@ -1,6 +1,6 @@
1
1
  import { closeHistory } from 'prosemirror-history';
2
2
  import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
3
- import { TextSelection } from 'prosemirror-state';
3
+ import { TextSelection, NodeSelection } from 'prosemirror-state';
4
4
  import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
5
5
  import { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue } from '../../utils';
6
6
  import { mapSlice } from '../../utils/slice';
@@ -54,8 +54,10 @@ export function handlePasteIntoTaskAndDecision(slice) {
54
54
  text
55
55
  }
56
56
  } = schema;
57
+ const isDecisionOrTaskNodeSelection = state.selection instanceof NodeSelection && ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(state.selection.node.type.name);
58
+ const hasParentDecisionOrTaskItem = hasParentNodeOfType([decisionItem, taskItem])(state.selection);
57
59
 
58
- if (!decisionItem || !decisionList || !taskList || !taskItem || !hasParentNodeOfType([decisionItem, taskItem])(state.selection)) {
60
+ if (!decisionItem || !decisionList || !taskList || !taskItem || !hasParentDecisionOrTaskItem && !isDecisionOrTaskNodeSelection) {
59
61
  return false;
60
62
  }
61
63
 
@@ -69,7 +71,15 @@ export function handlePasteIntoTaskAndDecision(slice) {
69
71
  }
70
72
 
71
73
  const transformedSlice = compose.apply(null, filters)(slice);
72
- const tr = closeHistory(state.tr).replaceSelection(transformedSlice).scrollIntoView();
74
+ const tr = closeHistory(state.tr);
75
+ const transformedSliceIsValidNode = transformedSlice.content.firstChild.type.inlineContent || ['decisionList', 'decisionItem', 'taskList', 'taskItem'].includes(transformedSlice.content.firstChild.type.name);
76
+
77
+ if (transformedSliceIsValidNode || isDecisionOrTaskNodeSelection) {
78
+ tr.replaceSelection(transformedSlice).scrollIntoView();
79
+ } else {
80
+ safeInsert(transformedSlice.content)(tr).scrollIntoView();
81
+ }
82
+
73
83
  queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
74
84
 
75
85
  if (dispatch) {
@@ -371,9 +381,13 @@ export function handleMediaSingle(inputMethod) {
371
381
  };
372
382
  };
373
383
  }
374
- export function handleExpand(slice) {
384
+ export function handleExpandPasteInTable(slice) {
375
385
  return (state, dispatch) => {
376
- if (!insideTable(state)) {
386
+ var _slice$content$firstC;
387
+
388
+ // Do not handle expand if it's not being pasted into a table
389
+ // OR if it's nested within another node when being pasted into a table
390
+ if (!insideTable(state) || ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type.name) !== 'expand') {
377
391
  return false;
378
392
  }
379
393
 
@@ -1,6 +1,6 @@
1
1
  import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents, withAnalytics } from '../../analytics';
2
2
  import { getPasteSource } from '../util';
3
- import { handlePasteAsPlainText, handlePasteIntoTaskAndDecision, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpand, handleSelectedTable, handlePasteLinkOnSelectedText } from '../handlers';
3
+ import { handlePasteAsPlainText, handlePasteIntoTaskAndDecision, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText } from '../handlers';
4
4
  import { pipe } from '../../../utils';
5
5
  import { findParentNode } from 'prosemirror-utils';
6
6
  import { mapSlice } from '../../../utils/slice';
@@ -239,7 +239,7 @@ export const handleMarkdownWithAnalytics = (view, event, slice) => pipe(handleMa
239
239
  export const handleRichTextWithAnalytics = (view, event, slice) => pipe(handleRichText, pasteCommandWithAnalytics(view, event, slice, {
240
240
  type: PasteTypes.richText
241
241
  }))(slice);
242
- export const handleExpandWithAnalytics = (view, event, slice) => pipe(handleExpand, pasteCommandWithAnalytics(view, event, slice, {
242
+ export const handleExpandWithAnalytics = (view, event, slice) => pipe(handleExpandPasteInTable, pasteCommandWithAnalytics(view, event, slice, {
243
243
  type: PasteTypes.richText
244
244
  }))(slice);
245
245
  export const handleSelectedTableWithAnalytics = (view, event, slice) => pipe(handleSelectedTable, pasteCommandWithAnalytics(view, event, slice, {
@@ -12,6 +12,23 @@ import { PlaceholderTextNodeView } from './placeholder-text-nodeview';
12
12
  import { pluginKey } from './plugin-key';
13
13
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
14
14
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
15
+ import { isSelectionAtPlaceholder } from './selection-utils';
16
+ import { createInternalTypeAheadTools } from '../type-ahead/api';
17
+
18
+ const getOpenTypeAhead = (view, content) => {
19
+ const typeAheadAPI = createInternalTypeAheadTools(view);
20
+ const typeAheadHandler = typeAheadAPI.findTypeAheadHandler(content);
21
+
22
+ if (!typeAheadHandler || !typeAheadHandler.id) {
23
+ return null;
24
+ }
25
+
26
+ return typeAheadAPI.openTypeAheadHandler({
27
+ triggerHandler: typeAheadHandler,
28
+ inputMethod: INPUT_METHOD.KEYBOARD
29
+ });
30
+ };
31
+
15
32
  export function createPlugin(dispatch, options) {
16
33
  const allowInserting = !!options.allowInserting;
17
34
  return new SafePlugin({
@@ -80,6 +97,34 @@ export function createPlugin(dispatch, options) {
80
97
  },
81
98
 
82
99
  props: {
100
+ handleDOMEvents: {
101
+ beforeinput: (view, event) => {
102
+ const {
103
+ state
104
+ } = view;
105
+
106
+ if (event instanceof InputEvent && !event.isComposing && event.inputType === 'insertText' && isSelectionAtPlaceholder(view.state.selection)) {
107
+ event.stopPropagation();
108
+ event.preventDefault();
109
+ const startNodePosition = state.selection.from;
110
+ const content = event.data || '';
111
+ const tr = view.state.tr;
112
+ tr.delete(startNodePosition, startNodePosition + 1);
113
+ const openTypeAhead = getOpenTypeAhead(view, content);
114
+
115
+ if (openTypeAhead) {
116
+ openTypeAhead(tr);
117
+ } else {
118
+ tr.insertText(content);
119
+ }
120
+
121
+ view.dispatch(tr);
122
+ return true;
123
+ }
124
+
125
+ return false;
126
+ }
127
+ },
83
128
  nodeViews: {
84
129
  placeholder: (node, view, getPos) => new PlaceholderTextNodeView(node, view, getPos)
85
130
  }
@@ -168,7 +213,7 @@ const decorateWithPluginOptions = (plugin, options) => {
168
213
  }),
169
214
 
170
215
  action(insert, state) {
171
- const tr = insert(state.schema.nodes.placeholder.createChecked());
216
+ const tr = state.tr;
172
217
  tr.setMeta(pluginKey, {
173
218
  showInsertPanelAt: tr.selection.anchor
174
219
  });
@@ -1,38 +1,84 @@
1
- import { DOMSerializer } from 'prosemirror-model';
2
- import { TextSelection } from 'prosemirror-state';
1
+ import { Selection } from 'prosemirror-state';
2
+ import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
3
+
4
+ const serializePlaceholderNode = node => {
5
+ const element = document.createElement('span');
6
+ element.classList.add('pm-placeholder');
7
+
8
+ if (browser.gecko) {
9
+ element.setAttribute('contenteditable', 'true');
10
+ }
11
+
12
+ element.innerText = ZERO_WIDTH_SPACE;
13
+ const elementChildren = document.createElement('span');
14
+ elementChildren.classList.add('pm-placeholder__text');
15
+ elementChildren.dataset.placeholder = node.attrs.text;
16
+ elementChildren.setAttribute('contenteditable', 'false');
17
+ element.appendChild(elementChildren);
18
+
19
+ if (browser.safari) {
20
+ element.appendChild(document.createTextNode(ZERO_WIDTH_SPACE));
21
+ } else {
22
+ element.appendChild(document.createElement('wbr'));
23
+ }
24
+
25
+ return element;
26
+ };
27
+
3
28
  export class PlaceholderTextNodeView {
4
29
  constructor(node, view, getPos) {
5
30
  this.node = node;
6
31
  this.view = view;
7
32
  this.getPos = getPos;
8
- const serializer = DOMSerializer.fromSchema(this.view.state.schema);
9
- this.dom = serializer.serializeNode(this.node);
33
+ this.dom = serializePlaceholderNode(this.node);
34
+ this.getPos = getPos;
35
+ }
36
+
37
+ stopEvent(e) {
38
+ if (e.type === 'mousedown' && typeof this.getPos === 'function') {
39
+ e.preventDefault();
40
+ const {
41
+ view
42
+ } = this;
43
+ const startNodePosition = this.getPos();
44
+ const tr = view.state.tr;
45
+ tr.setSelection(Selection.near(tr.doc.resolve(startNodePosition)));
46
+ view.dispatch(tr);
47
+ return true;
48
+ }
49
+
50
+ return false;
10
51
  }
11
52
 
12
53
  ignoreMutation(record) {
13
- // 😬
14
- // DOM Node needs to be contenteditable so Android does
15
- // not close its virtual keyboard, see ED-9613
16
- // To reestablish desired behaviour we replace the placeholdeer
17
- // when we detect a characterData mutation inside
54
+ if (typeof this.getPos !== 'function' || record.type !== 'selection') {
55
+ return true;
56
+ }
57
+
18
58
  const {
19
59
  view,
20
- dom,
21
60
  node
22
61
  } = this;
23
- const content = dom.textContent || '';
24
- const text = node.attrs.text;
25
-
26
- if (record.type === 'characterData' && content !== text && content.includes(text) && typeof this.getPos === 'function') {
27
- const start = this.getPos();
28
- const end = start + this.node.nodeSize;
29
- const stripped = content.replace(text, '');
30
- let tr = view.state.tr.replaceRangeWith(start, end, view.state.schema.text(stripped));
31
- tr = tr.setSelection(TextSelection.create(tr.doc, end, end));
62
+ const placeholderStartPosition = this.getPos();
63
+ const placeholderEndPosition = this.getPos() + node.nodeSize;
64
+ const selection = view.state.selection; // when the selection is set right after the placeholder.
65
+ // we should let ProseMirror deal with this edge-case
66
+
67
+ if (selection.from === placeholderEndPosition) {
68
+ return false;
69
+ }
70
+
71
+ const isSelectionAtPlaceholder = selection.from === placeholderStartPosition;
72
+ const isSelectionAfterlaceholder = selection.from > placeholderEndPosition;
73
+
74
+ if (isSelectionAtPlaceholder || isSelectionAfterlaceholder) {
75
+ const tr = view.state.tr;
76
+ tr.setSelection(Selection.near(tr.doc.resolve(placeholderEndPosition)));
32
77
  view.dispatch(tr);
78
+ return true;
33
79
  }
34
80
 
35
- return record.type !== 'selection';
81
+ return true;
36
82
  }
37
83
 
38
84
  }
@@ -0,0 +1,9 @@
1
+ import { TextSelection } from 'prosemirror-state';
2
+ export const isSelectionAtPlaceholder = selection => {
3
+ if (!(selection instanceof TextSelection) || !selection.$cursor) {
4
+ return false;
5
+ }
6
+
7
+ const node = selection.$cursor.doc.nodeAt(selection.$cursor.pos);
8
+ return (node === null || node === void 0 ? void 0 : node.type.name) === 'placeholder';
9
+ };
@@ -1,7 +1,29 @@
1
1
  import { css } from 'styled-components';
2
2
  import { N300 } from '@atlaskit/theme/colors';
3
+ import { SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
3
4
  export const placeholderTextStyles = css`
4
5
  .ProseMirror span[data-placeholder] {
5
6
  color: ${N300};
7
+ display: inline;
8
+ }
9
+
10
+ .ProseMirror span.pm-placeholder {
11
+ display: inline;
12
+ color: ${N300};
13
+ }
14
+ .ProseMirror span.pm-placeholder__text {
15
+ display: inline;
16
+ color: ${N300};
17
+ }
18
+
19
+ .ProseMirror span.pm-placeholder.${akEditorSelectedNodeClassName} {
20
+ ${getSelectionStyles([SelectionStyle.Background])}
21
+ }
22
+
23
+ .ProseMirror span.pm-placeholder__text[data-placeholder]::after {
24
+ color: ${N300};
25
+ cursor: text;
26
+ content: attr(data-placeholder);
27
+ display: inline;
6
28
  }
7
29
  `;
@@ -2,6 +2,6 @@ export { hoverColumns, hoverRows, hoverTable, hoverMergedCells, clearHoverSelect
2
2
  export { insertColumn, insertRow, createTable } from './insert';
3
3
  export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
4
4
  export { clearMultipleCells } from './clear';
5
- export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectRow, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, setTableSize } from './misc';
5
+ export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectRow, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations } from './misc';
6
6
  export { sortByColumn } from './sort';
7
7
  export { goToNextCell } from './go-to-next-cell';
@@ -94,7 +94,7 @@ export const insertColumn = column => (state, dispatch, view) => {
94
94
  };
95
95
  export const insertRow = (row, moveCursorToTheNewRow) => (state, dispatch) => {
96
96
  // Don't clone the header row
97
- const headerRowEnabled = checkIfHeaderRowEnabled(state);
97
+ const headerRowEnabled = checkIfHeaderRowEnabled(state.selection);
98
98
  const clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0; // When the table have header row
99
99
  // we should not add row on the position zero
100
100
 
@@ -13,7 +13,7 @@ import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
13
13
  import { fixAutoSizedTable } from '../transforms';
14
14
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
15
15
  import { createColumnControlsDecoration, createColumnSelectedDecoration } from '../utils/decoration';
16
- import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, isIsolating } from '../utils/nodes';
16
+ import { checkIfNumberColumnEnabled, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, isIsolating } from '../utils/nodes';
17
17
  import { updatePluginStateDecorations } from '../utils/update-plugin-state-decorations'; // #endregion
18
18
  // #endregion
19
19
  // #region Commands
@@ -40,8 +40,9 @@ export const setTableRef = ref => createCommand(state => {
40
40
  tablePos,
41
41
  tableWrapperTarget,
42
42
  layout: layout || 'default',
43
- isHeaderRowEnabled: checkIfHeaderRowEnabled(state),
44
- isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state),
43
+ isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
44
+ isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
45
+ isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
45
46
  decorationSet,
46
47
  resizeHandleColumnIndex: undefined
47
48
  }
@@ -110,7 +111,7 @@ export const triggerUnlessTableHeader = command => (state, dispatch, view) => {
110
111
  if (selection instanceof CellSelection) {
111
112
  const rect = getSelectionRect(selection);
112
113
 
113
- if (!checkIfHeaderRowEnabled(state) || rect && rect.top > 0) {
114
+ if (!checkIfHeaderRowEnabled(selection) || rect && rect.top > 0) {
114
115
  return command(state, dispatch, view);
115
116
  }
116
117
  }
@@ -382,13 +383,6 @@ export const addResizeHandleDecorations = columnIndex => createCommand(state =>
382
383
  }
383
384
  };
384
385
  }, tr => tr.setMeta('addToHistory', false));
385
- export const setTableSize = (tableHeight, tableWidth) => createCommand({
386
- type: 'SET_TABLE_SIZE',
387
- data: {
388
- tableHeight,
389
- tableWidth
390
- }
391
- }, tr => tr.setMeta('addToHistory', false));
392
386
  export const autoSizeTable = (view, node, table, basePos, opts) => {
393
387
  view.dispatch(fixAutoSizedTable(view, node, table, basePos, opts));
394
388
  return true;
@@ -313,7 +313,7 @@ export const toggleNumberColumnWithAnalytics = () => withAnalytics(state => {
313
313
  actionSubject: ACTION_SUBJECT.TABLE,
314
314
  actionSubjectId: null,
315
315
  attributes: {
316
- newState: !checkIfNumberColumnEnabled(state),
316
+ newState: !checkIfNumberColumnEnabled(state.selection),
317
317
  totalRowCount,
318
318
  totalColumnCount
319
319
  },
@@ -6,8 +6,9 @@ import { isTableCollapsible } from './utils/collapse';
6
6
  import { defaultTableSelection } from './pm-plugins/default-table-selection';
7
7
  import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
8
8
  import { TableSortStep } from '@atlaskit/adf-schema/steps';
9
-
10
9
  // #endregion
10
+ import { checkIfNumberColumnEnabled, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled } from './utils/nodes';
11
+
11
12
  const nextTableSorting = (tr, table) => {
12
13
  const tableSortStep = tr.steps.find(step => step instanceof TableSortStep);
13
14
  return tableSortStep && table && table.pos === tableSortStep.pos ? tableSortStep.next : undefined;
@@ -63,7 +64,10 @@ const updateTableNodePluginState = ({
63
64
  ...defaultTableSelection,
64
65
  tableNode,
65
66
  ordering: nextTableSorting(tr, table),
66
- resizeHandleColumnIndex: nextResizeHandleColumnIndex(tr, pluginState.resizeHandleColumnIndex)
67
+ resizeHandleColumnIndex: nextResizeHandleColumnIndex(tr, pluginState.resizeHandleColumnIndex),
68
+ isNumberColumnEnabled: checkIfNumberColumnEnabled(tr.selection),
69
+ isHeaderColumnEnabled: checkIfHeaderColumnEnabled(tr.selection),
70
+ isHeaderRowEnabled: checkIfHeaderRowEnabled(tr.selection)
67
71
  };
68
72
  };
69
73
 
@@ -15,7 +15,7 @@ import { createPlugin as createDecorationsPlugin } from './pm-plugins/decoration
15
15
  import { keymapPlugin } from './pm-plugins/keymap';
16
16
  import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
17
17
  import { createPlugin } from './pm-plugins/main';
18
- import { pluginKey } from './pm-plugins/plugin-factory';
18
+ import { pluginKey } from './pm-plugins/plugin-key';
19
19
  import { createPlugin as createStickyHeadersPlugin, findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from './pm-plugins/sticky-headers';
20
20
  import { createPlugin as createFlexiResizingPlugin, pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
21
21
  import { getToolbarConfig } from './toolbar';
@@ -25,7 +25,6 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
25
25
  import FloatingInsertButton from './ui/FloatingInsertButton';
26
26
  import LayoutButton from './ui/LayoutButton';
27
27
  import { isLayoutSupported } from './utils';
28
- import { getFeatureFlags } from '../feature-flags-context';
29
28
  import { ErrorBoundary } from '../../ui/ErrorBoundary';
30
29
 
31
30
  const tablesPlugin = options => ({
@@ -111,6 +110,8 @@ const tablesPlugin = options => ({
111
110
  }]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
112
111
  // causing issues with table selections in Safari
113
112
  // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
113
+ // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
114
+ // https://github.com/ProseMirror/prosemirror-view/pull/116
114
115
 
115
116
  if (browser.safari) {
116
117
  plugins.push({
@@ -162,15 +163,11 @@ const tablesPlugin = options => ({
162
163
  insertRowButtonIndex,
163
164
  isHeaderColumnEnabled,
164
165
  isHeaderRowEnabled,
165
- tableWrapperTarget,
166
- tableWidth
166
+ tableWrapperTarget
167
167
  } = tablePluginState;
168
168
  const {
169
169
  allowControls
170
170
  } = pluginConfig;
171
- const {
172
- tableRenderOptimization
173
- } = getFeatureFlags(state) || {};
174
171
  const stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
175
172
  return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
176
173
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
@@ -220,7 +217,6 @@ const tablesPlugin = options => ({
220
217
  targetRef: tableWrapperTarget,
221
218
  layout: layout,
222
219
  isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
223
- tableWidth: tableRenderOptimization ? tableWidth : undefined,
224
220
  stickyHeader: stickyHeader
225
221
  }));
226
222
  }
@@ -417,7 +417,7 @@ class TableComponent extends React.Component {
417
417
  if (this.overflowShadowsObserver) {
418
418
  var _this$state$stickyHea;
419
419
 
420
- this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, containsHeaderRow(view.state, getNode()));
420
+ this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, containsHeaderRow(getNode()));
421
421
  }
422
422
  }
423
423
 
@@ -490,7 +490,7 @@ class TableComponent extends React.Component {
490
490
  const headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined; //dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
491
491
 
492
492
  const tableHeight = tableRef && !tableRenderOptimization ? tableRef.offsetHeight : undefined;
493
- const hasHeaderRow = containsHeaderRow(view.state, node);
493
+ const hasHeaderRow = containsHeaderRow(node);
494
494
  const rowControls = /*#__PURE__*/React.createElement("div", {
495
495
  className: ClassName.ROW_CONTROLS_WRAPPER
496
496
  }, /*#__PURE__*/React.createElement(TableFloatingControls, {