@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
@@ -2,50 +2,54 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject, _templateObject2;
4
4
 
5
- import { css } from 'styled-components';
5
+ import { css } from '@emotion/react';
6
6
  import { themed } from '@atlaskit/theme/components';
7
7
  import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
8
8
  import * as colors from '@atlaskit/theme/colors';
9
9
  import { blockNodesVerticalMargin, akEditorTableCellMinWidth, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedBorderSize, akEditorDeleteIconColor, SelectionStyle, getSelectionStyles, akEditorCodeFontFamily, akEditorSelectedNodeClassName, overflowShadow, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
10
10
  import { codeBlockClassNames } from './ui/class-names';
11
- export var highlightingCodeBlockStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n --ds--code--bg-color: transparent;\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
12
- background: themed({
11
+ export var highlightingCodeBlockStyles = function highlightingCodeBlockStyles(props) {
12
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n background-repeat: no-repeat;\n background-color: ", ";\n --ds--code--bg-color: transparent;\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n color: ", ";\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n position: absolute;\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n overflow: hidden;\n tab-size: 4;\n\n & [data-ds--code--code-block] {\n font-size: ", ";\n line-height: 1.5rem;\n }\n }\n\n .", " {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n\n > code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n\n &[data-debounce='true'] {\n .", " {\n display: none;\n }\n }\n\n &:not([data-debounce='true']) {\n > code:not([data-language='plaintext']):not([data-language='none']):not([data-language='']) {\n color: transparent;\n caret-color: ", ";\n }\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
13
+ background: themed({
14
+ light: colors.N20,
15
+ dark: colors.DN50
16
+ })(props),
17
+ width: '8px'
18
+ }), themed({
13
19
  light: colors.N20,
14
20
  dark: colors.DN50
15
- }),
16
- width: '8px'
17
- }), themed({
18
- light: colors.N20,
19
- dark: colors.DN50
20
- }), akEditorCodeFontFamily, borderRadius(), blockNodesVerticalMargin, akEditorTableCellMinWidth, codeBlockClassNames.gutter, themed({
21
- light: colors.N30,
22
- dark: colors.DN20
23
- }), gridSize(), themed({
24
- light: colors.N90,
25
- dark: colors.DN90
26
- }), relativeFontSizeToBase16(fontSize()), themed({
27
- light: colors.N400,
28
- dark: colors.DN400
29
- }), codeBlockClassNames.highlighting, relativeFontSizeToBase16(fontSize()), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), borderRadius(), gridSize(), codeBlockClassNames.highlighting, themed({
30
- light: colors.N800,
31
- dark: colors.DN500
32
- }), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
33
- export var codeBlockStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n --ds--code--bg-color: transparent;\n background-repeat: no-repeat;\n background-color: ", ";\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
34
- background: themed({
21
+ })(props), akEditorCodeFontFamily, borderRadius(), blockNodesVerticalMargin, akEditorTableCellMinWidth, codeBlockClassNames.gutter, themed({
22
+ light: colors.N30,
23
+ dark: colors.DN20
24
+ })(props), gridSize(), themed({
25
+ light: colors.N90,
26
+ dark: colors.DN90
27
+ })(props), relativeFontSizeToBase16(fontSize()), themed({
28
+ light: colors.N400,
29
+ dark: colors.DN400
30
+ })(props), codeBlockClassNames.highlighting, relativeFontSizeToBase16(fontSize()), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), borderRadius(), gridSize(), codeBlockClassNames.highlighting, themed({
31
+ light: colors.N800,
32
+ dark: colors.DN500
33
+ })(props), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
34
+ };
35
+ export var codeBlockStyles = function codeBlockStyles(props) {
36
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ProseMirror .code-block {\n position: relative;\n background-image: ", ";\n --ds--code--bg-color: transparent;\n background-repeat: no-repeat;\n background-color: ", ";\n background-attachment: local, scroll, scroll;\n background-size: 8px 100%, 8px 100%, 8px 100%;\n background-position: 100% 0, 100% 0, 0 0;\n font-family: ", ";\n border-radius: ", "px;\n margin: ", " 0 0 0;\n counter-reset: line;\n display: flex;\n min-width: ", "px;\n cursor: pointer;\n overflow-x: auto;\n\n .", " {\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/develop/packages/design-system/code/src/themes/themeBuilder.ts#packages/design-system/code/src/themes/themeBuilder.ts-19:28 */\n flex-shrink: 0;\n text-align: right;\n background-color: ", ";\n padding: ", "px;\n\n span {\n display: block;\n line-height: 0;\n font-size: 0;\n\n &::before {\n display: inline-block;\n content: counter(line);\n counter-increment: line;\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n }\n }\n }\n\n .", " {\n display: flex;\n flex: 1;\n\n code {\n flex-grow: 1;\n tab-size: 4;\n cursor: text;\n /* https://bitbucket.org/atlassian/atlassian-frontend/src/218202daeaf527262c21841e6f88fa058d349ad4/packages/design-system/code/src/themes/themeBuilder.ts#lines-12:17 */\n font-size: ", ";\n line-height: 1.5rem;\n color: ", ";\n border-radius: ", "px;\n margin: ", "px;\n white-space: pre;\n }\n }\n }\n\n .ProseMirror li > .code-block {\n margin: 0;\n }\n\n .ProseMirror .code-block.", ":not(.danger) {\n ", "\n }\n\n /* Danger when top level node */\n .ProseMirror .danger.code-block {\n box-shadow: 0 0 0 ", "px ", ";\n\n .", " {\n background-color: ", ";\n color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n }\n\n /* Danger when nested node */\n .ProseMirror .danger .code-block {\n .", " {\n background-color: rgba(255, 143, 115, 0.5);\n color: ", ";\n }\n\n .", " {\n background-color: rgba(255, 189, 173, 0.5);\n }\n }\n"])), overflowShadow({
37
+ background: themed({
38
+ light: colors.N20,
39
+ dark: colors.DN50
40
+ })(props),
41
+ width: '8px'
42
+ }), themed({
35
43
  light: colors.N20,
36
44
  dark: colors.DN50
37
- }),
38
- width: '8px'
39
- }), themed({
40
- light: colors.N20,
41
- dark: colors.DN50
42
- }), akEditorCodeFontFamily, borderRadius(), blockNodesVerticalMargin, akEditorTableCellMinWidth, codeBlockClassNames.gutter, themed({
43
- light: colors.N30,
44
- dark: colors.DN20
45
- }), gridSize(), relativeFontSizeToBase16(fontSize()), themed({
46
- light: colors.N400,
47
- dark: colors.DN400
48
- }), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), themed({
49
- light: colors.N800,
50
- dark: colors.DN800
51
- }), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
45
+ })(props), akEditorCodeFontFamily, borderRadius(), blockNodesVerticalMargin, akEditorTableCellMinWidth, codeBlockClassNames.gutter, themed({
46
+ light: colors.N30,
47
+ dark: colors.DN20
48
+ })(props), gridSize(), relativeFontSizeToBase16(fontSize()), themed({
49
+ light: colors.N400,
50
+ dark: colors.DN400
51
+ })(props), codeBlockClassNames.content, relativeFontSizeToBase16(fontSize()), themed({
52
+ light: colors.N800,
53
+ dark: colors.DN800
54
+ })(props), borderRadius(), gridSize(), akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow, SelectionStyle.Blanket]), akEditorSelectedBorderSize, akEditorDeleteBorder, codeBlockClassNames.gutter, colors.R75, akEditorDeleteIconColor, codeBlockClassNames.content, akEditorDeleteBackground, codeBlockClassNames.gutter, akEditorDeleteIconColor, codeBlockClassNames.content);
55
+ };
@@ -7,6 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
  import { pluginFactory } from '../../utils/plugin-state-factory';
8
8
  import reducer from './reducer';
9
9
  import { pluginKey } from './plugin-key';
10
+ import { onSelectionChanged } from './utils';
10
11
  var factory = pluginFactory(pluginKey, reducer, {
11
12
  mapping: function mapping(tr, state) {
12
13
  var _ref = state,
@@ -25,7 +26,8 @@ var factory = pluginFactory(pluginKey, reducer, {
25
26
  return _objectSpread(_objectSpread({}, state), {}, {
26
27
  positions: positions
27
28
  });
28
- }
29
+ },
30
+ onSelectionChanged: onSelectionChanged
29
31
  });
30
32
  export var createPluginState = factory.createPluginState;
31
33
  export var createCommand = factory.createCommand;
@@ -251,6 +251,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
251
251
  var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
252
252
  var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
253
253
  var state = createPluginState(dispatch, {
254
+ shouldRefreshEditButton: false,
254
255
  showEditButton: false,
255
256
  showContextPanel: false
256
257
  });
@@ -274,25 +275,45 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
274
275
  element = _getPluginState.element,
275
276
  localId = _getPluginState.localId,
276
277
  extensionProvider = _getPluginState.extensionProvider,
277
- showContextPanel = _getPluginState.showContextPanel; // This fetches the selected extension node, either by keyboard selection or click for all types of extensions
278
+ showContextPanel = _getPluginState.showContextPanel,
279
+ shouldRefreshEditButton = _getPluginState.shouldRefreshEditButton;
278
280
 
281
+ if (!shouldRefreshEditButton) {
282
+ return false;
283
+ } // This fetches the selected extension node, either by keyboard selection or click for all types of extensions
279
284
 
280
- var selectedExtension = getSelectedExtension(state, true);
285
+
286
+ var selectedExtension = getSelectedExtension(state, true); // If our selection isn't on an extension node, clear some state and hide the config panel
281
287
 
282
288
  if (!selectedExtension) {
283
289
  if (showContextPanel) {
284
290
  clearEditingContext(state, dispatch);
285
291
  }
286
292
 
293
+ updateState({
294
+ shouldRefreshEditButton: false,
295
+ localId: undefined,
296
+ element: undefined,
297
+ showEditButton: false,
298
+ updateExtension: undefined
299
+ })(state, dispatch);
287
300
  return;
288
- }
301
+ } // By this point we're certain we've selected an extension node.
302
+ // But we need to determine if the selection has changed to another
303
+ // extension node or remained on the same node.
304
+
289
305
 
290
306
  var node = selectedExtension.node;
291
307
  var newElement = getSelectedDomElement(state.schema, domAtPos, selectedExtension); // New node is selection
292
308
 
293
- if (node.attrs.localId ? localId !== node.attrs.localId : // This is the current assumption and it's wrong but we are keeping it
309
+ var hasSelectedNodeChanged = node.attrs.localId ? localId !== node.attrs.localId : // This is the current assumption and it's wrong but we are keeping it
294
310
  // as fallback in case we need to turn off `allowLocalIdGeneration`
295
- element !== newElement) {
311
+ element !== newElement;
312
+ var nextState = {
313
+ shouldRefreshEditButton: false
314
+ };
315
+
316
+ if (hasSelectedNodeChanged) {
296
317
  if (showContextPanel) {
297
318
  clearEditingContext(state, dispatch);
298
319
  }
@@ -303,20 +324,20 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
303
324
  var showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
304
325
  var updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(function () {// do nothing;
305
326
  });
306
- updateState({
327
+ Object.assign(nextState, {
307
328
  localId: node.attrs.localId,
308
- showContextPanel: false,
309
329
  element: newElement,
310
330
  showEditButton: showEditButton,
311
331
  updateExtension: updateExtension
312
- })(state, dispatch);
332
+ });
313
333
  } // New DOM element doesn't necessarily mean it's a new Node
314
334
  else if (element !== newElement) {
315
- updateState({
335
+ Object.assign(nextState, {
316
336
  element: newElement
317
- })(state, dispatch);
337
+ });
318
338
  }
319
339
 
340
+ updateState(nextState)(state, dispatch);
320
341
  return true;
321
342
  },
322
343
  destroy: function destroy() {
@@ -333,7 +354,9 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
333
354
  inlineExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions)
334
355
  },
335
356
  handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension'], function (target) {
336
- return !target.closest('.extension-content');
357
+ // Clicked on anything around the extension content
358
+ // or specifically on the content border of a bodied extension
359
+ return !target.closest('.extension-content') || target.classList.contains('extension-content');
337
360
  }, {
338
361
  useLongPressSelection: useLongPressSelection
339
362
  })
@@ -1,15 +1,32 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+
3
+ 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; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+
1
7
  import { findParentNodeOfType, findSelectedNodeOfType, findDomRefAtPos } from 'prosemirror-utils';
2
8
  import { closestElement } from '../../utils/dom';
3
9
  import { findNodePosByLocalIds } from '../../utils/nodes-by-localIds';
10
+
11
+ var getSelectedExtensionByTransaction = function getSelectedExtensionByTransaction(transaction) {
12
+ var searchParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13
+ return _getSelectedExtension(transaction.doc.type.schema, transaction.selection, searchParent);
14
+ };
15
+
4
16
  export var getSelectedExtension = function getSelectedExtension(state) {
5
17
  var searchParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6
- var _state$schema$nodes = state.schema.nodes,
7
- inlineExtension = _state$schema$nodes.inlineExtension,
8
- extension = _state$schema$nodes.extension,
9
- bodiedExtension = _state$schema$nodes.bodiedExtension;
18
+ return _getSelectedExtension(state.schema, state.selection, searchParent);
19
+ };
20
+
21
+ var _getSelectedExtension = function _getSelectedExtension(schema, selection, searchParent) {
22
+ var _schema$nodes = schema.nodes,
23
+ inlineExtension = _schema$nodes.inlineExtension,
24
+ extension = _schema$nodes.extension,
25
+ bodiedExtension = _schema$nodes.bodiedExtension;
10
26
  var nodeTypes = [extension, bodiedExtension, inlineExtension];
11
- return findSelectedNodeOfType(nodeTypes)(state.selection) || searchParent && findParentNodeOfType(nodeTypes)(state.selection) || undefined;
27
+ return findSelectedNodeOfType(nodeTypes)(selection) || searchParent && findParentNodeOfType(nodeTypes)(selection) || undefined;
12
28
  };
29
+
13
30
  export var findExtensionWithLocalId = function findExtensionWithLocalId(state, localId) {
14
31
  var selectedExtension = getSelectedExtension(state, true);
15
32
 
@@ -21,10 +38,10 @@ export var findExtensionWithLocalId = function findExtensionWithLocalId(state, l
21
38
  return selectedExtension;
22
39
  }
23
40
 
24
- var _state$schema$nodes2 = state.schema.nodes,
25
- inlineExtension = _state$schema$nodes2.inlineExtension,
26
- extension = _state$schema$nodes2.extension,
27
- bodiedExtension = _state$schema$nodes2.bodiedExtension;
41
+ var _state$schema$nodes = state.schema.nodes,
42
+ inlineExtension = _state$schema$nodes.inlineExtension,
43
+ extension = _state$schema$nodes.extension,
44
+ bodiedExtension = _state$schema$nodes.bodiedExtension;
28
45
  var nodeTypes = [extension, bodiedExtension, inlineExtension];
29
46
  var matched;
30
47
  state.doc.descendants(function (node, pos) {
@@ -64,4 +81,29 @@ export var getNodeTypesReferenced = function getNodeTypesReferenced(ids, state)
64
81
  export var findNodePosWithLocalId = function findNodePosWithLocalId(state, localId) {
65
82
  var nodes = findNodePosByLocalIds(state, [localId]);
66
83
  return nodes.length >= 1 ? nodes[0] : undefined;
84
+ };
85
+ export var onSelectionChanged = function onSelectionChanged(tr, state) {
86
+ var selectedExtension = getSelectedExtensionByTransaction(tr, true);
87
+ var hasUnselectedExtension = !!state.element && !selectedExtension;
88
+ /*
89
+ * We use this to indicate to our plugin that the selection has changed.
90
+ *
91
+ * - ignore if shouldRefreshEditButton already set
92
+ * - restrict to scenarios when an extension is
93
+ * - a) actually selected
94
+ * - b) or un-selected (not accounting for selection extensionA -> extensionB)
95
+ *
96
+ * The rest of the logic will be handled in Extension main plugin view update().
97
+ *
98
+ * Known issue: typing inside of a bodiedExtension will trigger state changes each keystroke
99
+ * as the toolbar always being open while it is focused.
100
+ */
101
+
102
+ if (!state.shouldRefreshEditButton && (selectedExtension || hasUnselectedExtension)) {
103
+ return _objectSpread(_objectSpread({}, state), {}, {
104
+ shouldRefreshEditButton: true
105
+ });
106
+ }
107
+
108
+ return state;
67
109
  };
@@ -12,7 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  /** @jsx jsx */
14
14
  import React from 'react';
15
- import { jsx } from '@emotion/core';
15
+ import { jsx } from '@emotion/react';
16
16
  import { defineMessages, injectIntl } from 'react-intl-next';
17
17
  import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
18
18
  import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
@@ -12,7 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  /** @jsx jsx */
14
14
  import React from 'react';
15
- import { jsx } from '@emotion/core';
15
+ import { jsx } from '@emotion/react';
16
16
  import Find from './Find';
17
17
  import Replace from './Replace';
18
18
  import { ruleStyles, wrapperStyles } from './styles';
@@ -12,7 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  /** @jsx jsx */
14
14
  import React from 'react';
15
- import { jsx } from '@emotion/core';
15
+ import { jsx } from '@emotion/react';
16
16
  import Button from '@atlaskit/button/standard-button';
17
17
  import { defineMessages, injectIntl } from 'react-intl-next';
18
18
  import Textfield from '@atlaskit/textfield';
@@ -1,5 +1,9 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject;
4
+
1
5
  /** @jsx jsx */
2
- import { css } from '@emotion/core';
6
+ import { css } from '@emotion/react';
3
7
  import { N60, N30A } from '@atlaskit/theme/colors';
4
8
  import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
9
  export var replaceSectionButtonStyles = css({
@@ -20,15 +24,7 @@ export var wrapperStyles = css({
20
24
  margin: '0px 4px'
21
25
  }
22
26
  });
23
- export var sectionWrapperStyles = css({
24
- display: 'flex',
25
- alignItems: 'column',
26
- '> *': {
27
- display: 'inline-flex',
28
- height: '32px',
29
- flex: '0 0 auto'
30
- }
31
- });
27
+ export var sectionWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n\n & > * {\n display: inline-flex;\n height: 32px;\n flex: 0 0 auto;\n }\n\n & > [data-ds--text-field--container] {\n display: flex;\n flex: 1 1 auto;\n }\n"])));
32
28
  export var countStyles = css({
33
29
  color: "".concat(N60),
34
30
  fontSize: "".concat(relativeFontSizeToBase16(12)),
@@ -2,7 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
2
2
 
3
3
  var _templateObject;
4
4
 
5
- import { css } from 'styled-components';
5
+ import { css } from '@emotion/react';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
7
7
  import { N40A, N50A } from '@atlaskit/theme/colors';
8
8
  import { columnLayoutSharedStyle } from '@atlaskit/editor-common/styles';
@@ -11,4 +11,4 @@ import { TableCssClassName } from '../table/types';
11
11
  import { tableMarginFullWidthMode } from '../table/ui/consts';
12
12
  export var LAYOUT_SECTION_MARGIN = gridSize();
13
13
  export var LAYOUT_COLUMN_PADDING = gridSize() * 1.5;
14
- export var layoutStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", " [data-layout-section] {\n margin: ", "px -", "px 0;\n transition: border-color 0.3s ", ";\n cursor: pointer;\n\n /* Inner cursor located 26px from left */\n [data-layout-column] {\n flex: 1;\n min-width: 0;\n border: ", "px solid ", ";\n border-radius: 4px;\n padding: ", "px;\n box-sizing: border-box;\n\n > div {\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n > .mediaSingleView-content-wrap:first-child .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child\n + span\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n > [data-node-type='decisionList'] {\n li:first-of-type [data-decision-wrapper] {\n margin-top: 0;\n }\n }\n }\n\n /* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n [data-layout-content] {\n height: 100%;\n cursor: text;\n }\n }\n\n [data-layout-column] + [data-layout-column] {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n [data-layout-column] + [data-layout-column] {\n margin-left: 0;\n }\n }\n\n /* Shows the border when cursor is inside a layout */\n &.selected [data-layout-column],\n &:hover [data-layout-column] {\n border-color: ", ";\n }\n\n &.selected.danger > [data-layout-column] {\n background-color: ", ";\n border-color: ", ";\n }\n\n &.", ":not(.danger) {\n [data-layout-column] {\n ", "\n }\n }\n }\n }\n\n .fabric-editor--full-width-mode .ProseMirror {\n [data-layout-section] {\n .", " {\n margin: 0 ", "px;\n }\n }\n }\n"])), columnLayoutSharedStyle, gridSize() - 1, akLayoutGutterOffset, akEditorSwoopCubicBezier, akEditorSelectedBorderSize, N40A, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN, gridMediumMaxWidth, N50A, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode);
14
+ export var layoutStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror {\n ", " [data-layout-section] {\n margin: ", "px -", "px 0;\n transition: border-color 0.3s ", ";\n cursor: pointer;\n\n /* Inner cursor located 26px from left */\n [data-layout-column] {\n flex: 1;\n min-width: 0;\n border: ", "px solid ", ";\n border-radius: 4px;\n padding: ", "px;\n box-sizing: border-box;\n\n > div {\n > *:first-child {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + * {\n margin-top: 0;\n }\n\n .rich-media-item {\n margin-top: 0;\n }\n\n > .mediaSingleView-content-wrap:first-child .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor.-right:first-child\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child\n + span\n + .mediaSingleView-content-wrap\n .rich-media-item {\n margin-top: 0;\n }\n\n /* Prevent first DecisionWrapper's margin-top: 8px from shifting decisions down\n and shrinking layout's node selectable area (leniency margin) */\n > [data-node-type='decisionList'] {\n li:first-of-type [data-decision-wrapper] {\n margin-top: 0;\n }\n }\n }\n\n /* Make the 'content' fill the entire height of the layout column to allow click\n handler of layout section nodeview to target only data-layout-column */\n [data-layout-content] {\n height: 100%;\n cursor: text;\n }\n }\n\n [data-layout-column] + [data-layout-column] {\n margin-left: ", "px;\n }\n\n @media screen and (max-width: ", "px) {\n [data-layout-column] + [data-layout-column] {\n margin-left: 0;\n }\n }\n\n /* Shows the border when cursor is inside a layout */\n &.selected [data-layout-column],\n &:hover [data-layout-column] {\n border-color: ", ";\n }\n\n &.selected.danger > [data-layout-column] {\n background-color: ", ";\n border-color: ", ";\n }\n\n &.", ":not(.danger) {\n [data-layout-column] {\n ", "\n }\n }\n }\n }\n\n .fabric-editor--full-width-mode .ProseMirror {\n [data-layout-section] {\n .", " {\n margin: 0 ", "px;\n }\n }\n }\n"])), columnLayoutSharedStyle, gridSize() - 1, akLayoutGutterOffset, akEditorSwoopCubicBezier, akEditorSelectedBorderSize, N40A, LAYOUT_COLUMN_PADDING, LAYOUT_SECTION_MARGIN, gridMediumMaxWidth, N50A, akEditorDeleteBackground, akEditorDeleteBorder, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.Border, SelectionStyle.Blanket]), TableCssClassName.TABLE_CONTAINER, tableMarginFullWidthMode);
@@ -0,0 +1,168 @@
1
+ import { Fragment, Slice, NodeRange } from 'prosemirror-model';
2
+ import { ReplaceAroundStep, findWrapping, canSplit, canJoin } from 'prosemirror-transform';
3
+ /**
4
+ * Wraps the selection in a list with the given type. If this results in
5
+ * two adjacent lists of the same type, those will be joined together.
6
+ */
7
+
8
+ export function wrapInListAndJoin(nodeType, tr) {
9
+ wrapInList(nodeType)(tr);
10
+ autoJoin(tr, function (before, after) {
11
+ return before.type === after.type && before.type === nodeType;
12
+ });
13
+ }
14
+ /**
15
+ * Wraps the selection in a list with the given type and attributes.
16
+ *
17
+ * Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L64-L89
18
+ */
19
+
20
+ export function wrapInList(listType, attrs) {
21
+ return function (tr) {
22
+ var _tr$selection = tr.selection,
23
+ $from = _tr$selection.$from,
24
+ $to = _tr$selection.$to;
25
+ var range = $from.blockRange($to);
26
+ var doJoin = false;
27
+ var outerRange = range;
28
+
29
+ if (!range) {
30
+ return false;
31
+ } // This is at the top of an existing list item
32
+
33
+
34
+ if (range.depth >= 2 && // @ts-ignore - missing type for compatibleContent
35
+ $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex === 0) {
36
+ // Don't do anything if this is the top of the list
37
+ if ($from.index(range.depth - 1) === 0) {
38
+ return false;
39
+ }
40
+
41
+ var $insert = tr.doc.resolve(range.start - 2);
42
+ outerRange = new NodeRange($insert, $insert, range.depth);
43
+
44
+ if (range.endIndex < range.parent.childCount) {
45
+ range = new NodeRange($from, tr.doc.resolve($to.end(range.depth)), range.depth);
46
+ }
47
+
48
+ doJoin = true;
49
+ }
50
+
51
+ var wrap = findWrapping(outerRange, listType, attrs, range);
52
+
53
+ if (!wrap) {
54
+ return false;
55
+ }
56
+
57
+ tr = doWrapInList(tr, range, wrap, doJoin, listType);
58
+ return true;
59
+ };
60
+ }
61
+ /**
62
+ * Internal function used by wrapInList
63
+ *
64
+ * Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L91-L112
65
+ */
66
+
67
+ function doWrapInList(tr, range, wrappers, joinBefore, listType) {
68
+ var content = Fragment.empty;
69
+
70
+ for (var i = wrappers.length - 1; i >= 0; i--) {
71
+ content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
72
+ }
73
+
74
+ tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
75
+ var found = 0;
76
+
77
+ for (var _i = 0; _i < wrappers.length; _i++) {
78
+ if (wrappers[_i].type === listType) {
79
+ found = _i + 1;
80
+ }
81
+ }
82
+
83
+ var splitDepth = wrappers.length - found;
84
+ var splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0);
85
+ var parent = range.parent;
86
+
87
+ for (var _i2 = range.startIndex, e = range.endIndex, first = true; _i2 < e; _i2++, first = false) {
88
+ if (!first && canSplit(tr.doc, splitPos, splitDepth)) {
89
+ tr.split(splitPos, splitDepth);
90
+ splitPos += 2 * splitDepth;
91
+ }
92
+
93
+ splitPos += parent.child(_i2).nodeSize;
94
+ }
95
+
96
+ return tr;
97
+ }
98
+ /**
99
+ * Checks whether two adjacent nodes can be joined. If so, the document
100
+ * will be updated to join those nodes. If not, the original transaction
101
+ * remains untouched.
102
+ *
103
+ * Nodes are considered joinable if the `isJoinable` predicate returns true.
104
+ *
105
+ * Adapted from https://github.com/ProseMirror/prosemirror-commands/blob/master/src/commands.js#L597-L610
106
+ */
107
+
108
+
109
+ export function autoJoin(tr, isJoinable) {
110
+ if (!tr.isGeneric) {
111
+ return;
112
+ }
113
+
114
+ var ranges = [];
115
+
116
+ for (var i = 0; i < tr.mapping.maps.length; i++) {
117
+ var map = tr.mapping.maps[i];
118
+
119
+ for (var j = 0; j < ranges.length; j++) {
120
+ ranges[j] = map.map(ranges[j]);
121
+ }
122
+
123
+ map.forEach(function (_s, _e, from, to) {
124
+ return ranges.push(from, to);
125
+ });
126
+ } // Figure out which joinable points exist inside those ranges,
127
+ // by checking all node boundaries in their parent nodes.
128
+
129
+
130
+ var joinable = [];
131
+
132
+ for (var _i3 = 0; _i3 < ranges.length; _i3 += 2) {
133
+ var from = ranges[_i3];
134
+ var to = ranges[_i3 + 1];
135
+ var $from = tr.doc.resolve(from);
136
+ var depth = $from.sharedDepth(to);
137
+ var parent = $from.node(depth);
138
+
139
+ for (var index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {
140
+ var _after = parent.maybeChild(index);
141
+
142
+ if (!_after) {
143
+ break;
144
+ }
145
+
146
+ if (index && joinable.indexOf(pos) === -1) {
147
+ var _before = parent.child(index - 1);
148
+
149
+ if (_before.type === _after.type && isJoinable(_before, _after)) {
150
+ joinable.push(pos);
151
+ }
152
+ }
153
+
154
+ pos += _after.nodeSize;
155
+ }
156
+ } // Join the joinable points
157
+
158
+
159
+ joinable.sort(function (a, b) {
160
+ return a - b;
161
+ });
162
+
163
+ for (var _i4 = joinable.length - 1; _i4 >= 0; _i4--) {
164
+ if (canJoin(tr.doc, joinable[_i4])) {
165
+ tr.join(joinable[_i4]);
166
+ }
167
+ }
168
+ }