@atlaskit/editor-core 151.2.0 → 152.0.1

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 (311) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/dist/cjs/create-editor/ReactEditorView.js +22 -8
  3. package/dist/cjs/create-editor/create-plugins-list.js +25 -9
  4. package/dist/cjs/labs/next/presets/cxhtml.js +1 -2
  5. package/dist/cjs/nodeviews/ReactNodeView.js +2 -2
  6. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +6 -0
  7. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  8. package/dist/cjs/plugins/annotation/utils.js +19 -8
  9. package/dist/cjs/plugins/avatar-group/index.js +2 -1
  10. package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  11. package/dist/cjs/plugins/before-primaryToolbar/index.js +26 -0
  12. package/dist/cjs/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +28 -0
  13. package/dist/cjs/plugins/extension/extension-api.js +10 -2
  14. package/dist/cjs/plugins/extension/ui/styles.js +1 -1
  15. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  16. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +172 -0
  17. package/dist/cjs/plugins/find-replace/index.js +14 -137
  18. package/dist/cjs/plugins/find-replace/ui/Find.js +16 -9
  19. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +9 -2
  20. package/dist/cjs/plugins/find-replace/ui/Replace.js +11 -3
  21. package/dist/cjs/plugins/find-replace/ui/styles.js +44 -35
  22. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -4
  23. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  24. package/dist/cjs/plugins/fragment/index.js +34 -0
  25. package/dist/cjs/plugins/fragment/plugin-key.js +11 -0
  26. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  27. package/dist/cjs/plugins/index.js +16 -0
  28. package/dist/cjs/plugins/list/actions/conversions.js +39 -71
  29. package/dist/cjs/plugins/list/transforms.js +7 -1
  30. package/dist/cjs/plugins/media/index.js +2 -3
  31. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +3 -1
  32. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +12 -5
  33. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +6 -4
  34. package/dist/cjs/plugins/media/nodeviews/styles.js +6 -1
  35. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  36. package/dist/cjs/plugins/media/pm-plugins/main.js +49 -15
  37. package/dist/cjs/plugins/media/toolbar/commands.js +59 -0
  38. package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +7 -2
  39. package/dist/cjs/plugins/media/toolbar/index.js +90 -3
  40. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  41. package/dist/cjs/plugins/media/utils/media-common.js +1 -1
  42. package/dist/cjs/plugins/media/utils/media-files.js +5 -1
  43. package/dist/cjs/plugins/panel/actions.js +2 -2
  44. package/dist/cjs/plugins/panel/index.js +3 -3
  45. package/dist/cjs/plugins/panel/nodeviews/panel.js +2 -2
  46. package/dist/cjs/plugins/panel/toolbar.js +10 -5
  47. package/dist/cjs/plugins/panel/utils.js +15 -0
  48. package/dist/cjs/plugins/rank.js +3 -2
  49. package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +49 -1
  50. package/dist/cjs/plugins/status/ui/statusPicker.js +4 -2
  51. package/dist/cjs/plugins/table/commands/insert.js +1 -0
  52. package/dist/cjs/plugins/table/index.js +3 -2
  53. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -3
  54. package/dist/cjs/plugins/table/pm-plugins/main.js +26 -3
  55. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  56. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  57. package/dist/cjs/plugins/table/transforms/column-width.js +14 -5
  58. package/dist/cjs/plugins/table/transforms/fix-tables.js +43 -6
  59. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  60. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  61. package/dist/cjs/plugins/table/ui/common-styles.css.js +1 -1
  62. package/dist/cjs/plugins/table/ui/consts.js +1 -1
  63. package/dist/cjs/plugins/table/ui/messages.js +1 -1
  64. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  65. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  66. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -2
  67. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  68. package/dist/cjs/plugins/text-formatting/index.js +2 -1
  69. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +1 -0
  70. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +77 -26
  71. package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +32 -9
  72. package/dist/cjs/ui/ColorPalette/Color/index.js +8 -18
  73. package/dist/cjs/ui/ColorPalette/index.js +7 -4
  74. package/dist/cjs/ui/ColorPickerButton/index.js +1 -1
  75. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +114 -61
  76. package/dist/cjs/ui/ConfigPanel/FormContent.js +39 -26
  77. package/dist/cjs/ui/ConfigPanel/transformers.js +490 -248
  78. package/dist/cjs/ui/ConfigPanel/utils.js +2 -10
  79. package/dist/cjs/ui/DropdownMenu/index.js +3 -1
  80. package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +1 -1
  81. package/dist/cjs/ui/Resizer/index.js +9 -1
  82. package/dist/cjs/version-wrapper.js +1 -1
  83. package/dist/cjs/version.json +1 -1
  84. package/dist/es2019/create-editor/ReactEditorView.js +19 -8
  85. package/dist/es2019/create-editor/create-plugins-list.js +26 -10
  86. package/dist/es2019/labs/next/presets/cxhtml.js +1 -2
  87. package/dist/es2019/nodeviews/ReactNodeView.js +1 -1
  88. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +11 -0
  89. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  90. package/dist/es2019/plugins/annotation/utils.js +18 -7
  91. package/dist/es2019/plugins/avatar-group/index.js +2 -1
  92. package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +3 -2
  93. package/dist/es2019/plugins/before-primaryToolbar/index.js +15 -0
  94. package/dist/es2019/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  95. package/dist/es2019/plugins/extension/extension-api.js +9 -2
  96. package/dist/es2019/plugins/extension/ui/styles.js +6 -0
  97. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  98. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +152 -0
  99. package/dist/es2019/plugins/find-replace/index.js +15 -128
  100. package/dist/es2019/plugins/find-replace/ui/Find.js +18 -10
  101. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +11 -3
  102. package/dist/es2019/plugins/find-replace/ui/Replace.js +12 -4
  103. package/dist/es2019/plugins/find-replace/ui/styles.js +37 -47
  104. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  105. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -2
  106. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  107. package/dist/es2019/plugins/fragment/index.js +22 -0
  108. package/dist/es2019/plugins/fragment/plugin-key.js +2 -0
  109. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  110. package/dist/es2019/plugins/index.js +2 -0
  111. package/dist/es2019/plugins/list/actions/conversions.js +38 -69
  112. package/dist/es2019/plugins/list/transforms.js +5 -1
  113. package/dist/es2019/plugins/media/index.js +2 -2
  114. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +2 -1
  115. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +8 -4
  116. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +7 -5
  117. package/dist/es2019/plugins/media/nodeviews/styles.js +2 -0
  118. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  119. package/dist/es2019/plugins/media/pm-plugins/main.js +32 -17
  120. package/dist/es2019/plugins/media/toolbar/commands.js +47 -0
  121. package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +6 -2
  122. package/dist/es2019/plugins/media/toolbar/index.js +90 -3
  123. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +7 -1
  124. package/dist/es2019/plugins/media/utils/media-common.js +1 -1
  125. package/dist/es2019/plugins/media/utils/media-files.js +6 -1
  126. package/dist/es2019/plugins/panel/actions.js +2 -2
  127. package/dist/es2019/plugins/panel/index.js +5 -5
  128. package/dist/es2019/plugins/panel/nodeviews/panel.js +2 -2
  129. package/dist/es2019/plugins/panel/toolbar.js +10 -5
  130. package/dist/es2019/plugins/panel/utils.js +8 -1
  131. package/dist/es2019/plugins/rank.js +3 -2
  132. package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +48 -1
  133. package/dist/es2019/plugins/status/ui/statusPicker.js +4 -2
  134. package/dist/es2019/plugins/table/commands/insert.js +1 -2
  135. package/dist/es2019/plugins/table/index.js +2 -1
  136. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  137. package/dist/es2019/plugins/table/pm-plugins/main.js +25 -4
  138. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  139. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  140. package/dist/es2019/plugins/table/transforms/column-width.js +13 -3
  141. package/dist/es2019/plugins/table/transforms/fix-tables.js +43 -5
  142. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  143. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  144. package/dist/es2019/plugins/table/ui/common-styles.css.js +5 -1
  145. package/dist/es2019/plugins/table/ui/consts.js +2 -2
  146. package/dist/es2019/plugins/table/ui/messages.js +1 -1
  147. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  148. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  149. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  150. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  151. package/dist/es2019/plugins/text-formatting/index.js +3 -2
  152. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  153. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  154. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +60 -27
  155. package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +51 -7
  156. package/dist/es2019/ui/ColorPalette/Color/index.js +9 -18
  157. package/dist/es2019/ui/ColorPalette/index.js +7 -4
  158. package/dist/es2019/ui/ColorPickerButton/index.js +1 -1
  159. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +101 -49
  160. package/dist/es2019/ui/ConfigPanel/FormContent.js +35 -26
  161. package/dist/es2019/ui/ConfigPanel/transformers.js +243 -72
  162. package/dist/es2019/ui/ConfigPanel/utils.js +1 -2
  163. package/dist/es2019/ui/Dropdown/index.js +2 -1
  164. package/dist/es2019/ui/DropdownMenu/index.js +7 -3
  165. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
  166. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  167. package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +2 -2
  168. package/dist/es2019/ui/Resizer/index.js +9 -1
  169. package/dist/es2019/version-wrapper.js +1 -1
  170. package/dist/es2019/version.json +1 -1
  171. package/dist/esm/create-editor/ReactEditorView.js +22 -8
  172. package/dist/esm/create-editor/create-plugins-list.js +26 -10
  173. package/dist/esm/labs/next/presets/cxhtml.js +1 -2
  174. package/dist/esm/nodeviews/ReactNodeView.js +2 -2
  175. package/dist/esm/nodeviews/SelectionBasedNodeView.js +7 -0
  176. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  177. package/dist/esm/plugins/annotation/utils.js +18 -7
  178. package/dist/esm/plugins/avatar-group/index.js +2 -1
  179. package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  180. package/dist/esm/plugins/before-primaryToolbar/index.js +15 -0
  181. package/dist/esm/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  182. package/dist/esm/plugins/extension/extension-api.js +9 -2
  183. package/dist/esm/plugins/extension/ui/styles.js +1 -1
  184. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  185. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +155 -0
  186. package/dist/esm/plugins/find-replace/index.js +14 -131
  187. package/dist/esm/plugins/find-replace/ui/Find.js +17 -10
  188. package/dist/esm/plugins/find-replace/ui/FindReplace.js +10 -3
  189. package/dist/esm/plugins/find-replace/ui/Replace.js +11 -4
  190. package/dist/esm/plugins/find-replace/ui/styles.js +39 -18
  191. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  192. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +9 -4
  193. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  194. package/dist/esm/plugins/fragment/index.js +22 -0
  195. package/dist/esm/plugins/fragment/plugin-key.js +2 -0
  196. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  197. package/dist/esm/plugins/index.js +2 -0
  198. package/dist/esm/plugins/list/actions/conversions.js +38 -71
  199. package/dist/esm/plugins/list/transforms.js +7 -1
  200. package/dist/esm/plugins/media/index.js +2 -3
  201. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +2 -1
  202. package/dist/esm/plugins/media/nodeviews/mediaInline.js +11 -6
  203. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +7 -5
  204. package/dist/esm/plugins/media/nodeviews/styles.js +2 -0
  205. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  206. package/dist/esm/plugins/media/pm-plugins/main.js +47 -16
  207. package/dist/esm/plugins/media/toolbar/commands.js +45 -0
  208. package/dist/esm/plugins/media/toolbar/filePreviewItem.js +6 -2
  209. package/dist/esm/plugins/media/toolbar/index.js +88 -3
  210. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  211. package/dist/esm/plugins/media/utils/media-common.js +1 -1
  212. package/dist/esm/plugins/media/utils/media-files.js +6 -1
  213. package/dist/esm/plugins/panel/actions.js +2 -2
  214. package/dist/esm/plugins/panel/index.js +5 -5
  215. package/dist/esm/plugins/panel/nodeviews/panel.js +2 -2
  216. package/dist/esm/plugins/panel/toolbar.js +9 -4
  217. package/dist/esm/plugins/panel/utils.js +13 -0
  218. package/dist/esm/plugins/rank.js +3 -2
  219. package/dist/esm/plugins/selection/pm-plugins/selection-main.js +50 -1
  220. package/dist/esm/plugins/status/ui/statusPicker.js +4 -2
  221. package/dist/esm/plugins/table/commands/insert.js +1 -2
  222. package/dist/esm/plugins/table/index.js +3 -2
  223. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  224. package/dist/esm/plugins/table/pm-plugins/main.js +27 -4
  225. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  226. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  227. package/dist/esm/plugins/table/transforms/column-width.js +13 -3
  228. package/dist/esm/plugins/table/transforms/fix-tables.js +42 -4
  229. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  230. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  231. package/dist/esm/plugins/table/ui/common-styles.css.js +1 -1
  232. package/dist/esm/plugins/table/ui/consts.js +2 -2
  233. package/dist/esm/plugins/table/ui/messages.js +1 -1
  234. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  235. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  236. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  237. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  238. package/dist/esm/plugins/text-formatting/index.js +3 -2
  239. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  240. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  241. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +67 -27
  242. package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +20 -7
  243. package/dist/esm/ui/ColorPalette/Color/index.js +9 -16
  244. package/dist/esm/ui/ColorPalette/index.js +7 -4
  245. package/dist/esm/ui/ColorPickerButton/index.js +1 -1
  246. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +113 -62
  247. package/dist/esm/ui/ConfigPanel/FormContent.js +39 -26
  248. package/dist/esm/ui/ConfigPanel/transformers.js +488 -248
  249. package/dist/esm/ui/ConfigPanel/utils.js +1 -6
  250. package/dist/esm/ui/Dropdown/index.js +2 -1
  251. package/dist/esm/ui/DropdownMenu/index.js +7 -3
  252. package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
  253. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  254. package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +2 -2
  255. package/dist/esm/ui/Resizer/index.js +9 -1
  256. package/dist/esm/version-wrapper.js +1 -1
  257. package/dist/esm/version.json +1 -1
  258. package/dist/types/labs/next/full-page.d.ts +1 -1
  259. package/dist/types/nodeviews/ReactNodeView.d.ts +1 -1
  260. package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +1 -0
  261. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  262. package/dist/types/plugins/analytics/types/events.d.ts +7 -1
  263. package/dist/types/plugins/annotation/utils.d.ts +1 -1
  264. package/dist/types/plugins/avatar-group/index.d.ts +1 -0
  265. package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +1 -0
  266. package/dist/types/plugins/before-primaryToolbar/index.d.ts +5 -0
  267. package/dist/types/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.d.ts +5 -0
  268. package/dist/types/plugins/code-block/types.d.ts +1 -1
  269. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  270. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +15 -0
  271. package/dist/types/plugins/find-replace/index.d.ts +1 -0
  272. package/dist/types/plugins/find-replace/ui/Find.d.ts +1 -0
  273. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +1 -0
  274. package/dist/types/plugins/find-replace/ui/Replace.d.ts +1 -0
  275. package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -14
  276. package/dist/types/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +1 -1
  277. package/dist/types/plugins/fragment/index.d.ts +5 -0
  278. package/dist/types/plugins/fragment/plugin-key.d.ts +2 -0
  279. package/dist/types/plugins/index.d.ts +2 -0
  280. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +3 -2
  281. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  282. package/dist/types/plugins/media/nodeviews/styles.d.ts +2 -0
  283. package/dist/types/plugins/media/toolbar/commands.d.ts +3 -0
  284. package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +2 -0
  285. package/dist/types/plugins/media/types.d.ts +0 -1
  286. package/dist/types/plugins/panel/actions.d.ts +1 -1
  287. package/dist/types/plugins/panel/types.d.ts +8 -2
  288. package/dist/types/plugins/quick-insert/index.d.ts +2 -1
  289. package/dist/types/plugins/table/commands/insert.d.ts +3 -0
  290. package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
  291. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -0
  292. package/dist/types/plugins/table/transforms/column-width.d.ts +4 -1
  293. package/dist/types/plugins/table/transforms/fix-tables.d.ts +3 -2
  294. package/dist/types/plugins/table/types.d.ts +8 -0
  295. package/dist/types/plugins/table/ui/consts.d.ts +1 -1
  296. package/dist/types/types/editor-appearance-component.d.ts +2 -2
  297. package/dist/types/types/editor-props.d.ts +11 -1
  298. package/dist/types/types/feature-flags.d.ts +13 -0
  299. package/dist/types/types/index.d.ts +1 -1
  300. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -2
  301. package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +10 -1
  302. package/dist/types/ui/ColorPalette/Color/index.d.ts +8 -5
  303. package/dist/types/ui/ColorPalette/index.d.ts +1 -0
  304. package/dist/types/ui/ConfigPanel/transformers.d.ts +7 -1
  305. package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
  306. package/dist/types/ui/Resizer/index.d.ts +1 -0
  307. package/package.json +33 -29
  308. package/dist/cjs/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -38
  309. package/dist/es2019/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  310. package/dist/esm/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  311. package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +0 -1
@@ -97,6 +97,13 @@ export var SelectionBasedNodeView = /*#__PURE__*/function (_ReactNodeView) {
97
97
  return _this.isSelectedNode(_this.view.state.selection) || _this.isSelectionInsideNode(from, to);
98
98
  });
99
99
 
100
+ _defineProperty(_assertThisInitialized(_this), "nodeInsideSelection", function () {
101
+ var selection = _this.view.state.selection;
102
+ var from = selection.from,
103
+ to = selection.to;
104
+ return _this.isSelectedNode(selection) || _this.isNodeInsideSelection(from, to);
105
+ });
106
+
100
107
  _defineProperty(_assertThisInitialized(_this), "onSelectionChange", function () {
101
108
  _this.update(_this.node, []);
102
109
  });
@@ -55,6 +55,7 @@ export var ACTION;
55
55
  ACTION["INITIALISED"] = "initialised";
56
56
  ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
57
57
  ACTION["INSERTED"] = "inserted";
58
+ ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
58
59
  ACTION["INVOKED"] = "invoked";
59
60
  ACTION["LANGUAGE_SELECTED"] = "languageSelected";
60
61
  ACTION["LIST_ITEM_JOINED"] = "listItemJoined";
@@ -264,7 +264,7 @@ export var isSelectionValid = function isSelectionValid(state) {
264
264
  return AnnotationSelectionType.DISABLED;
265
265
  }
266
266
 
267
- if (disallowOnWhitespace && hasWhitespaceNode(selection)) {
267
+ if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection)) {
268
268
  return AnnotationSelectionType.INVALID;
269
269
  }
270
270
 
@@ -314,16 +314,27 @@ function isEmptyTextSelection(selection, schema) {
314
314
  */
315
315
 
316
316
 
317
- export function hasWhitespaceNode(selection) {
318
- var foundWhitespace = false;
319
- selection.content().content.descendants(function (node) {
317
+ export function hasInvalidWhitespaceNode(selection) {
318
+ var foundInvalidWhitespace = false;
319
+ var content = selection.content().content;
320
+ content.descendants(function (node) {
320
321
  if (node.textContent.trim() === '') {
321
- foundWhitespace = true;
322
+ // Trailing new lines do not result in the annotation spanning into
323
+ // the trailing new line so can be ignored when looking for invalid
324
+ // whitespace nodes.
325
+ var nodeIsTrailingNewLine = // it is the final node
326
+ node.eq(content.lastChild) && // and there are multiple nodes
327
+ !node.eq(content.firstChild) && // and it is a paragraph node
328
+ node.type.name === 'paragraph';
329
+
330
+ if (!nodeIsTrailingNewLine) {
331
+ foundInvalidWhitespace = true;
332
+ }
322
333
  }
323
334
 
324
- return !foundWhitespace;
335
+ return !foundInvalidWhitespace;
325
336
  });
326
- return foundWhitespace;
337
+ return foundInvalidWhitespace;
327
338
  }
328
339
  /*
329
340
  * verifies if node contains annotation mark
@@ -17,7 +17,8 @@ var avatarGroup = function avatarGroup(props) {
17
17
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
18
18
  editorView: editorView,
19
19
  eventDispatcher: eventDispatcher,
20
- collabEdit: props.collabEdit
20
+ collabEdit: props.collabEdit,
21
+ takeFullWidth: props.takeFullWidth
21
22
  });
22
23
  }
23
24
  };
@@ -6,7 +6,9 @@ import React, { useEffect } from 'react';
6
6
  import AvatarsWithPluginState from '../../collab-edit/ui/avatars-with-plugin-state';
7
7
  import styled from 'styled-components';
8
8
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../analytics';
9
- var ToolbarButtonWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-grow: 1;\n justify-content: flex-end;\n align-items: center;\n & > div {\n margin-right: 0;\n }\n"])));
9
+ var ToolbarButtonWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-grow: ", ";\n justify-content: flex-end;\n align-items: center;\n & > div {\n margin-right: 0;\n }\n"])), function (props) {
10
+ return props.takeFullWidth ? 1 : 0;
11
+ });
10
12
  export var AvatarGroupPluginWrapper = function AvatarGroupPluginWrapper(props) {
11
13
  var dispatchAnalyticsEvent = props.dispatchAnalyticsEvent;
12
14
  useEffect(function () {
@@ -23,7 +25,8 @@ export var AvatarGroupPluginWrapper = function AvatarGroupPluginWrapper(props) {
23
25
  }, [dispatchAnalyticsEvent]);
24
26
  return /*#__PURE__*/React.createElement(ToolbarButtonWrapper, {
25
27
  "aria-label": "Editors",
26
- "data-testid": 'avatar-group-in-plugin'
28
+ "data-testid": 'avatar-group-in-plugin',
29
+ takeFullWidth: props.takeFullWidth
27
30
  }, /*#__PURE__*/React.createElement(AvatarsWithPluginState, {
28
31
  editorView: props.editorView,
29
32
  eventDispatcher: props.eventDispatcher,
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { BeforePrimaryToolbarWrapper } from './ui/BeforePrimaryToolbarWrapper';
3
+
4
+ var beforePrimaryToolbar = function beforePrimaryToolbar(props) {
5
+ return {
6
+ name: 'beforePrimaryToolbar',
7
+ primaryToolbarComponent: function primaryToolbarComponent() {
8
+ return /*#__PURE__*/React.createElement(BeforePrimaryToolbarWrapper, {
9
+ beforePrimaryToolbarComponents: props.beforePrimaryToolbarComponents
10
+ });
11
+ }
12
+ };
13
+ };
14
+
15
+ export default beforePrimaryToolbar;
@@ -0,0 +1,12 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject;
4
+
5
+ import React from 'react';
6
+ import styled from 'styled-components';
7
+ export var BeforePrimaryToolbarPluginWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin-right: 8px;\n flex-grow: 1;\n justify-content: flex-end;\n align-items: center;\n"])));
8
+ export var BeforePrimaryToolbarWrapper = function BeforePrimaryToolbarWrapper(props) {
9
+ return /*#__PURE__*/React.createElement(BeforePrimaryToolbarPluginWrapper, {
10
+ "data-testid": 'before-primary-toolbar-components-plugin'
11
+ }, props.beforePrimaryToolbarComponents);
12
+ };
@@ -1,5 +1,6 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import { Fragment, Mark } from 'prosemirror-model';
3
+ import { NodeSelection } from 'prosemirror-state';
3
4
  import { insertMacroFromMacroBrowser } from '../macro';
4
5
  import { pluginKey as macroPluginKey } from '../macro/plugin-key';
5
6
  import { setEditingContextToContextPanel } from './commands';
@@ -43,7 +44,7 @@ var extensionAPICallPayload = function extensionAPICallPayload(functionName) {
43
44
 
44
45
  export var createExtensionAPI = function createExtensionAPI(options) {
45
46
  var doc = {
46
- insertAfter: function insertAfter(localId, adf) {
47
+ insertAfter: function insertAfter(localId, adf, opt) {
47
48
  var editorView = options.editorView;
48
49
  var dispatch = editorView.dispatch; // Be extra cautious since 3rd party devs can use regular JS without type safety
49
50
 
@@ -82,7 +83,8 @@ export var createExtensionAPI = function createExtensionAPI(options) {
82
83
  throw new Error('insertAfter(): Could not create a node for given ADFEntity.');
83
84
  }
84
85
 
85
- tr.insert(nodePos.pos + nodePos.node.nodeSize, newNode); // Validate if the document is valid at this point
86
+ var insertPosition = nodePos.pos + nodePos.node.nodeSize;
87
+ tr.insert(insertPosition, newNode); // Validate if the document is valid at this point
86
88
 
87
89
  try {
88
90
  tr.doc.check();
@@ -126,6 +128,11 @@ export var createExtensionAPI = function createExtensionAPI(options) {
126
128
  };
127
129
  addAnalytics(state, tr, payload);
128
130
  });
131
+
132
+ if (opt && opt.allowSelectionToNewNode) {
133
+ tr.setSelection(new NodeSelection(tr.doc.resolve(insertPosition)));
134
+ }
135
+
129
136
  dispatch(tr);
130
137
  },
131
138
  scrollTo: function scrollTo(localId) {
@@ -4,4 +4,4 @@ var _templateObject;
4
4
 
5
5
  import { css } from 'styled-components';
6
6
  import { blockNodesVerticalMargin, akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground, SelectionStyle, getSelectionStyles, akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
7
- export var extensionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .extensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n"])), blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground);
7
+ export var extensionStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .extensionView-content-wrap,\n .bodiedExtensionView-content-wrap {\n margin: ", " 0;\n\n &:first-of-type {\n margin-top: 0;\n }\n\n &:last-of-type {\n margin-bottom: 0;\n }\n\n &:not(.danger).", " {\n & > span > .extension-container {\n ", "\n }\n }\n\n &.danger > span > .extension-container {\n box-shadow: 0 0 0 ", "px ", ";\n background-color: ", ";\n }\n\n &.inline {\n word-wrap: break-all;\n }\n }\n\n .extensionView-content-wrap .extension-container {\n overflow: hidden;\n }\n\n .bodiedExtensionView-content-wrap\n .extensionView-content-wrap\n .extension-container {\n width: 100%;\n }\n"])), blockNodesVerticalMargin, akEditorSelectedNodeClassName, getSelectionStyles([SelectionStyle.BoxShadow]), akEditorSelectedBorderSize, akEditorDeleteBorder, akEditorDeleteBackground);
@@ -13,7 +13,7 @@ import { browser } from '@atlaskit/editor-common';
13
13
  */
14
14
 
15
15
  export function createFeatureFlagsFromProps(props) {
16
- var _props$allowTextColor, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29;
16
+ var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$allowTables, _props$featureFlags4, _props$featureFlags5, _props$allowTables2, _props$featureFlags6, _props$featureFlags7, _props$allowTables3, _props$featureFlags8, _props$featureFlags9, _props$allowTables4, _props$featureFlags10, _props$featureFlags11, _props$allowTables5, _props$allowExtension, _props$featureFlags12, _props$featureFlags13, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31;
17
17
 
18
18
  var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
19
19
  return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
@@ -26,6 +26,7 @@ export function createFeatureFlagsFromProps(props) {
26
26
  findReplaceMatchCase: _typeof(props.allowFindReplace) === 'object' && Boolean(props.allowFindReplace.allowMatchCase),
27
27
  keyboardAccessibleDatepicker: typeof props.allowKeyboardAccessibleDatepicker === 'boolean' ? props.allowKeyboardAccessibleDatepicker : false,
28
28
  addColumnWithCustomStep: !props.allowTables || typeof props.allowTables === 'boolean' ? false : Boolean(props.allowTables.allowAddColumnWithCustomStep),
29
+ singleLayout: _typeof(props.allowLayouts) === 'object' && !!((_props$allowLayouts = props.allowLayouts) !== null && _props$allowLayouts !== void 0 && _props$allowLayouts.UNSAFE_allowSingleColumnLayout),
29
30
  undoRedoButtons: props.UNSAFE_allowUndoRedoButtons,
30
31
  catchAllTracking: (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.catchAllTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.enabled,
31
32
  nextEmojiNodeView: ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.nextEmojiNodeView) === true,
@@ -44,6 +45,7 @@ export function createFeatureFlagsFromProps(props) {
44
45
  collabAvatarScroll: Boolean(typeof ((_props$featureFlags24 = props.featureFlags) === null || _props$featureFlags24 === void 0 ? void 0 : _props$featureFlags24.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags25 = props.featureFlags) !== null && _props$featureFlags25 !== void 0 && _props$featureFlags25.collabAvatarScroll) : false),
45
46
  ufo: Boolean(typeof ((_props$featureFlags26 = props.featureFlags) === null || _props$featureFlags26 === void 0 ? void 0 : _props$featureFlags26.ufo) === 'boolean' ? !!((_props$featureFlags27 = props.featureFlags) !== null && _props$featureFlags27 !== void 0 && _props$featureFlags27.ufo) : false),
46
47
  codeBlockSyntaxHighlighting: Boolean(typeof normalizedFeatureFlags.codeBlockSyntaxHighlighting === 'boolean' ? !!normalizedFeatureFlags.codeBlockSyntaxHighlighting && !browser.safari : false),
47
- codeBidiWarnings: Boolean(typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.codeBidiWarnings) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.codeBidiWarnings) : true)
48
+ twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags28 = props.featureFlags) === null || _props$featureFlags28 === void 0 ? void 0 : _props$featureFlags28.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags29 = props.featureFlags) !== null && _props$featureFlags29 !== void 0 && _props$featureFlags29.twoLineEditorToolbar) : false),
49
+ codeBidiWarnings: Boolean(typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.codeBidiWarnings) === 'boolean' ? !!((_props$featureFlags31 = props.featureFlags) !== null && _props$featureFlags31 !== void 0 && _props$featureFlags31.codeBidiWarnings) : true)
48
50
  });
49
51
  }
@@ -0,0 +1,155 @@
1
+ import React from 'react';
2
+ import { findReplacePluginKey } from './types';
3
+ import WithPluginState from '../../ui/WithPluginState';
4
+ import { cancelSearchWithAnalytics, replaceWithAnalytics, replaceAllWithAnalytics, findWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, activateWithAnalytics } from './commands-with-analytics';
5
+ import { blur, toggleMatchCase } from './commands';
6
+ import FindReplaceToolbarButton from './ui/FindReplaceToolbarButton';
7
+ import { TRIGGER_METHOD } from '../analytics';
8
+ import { getFeatureFlags } from '../feature-flags-context';
9
+
10
+ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithState(props) {
11
+ var popupsBoundariesElement = props.popupsBoundariesElement,
12
+ popupsMountPoint = props.popupsMountPoint,
13
+ popupsScrollableElement = props.popupsScrollableElement,
14
+ isToolbarReducedSpacing = props.isToolbarReducedSpacing,
15
+ editorView = props.editorView,
16
+ containerElement = props.containerElement,
17
+ dispatchAnalyticsEvent = props.dispatchAnalyticsEvent;
18
+
19
+ if (!editorView) {
20
+ return null;
21
+ } // we need the editor to be in focus for scrollIntoView() to work
22
+ // so we focus it while we run the command, then put focus back into
23
+ // whatever element was previously focused in find replace component
24
+
25
+
26
+ var runWithEditorFocused = function runWithEditorFocused(fn) {
27
+ var activeElement = document.activeElement;
28
+ editorView.focus();
29
+ fn();
30
+ activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus();
31
+ };
32
+
33
+ var dispatchCommand = function dispatchCommand(cmd) {
34
+ var state = editorView.state,
35
+ dispatch = editorView.dispatch;
36
+ cmd(state, dispatch);
37
+ };
38
+
39
+ var handleActivate = function handleActivate() {
40
+ runWithEditorFocused(function () {
41
+ return dispatchCommand(activateWithAnalytics({
42
+ triggerMethod: TRIGGER_METHOD.TOOLBAR
43
+ }));
44
+ });
45
+ };
46
+
47
+ var handleFind = function handleFind(keyword) {
48
+ runWithEditorFocused(function () {
49
+ return dispatchCommand(findWithAnalytics({
50
+ editorView: editorView,
51
+ containerElement: containerElement,
52
+ keyword: keyword
53
+ }));
54
+ });
55
+ };
56
+
57
+ var handleFindNext = function handleFindNext(_ref) {
58
+ var triggerMethod = _ref.triggerMethod;
59
+ runWithEditorFocused(function () {
60
+ return dispatchCommand(findNextWithAnalytics({
61
+ triggerMethod: triggerMethod
62
+ }));
63
+ });
64
+ };
65
+
66
+ var handleFindPrev = function handleFindPrev(_ref2) {
67
+ var triggerMethod = _ref2.triggerMethod;
68
+ runWithEditorFocused(function () {
69
+ return dispatchCommand(findPrevWithAnalytics({
70
+ triggerMethod: triggerMethod
71
+ }));
72
+ });
73
+ };
74
+
75
+ var handleReplace = function handleReplace(_ref3) {
76
+ var triggerMethod = _ref3.triggerMethod,
77
+ replaceText = _ref3.replaceText;
78
+ runWithEditorFocused(function () {
79
+ return dispatchCommand(replaceWithAnalytics({
80
+ triggerMethod: triggerMethod,
81
+ replaceText: replaceText
82
+ }));
83
+ });
84
+ };
85
+
86
+ var handleReplaceAll = function handleReplaceAll(_ref4) {
87
+ var replaceText = _ref4.replaceText;
88
+ runWithEditorFocused(function () {
89
+ return dispatchCommand(replaceAllWithAnalytics({
90
+ replaceText: replaceText
91
+ }));
92
+ });
93
+ };
94
+
95
+ var handleFindBlur = function handleFindBlur() {
96
+ dispatchCommand(blur());
97
+ };
98
+
99
+ var handleCancel = function handleCancel(_ref5) {
100
+ var triggerMethod = _ref5.triggerMethod;
101
+ dispatchCommand(cancelSearchWithAnalytics({
102
+ triggerMethod: triggerMethod
103
+ }));
104
+ editorView.focus();
105
+ };
106
+
107
+ var handleToggleMatchCase = function handleToggleMatchCase() {
108
+ dispatchCommand(toggleMatchCase());
109
+ };
110
+
111
+ var _getFeatureFlags = getFeatureFlags(editorView.state),
112
+ findReplaceMatchCase = _getFeatureFlags.findReplaceMatchCase;
113
+
114
+ return /*#__PURE__*/React.createElement(WithPluginState, {
115
+ debounce: false,
116
+ plugins: {
117
+ findReplaceState: findReplacePluginKey
118
+ },
119
+ render: function render(_ref6) {
120
+ var findReplaceState = _ref6.findReplaceState;
121
+
122
+ if (!findReplaceState) {
123
+ return null;
124
+ }
125
+
126
+ return /*#__PURE__*/React.createElement(FindReplaceToolbarButton, {
127
+ allowMatchCase: findReplaceMatchCase,
128
+ shouldMatchCase: findReplaceState.shouldMatchCase,
129
+ onToggleMatchCase: handleToggleMatchCase,
130
+ isActive: findReplaceState.isActive,
131
+ findText: findReplaceState.findText,
132
+ index: findReplaceState.index,
133
+ numMatches: findReplaceState.matches.length,
134
+ replaceText: findReplaceState.replaceText,
135
+ shouldFocus: findReplaceState.shouldFocus,
136
+ popupsBoundariesElement: popupsBoundariesElement,
137
+ popupsMountPoint: popupsMountPoint,
138
+ popupsScrollableElement: popupsScrollableElement,
139
+ isReducedSpacing: !!isToolbarReducedSpacing,
140
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
141
+ onFindBlur: handleFindBlur,
142
+ onCancel: handleCancel,
143
+ onActivate: handleActivate,
144
+ onFind: handleFind,
145
+ onFindNext: handleFindNext,
146
+ onFindPrev: handleFindPrev,
147
+ onReplace: handleReplace,
148
+ onReplaceAll: handleReplaceAll,
149
+ takeFullWidth: !!props.takeFullWidth
150
+ });
151
+ }
152
+ });
153
+ };
154
+
155
+ export default FindReplaceToolbarButtonWithState;
@@ -1,13 +1,7 @@
1
1
  import React from 'react';
2
2
  import { createPlugin } from './plugin';
3
- import { findReplacePluginKey } from './types';
4
3
  import keymapPlugin from './keymap';
5
- import WithPluginState from '../../ui/WithPluginState';
6
- import { cancelSearchWithAnalytics, replaceWithAnalytics, replaceAllWithAnalytics, findWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, activateWithAnalytics } from './commands-with-analytics';
7
- import { blur, toggleMatchCase } from './commands';
8
- import FindReplaceToolbarButton from './ui/FindReplaceToolbarButton';
9
- import { TRIGGER_METHOD } from '../analytics';
10
- import { getFeatureFlags } from '../feature-flags-context';
4
+ import FindReplaceToolbarButtonWithState from './FindReplaceToolbarButtonWithState';
11
5
  export var findReplacePlugin = function findReplacePlugin(props) {
12
6
  return {
13
7
  name: 'findReplace',
@@ -34,131 +28,20 @@ export var findReplacePlugin = function findReplacePlugin(props) {
34
28
  containerElement = _ref2.containerElement,
35
29
  dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
36
30
 
37
- // we need the editor to be in focus for scrollIntoView() to work
38
- // so we focus it while we run the command, then put focus back into
39
- // whatever element was previously focused in find replace component
40
- var runWithEditorFocused = function runWithEditorFocused(fn) {
41
- var activeElement = document.activeElement;
42
- editorView.focus();
43
- fn();
44
- activeElement === null || activeElement === void 0 ? void 0 : activeElement.focus();
45
- };
46
-
47
- var dispatchCommand = function dispatchCommand(cmd) {
48
- var state = editorView.state,
49
- dispatch = editorView.dispatch;
50
- cmd(state, dispatch);
51
- };
52
-
53
- var handleActivate = function handleActivate() {
54
- runWithEditorFocused(function () {
55
- return dispatchCommand(activateWithAnalytics({
56
- triggerMethod: TRIGGER_METHOD.TOOLBAR
57
- }));
58
- });
59
- };
60
-
61
- var handleFind = function handleFind(keyword) {
62
- runWithEditorFocused(function () {
63
- return dispatchCommand(findWithAnalytics({
64
- editorView: editorView,
65
- containerElement: containerElement,
66
- keyword: keyword
67
- }));
68
- });
69
- };
70
-
71
- var handleFindNext = function handleFindNext(_ref3) {
72
- var triggerMethod = _ref3.triggerMethod;
73
- runWithEditorFocused(function () {
74
- return dispatchCommand(findNextWithAnalytics({
75
- triggerMethod: triggerMethod
76
- }));
77
- });
78
- };
79
-
80
- var handleFindPrev = function handleFindPrev(_ref4) {
81
- var triggerMethod = _ref4.triggerMethod;
82
- runWithEditorFocused(function () {
83
- return dispatchCommand(findPrevWithAnalytics({
84
- triggerMethod: triggerMethod
85
- }));
86
- });
87
- };
88
-
89
- var handleReplace = function handleReplace(_ref5) {
90
- var triggerMethod = _ref5.triggerMethod,
91
- replaceText = _ref5.replaceText;
92
- runWithEditorFocused(function () {
93
- return dispatchCommand(replaceWithAnalytics({
94
- triggerMethod: triggerMethod,
95
- replaceText: replaceText
96
- }));
97
- });
98
- };
99
-
100
- var handleReplaceAll = function handleReplaceAll(_ref6) {
101
- var replaceText = _ref6.replaceText;
102
- runWithEditorFocused(function () {
103
- return dispatchCommand(replaceAllWithAnalytics({
104
- replaceText: replaceText
105
- }));
31
+ if (props.twoLineEditorToolbar) {
32
+ return null;
33
+ } else {
34
+ return /*#__PURE__*/React.createElement(FindReplaceToolbarButtonWithState, {
35
+ popupsBoundariesElement: popupsBoundariesElement,
36
+ popupsMountPoint: popupsMountPoint,
37
+ popupsScrollableElement: popupsScrollableElement,
38
+ isToolbarReducedSpacing: isToolbarReducedSpacing,
39
+ editorView: editorView,
40
+ containerElement: containerElement,
41
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
42
+ takeFullWidth: props.takeFullWidth
106
43
  });
107
- };
108
-
109
- var handleFindBlur = function handleFindBlur() {
110
- dispatchCommand(blur());
111
- };
112
-
113
- var handleCancel = function handleCancel(_ref7) {
114
- var triggerMethod = _ref7.triggerMethod;
115
- dispatchCommand(cancelSearchWithAnalytics({
116
- triggerMethod: triggerMethod
117
- }));
118
- editorView.focus();
119
- };
120
-
121
- var handleToggleMatchCase = function handleToggleMatchCase() {
122
- dispatchCommand(toggleMatchCase());
123
- };
124
-
125
- var _getFeatureFlags = getFeatureFlags(editorView.state),
126
- findReplaceMatchCase = _getFeatureFlags.findReplaceMatchCase;
127
-
128
- return /*#__PURE__*/React.createElement(WithPluginState, {
129
- debounce: false,
130
- plugins: {
131
- findReplaceState: findReplacePluginKey
132
- },
133
- render: function render(_ref8) {
134
- var findReplaceState = _ref8.findReplaceState;
135
- return /*#__PURE__*/React.createElement(FindReplaceToolbarButton, {
136
- allowMatchCase: findReplaceMatchCase,
137
- shouldMatchCase: findReplaceState.shouldMatchCase,
138
- onToggleMatchCase: handleToggleMatchCase,
139
- isActive: findReplaceState.isActive,
140
- findText: findReplaceState.findText,
141
- index: findReplaceState.index,
142
- numMatches: findReplaceState.matches.length,
143
- replaceText: findReplaceState.replaceText,
144
- shouldFocus: findReplaceState.shouldFocus,
145
- popupsBoundariesElement: popupsBoundariesElement,
146
- popupsMountPoint: popupsMountPoint,
147
- popupsScrollableElement: popupsScrollableElement,
148
- isReducedSpacing: isToolbarReducedSpacing,
149
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
150
- onFindBlur: handleFindBlur,
151
- onCancel: handleCancel,
152
- onActivate: handleActivate,
153
- onFind: handleFind,
154
- onFindNext: handleFindNext,
155
- onFindPrev: handleFindPrev,
156
- onReplace: handleReplace,
157
- onReplaceAll: handleReplaceAll,
158
- takeFullWidth: props.takeFullWidth
159
- });
160
- }
161
- });
44
+ }
162
45
  }
163
46
  };
164
47
  };
@@ -10,14 +10,16 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
 
11
11
  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; } }
12
12
 
13
+ /** @jsx jsx */
13
14
  import React from 'react';
15
+ import { jsx } from '@emotion/core';
14
16
  import { defineMessages, injectIntl } from 'react-intl';
15
17
  import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
16
18
  import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
17
19
  import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
18
20
  import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
19
21
  import Textfield from '@atlaskit/textfield';
20
- import { SectionWrapper, Count } from './styles';
22
+ import { countStyles, sectionWrapperStyles } from './styles';
21
23
  import { TRIGGER_METHOD } from '../../analytics/types';
22
24
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
23
25
  var messages = defineMessages({
@@ -170,16 +172,16 @@ var Find = /*#__PURE__*/function (_React$Component) {
170
172
  _this.findNext = formatMessage(messages.findNext);
171
173
  _this.findPrevious = formatMessage(messages.findPrevious);
172
174
  _this.matchCase = formatMessage(messages.matchCase);
173
- _this.matchCaseIcon = /*#__PURE__*/React.createElement(MatchCaseIcon, {
175
+ _this.matchCaseIcon = jsx(MatchCaseIcon, {
174
176
  label: _this.matchCase
175
177
  });
176
- _this.findNextIcon = /*#__PURE__*/React.createElement(ChevronDownIcon, {
178
+ _this.findNextIcon = jsx(ChevronDownIcon, {
177
179
  label: _this.findNext
178
180
  });
179
- _this.findPrevIcon = /*#__PURE__*/React.createElement(ChevronUpIcon, {
181
+ _this.findPrevIcon = jsx(ChevronUpIcon, {
180
182
  label: _this.findPrevious
181
183
  });
182
- _this.closeIcon = /*#__PURE__*/React.createElement(EditorCloseIcon, {
184
+ _this.closeIcon = jsx(EditorCloseIcon, {
183
185
  label: _this.closeFindReplaceDialog
184
186
  }); // We locally manage the value of the input inside this component in order to support compositions.
185
187
  // This requires some additional work inside componentDidUpdate to ensure we support changes that
@@ -225,7 +227,9 @@ var Find = /*#__PURE__*/function (_React$Component) {
225
227
  selectedMatchPosition: count.index + 1,
226
228
  totalResultsCount: count.total
227
229
  });
228
- return /*#__PURE__*/React.createElement(SectionWrapper, null, /*#__PURE__*/React.createElement(Textfield, {
230
+ return jsx("div", {
231
+ css: sectionWrapperStyles
232
+ }, jsx(Textfield, {
229
233
  name: "find",
230
234
  appearance: "none",
231
235
  placeholder: this.find,
@@ -237,24 +241,27 @@ var Find = /*#__PURE__*/function (_React$Component) {
237
241
  onBlur: this.props.onFindBlur,
238
242
  onCompositionStart: this.handleCompositionStart,
239
243
  onCompositionEnd: this.handleCompositionEnd
240
- }), findText && /*#__PURE__*/React.createElement(Count, null, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
244
+ }), findText && jsx("span", {
245
+ "data-testid": "textfield-count",
246
+ css: countStyles
247
+ }, count.total === 0 ? this.noResultsFound : resultsCount), allowMatchCase && jsx(FindReplaceTooltipButton, {
241
248
  title: this.matchCase,
242
249
  icon: this.matchCaseIcon,
243
250
  onClick: this.handleMatchCaseClick,
244
251
  isPressed: shouldMatchCase
245
- }), /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
252
+ }), jsx(FindReplaceTooltipButton, {
246
253
  title: this.findNext,
247
254
  icon: this.findNextIcon,
248
255
  keymapDescription: 'Enter',
249
256
  onClick: this.handleFindNextClick,
250
257
  disabled: count.total <= 1
251
- }), /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
258
+ }), jsx(FindReplaceTooltipButton, {
252
259
  title: this.findPrevious,
253
260
  icon: this.findPrevIcon,
254
261
  keymapDescription: 'Shift Enter',
255
262
  onClick: this.handleFindPrevClick,
256
263
  disabled: count.total <= 1
257
- }), /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
264
+ }), jsx(FindReplaceTooltipButton, {
258
265
  title: this.closeFindReplaceDialog,
259
266
  icon: this.closeIcon,
260
267
  keymapDescription: 'Escape',
@@ -10,10 +10,12 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
 
11
11
  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; } }
12
12
 
13
+ /** @jsx jsx */
13
14
  import React from 'react';
15
+ import { jsx } from '@emotion/core';
14
16
  import Find from './Find';
15
17
  import Replace from './Replace';
16
- import { Rule, Wrapper } from './styles';
18
+ import { ruleStyles, wrapperStyles } from './styles';
17
19
 
18
20
  var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
19
21
  _inherits(FindReplace, _React$PureComponent);
@@ -77,7 +79,9 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
77
79
  allowMatchCase = _this$props.allowMatchCase,
78
80
  shouldMatchCase = _this$props.shouldMatchCase,
79
81
  onToggleMatchCase = _this$props.onToggleMatchCase;
80
- return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(Find, {
82
+ return jsx("div", {
83
+ css: wrapperStyles
84
+ }, jsx(Find, {
81
85
  allowMatchCase: allowMatchCase,
82
86
  shouldMatchCase: shouldMatchCase,
83
87
  onToggleMatchCase: onToggleMatchCase,
@@ -91,7 +95,10 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
91
95
  onFindTextfieldRefSet: this.setFindTextfieldRef,
92
96
  onCancel: onCancel,
93
97
  onArrowDown: this.setFocusToReplace
94
- }), /*#__PURE__*/React.createElement(Rule, null), /*#__PURE__*/React.createElement(Replace, {
98
+ }), jsx("hr", {
99
+ css: ruleStyles,
100
+ id: "replace-hr-element"
101
+ }), jsx(Replace, {
95
102
  canReplace: count.total > 0,
96
103
  replaceText: replaceText,
97
104
  onReplace: onReplace,