@atlaskit/editor-core 151.1.2 → 152.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/dist/cjs/create-editor/ReactEditorView.js +22 -8
  3. package/dist/cjs/create-editor/create-plugins-list.js +30 -11
  4. package/dist/cjs/labs/next/presets/cxhtml.js +1 -2
  5. package/dist/cjs/labs/next/presets/default.js +3 -1
  6. package/dist/cjs/nodeviews/ReactNodeView.js +2 -2
  7. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +6 -0
  8. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  9. package/dist/cjs/plugins/annotation/utils.js +19 -8
  10. package/dist/cjs/plugins/avatar-group/index.js +2 -1
  11. package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  12. package/dist/cjs/plugins/before-primaryToolbar/index.js +26 -0
  13. package/dist/cjs/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +28 -0
  14. package/dist/cjs/plugins/code-bidi-warning/index.js +5 -2
  15. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +12 -3
  16. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +15 -5
  17. package/dist/cjs/plugins/code-block/index.js +3 -3
  18. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  19. package/dist/cjs/plugins/code-block/pm-plugins/main.js +11 -3
  20. package/dist/cjs/plugins/extension/extension-api.js +10 -2
  21. package/dist/cjs/plugins/extension/ui/styles.js +1 -1
  22. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  23. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +172 -0
  24. package/dist/cjs/plugins/find-replace/index.js +14 -137
  25. package/dist/cjs/plugins/find-replace/ui/Find.js +16 -9
  26. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +9 -2
  27. package/dist/cjs/plugins/find-replace/ui/Replace.js +11 -3
  28. package/dist/cjs/plugins/find-replace/ui/styles.js +44 -35
  29. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -4
  30. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  31. package/dist/cjs/plugins/fragment/index.js +34 -0
  32. package/dist/cjs/plugins/fragment/plugin-key.js +11 -0
  33. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  34. package/dist/cjs/plugins/index.js +16 -0
  35. package/dist/cjs/plugins/list/actions/conversions.js +39 -71
  36. package/dist/cjs/plugins/list/transforms.js +7 -1
  37. package/dist/cjs/plugins/media/index.js +2 -3
  38. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +3 -1
  39. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +12 -5
  40. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +6 -4
  41. package/dist/cjs/plugins/media/nodeviews/styles.js +6 -1
  42. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  43. package/dist/cjs/plugins/media/pm-plugins/main.js +49 -15
  44. package/dist/cjs/plugins/media/toolbar/commands.js +59 -0
  45. package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +7 -2
  46. package/dist/cjs/plugins/media/toolbar/index.js +90 -3
  47. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  48. package/dist/cjs/plugins/media/utils/media-common.js +1 -1
  49. package/dist/cjs/plugins/media/utils/media-files.js +5 -1
  50. package/dist/cjs/plugins/panel/actions.js +2 -2
  51. package/dist/cjs/plugins/panel/index.js +3 -3
  52. package/dist/cjs/plugins/panel/nodeviews/panel.js +2 -2
  53. package/dist/cjs/plugins/panel/toolbar.js +10 -5
  54. package/dist/cjs/plugins/panel/utils.js +15 -0
  55. package/dist/cjs/plugins/rank.js +3 -2
  56. package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +49 -1
  57. package/dist/cjs/plugins/status/ui/statusPicker.js +4 -2
  58. package/dist/cjs/plugins/table/commands/insert.js +1 -0
  59. package/dist/cjs/plugins/table/index.js +3 -2
  60. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -3
  61. package/dist/cjs/plugins/table/pm-plugins/main.js +26 -3
  62. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  63. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  64. package/dist/cjs/plugins/table/transforms/column-width.js +14 -5
  65. package/dist/cjs/plugins/table/transforms/fix-tables.js +43 -6
  66. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  67. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  68. package/dist/cjs/plugins/table/ui/common-styles.css.js +1 -1
  69. package/dist/cjs/plugins/table/ui/consts.js +1 -1
  70. package/dist/cjs/plugins/table/ui/messages.js +1 -1
  71. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  72. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  73. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -2
  74. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  75. package/dist/cjs/plugins/text-formatting/index.js +2 -1
  76. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +1 -0
  77. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +77 -26
  78. package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +32 -9
  79. package/dist/cjs/ui/ColorPalette/Color/index.js +8 -18
  80. package/dist/cjs/ui/ColorPalette/index.js +7 -4
  81. package/dist/cjs/ui/ColorPickerButton/index.js +1 -1
  82. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +114 -61
  83. package/dist/cjs/ui/ConfigPanel/FormContent.js +39 -26
  84. package/dist/cjs/ui/ConfigPanel/transformers.js +490 -248
  85. package/dist/cjs/ui/ConfigPanel/utils.js +2 -10
  86. package/dist/cjs/ui/DropdownMenu/index.js +3 -1
  87. package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +1 -1
  88. package/dist/cjs/ui/Resizer/index.js +9 -1
  89. package/dist/cjs/version-wrapper.js +1 -1
  90. package/dist/cjs/version.json +1 -1
  91. package/dist/es2019/create-editor/ReactEditorView.js +19 -8
  92. package/dist/es2019/create-editor/create-plugins-list.js +31 -12
  93. package/dist/es2019/labs/next/presets/cxhtml.js +1 -2
  94. package/dist/es2019/labs/next/presets/default.js +3 -1
  95. package/dist/es2019/nodeviews/ReactNodeView.js +1 -1
  96. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +11 -0
  97. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  98. package/dist/es2019/plugins/annotation/utils.js +18 -7
  99. package/dist/es2019/plugins/avatar-group/index.js +2 -1
  100. package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +3 -2
  101. package/dist/es2019/plugins/before-primaryToolbar/index.js +15 -0
  102. package/dist/es2019/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  103. package/dist/es2019/plugins/code-bidi-warning/index.js +8 -2
  104. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +12 -2
  105. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +16 -5
  106. package/dist/es2019/plugins/code-block/index.js +3 -2
  107. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  108. package/dist/es2019/plugins/code-block/pm-plugins/main.js +11 -3
  109. package/dist/es2019/plugins/extension/extension-api.js +9 -2
  110. package/dist/es2019/plugins/extension/ui/styles.js +6 -0
  111. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  112. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +152 -0
  113. package/dist/es2019/plugins/find-replace/index.js +15 -128
  114. package/dist/es2019/plugins/find-replace/ui/Find.js +18 -10
  115. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +11 -3
  116. package/dist/es2019/plugins/find-replace/ui/Replace.js +12 -4
  117. package/dist/es2019/plugins/find-replace/ui/styles.js +37 -47
  118. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  119. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -2
  120. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  121. package/dist/es2019/plugins/fragment/index.js +22 -0
  122. package/dist/es2019/plugins/fragment/plugin-key.js +2 -0
  123. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  124. package/dist/es2019/plugins/index.js +2 -0
  125. package/dist/es2019/plugins/list/actions/conversions.js +38 -69
  126. package/dist/es2019/plugins/list/transforms.js +5 -1
  127. package/dist/es2019/plugins/media/index.js +2 -2
  128. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +2 -1
  129. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +8 -4
  130. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +7 -5
  131. package/dist/es2019/plugins/media/nodeviews/styles.js +2 -0
  132. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  133. package/dist/es2019/plugins/media/pm-plugins/main.js +32 -17
  134. package/dist/es2019/plugins/media/toolbar/commands.js +47 -0
  135. package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +6 -2
  136. package/dist/es2019/plugins/media/toolbar/index.js +90 -3
  137. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +7 -1
  138. package/dist/es2019/plugins/media/utils/media-common.js +1 -1
  139. package/dist/es2019/plugins/media/utils/media-files.js +6 -1
  140. package/dist/es2019/plugins/panel/actions.js +2 -2
  141. package/dist/es2019/plugins/panel/index.js +5 -5
  142. package/dist/es2019/plugins/panel/nodeviews/panel.js +2 -2
  143. package/dist/es2019/plugins/panel/toolbar.js +10 -5
  144. package/dist/es2019/plugins/panel/utils.js +8 -1
  145. package/dist/es2019/plugins/rank.js +3 -2
  146. package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +48 -1
  147. package/dist/es2019/plugins/status/ui/statusPicker.js +4 -2
  148. package/dist/es2019/plugins/table/commands/insert.js +1 -2
  149. package/dist/es2019/plugins/table/index.js +2 -1
  150. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  151. package/dist/es2019/plugins/table/pm-plugins/main.js +25 -4
  152. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  153. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  154. package/dist/es2019/plugins/table/transforms/column-width.js +13 -3
  155. package/dist/es2019/plugins/table/transforms/fix-tables.js +43 -5
  156. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  157. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  158. package/dist/es2019/plugins/table/ui/common-styles.css.js +5 -1
  159. package/dist/es2019/plugins/table/ui/consts.js +2 -2
  160. package/dist/es2019/plugins/table/ui/messages.js +1 -1
  161. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  162. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  163. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  164. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  165. package/dist/es2019/plugins/text-formatting/index.js +3 -2
  166. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  167. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  168. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +60 -27
  169. package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +51 -7
  170. package/dist/es2019/ui/ColorPalette/Color/index.js +9 -18
  171. package/dist/es2019/ui/ColorPalette/index.js +7 -4
  172. package/dist/es2019/ui/ColorPickerButton/index.js +1 -1
  173. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +101 -49
  174. package/dist/es2019/ui/ConfigPanel/FormContent.js +35 -26
  175. package/dist/es2019/ui/ConfigPanel/transformers.js +243 -72
  176. package/dist/es2019/ui/ConfigPanel/utils.js +1 -2
  177. package/dist/es2019/ui/Dropdown/index.js +2 -1
  178. package/dist/es2019/ui/DropdownMenu/index.js +7 -3
  179. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
  180. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  181. package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +2 -2
  182. package/dist/es2019/ui/Resizer/index.js +9 -1
  183. package/dist/es2019/version-wrapper.js +1 -1
  184. package/dist/es2019/version.json +1 -1
  185. package/dist/esm/create-editor/ReactEditorView.js +22 -8
  186. package/dist/esm/create-editor/create-plugins-list.js +31 -12
  187. package/dist/esm/labs/next/presets/cxhtml.js +1 -2
  188. package/dist/esm/labs/next/presets/default.js +3 -1
  189. package/dist/esm/nodeviews/ReactNodeView.js +2 -2
  190. package/dist/esm/nodeviews/SelectionBasedNodeView.js +7 -0
  191. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  192. package/dist/esm/plugins/annotation/utils.js +18 -7
  193. package/dist/esm/plugins/avatar-group/index.js +2 -1
  194. package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  195. package/dist/esm/plugins/before-primaryToolbar/index.js +15 -0
  196. package/dist/esm/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  197. package/dist/esm/plugins/code-bidi-warning/index.js +5 -2
  198. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +12 -3
  199. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +15 -5
  200. package/dist/esm/plugins/code-block/index.js +3 -3
  201. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  202. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  203. package/dist/esm/plugins/extension/extension-api.js +9 -2
  204. package/dist/esm/plugins/extension/ui/styles.js +1 -1
  205. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  206. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +155 -0
  207. package/dist/esm/plugins/find-replace/index.js +14 -131
  208. package/dist/esm/plugins/find-replace/ui/Find.js +17 -10
  209. package/dist/esm/plugins/find-replace/ui/FindReplace.js +10 -3
  210. package/dist/esm/plugins/find-replace/ui/Replace.js +11 -4
  211. package/dist/esm/plugins/find-replace/ui/styles.js +39 -18
  212. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  213. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +9 -4
  214. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  215. package/dist/esm/plugins/fragment/index.js +22 -0
  216. package/dist/esm/plugins/fragment/plugin-key.js +2 -0
  217. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  218. package/dist/esm/plugins/index.js +2 -0
  219. package/dist/esm/plugins/list/actions/conversions.js +38 -71
  220. package/dist/esm/plugins/list/transforms.js +7 -1
  221. package/dist/esm/plugins/media/index.js +2 -3
  222. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +2 -1
  223. package/dist/esm/plugins/media/nodeviews/mediaInline.js +11 -6
  224. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +7 -5
  225. package/dist/esm/plugins/media/nodeviews/styles.js +2 -0
  226. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  227. package/dist/esm/plugins/media/pm-plugins/main.js +47 -16
  228. package/dist/esm/plugins/media/toolbar/commands.js +45 -0
  229. package/dist/esm/plugins/media/toolbar/filePreviewItem.js +6 -2
  230. package/dist/esm/plugins/media/toolbar/index.js +88 -3
  231. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  232. package/dist/esm/plugins/media/utils/media-common.js +1 -1
  233. package/dist/esm/plugins/media/utils/media-files.js +6 -1
  234. package/dist/esm/plugins/panel/actions.js +2 -2
  235. package/dist/esm/plugins/panel/index.js +5 -5
  236. package/dist/esm/plugins/panel/nodeviews/panel.js +2 -2
  237. package/dist/esm/plugins/panel/toolbar.js +9 -4
  238. package/dist/esm/plugins/panel/utils.js +13 -0
  239. package/dist/esm/plugins/rank.js +3 -2
  240. package/dist/esm/plugins/selection/pm-plugins/selection-main.js +50 -1
  241. package/dist/esm/plugins/status/ui/statusPicker.js +4 -2
  242. package/dist/esm/plugins/table/commands/insert.js +1 -2
  243. package/dist/esm/plugins/table/index.js +3 -2
  244. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  245. package/dist/esm/plugins/table/pm-plugins/main.js +27 -4
  246. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  247. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  248. package/dist/esm/plugins/table/transforms/column-width.js +13 -3
  249. package/dist/esm/plugins/table/transforms/fix-tables.js +42 -4
  250. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  251. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  252. package/dist/esm/plugins/table/ui/common-styles.css.js +1 -1
  253. package/dist/esm/plugins/table/ui/consts.js +2 -2
  254. package/dist/esm/plugins/table/ui/messages.js +1 -1
  255. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  256. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  257. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  258. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  259. package/dist/esm/plugins/text-formatting/index.js +3 -2
  260. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  261. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  262. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +67 -27
  263. package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +20 -7
  264. package/dist/esm/ui/ColorPalette/Color/index.js +9 -16
  265. package/dist/esm/ui/ColorPalette/index.js +7 -4
  266. package/dist/esm/ui/ColorPickerButton/index.js +1 -1
  267. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +113 -62
  268. package/dist/esm/ui/ConfigPanel/FormContent.js +39 -26
  269. package/dist/esm/ui/ConfigPanel/transformers.js +488 -248
  270. package/dist/esm/ui/ConfigPanel/utils.js +1 -6
  271. package/dist/esm/ui/Dropdown/index.js +2 -1
  272. package/dist/esm/ui/DropdownMenu/index.js +7 -3
  273. package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
  274. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  275. package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +2 -2
  276. package/dist/esm/ui/Resizer/index.js +9 -1
  277. package/dist/esm/version-wrapper.js +1 -1
  278. package/dist/esm/version.json +1 -1
  279. package/dist/types/labs/next/full-page.d.ts +1 -1
  280. package/dist/types/nodeviews/ReactNodeView.d.ts +1 -1
  281. package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +1 -0
  282. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  283. package/dist/types/plugins/analytics/types/events.d.ts +7 -1
  284. package/dist/types/plugins/annotation/utils.d.ts +1 -1
  285. package/dist/types/plugins/avatar-group/index.d.ts +1 -0
  286. package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +1 -0
  287. package/dist/types/plugins/before-primaryToolbar/index.d.ts +5 -0
  288. package/dist/types/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.d.ts +5 -0
  289. package/dist/types/plugins/code-bidi-warning/index.d.ts +4 -2
  290. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +4 -2
  291. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +2 -1
  292. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +1 -0
  293. package/dist/types/plugins/code-block/index.d.ts +1 -1
  294. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +12 -1
  295. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +3 -1
  296. package/dist/types/plugins/code-block/types.d.ts +2 -0
  297. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  298. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +15 -0
  299. package/dist/types/plugins/find-replace/index.d.ts +1 -0
  300. package/dist/types/plugins/find-replace/ui/Find.d.ts +1 -0
  301. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +1 -0
  302. package/dist/types/plugins/find-replace/ui/Replace.d.ts +1 -0
  303. package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -14
  304. package/dist/types/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +1 -1
  305. package/dist/types/plugins/fragment/index.d.ts +5 -0
  306. package/dist/types/plugins/fragment/plugin-key.d.ts +2 -0
  307. package/dist/types/plugins/index.d.ts +2 -0
  308. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +3 -2
  309. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  310. package/dist/types/plugins/media/nodeviews/styles.d.ts +2 -0
  311. package/dist/types/plugins/media/toolbar/commands.d.ts +3 -0
  312. package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +2 -0
  313. package/dist/types/plugins/media/types.d.ts +0 -1
  314. package/dist/types/plugins/panel/actions.d.ts +1 -1
  315. package/dist/types/plugins/panel/types.d.ts +8 -2
  316. package/dist/types/plugins/quick-insert/index.d.ts +2 -1
  317. package/dist/types/plugins/table/commands/insert.d.ts +3 -0
  318. package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
  319. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -0
  320. package/dist/types/plugins/table/transforms/column-width.d.ts +4 -1
  321. package/dist/types/plugins/table/transforms/fix-tables.d.ts +3 -2
  322. package/dist/types/plugins/table/types.d.ts +8 -0
  323. package/dist/types/plugins/table/ui/consts.d.ts +1 -1
  324. package/dist/types/types/editor-appearance-component.d.ts +2 -2
  325. package/dist/types/types/editor-props.d.ts +11 -1
  326. package/dist/types/types/feature-flags.d.ts +13 -0
  327. package/dist/types/types/index.d.ts +1 -1
  328. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -2
  329. package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +10 -1
  330. package/dist/types/ui/ColorPalette/Color/index.d.ts +8 -5
  331. package/dist/types/ui/ColorPalette/index.d.ts +1 -0
  332. package/dist/types/ui/ConfigPanel/transformers.d.ts +7 -1
  333. package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
  334. package/dist/types/ui/Resizer/index.d.ts +1 -0
  335. package/package.json +35 -31
  336. package/dist/cjs/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -38
  337. package/dist/es2019/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  338. package/dist/esm/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  339. package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +0 -1
@@ -32,8 +32,7 @@ export function useCXHTMLPreset(_ref) {
32
32
  }
33
33
  }]);
34
34
  preset.add([panelPlugin, {
35
- UNSAFE_allowCustomPanel: true,
36
- UNSAFE_allowCustomPanelEdit: true
35
+ allowCustomPanel: true
37
36
  }]);
38
37
  preset.add(listPlugin);
39
38
  preset.add(textColorPlugin);
@@ -63,7 +63,9 @@ export function createDefaultPreset(options) {
63
63
  preset.add(floatingToolbarPlugin);
64
64
  preset.add([featureFlagsContextPlugin, options.featureFlags || {}]);
65
65
  preset.add([selectionPlugin, options.selection]);
66
- preset.add([codeBlockPlugin, options.codeBlock]);
66
+ preset.add([codeBlockPlugin, options.codeBlock || {
67
+ appearance: 'full-page'
68
+ }]);
67
69
  return preset;
68
70
  }
69
71
  export function useDefaultPreset(props) {
@@ -173,10 +173,10 @@ var ReactNodeView = /*#__PURE__*/function () {
173
173
  }
174
174
  }, {
175
175
  key: "update",
176
- value: function update(node, _decorations) {
176
+ value: function update(node, _decorations, _innerDecorations) {
177
177
  var _this4 = this;
178
178
 
179
- var validUpdate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
179
+ var validUpdate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {
180
180
  return true;
181
181
  };
182
182
  // @see https://github.com/ProseMirror/prosemirror/issues/648
@@ -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,13 +1,16 @@
1
1
  import { createPlugin } from './pm-plugins/main';
2
2
 
3
- var codeBidiWarning = function codeBidiWarning() {
3
+ var codeBidiWarning = function codeBidiWarning(_ref) {
4
+ var appearance = _ref.appearance;
4
5
  return {
5
6
  name: 'codeBidiWarning',
6
7
  pmPlugins: function pmPlugins() {
7
8
  return [{
8
9
  name: 'codeBidiWarning',
9
10
  plugin: function plugin(options) {
10
- return createPlugin(options);
11
+ return createPlugin(options, {
12
+ appearance: appearance
13
+ });
11
14
  }
12
15
  }];
13
16
  }
@@ -2,20 +2,29 @@ import { Plugin } from 'prosemirror-state';
2
2
  import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages';
3
3
  import { codeBidiWarningPluginKey } from '../plugin-key';
4
4
  import { createBidiWarningsDecorationSetFromDoc, createPluginState, getPluginState } from './plugin-factory';
5
- export var createPlugin = function createPlugin(_ref) {
5
+ export var createPlugin = function createPlugin(_ref, _ref2) {
6
6
  var dispatch = _ref.dispatch,
7
7
  reactContext = _ref.reactContext;
8
+ var appearance = _ref2.appearance;
8
9
  var intl = reactContext().intl;
9
10
  var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
10
11
  return new Plugin({
11
12
  key: codeBidiWarningPluginKey,
12
13
  state: createPluginState(dispatch, function (state) {
14
+ // The appearance being mobile indicates we are in an editor being
15
+ // rendered by mobile bridge in a web view.
16
+ // The tooltip is likely to have unexpected behaviour there, with being cut
17
+ // off, so we disable it. This is also to keep the behaviour consistent with
18
+ // the rendering in the mobile Native Renderer.
19
+ var tooltipEnabled = appearance !== 'mobile';
13
20
  return {
14
21
  decorationSet: createBidiWarningsDecorationSetFromDoc({
15
22
  doc: state.doc,
16
- codeBidiWarningLabel: codeBidiWarningLabel
23
+ codeBidiWarningLabel: codeBidiWarningLabel,
24
+ tooltipEnabled: tooltipEnabled
17
25
  }),
18
- codeBidiWarningLabel: codeBidiWarningLabel
26
+ codeBidiWarningLabel: codeBidiWarningLabel,
27
+ tooltipEnabled: tooltipEnabled
19
28
  };
20
29
  }),
21
30
  props: {
@@ -22,7 +22,8 @@ var _pluginFactory = pluginFactory(codeBidiWarningPluginKey, reducer, {
22
22
 
23
23
  var newBidiWarningsDecorationSet = createBidiWarningsDecorationSetFromDoc({
24
24
  doc: tr.doc,
25
- codeBidiWarningLabel: pluginState.codeBidiWarningLabel
25
+ codeBidiWarningLabel: pluginState.codeBidiWarningLabel,
26
+ tooltipEnabled: pluginState.tooltipEnabled
26
27
  });
27
28
  return _objectSpread(_objectSpread({}, pluginState), {}, {
28
29
  decorationSet: newBidiWarningsDecorationSet
@@ -35,7 +36,8 @@ var _pluginFactory = pluginFactory(codeBidiWarningPluginKey, reducer, {
35
36
  export { createPluginState, getPluginState };
36
37
  export function createBidiWarningsDecorationSetFromDoc(_ref) {
37
38
  var doc = _ref.doc,
38
- codeBidiWarningLabel = _ref.codeBidiWarningLabel;
39
+ codeBidiWarningLabel = _ref.codeBidiWarningLabel,
40
+ tooltipEnabled = _ref.tooltipEnabled;
39
41
  var bidiCharactersAndTheirPositions = [];
40
42
  doc.descendants(function (node, pos) {
41
43
  var isTextWithCodeMark = node.type.name === 'text' && node.marks && node.marks.some(function (mark) {
@@ -77,20 +79,28 @@ export function createBidiWarningsDecorationSetFromDoc(_ref) {
77
79
  var position = _ref4.position,
78
80
  bidiCharacter = _ref4.bidiCharacter;
79
81
  return Decoration.widget(position, function () {
80
- return renderDOM(bidiCharacter, codeBidiWarningLabel);
82
+ return renderDOM({
83
+ bidiCharacter: bidiCharacter,
84
+ codeBidiWarningLabel: codeBidiWarningLabel,
85
+ tooltipEnabled: tooltipEnabled
86
+ });
81
87
  });
82
88
  }));
83
89
  return newBidiWarningsDecorationSet;
84
90
  }
85
91
 
86
- function renderDOM(bidiCharacter, codeBidiWarningLabel) {
92
+ function renderDOM(_ref5) {
93
+ var bidiCharacter = _ref5.bidiCharacter,
94
+ codeBidiWarningLabel = _ref5.codeBidiWarningLabel,
95
+ tooltipEnabled = _ref5.tooltipEnabled;
87
96
  var element = document.createElement('span'); // Note: we use this pattern elsewhere (see highlighting code block, and drop cursor widget decoration)
88
97
  // we should investigate if there is a memory leak with such usage.
89
98
 
90
99
  ReactDOM.render( /*#__PURE__*/React.createElement(CodeBidiWarning, {
91
100
  bidiCharacter: bidiCharacter,
92
101
  skipChildren: true,
93
- label: codeBidiWarningLabel
102
+ label: codeBidiWarningLabel,
103
+ tooltipEnabled: tooltipEnabled
94
104
  }), element);
95
105
  return element;
96
106
  }
@@ -9,8 +9,7 @@ import { IconCode } from '../quick-insert/assets';
9
9
  import { messages } from '../block-type/messages';
10
10
  import refreshBrowserSelectionOnChange from './refresh-browser-selection';
11
11
 
12
- var codeBlockPlugin = function codeBlockPlugin() {
13
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12
+ var codeBlockPlugin = function codeBlockPlugin(options) {
14
13
  return {
15
14
  name: 'codeBlock',
16
15
  nodes: function nodes() {
@@ -26,7 +25,8 @@ var codeBlockPlugin = function codeBlockPlugin() {
26
25
  var reactContext = _ref.reactContext;
27
26
  return createPlugin({
28
27
  useLongPressSelection: options.useLongPressSelection,
29
- reactContext: reactContext
28
+ reactContext: reactContext,
29
+ appearance: options.appearance
30
30
  });
31
31
  }
32
32
  }, {
@@ -121,7 +121,8 @@ export var CodeBlockView = /*#__PURE__*/function () {
121
121
  language: node.attrs.language,
122
122
  showLineNumbers: false,
123
123
  codeBidiWarnings: this.codeBidiWarningOptions.enabled,
124
- codeBidiWarningLabel: this.codeBidiWarningOptions.label
124
+ codeBidiWarningLabel: this.codeBidiWarningOptions.label,
125
+ codeBidiWarningTooltipEnabled: this.codeBidiWarningOptions.tooltipEnabled
125
126
  }), highlighting);
126
127
  this.measure(performance.now() - start);
127
128
  content === null || content === void 0 ? void 0 : content.setAttribute('data-debounce', 'false');
@@ -165,11 +166,13 @@ export var CodeBlockView = /*#__PURE__*/function () {
165
166
  }();
166
167
  export var highlightingCodeBlockNodeView = function highlightingCodeBlockNodeView(_ref) {
167
168
  var codeBidiWarnings = _ref.codeBidiWarnings,
168
- codeBidiWarningLabel = _ref.codeBidiWarningLabel;
169
+ codeBidiWarningLabel = _ref.codeBidiWarningLabel,
170
+ codeBidiWarningTooltipEnabled = _ref.codeBidiWarningTooltipEnabled;
169
171
  return function (node, view, getPos) {
170
172
  return new CodeBlockView(node, view, getPos, {
173
+ label: codeBidiWarningLabel,
171
174
  enabled: codeBidiWarnings,
172
- label: codeBidiWarningLabel
175
+ tooltipEnabled: codeBidiWarningTooltipEnabled
173
176
  });
174
177
  };
175
178
  };
@@ -17,7 +17,8 @@ import { getFeatureFlags } from '../../feature-flags-context';
17
17
  export var createPlugin = function createPlugin(_ref) {
18
18
  var _ref$useLongPressSele = _ref.useLongPressSelection,
19
19
  useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
20
- reactContext = _ref.reactContext;
20
+ reactContext = _ref.reactContext,
21
+ appearance = _ref.appearance;
21
22
  var intl = reactContext().intl;
22
23
  var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label);
23
24
  return new Plugin({
@@ -57,10 +58,17 @@ export var createPlugin = function createPlugin(_ref) {
57
58
  props: {
58
59
  nodeViews: {
59
60
  codeBlock: function codeBlock(node, view, getPos) {
60
- var featureFlags = getFeatureFlags(view.state);
61
+ var featureFlags = getFeatureFlags(view.state); // The appearance being mobile indicates we are in an editor being
62
+ // rendered by mobile bridge in a web view.
63
+ // The tooltip is likely to have unexpected behaviour there, with being cut
64
+ // off, so we disable it. This is also to keep the behaviour consistent with
65
+ // the rendering in the mobile Native Renderer.
66
+
67
+ var codeBidiWarningTooltipEnabled = appearance !== 'mobile';
61
68
  var createCodeBlockNodeView = featureFlags !== null && featureFlags !== void 0 && featureFlags.codeBlockSyntaxHighlighting ? highlightingCodeBlockNodeView({
62
69
  codeBidiWarnings: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.codeBidiWarnings,
63
- codeBidiWarningLabel: codeBidiWarningLabel
70
+ codeBidiWarningLabel: codeBidiWarningLabel,
71
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
64
72
  }) : codeBlockNodeView();
65
73
  return createCodeBlockNodeView(node, view, getPos);
66
74
  }
@@ -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;