@atlaskit/editor-core 161.0.0 → 162.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/CHANGELOG.md +44 -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 +1 -1
  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/FloatingContextualMenu/index.js +3 -1
  61. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  62. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -2
  63. package/dist/cjs/plugins/table/ui/common-styles.css.js +17 -8
  64. package/dist/cjs/plugins/table/ui/ui-styles.css.js +39 -25
  65. package/dist/cjs/plugins/table/utils/nodes.js +15 -15
  66. package/dist/cjs/plugins/tasks-and-decisions/commands.js +15 -1
  67. package/dist/cjs/plugins/text-formatting/styles.js +5 -2
  68. package/dist/cjs/plugins/text-formatting/ui/Toolbar/index.js +71 -1
  69. package/dist/cjs/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
  70. package/dist/cjs/plugins/text-formatting/utils.js +30 -2
  71. package/dist/cjs/plugins/type-ahead/api.js +32 -1
  72. package/dist/cjs/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +20 -5
  73. package/dist/cjs/plugins/type-ahead/utils.js +22 -4
  74. package/dist/cjs/ui/Appearance/Comment/Comment.js +1 -1
  75. package/dist/cjs/ui/Appearance/FullPage/StyledComponents.js +1 -1
  76. package/dist/cjs/ui/ContentStyles/index.js +32 -9
  77. package/dist/cjs/utils/index.js +1 -8
  78. package/dist/cjs/utils/insert.js +1 -9
  79. package/dist/cjs/utils/selection.js +2 -9
  80. package/dist/cjs/version-wrapper.js +1 -1
  81. package/dist/cjs/version.json +1 -1
  82. package/dist/es2019/actions/index.js +20 -23
  83. package/dist/es2019/extensibility.js +1 -1
  84. package/dist/es2019/labs/next/full-page.js +2 -2
  85. package/dist/es2019/plugins/block-type/styles.js +3 -3
  86. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/index.js +15 -12
  87. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +19 -14
  88. package/dist/es2019/plugins/card/messages.js +4 -4
  89. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +21 -9
  90. package/dist/es2019/plugins/card/ui/LinkToolbarButtonGroup.js +54 -3
  91. package/dist/es2019/plugins/card/ui/LinkToolbarIconDropdown.js +145 -3
  92. package/dist/es2019/plugins/card/ui/ResizableEmbedCard.js +10 -6
  93. package/dist/es2019/plugins/card/ui/assets/card.js +1 -1
  94. package/dist/es2019/plugins/card/ui/assets/embed.js +1 -1
  95. package/dist/es2019/plugins/card/ui/assets/inline.js +1 -1
  96. package/dist/es2019/plugins/card/ui/assets/url.js +1 -1
  97. package/dist/es2019/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
  98. package/dist/es2019/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
  99. package/dist/es2019/plugins/card/ui/styled.js +2 -2
  100. package/dist/es2019/plugins/card/ui/types.js +1 -0
  101. package/dist/es2019/plugins/clipboard/pm-plugins/main.js +91 -9
  102. package/dist/es2019/plugins/code-block/styles.js +14 -14
  103. package/dist/es2019/plugins/extension/plugin-factory.js +3 -1
  104. package/dist/es2019/plugins/extension/pm-plugins/main.js +38 -12
  105. package/dist/es2019/plugins/extension/utils.js +37 -2
  106. package/dist/es2019/plugins/find-replace/ui/Find.js +1 -1
  107. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +1 -1
  108. package/dist/es2019/plugins/find-replace/ui/Replace.js +1 -1
  109. package/dist/es2019/plugins/find-replace/ui/styles.js +14 -9
  110. package/dist/es2019/plugins/layout/styles.js +5 -1
  111. package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +163 -0
  112. package/dist/es2019/plugins/list/commands/index.js +29 -28
  113. package/dist/es2019/plugins/list/utils/replace-content.js +22 -0
  114. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  115. package/dist/es2019/plugins/media/styles.js +1 -1
  116. package/dist/es2019/plugins/media/utils/media-single.js +14 -1
  117. package/dist/es2019/plugins/paste/handlers.js +19 -5
  118. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
  119. package/dist/es2019/plugins/placeholder-text/index.js +46 -1
  120. package/dist/es2019/plugins/placeholder-text/placeholder-text-nodeview.js +66 -20
  121. package/dist/es2019/plugins/placeholder-text/selection-utils.js +9 -0
  122. package/dist/es2019/plugins/placeholder-text/styles.js +22 -0
  123. package/dist/es2019/plugins/table/commands/index.js +1 -1
  124. package/dist/es2019/plugins/table/commands/insert.js +1 -1
  125. package/dist/es2019/plugins/table/commands/misc.js +5 -11
  126. package/dist/es2019/plugins/table/commands-with-analytics.js +1 -1
  127. package/dist/es2019/plugins/table/handlers.js +6 -2
  128. package/dist/es2019/plugins/table/index.js +4 -8
  129. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -2
  130. package/dist/es2019/plugins/table/nodeviews/table.js +2 -16
  131. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +1 -1
  132. package/dist/es2019/plugins/table/pm-plugins/main.js +2 -1
  133. package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +1 -2
  134. package/dist/es2019/plugins/table/pm-plugins/plugin-key.js +2 -0
  135. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
  136. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
  137. package/dist/es2019/plugins/table/reducer.js +0 -9
  138. package/dist/es2019/plugins/table/toolbar.js +1 -4
  139. package/dist/es2019/plugins/table/transforms/metadata.js +1 -1
  140. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +2 -1
  141. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  142. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +1 -2
  143. package/dist/es2019/plugins/table/ui/common-styles.css.js +51 -26
  144. package/dist/es2019/plugins/table/ui/ui-styles.css.js +57 -56
  145. package/dist/es2019/plugins/table/utils/nodes.js +11 -11
  146. package/dist/es2019/plugins/tasks-and-decisions/commands.js +13 -1
  147. package/dist/es2019/plugins/text-formatting/styles.js +3 -3
  148. package/dist/es2019/plugins/text-formatting/ui/Toolbar/index.js +61 -2
  149. package/dist/es2019/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
  150. package/dist/es2019/plugins/text-formatting/utils.js +13 -1
  151. package/dist/es2019/plugins/type-ahead/api.js +31 -2
  152. package/dist/es2019/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +17 -5
  153. package/dist/es2019/plugins/type-ahead/utils.js +15 -0
  154. package/dist/es2019/ui/Appearance/Comment/Comment.js +2 -2
  155. package/dist/es2019/ui/Appearance/FullPage/StyledComponents.js +2 -2
  156. package/dist/es2019/ui/ContentStyles/index.js +45 -23
  157. package/dist/es2019/utils/index.js +1 -1
  158. package/dist/es2019/utils/insert.js +2 -10
  159. package/dist/es2019/utils/selection.js +1 -6
  160. package/dist/es2019/version-wrapper.js +1 -1
  161. package/dist/es2019/version.json +1 -1
  162. package/dist/esm/actions/index.js +76 -48
  163. package/dist/esm/extensibility.js +1 -1
  164. package/dist/esm/labs/next/full-page.js +2 -2
  165. package/dist/esm/plugins/block-type/styles.js +4 -2
  166. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/index.js +14 -12
  167. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +9 -5
  168. package/dist/esm/plugins/card/messages.js +4 -4
  169. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +25 -9
  170. package/dist/esm/plugins/card/ui/LinkToolbarButtonGroup.js +57 -5
  171. package/dist/esm/plugins/card/ui/LinkToolbarIconDropdown.js +154 -5
  172. package/dist/esm/plugins/card/ui/ResizableEmbedCard.js +9 -6
  173. package/dist/esm/plugins/card/ui/assets/card.js +1 -1
  174. package/dist/esm/plugins/card/ui/assets/embed.js +1 -1
  175. package/dist/esm/plugins/card/ui/assets/inline.js +1 -1
  176. package/dist/esm/plugins/card/ui/assets/url.js +1 -1
  177. package/dist/esm/plugins/card/ui/link-toolbar-button-group-options.js +45 -0
  178. package/dist/esm/plugins/card/ui/link-toolbar-icon-dropdown-options.js +51 -0
  179. package/dist/esm/plugins/card/ui/styled.js +2 -2
  180. package/dist/esm/plugins/card/ui/types.js +1 -0
  181. package/dist/esm/plugins/clipboard/pm-plugins/main.js +91 -2
  182. package/dist/esm/plugins/code-block/styles.js +42 -38
  183. package/dist/esm/plugins/extension/plugin-factory.js +3 -1
  184. package/dist/esm/plugins/extension/pm-plugins/main.js +34 -11
  185. package/dist/esm/plugins/extension/utils.js +51 -9
  186. package/dist/esm/plugins/find-replace/ui/Find.js +1 -1
  187. package/dist/esm/plugins/find-replace/ui/FindReplace.js +1 -1
  188. package/dist/esm/plugins/find-replace/ui/Replace.js +1 -1
  189. package/dist/esm/plugins/find-replace/ui/styles.js +6 -10
  190. package/dist/esm/plugins/layout/styles.js +2 -2
  191. package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +168 -0
  192. package/dist/esm/plugins/list/commands/index.js +33 -34
  193. package/dist/esm/plugins/list/utils/replace-content.js +21 -0
  194. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  195. package/dist/esm/plugins/media/styles.js +1 -1
  196. package/dist/esm/plugins/media/utils/media-single.js +12 -1
  197. package/dist/esm/plugins/paste/handlers.js +19 -5
  198. package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
  199. package/dist/esm/plugins/placeholder-text/index.js +44 -1
  200. package/dist/esm/plugins/placeholder-text/placeholder-text-nodeview.js +67 -20
  201. package/dist/esm/plugins/placeholder-text/selection-utils.js +9 -0
  202. package/dist/esm/plugins/placeholder-text/styles.js +2 -1
  203. package/dist/esm/plugins/table/commands/index.js +1 -1
  204. package/dist/esm/plugins/table/commands/insert.js +1 -1
  205. package/dist/esm/plugins/table/commands/misc.js +5 -15
  206. package/dist/esm/plugins/table/commands-with-analytics.js +1 -1
  207. package/dist/esm/plugins/table/handlers.js +6 -2
  208. package/dist/esm/plugins/table/index.js +6 -11
  209. package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -2
  210. package/dist/esm/plugins/table/nodeviews/table.js +6 -37
  211. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +1 -1
  212. package/dist/esm/plugins/table/pm-plugins/main.js +2 -1
  213. package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +1 -2
  214. package/dist/esm/plugins/table/pm-plugins/plugin-key.js +2 -0
  215. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +2 -0
  216. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +1 -1
  217. package/dist/esm/plugins/table/reducer.js +0 -7
  218. package/dist/esm/plugins/table/toolbar.js +1 -10
  219. package/dist/esm/plugins/table/transforms/metadata.js +1 -1
  220. package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +2 -1
  221. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +1 -1
  222. package/dist/esm/plugins/table/ui/LayoutButton/index.js +1 -2
  223. package/dist/esm/plugins/table/ui/common-styles.css.js +10 -6
  224. package/dist/esm/plugins/table/ui/ui-styles.css.js +20 -11
  225. package/dist/esm/plugins/table/utils/nodes.js +14 -14
  226. package/dist/esm/plugins/tasks-and-decisions/commands.js +13 -1
  227. package/dist/esm/plugins/text-formatting/styles.js +4 -2
  228. package/dist/esm/plugins/text-formatting/ui/Toolbar/index.js +69 -2
  229. package/dist/esm/plugins/text-formatting/ui/Toolbar/toolbar-messages.js +30 -0
  230. package/dist/esm/plugins/text-formatting/utils.js +18 -0
  231. package/dist/esm/plugins/type-ahead/api.js +30 -2
  232. package/dist/esm/plugins/type-ahead/transforms/open-typeahead-at-cursor.js +16 -4
  233. package/dist/esm/plugins/type-ahead/utils.js +17 -3
  234. package/dist/esm/ui/Appearance/Comment/Comment.js +2 -2
  235. package/dist/esm/ui/Appearance/FullPage/StyledComponents.js +2 -2
  236. package/dist/esm/ui/ContentStyles/index.js +27 -9
  237. package/dist/esm/utils/index.js +1 -1
  238. package/dist/esm/utils/insert.js +2 -10
  239. package/dist/esm/utils/selection.js +1 -6
  240. package/dist/esm/version-wrapper.js +1 -1
  241. package/dist/esm/version.json +1 -1
  242. package/dist/types/actions/index.d.ts +2 -2
  243. package/dist/types/extensibility.d.ts +1 -1
  244. package/dist/types/plugins/analytics/types/list-events.d.ts +0 -1
  245. package/dist/types/plugins/block-type/styles.d.ts +2 -1
  246. package/dist/types/plugins/block-type/ui/ToolbarBlockType/index.d.ts +1 -0
  247. package/dist/types/plugins/block-type/ui/ToolbarBlockType/styled.d.ts +2 -7
  248. package/dist/types/plugins/card/messages.d.ts +2 -2
  249. package/dist/types/plugins/card/ui/LinkToolbarButtonGroup.d.ts +18 -2
  250. package/dist/types/plugins/card/ui/LinkToolbarIconDropdown.d.ts +23 -3
  251. package/dist/types/plugins/card/ui/ResizableEmbedCard.d.ts +3 -1
  252. package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +5 -0
  253. package/dist/types/plugins/card/ui/link-toolbar-icon-dropdown-options.d.ts +5 -0
  254. package/dist/types/plugins/card/ui/styled.d.ts +2 -3
  255. package/dist/types/plugins/card/ui/types.d.ts +12 -0
  256. package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +10 -1
  257. package/dist/types/plugins/code-block/styles.d.ts +3 -2
  258. package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -1
  259. package/dist/types/plugins/extension/types.d.ts +1 -0
  260. package/dist/types/plugins/extension/utils.d.ts +3 -1
  261. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +2 -1
  262. package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -5
  263. package/dist/types/plugins/layout/styles.d.ts +1 -1
  264. package/dist/types/plugins/list/actions/wrap-and-join-lists.d.ts +25 -0
  265. package/dist/types/plugins/list/commands/index.d.ts +0 -1
  266. package/dist/types/plugins/list/utils/replace-content.d.ts +8 -0
  267. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +2 -2
  268. package/dist/types/plugins/media/styles.d.ts +1 -1
  269. package/dist/types/plugins/media/utils/media-single.d.ts +1 -0
  270. package/dist/types/plugins/panel/styles.d.ts +1 -1
  271. package/dist/types/plugins/paste/handlers.d.ts +1 -1
  272. package/dist/types/plugins/placeholder-text/placeholder-text-nodeview.d.ts +3 -2
  273. package/dist/types/plugins/placeholder-text/selection-utils.d.ts +2 -0
  274. package/dist/types/plugins/rule/styles.d.ts +1 -1
  275. package/dist/types/plugins/table/commands/index.d.ts +1 -1
  276. package/dist/types/plugins/table/commands/misc.d.ts +0 -1
  277. package/dist/types/plugins/table/nodeviews/table.d.ts +0 -1
  278. package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +1 -4
  279. package/dist/types/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
  280. package/dist/types/plugins/table/types.d.ts +1 -8
  281. package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +0 -1
  282. package/dist/types/plugins/table/ui/common-styles.css.d.ts +6 -3
  283. package/dist/types/plugins/table/ui/ui-styles.css.d.ts +15 -14
  284. package/dist/types/plugins/table/utils/nodes.d.ts +6 -6
  285. package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +1 -1
  286. package/dist/types/plugins/text-formatting/styles.d.ts +2 -1
  287. package/dist/types/plugins/text-formatting/ui/Toolbar/toolbar-messages.d.ts +30 -0
  288. package/dist/types/plugins/text-formatting/utils.d.ts +4 -0
  289. package/dist/types/plugins/type-ahead/api.d.ts +11 -1
  290. package/dist/types/plugins/type-ahead/transforms/open-typeahead-at-cursor.d.ts +1 -0
  291. package/dist/types/plugins/type-ahead/utils.d.ts +4 -0
  292. package/dist/types/ui/ContentStyles/index.d.ts +1 -0
  293. package/dist/types/utils/index.d.ts +1 -1
  294. package/dist/types/utils/selection.d.ts +0 -1
  295. package/package.json +28 -26
@@ -11,46 +11,90 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
11
11
 
12
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
13
 
14
- var _prosemirrorModel = require("prosemirror-model");
15
-
16
14
  var _prosemirrorState = require("prosemirror-state");
17
15
 
16
+ var _utils = require("@atlaskit/editor-common/utils");
17
+
18
+ var serializePlaceholderNode = function serializePlaceholderNode(node) {
19
+ var element = document.createElement('span');
20
+ element.classList.add('pm-placeholder');
21
+
22
+ if (_utils.browser.gecko) {
23
+ element.setAttribute('contenteditable', 'true');
24
+ }
25
+
26
+ element.innerText = _utils.ZERO_WIDTH_SPACE;
27
+ var elementChildren = document.createElement('span');
28
+ elementChildren.classList.add('pm-placeholder__text');
29
+ elementChildren.dataset.placeholder = node.attrs.text;
30
+ elementChildren.setAttribute('contenteditable', 'false');
31
+ element.appendChild(elementChildren);
32
+
33
+ if (_utils.browser.safari) {
34
+ element.appendChild(document.createTextNode(_utils.ZERO_WIDTH_SPACE));
35
+ } else {
36
+ element.appendChild(document.createElement('wbr'));
37
+ }
38
+
39
+ return element;
40
+ };
41
+
18
42
  var PlaceholderTextNodeView = /*#__PURE__*/function () {
19
43
  function PlaceholderTextNodeView(node, view, getPos) {
20
44
  (0, _classCallCheck2.default)(this, PlaceholderTextNodeView);
21
45
  this.node = node;
22
46
  this.view = view;
23
47
  this.getPos = getPos;
24
-
25
- var serializer = _prosemirrorModel.DOMSerializer.fromSchema(this.view.state.schema);
26
-
27
- this.dom = serializer.serializeNode(this.node);
48
+ this.dom = serializePlaceholderNode(this.node);
49
+ this.getPos = getPos;
28
50
  }
29
51
 
30
52
  (0, _createClass2.default)(PlaceholderTextNodeView, [{
53
+ key: "stopEvent",
54
+ value: function stopEvent(e) {
55
+ if (e.type === 'mousedown' && typeof this.getPos === 'function') {
56
+ e.preventDefault();
57
+ var _view = this.view;
58
+ var startNodePosition = this.getPos();
59
+ var tr = _view.state.tr;
60
+ tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(startNodePosition)));
61
+
62
+ _view.dispatch(tr);
63
+
64
+ return true;
65
+ }
66
+
67
+ return false;
68
+ }
69
+ }, {
31
70
  key: "ignoreMutation",
32
71
  value: function ignoreMutation(record) {
33
- // 😬
34
- // DOM Node needs to be contenteditable so Android does
35
- // not close its virtual keyboard, see ED-9613
36
- // To reestablish desired behaviour we replace the placeholdeer
37
- // when we detect a characterData mutation inside
72
+ if (typeof this.getPos !== 'function' || record.type !== 'selection') {
73
+ return true;
74
+ }
75
+
38
76
  var view = this.view,
39
- dom = this.dom,
40
77
  node = this.node;
41
- var content = dom.textContent || '';
42
- var text = node.attrs.text;
43
-
44
- if (record.type === 'characterData' && content !== text && content.includes(text) && typeof this.getPos === 'function') {
45
- var start = this.getPos();
46
- var end = start + this.node.nodeSize;
47
- var stripped = content.replace(text, '');
48
- var tr = view.state.tr.replaceRangeWith(start, end, view.state.schema.text(stripped));
49
- tr = tr.setSelection(_prosemirrorState.TextSelection.create(tr.doc, end, end));
78
+ var placeholderStartPosition = this.getPos();
79
+ var placeholderEndPosition = this.getPos() + node.nodeSize;
80
+ var selection = view.state.selection; // when the selection is set right after the placeholder.
81
+ // we should let ProseMirror deal with this edge-case
82
+
83
+ if (selection.from === placeholderEndPosition) {
84
+ return false;
85
+ }
86
+
87
+ var isSelectionAtPlaceholder = selection.from === placeholderStartPosition;
88
+ var isSelectionAfterlaceholder = selection.from > placeholderEndPosition;
89
+
90
+ if (isSelectionAtPlaceholder || isSelectionAfterlaceholder) {
91
+ var tr = view.state.tr;
92
+ tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(placeholderEndPosition)));
50
93
  view.dispatch(tr);
94
+ return true;
51
95
  }
52
96
 
53
- return record.type !== 'selection';
97
+ return true;
54
98
  }
55
99
  }]);
56
100
  return PlaceholderTextNodeView;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSelectionAtPlaceholder = void 0;
7
+
8
+ var _prosemirrorState = require("prosemirror-state");
9
+
10
+ var isSelectionAtPlaceholder = function isSelectionAtPlaceholder(selection) {
11
+ if (!(selection instanceof _prosemirrorState.TextSelection) || !selection.$cursor) {
12
+ return false;
13
+ }
14
+
15
+ var node = selection.$cursor.doc.nodeAt(selection.$cursor.pos);
16
+ return (node === null || node === void 0 ? void 0 : node.type.name) === 'placeholder';
17
+ };
18
+
19
+ exports.isSelectionAtPlaceholder = isSelectionAtPlaceholder;
@@ -13,7 +13,9 @@ var _styledComponents = require("styled-components");
13
13
 
14
14
  var _colors = require("@atlaskit/theme/colors");
15
15
 
16
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
17
+
16
18
  var _templateObject;
17
19
 
18
- var placeholderTextStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror span[data-placeholder] {\n color: ", ";\n }\n"])), _colors.N300);
20
+ var placeholderTextStyles = (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror span[data-placeholder] {\n color: ", ";\n display: inline;\n }\n\n .ProseMirror span.pm-placeholder {\n display: inline;\n color: ", ";\n }\n .ProseMirror span.pm-placeholder__text {\n display: inline;\n color: ", ";\n }\n\n .ProseMirror span.pm-placeholder.", " {\n ", "\n }\n\n .ProseMirror span.pm-placeholder__text[data-placeholder]::after {\n color: ", ";\n cursor: text;\n content: attr(data-placeholder);\n display: inline;\n }\n"])), _colors.N300, _colors.N300, _colors.N300, _editorSharedStyles.akEditorSelectedNodeClassName, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.Background]), _colors.N300);
19
21
  exports.placeholderTextStyles = placeholderTextStyles;
@@ -153,12 +153,6 @@ Object.defineProperty(exports, "setTableRef", {
153
153
  return _misc.setTableRef;
154
154
  }
155
155
  });
156
- Object.defineProperty(exports, "setTableSize", {
157
- enumerable: true,
158
- get: function get() {
159
- return _misc.setTableSize;
160
- }
161
- });
162
156
  Object.defineProperty(exports, "showInsertColumnButton", {
163
157
  enumerable: true,
164
158
  get: function get() {
@@ -126,7 +126,7 @@ exports.insertColumn = insertColumn;
126
126
  var insertRow = function insertRow(row, moveCursorToTheNewRow) {
127
127
  return function (state, dispatch) {
128
128
  // Don't clone the header row
129
- var headerRowEnabled = (0, _utils2.checkIfHeaderRowEnabled)(state);
129
+ var headerRowEnabled = (0, _utils2.checkIfHeaderRowEnabled)(state.selection);
130
130
  var clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0; // When the table have header row
131
131
  // we should not add row on the position zero
132
132
 
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableSize = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRow = exports.selectColumn = exports.moveCursorBackward = exports.hideInsertColumnOrRowButton = exports.deleteTableIfSelected = exports.deleteTable = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
8
+ exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRow = exports.selectColumn = exports.moveCursorBackward = exports.hideInsertColumnOrRowButton = exports.deleteTableIfSelected = exports.deleteTable = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -76,8 +76,9 @@ var setTableRef = function setTableRef(ref) {
76
76
  tablePos: tablePos,
77
77
  tableWrapperTarget: tableWrapperTarget,
78
78
  layout: layout || 'default',
79
- isHeaderRowEnabled: (0, _nodes.checkIfHeaderRowEnabled)(state),
80
- isHeaderColumnEnabled: (0, _nodes.checkIfHeaderColumnEnabled)(state),
79
+ isNumberColumnEnabled: (0, _nodes.checkIfNumberColumnEnabled)(state.selection),
80
+ isHeaderRowEnabled: (0, _nodes.checkIfHeaderRowEnabled)(state.selection),
81
+ isHeaderColumnEnabled: (0, _nodes.checkIfHeaderColumnEnabled)(state.selection),
81
82
  decorationSet: decorationSet,
82
83
  resizeHandleColumnIndex: undefined
83
84
  }
@@ -146,7 +147,7 @@ var triggerUnlessTableHeader = function triggerUnlessTableHeader(command) {
146
147
  if (selection instanceof _cellSelection.CellSelection) {
147
148
  var rect = (0, _utils.getSelectionRect)(selection);
148
149
 
149
- if (!(0, _nodes.checkIfHeaderRowEnabled)(state) || rect && rect.top > 0) {
150
+ if (!(0, _nodes.checkIfHeaderRowEnabled)(selection) || rect && rect.top > 0) {
150
151
  return command(state, dispatch, view);
151
152
  }
152
153
  }
@@ -483,20 +484,6 @@ var addResizeHandleDecorations = function addResizeHandleDecorations(columnIndex
483
484
 
484
485
  exports.addResizeHandleDecorations = addResizeHandleDecorations;
485
486
 
486
- var setTableSize = function setTableSize(tableHeight, tableWidth) {
487
- return (0, _pluginFactory.createCommand)({
488
- type: 'SET_TABLE_SIZE',
489
- data: {
490
- tableHeight: tableHeight,
491
- tableWidth: tableWidth
492
- }
493
- }, function (tr) {
494
- return tr.setMeta('addToHistory', false);
495
- });
496
- };
497
-
498
- exports.setTableSize = setTableSize;
499
-
500
487
  var autoSizeTable = function autoSizeTable(view, node, table, basePos, opts) {
501
488
  view.dispatch((0, _transforms.fixAutoSizedTable)(view, node, table, basePos, opts));
502
489
  return true;
@@ -408,7 +408,7 @@ var toggleNumberColumnWithAnalytics = function toggleNumberColumnWithAnalytics()
408
408
  actionSubject: _analytics.ACTION_SUBJECT.TABLE,
409
409
  actionSubjectId: null,
410
410
  attributes: {
411
- newState: !(0, _utils2.checkIfNumberColumnEnabled)(state),
411
+ newState: !(0, _utils2.checkIfNumberColumnEnabled)(state.selection),
412
412
  totalRowCount: totalRowCount,
413
413
  totalColumnCount: totalColumnCount
414
414
  },
@@ -23,11 +23,12 @@ var _tableResizing = require("./pm-plugins/table-resizing");
23
23
 
24
24
  var _steps = require("@atlaskit/adf-schema/steps");
25
25
 
26
+ var _nodes = require("./utils/nodes");
27
+
26
28
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
27
29
 
28
30
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
29
31
 
30
- // #endregion
31
32
  var nextTableSorting = function nextTableSorting(tr, table) {
32
33
  var tableSortStep = tr.steps.find(function (step) {
33
34
  return step instanceof _steps.TableSortStep;
@@ -84,7 +85,10 @@ var updateTableNodePluginState = function updateTableNodePluginState(_ref2) {
84
85
  return _objectSpread(_objectSpread(_objectSpread({}, pluginState), _defaultTableSelection.defaultTableSelection), {}, {
85
86
  tableNode: tableNode,
86
87
  ordering: nextTableSorting(tr, table),
87
- resizeHandleColumnIndex: nextResizeHandleColumnIndex(tr, pluginState.resizeHandleColumnIndex)
88
+ resizeHandleColumnIndex: nextResizeHandleColumnIndex(tr, pluginState.resizeHandleColumnIndex),
89
+ isNumberColumnEnabled: (0, _nodes.checkIfNumberColumnEnabled)(tr.selection),
90
+ isHeaderColumnEnabled: (0, _nodes.checkIfHeaderColumnEnabled)(tr.selection),
91
+ isHeaderRowEnabled: (0, _nodes.checkIfHeaderRowEnabled)(tr.selection)
88
92
  });
89
93
  };
90
94
  };
@@ -41,7 +41,7 @@ var _tableSelectionKeymap = require("./pm-plugins/table-selection-keymap");
41
41
 
42
42
  var _main = require("./pm-plugins/main");
43
43
 
44
- var _pluginFactory = require("./pm-plugins/plugin-factory");
44
+ var _pluginKey = require("./pm-plugins/plugin-key");
45
45
 
46
46
  var _stickyHeaders = require("./pm-plugins/sticky-headers");
47
47
 
@@ -61,8 +61,6 @@ var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
61
61
 
62
62
  var _utils3 = require("./utils");
63
63
 
64
- var _featureFlagsContext = require("../feature-flags-context");
65
-
66
64
  var _ErrorBoundary = require("../../ui/ErrorBoundary");
67
65
 
68
66
  var tablesPlugin = function tablesPlugin(options) {
@@ -157,6 +155,8 @@ var tablesPlugin = function tablesPlugin(options) {
157
155
  }]; // workaround for prosemirrors delayed dom selection syncing during pointer drag
158
156
  // causing issues with table selections in Safari
159
157
  // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
158
+ // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
159
+ // https://github.com/ProseMirror/prosemirror-view/pull/116
160
160
 
161
161
  if (_utils.browser.safari) {
162
162
  plugins.push({
@@ -181,7 +181,7 @@ var tablesPlugin = function tablesPlugin(options) {
181
181
  fallbackComponent: null
182
182
  }, /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
183
183
  plugins: {
184
- tablePluginState: _pluginFactory.pluginKey,
184
+ tablePluginState: _pluginKey.pluginKey,
185
185
  tableResizingPluginState: _tableResizing.pluginKey,
186
186
  stickyHeadersState: _stickyHeaders.pluginKey
187
187
  },
@@ -203,13 +203,8 @@ var tablesPlugin = function tablesPlugin(options) {
203
203
  insertRowButtonIndex = _ref9.insertRowButtonIndex,
204
204
  isHeaderColumnEnabled = _ref9.isHeaderColumnEnabled,
205
205
  isHeaderRowEnabled = _ref9.isHeaderRowEnabled,
206
- tableWrapperTarget = _ref9.tableWrapperTarget,
207
- tableWidth = _ref9.tableWidth;
206
+ tableWrapperTarget = _ref9.tableWrapperTarget;
208
207
  var allowControls = pluginConfig.allowControls;
209
-
210
- var _ref10 = (0, _featureFlagsContext.getFeatureFlags)(state) || {},
211
- tableRenderOptimization = _ref10.tableRenderOptimization;
212
-
213
208
  var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
214
209
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
215
210
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
@@ -259,15 +254,14 @@ var tablesPlugin = function tablesPlugin(options) {
259
254
  targetRef: tableWrapperTarget,
260
255
  layout: layout,
261
256
  isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
262
- tableWidth: tableRenderOptimization ? tableWidth : undefined,
263
257
  stickyHeader: stickyHeader
264
258
  }));
265
259
  }
266
260
  }));
267
261
  },
268
262
  pluginsOptions: {
269
- quickInsert: function quickInsert(_ref11) {
270
- var formatMessage = _ref11.formatMessage;
263
+ quickInsert: function quickInsert(_ref10) {
264
+ var formatMessage = _ref10.formatMessage;
271
265
  return [{
272
266
  id: 'table',
273
267
  title: formatMessage(_messages.messages.table),
@@ -449,7 +449,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
449
449
  if (this.overflowShadowsObserver) {
450
450
  var _this$state$stickyHea;
451
451
 
452
- this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, (0, _utils5.containsHeaderRow)(view.state, getNode()));
452
+ this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, (0, _utils5.containsHeaderRow)(getNode()));
453
453
  }
454
454
  }
455
455
 
@@ -524,7 +524,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
524
524
  var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined; //dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
525
525
 
526
526
  var tableHeight = tableRef && !tableRenderOptimization ? tableRef.offsetHeight : undefined;
527
- var hasHeaderRow = (0, _utils5.containsHeaderRow)(view.state, node);
527
+ var hasHeaderRow = (0, _utils5.containsHeaderRow)(node);
528
528
 
529
529
  var rowControls = /*#__PURE__*/_react.default.createElement("div", {
530
530
  className: _types.TableCssClassName.ROW_CONTROLS_WRAPPER
@@ -41,6 +41,8 @@ var _createPluginConfig = require("../create-plugin-config");
41
41
 
42
42
  var _pluginFactory = require("../pm-plugins/plugin-factory");
43
43
 
44
+ var _pluginKey = require("../pm-plugins/plugin-key");
45
+
44
46
  var _tableResizing = require("../pm-plugins/table-resizing");
45
47
 
46
48
  var _utils = require("../pm-plugins/table-resizing/utils");
@@ -49,18 +51,10 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
49
51
 
50
52
  var _TableComponent = _interopRequireDefault(require("./TableComponent"));
51
53
 
52
- var _commands = require("../commands");
53
-
54
54
  var _featureFlagsContext = require("../../feature-flags-context");
55
55
 
56
56
  var _extensibility = require("../../../extensibility");
57
57
 
58
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
59
-
60
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
61
-
62
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
63
-
64
58
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
65
59
 
66
60
  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; } }
@@ -99,7 +93,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
99
93
  });
100
94
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasHoveredRows", false);
101
95
  _this.getPos = props.getPos;
102
- _this.editorView = props.view;
103
96
  _this.tableRenderOptimization = props.tableRenderOptimization;
104
97
  _this.eventDispatcher = props.eventDispatcher;
105
98
  return _this;
@@ -108,42 +101,18 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
108
101
  (0, _createClass2.default)(TableView, [{
109
102
  key: "getContentDOM",
110
103
  value: function getContentDOM() {
111
- var _window,
112
- _this2 = this;
113
-
114
104
  var rendered = _prosemirrorModel.DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
115
105
 
116
106
  if (rendered.dom) {
117
107
  this.table = rendered.dom;
118
108
  }
119
109
 
120
- if (this.tableRenderOptimization && this.table && !this.resizeObserver && (_window = window) !== null && _window !== void 0 && _window.ResizeObserver) {
121
- this.resizeObserver = new ResizeObserver(function (entries) {
122
- var _iterator = _createForOfIteratorHelper(entries),
123
- _step;
124
-
125
- try {
126
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
127
- var entry = _step.value;
128
- var height = entry.contentRect ? entry.contentRect.height : entry.target.offsetHeight;
129
- var width = entry.contentRect ? entry.contentRect.width : entry.target.offsetWidth;
130
- (0, _commands.setTableSize)(height, width)(_this2.editorView.state, _this2.editorView.dispatch);
131
- }
132
- } catch (err) {
133
- _iterator.e(err);
134
- } finally {
135
- _iterator.f();
136
- }
137
- });
138
- this.resizeObserver.observe(this.table);
139
- }
140
-
141
110
  return rendered;
142
111
  }
143
112
  }, {
144
113
  key: "setDomAttrs",
145
114
  value: function setDomAttrs(node) {
146
- var _this3 = this;
115
+ var _this2 = this;
147
116
 
148
117
  if (!this.table) {
149
118
  return;
@@ -151,18 +120,18 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
151
120
 
152
121
  var attrs = tableAttributes(node);
153
122
  Object.keys(attrs).forEach(function (attr) {
154
- _this3.table.setAttribute(attr, attrs[attr]);
123
+ _this2.table.setAttribute(attr, attrs[attr]);
155
124
  });
156
125
  }
157
126
  }, {
158
127
  key: "render",
159
128
  value: function render(props, forwardRef) {
160
- var _this4 = this;
129
+ var _this3 = this;
161
130
 
162
131
  return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
163
132
  plugins: {
164
133
  containerWidth: _width.pluginKey,
165
- pluginState: _pluginFactory.pluginKey,
134
+ pluginState: _pluginKey.pluginKey,
166
135
  tableResizingPluginState: _tableResizing.pluginKey
167
136
  },
168
137
  editorView: props.view,
@@ -183,7 +152,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
183
152
  tableActive: tableActive,
184
153
  ordering: pluginState.ordering,
185
154
  tableResizingPluginState: tableResizingPluginState,
186
- getNode: _this4.getNode,
155
+ getNode: _this3.getNode,
187
156
  containerWidth: containerWidth,
188
157
  contentDOM: forwardRef
189
158
  });
@@ -13,7 +13,7 @@ var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
13
 
14
14
  var _prosemirrorView = require("prosemirror-view");
15
15
 
16
- var _pluginFactory = require("../plugin-factory");
16
+ var _pluginKey = require("../plugin-key");
17
17
 
18
18
  var _utils = require("./utils");
19
19
 
@@ -56,7 +56,7 @@ var createPlugin = function createPlugin() {
56
56
  },
57
57
  apply: function apply(tr, decorationSet, oldState) {
58
58
  var pluginState = decorationSet;
59
- var meta = tr.getMeta(_pluginFactory.pluginKey);
59
+ var meta = tr.getMeta(_pluginKey.pluginKey);
60
60
 
61
61
  if (meta && meta.data && meta.data.decorationSet) {
62
62
  pluginState = meta.data.decorationSet;
@@ -39,6 +39,8 @@ var _defaultTableSelection = require("./default-table-selection");
39
39
 
40
40
  var _pluginFactory = require("./plugin-factory");
41
41
 
42
+ var _pluginKey = require("./plugin-key");
43
+
42
44
  var _tableCell = _interopRequireDefault(require("../nodeviews/tableCell"));
43
45
 
44
46
  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; }
@@ -87,7 +89,7 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
87
89
  var invalidTableIds = [];
88
90
  return new _safePlugin.SafePlugin({
89
91
  state: state,
90
- key: _pluginFactory.pluginKey,
92
+ key: _pluginKey.pluginKey,
91
93
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
92
94
  var tr = transactions.find(function (tr) {
93
95
  return tr.getMeta('uiEvent') === 'cut';
@@ -5,26 +5,23 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.pluginKey = exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
8
+ exports.getPluginState = exports.createPluginState = exports.createCommand = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
- var _prosemirrorState = require("prosemirror-state");
13
-
14
12
  var _pluginStateFactory = require("../../../utils/plugin-state-factory");
15
13
 
16
14
  var _handlers = require("../handlers");
17
15
 
18
16
  var _reducer = _interopRequireDefault(require("../reducer"));
19
17
 
18
+ var _pluginKey = require("./plugin-key");
19
+
20
20
  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; }
21
21
 
22
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
23
 
24
- var pluginKey = new _prosemirrorState.PluginKey('tablePlugin');
25
- exports.pluginKey = pluginKey;
26
-
27
- var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(pluginKey, _reducer.default, {
24
+ var _pluginFactory = (0, _pluginStateFactory.pluginFactory)(_pluginKey.pluginKey, _reducer.default, {
28
25
  mapping: function mapping(tr, pluginState) {
29
26
  if (tr.docChanged) {
30
27
  var updatedTargetCell = {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pluginKey = void 0;
7
+
8
+ var _prosemirrorState = require("prosemirror-state");
9
+
10
+ var pluginKey = new _prosemirrorState.PluginKey('tablePlugin');
11
+ exports.pluginKey = pluginKey;
@@ -33,6 +33,8 @@ var createPlugin = function createPlugin() {
33
33
  // DOM selection syncing during pointer drag.
34
34
  //
35
35
  // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
36
+ // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
37
+ // https://github.com/ProseMirror/prosemirror-view/pull/116
36
38
  // This fix removes the selectionToDOM from the view
37
39
  // prior to selectionToDOM being called.
38
40
  // selectionToDOM checks if there is an "active"
@@ -23,7 +23,7 @@ var _types = require("../../../types");
23
23
 
24
24
  var _consts = require("../../../ui/consts");
25
25
 
26
- var _pluginFactory = require("../../plugin-factory");
26
+ var _pluginKey = require("../../plugin-key");
27
27
 
28
28
  var _dom = require("../../table-resizing/utils/dom");
29
29
 
@@ -350,7 +350,7 @@ var TableRowNodeView = /*#__PURE__*/function () {
350
350
  }
351
351
 
352
352
  this.eventDispatcher.on(_width.pluginKey.key, this.onWidthPluginState);
353
- this.eventDispatcher.on(_pluginFactory.pluginKey.key, this.onTablePluginState);
353
+ this.eventDispatcher.on(_pluginKey.pluginKey.key, this.onTablePluginState);
354
354
  this.listening = true;
355
355
  }
356
356
  }, {
@@ -373,7 +373,7 @@ var TableRowNodeView = /*#__PURE__*/function () {
373
373
  }
374
374
 
375
375
  this.eventDispatcher.off(_width.pluginKey.key, this.onWidthPluginState);
376
- this.eventDispatcher.off(_pluginFactory.pluginKey.key, this.onTablePluginState);
376
+ this.eventDispatcher.off(_pluginKey.pluginKey.key, this.onTablePluginState);
377
377
  this.listening = false;
378
378
  } // initialize intersection observer to track if table is within scroll area
379
379
 
@@ -90,13 +90,6 @@ var _default = function _default(pluginState, action) {
90
90
 
91
91
  return _objectSpread(_objectSpread({}, pluginState), action.data);
92
92
 
93
- case 'SET_TABLE_SIZE':
94
- if (pluginState.tableWidth !== action.data.tableWidth || pluginState.tableHeight !== action.data.tableHeight) {
95
- return _objectSpread(_objectSpread({}, pluginState), action.data);
96
- }
97
-
98
- return pluginState;
99
-
100
93
  case 'SET_TABLE_REF':
101
94
  case 'HOVER_ROWS':
102
95
  case 'HOVER_COLUMNS':