@atlaskit/editor-core 180.1.0 → 181.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 (404) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/cjs/actions/index.js +25 -10
  3. package/dist/cjs/analytics-api/attach-payload-into-transaction.js +1 -1
  4. package/dist/cjs/create-editor/ReactEditorView.js +0 -5
  5. package/dist/cjs/create-editor/ReactEditorViewInternal.js +73 -103
  6. package/dist/cjs/create-editor/create-plugins-list.js +30 -3
  7. package/dist/cjs/create-editor/preset-utils.js +27 -0
  8. package/dist/cjs/editor-next/editor-internal.js +2 -2
  9. package/dist/cjs/editor-next/editor-migration-component.js +18 -2
  10. package/dist/cjs/editor-next/hooks/useProviderFactory.js +4 -3
  11. package/dist/cjs/editor-next/index.js +13 -9
  12. package/dist/cjs/editor-next/utils/getProvidersFromEditorProps.js +41 -0
  13. package/dist/cjs/editor-next/utils/handleProviders.js +17 -22
  14. package/dist/cjs/editor.js +20 -13
  15. package/dist/cjs/keymaps/consts.js +1 -16
  16. package/dist/cjs/labs/next/presets/cxhtml.js +56 -55
  17. package/dist/cjs/labs/next/presets/default.js +15 -42
  18. package/dist/cjs/labs/next/presets/mobile.js +76 -89
  19. package/dist/cjs/labs/next/presets/universal.js +330 -257
  20. package/dist/cjs/labs/next/presets/useUniversalPreset.js +36 -0
  21. package/dist/cjs/plugins/analytics/plugin.js +6 -0
  22. package/dist/cjs/plugins/annotation/utils.js +2 -36
  23. package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +2 -7
  24. package/dist/cjs/plugins/block-type/pm-plugins/input-rule.js +0 -10
  25. package/dist/cjs/plugins/caption/index.js +0 -7
  26. package/dist/cjs/plugins/card/nodeviews/blockCard.js +9 -4
  27. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +6 -2
  28. package/dist/cjs/plugins/card/pm-plugins/main.js +6 -3
  29. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +4 -0
  30. package/dist/cjs/plugins/code-block/pm-plugins/main-state.js +2 -14
  31. package/dist/cjs/plugins/collab-edit/provider/index.js +1 -8
  32. package/dist/cjs/plugins/collab-edit/provider/types.js +1 -12
  33. package/dist/cjs/plugins/context-panel/index.js +1 -6
  34. package/dist/cjs/plugins/data-consumer/index.js +0 -8
  35. package/dist/cjs/plugins/date/utils/internal.js +0 -4
  36. package/dist/cjs/plugins/extension/commands.js +1 -8
  37. package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +9 -2
  38. package/dist/cjs/plugins/extension/ui/Extension/Extension/styles.js +2 -2
  39. package/dist/cjs/plugins/extension/ui/Extension/Lozenge.js +1 -0
  40. package/dist/cjs/plugins/feedback-dialog/index.js +1 -4
  41. package/dist/cjs/plugins/floating-toolbar/ui/Button.js +7 -3
  42. package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +10 -5
  43. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
  44. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
  45. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +24 -8
  46. package/dist/cjs/plugins/floating-toolbar/utils.js +0 -12
  47. package/dist/cjs/plugins/fragment/index.js +0 -8
  48. package/dist/cjs/plugins/help-dialog/commands.js +2 -6
  49. package/dist/cjs/plugins/image-upload/pm-plugins/main.js +50 -12
  50. package/dist/cjs/plugins/layout/styles.js +10 -1
  51. package/dist/cjs/plugins/list/utils/find.js +0 -28
  52. package/dist/cjs/plugins/list/utils/indentation.js +1 -25
  53. package/dist/cjs/plugins/list/utils/node.js +0 -5
  54. package/dist/cjs/plugins/list/utils/selection.js +2 -15
  55. package/dist/cjs/plugins/media/utils/media-common.js +1 -20
  56. package/dist/cjs/plugins/mentions/nodeviews/mention.js +100 -16
  57. package/dist/cjs/plugins/mentions/type-ahead/index.js +1 -18
  58. package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +1 -3
  59. package/dist/cjs/plugins/mobile-dimensions/index.js +1 -4
  60. package/dist/cjs/plugins/paste/index.js +1 -2
  61. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +123 -87
  62. package/dist/cjs/plugins/paste/util/index.js +0 -46
  63. package/dist/cjs/plugins/quick-insert/assets/index.js +1 -27
  64. package/dist/cjs/plugins/selection/gap-cursor/actions.js +49 -44
  65. package/dist/cjs/plugins/status/utils.js +1 -15
  66. package/dist/cjs/plugins/text-color/pm-plugins/main.js +0 -1
  67. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +7 -5
  68. package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
  69. package/dist/cjs/plugins/text-formatting/utils.js +1 -26
  70. package/dist/cjs/plugins/type-ahead/constants.js +1 -7
  71. package/dist/cjs/plugins/type-ahead/pm-plugins/decorations.js +2 -35
  72. package/dist/cjs/plugins/type-ahead/utils.js +3 -22
  73. package/dist/cjs/test-utils.js +4 -12
  74. package/dist/cjs/ui/Appearance/Comment/Toolbar.js +43 -8
  75. package/dist/cjs/ui/ColorPalette/index.js +18 -0
  76. package/dist/cjs/ui/ColorPickerButton/index.js +6 -2
  77. package/dist/cjs/ui/ConfigPanel/Fields/Expand.js +1 -0
  78. package/dist/cjs/ui/ConfigPanel/utils.js +4 -17
  79. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  80. package/dist/cjs/ui/ElementBrowser/ModalElementBrowser.js +1 -1
  81. package/dist/cjs/ui/ElementBrowser/constants.js +1 -3
  82. package/dist/cjs/ui/Resizer/utils.js +1 -3
  83. package/dist/cjs/ui/styles.js +3 -7
  84. package/dist/cjs/utils/get-editor-plugins.js +1 -3
  85. package/dist/cjs/utils/index.js +9 -269
  86. package/dist/cjs/utils/input-rules.js +1 -15
  87. package/dist/cjs/version-wrapper.js +1 -1
  88. package/dist/cjs/version.json +1 -1
  89. package/dist/es2019/actions/index.js +23 -9
  90. package/dist/es2019/analytics-api/attach-payload-into-transaction.js +1 -1
  91. package/dist/es2019/create-editor/ReactEditorView.js +0 -5
  92. package/dist/es2019/create-editor/ReactEditorViewInternal.js +67 -82
  93. package/dist/es2019/create-editor/create-plugins-list.js +25 -3
  94. package/dist/es2019/create-editor/preset-utils.js +15 -0
  95. package/dist/es2019/editor-next/editor-internal.js +2 -2
  96. package/dist/es2019/editor-next/editor-migration-component.js +19 -2
  97. package/dist/es2019/editor-next/hooks/useProviderFactory.js +4 -3
  98. package/dist/es2019/editor-next/index.js +13 -7
  99. package/dist/es2019/editor-next/utils/getProvidersFromEditorProps.js +36 -0
  100. package/dist/es2019/editor-next/utils/handleProviders.js +18 -24
  101. package/dist/es2019/editor.js +20 -11
  102. package/dist/es2019/keymaps/consts.js +7 -11
  103. package/dist/es2019/labs/next/presets/cxhtml.js +56 -53
  104. package/dist/es2019/labs/next/presets/default.js +18 -38
  105. package/dist/es2019/labs/next/presets/mobile.js +88 -88
  106. package/dist/es2019/labs/next/presets/universal.js +338 -265
  107. package/dist/es2019/labs/next/presets/useUniversalPreset.js +25 -0
  108. package/dist/es2019/plugins/analytics/plugin.js +7 -0
  109. package/dist/es2019/plugins/annotation/utils.js +2 -30
  110. package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +1 -3
  111. package/dist/es2019/plugins/block-type/pm-plugins/input-rule.js +3 -9
  112. package/dist/es2019/plugins/caption/index.js +0 -2
  113. package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -4
  114. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +6 -2
  115. package/dist/es2019/plugins/card/pm-plugins/main.js +6 -3
  116. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +4 -0
  117. package/dist/es2019/plugins/code-block/pm-plugins/main-state.js +1 -9
  118. package/dist/es2019/plugins/collab-edit/provider/index.js +1 -1
  119. package/dist/es2019/plugins/collab-edit/provider/types.js +1 -10
  120. package/dist/es2019/plugins/context-panel/index.js +0 -3
  121. package/dist/es2019/plugins/data-consumer/index.js +0 -7
  122. package/dist/es2019/plugins/date/utils/internal.js +0 -3
  123. package/dist/es2019/plugins/extension/commands.js +0 -6
  124. package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +12 -2
  125. package/dist/es2019/plugins/extension/ui/Extension/Extension/styles.js +3 -0
  126. package/dist/es2019/plugins/extension/ui/Extension/Lozenge.js +1 -0
  127. package/dist/es2019/plugins/feedback-dialog/index.js +0 -2
  128. package/dist/es2019/plugins/floating-toolbar/ui/Button.js +7 -3
  129. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +10 -5
  130. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +1 -11
  131. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
  132. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +21 -4
  133. package/dist/es2019/plugins/floating-toolbar/utils.js +0 -10
  134. package/dist/es2019/plugins/fragment/index.js +0 -7
  135. package/dist/es2019/plugins/help-dialog/commands.js +1 -2
  136. package/dist/es2019/plugins/image-upload/pm-plugins/main.js +47 -5
  137. package/dist/es2019/plugins/layout/styles.js +12 -4
  138. package/dist/es2019/plugins/list/utils/find.js +0 -27
  139. package/dist/es2019/plugins/list/utils/indentation.js +0 -23
  140. package/dist/es2019/plugins/list/utils/node.js +1 -4
  141. package/dist/es2019/plugins/list/utils/selection.js +2 -15
  142. package/dist/es2019/plugins/media/utils/media-common.js +1 -19
  143. package/dist/es2019/plugins/mentions/nodeviews/mention.js +64 -16
  144. package/dist/es2019/plugins/mentions/type-ahead/index.js +1 -14
  145. package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +1 -2
  146. package/dist/es2019/plugins/mobile-dimensions/index.js +0 -3
  147. package/dist/es2019/plugins/paste/index.js +1 -2
  148. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +126 -94
  149. package/dist/es2019/plugins/paste/util/index.js +5 -45
  150. package/dist/es2019/plugins/quick-insert/assets/index.js +0 -8
  151. package/dist/es2019/plugins/selection/gap-cursor/actions.js +56 -56
  152. package/dist/es2019/plugins/status/utils.js +1 -11
  153. package/dist/es2019/plugins/text-color/pm-plugins/main.js +1 -1
  154. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +7 -5
  155. package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
  156. package/dist/es2019/plugins/text-formatting/utils.js +0 -19
  157. package/dist/es2019/plugins/type-ahead/constants.js +0 -5
  158. package/dist/es2019/plugins/type-ahead/pm-plugins/decorations.js +0 -35
  159. package/dist/es2019/plugins/type-ahead/utils.js +0 -23
  160. package/dist/es2019/test-utils.js +4 -7
  161. package/dist/es2019/ui/Appearance/Comment/Toolbar.js +40 -6
  162. package/dist/es2019/ui/ColorPalette/index.js +2 -1
  163. package/dist/es2019/ui/ColorPickerButton/index.js +6 -2
  164. package/dist/es2019/ui/ConfigPanel/Fields/Expand.js +1 -0
  165. package/dist/es2019/ui/ConfigPanel/utils.js +0 -6
  166. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  167. package/dist/es2019/ui/ElementBrowser/ModalElementBrowser.js +1 -1
  168. package/dist/es2019/ui/ElementBrowser/constants.js +0 -1
  169. package/dist/es2019/ui/Resizer/utils.js +0 -1
  170. package/dist/es2019/ui/styles.js +0 -6
  171. package/dist/es2019/utils/get-editor-plugins.js +1 -3
  172. package/dist/es2019/utils/index.js +13 -199
  173. package/dist/es2019/utils/input-rules.js +0 -14
  174. package/dist/es2019/version-wrapper.js +1 -1
  175. package/dist/es2019/version.json +1 -1
  176. package/dist/esm/actions/index.js +23 -9
  177. package/dist/esm/analytics-api/attach-payload-into-transaction.js +1 -1
  178. package/dist/esm/create-editor/ReactEditorView.js +0 -5
  179. package/dist/esm/create-editor/ReactEditorViewInternal.js +73 -102
  180. package/dist/esm/create-editor/create-plugins-list.js +29 -3
  181. package/dist/esm/create-editor/preset-utils.js +21 -0
  182. package/dist/esm/editor-next/editor-internal.js +2 -2
  183. package/dist/esm/editor-next/editor-migration-component.js +18 -2
  184. package/dist/esm/editor-next/hooks/useProviderFactory.js +4 -3
  185. package/dist/esm/editor-next/index.js +13 -9
  186. package/dist/esm/editor-next/utils/getProvidersFromEditorProps.js +35 -0
  187. package/dist/esm/editor-next/utils/handleProviders.js +17 -22
  188. package/dist/esm/editor.js +20 -13
  189. package/dist/esm/keymaps/consts.js +7 -11
  190. package/dist/esm/labs/next/presets/cxhtml.js +56 -55
  191. package/dist/esm/labs/next/presets/default.js +18 -41
  192. package/dist/esm/labs/next/presets/mobile.js +88 -90
  193. package/dist/esm/labs/next/presets/universal.js +330 -257
  194. package/dist/esm/labs/next/presets/useUniversalPreset.js +29 -0
  195. package/dist/esm/plugins/analytics/plugin.js +6 -0
  196. package/dist/esm/plugins/annotation/utils.js +2 -32
  197. package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +1 -5
  198. package/dist/esm/plugins/block-type/pm-plugins/input-rule.js +3 -9
  199. package/dist/esm/plugins/caption/index.js +0 -2
  200. package/dist/esm/plugins/card/nodeviews/blockCard.js +9 -4
  201. package/dist/esm/plugins/card/nodeviews/inlineCard.js +6 -2
  202. package/dist/esm/plugins/card/pm-plugins/main.js +6 -3
  203. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +4 -0
  204. package/dist/esm/plugins/code-block/pm-plugins/main-state.js +0 -10
  205. package/dist/esm/plugins/collab-edit/provider/index.js +1 -1
  206. package/dist/esm/plugins/collab-edit/provider/types.js +1 -10
  207. package/dist/esm/plugins/context-panel/index.js +0 -3
  208. package/dist/esm/plugins/data-consumer/index.js +0 -7
  209. package/dist/esm/plugins/date/utils/internal.js +0 -3
  210. package/dist/esm/plugins/extension/commands.js +0 -6
  211. package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +9 -2
  212. package/dist/esm/plugins/extension/ui/Extension/Extension/styles.js +2 -2
  213. package/dist/esm/plugins/extension/ui/Extension/Lozenge.js +1 -0
  214. package/dist/esm/plugins/feedback-dialog/index.js +0 -2
  215. package/dist/esm/plugins/floating-toolbar/ui/Button.js +7 -3
  216. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +10 -5
  217. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +2 -9
  218. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -0
  219. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +24 -8
  220. package/dist/esm/plugins/floating-toolbar/utils.js +0 -10
  221. package/dist/esm/plugins/fragment/index.js +0 -7
  222. package/dist/esm/plugins/help-dialog/commands.js +0 -3
  223. package/dist/esm/plugins/image-upload/pm-plugins/main.js +51 -12
  224. package/dist/esm/plugins/layout/styles.js +11 -2
  225. package/dist/esm/plugins/list/utils/find.js +0 -27
  226. package/dist/esm/plugins/list/utils/indentation.js +0 -23
  227. package/dist/esm/plugins/list/utils/node.js +1 -4
  228. package/dist/esm/plugins/list/utils/selection.js +2 -12
  229. package/dist/esm/plugins/media/utils/media-common.js +1 -17
  230. package/dist/esm/plugins/mentions/nodeviews/mention.js +97 -16
  231. package/dist/esm/plugins/mentions/type-ahead/index.js +1 -18
  232. package/dist/esm/plugins/mentions/ui/InviteItem/index.js +1 -2
  233. package/dist/esm/plugins/mobile-dimensions/index.js +0 -3
  234. package/dist/esm/plugins/paste/index.js +1 -2
  235. package/dist/esm/plugins/paste/pm-plugins/analytics.js +122 -86
  236. package/dist/esm/plugins/paste/util/index.js +5 -45
  237. package/dist/esm/plugins/quick-insert/assets/index.js +0 -20
  238. package/dist/esm/plugins/selection/gap-cursor/actions.js +52 -45
  239. package/dist/esm/plugins/status/utils.js +1 -13
  240. package/dist/esm/plugins/text-color/pm-plugins/main.js +1 -1
  241. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +7 -5
  242. package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +8 -2
  243. package/dist/esm/plugins/text-formatting/utils.js +0 -21
  244. package/dist/esm/plugins/type-ahead/constants.js +0 -5
  245. package/dist/esm/plugins/type-ahead/pm-plugins/decorations.js +0 -31
  246. package/dist/esm/plugins/type-ahead/utils.js +2 -20
  247. package/dist/esm/test-utils.js +4 -7
  248. package/dist/esm/ui/Appearance/Comment/Toolbar.js +41 -6
  249. package/dist/esm/ui/ColorPalette/index.js +2 -1
  250. package/dist/esm/ui/ColorPickerButton/index.js +6 -2
  251. package/dist/esm/ui/ConfigPanel/Fields/Expand.js +1 -0
  252. package/dist/esm/ui/ConfigPanel/utils.js +3 -14
  253. package/dist/esm/ui/ContentStyles/index.js +1 -1
  254. package/dist/esm/ui/ElementBrowser/ModalElementBrowser.js +1 -1
  255. package/dist/esm/ui/ElementBrowser/constants.js +0 -1
  256. package/dist/esm/ui/Resizer/utils.js +0 -1
  257. package/dist/esm/ui/styles.js +2 -5
  258. package/dist/esm/utils/get-editor-plugins.js +1 -3
  259. package/dist/esm/utils/index.js +13 -196
  260. package/dist/esm/utils/input-rules.js +0 -13
  261. package/dist/esm/version-wrapper.js +1 -1
  262. package/dist/esm/version.json +1 -1
  263. package/dist/types/actions/index.d.ts +4 -4
  264. package/dist/types/create-editor/ReactEditorView.d.ts +0 -3
  265. package/dist/types/create-editor/ReactEditorViewInternal.d.ts +9 -7
  266. package/dist/types/create-editor/ReactEditorViewNext.d.ts +3 -4
  267. package/dist/types/create-editor/create-plugins-list.d.ts +3 -5
  268. package/dist/types/create-editor/preset-utils.d.ts +2 -0
  269. package/dist/types/editor-next/editor-internal.d.ts +9 -9
  270. package/dist/types/editor-next/hooks/useMeasureEditorMountTime.d.ts +2 -2
  271. package/dist/types/editor-next/hooks/useProviderFactory.d.ts +2 -2
  272. package/dist/types/editor-next/index.d.ts +6 -6
  273. package/dist/types/editor-next/utils/deprecationWarnings.d.ts +2 -2
  274. package/dist/types/editor-next/utils/editorPropTypes.d.ts +1 -1
  275. package/dist/types/editor-next/utils/getProvidersFromEditorProps.d.ts +9 -0
  276. package/dist/types/editor-next/utils/handleProviders.d.ts +2 -2
  277. package/dist/types/editor-next/utils/onEditorCreated.d.ts +2 -2
  278. package/dist/types/editor-next/utils/sendDurationAnalytics.d.ts +1 -1
  279. package/dist/types/editor.d.ts +7 -4
  280. package/dist/types/keymaps/consts.d.ts +0 -11
  281. package/dist/types/labs/next/presets/cxhtml.d.ts +33 -1
  282. package/dist/types/labs/next/presets/default.d.ts +67 -10
  283. package/dist/types/labs/next/presets/mobile.d.ts +33 -1
  284. package/dist/types/labs/next/presets/universal.d.ts +5 -13
  285. package/dist/types/labs/next/presets/useUniversalPreset.d.ts +7 -0
  286. package/dist/types/nodeviews/context-adapter.d.ts +0 -1
  287. package/dist/types/nodeviews/index.d.ts +0 -1
  288. package/dist/types/plugins/alignment/pm-plugins/types.d.ts +0 -11
  289. package/dist/types/plugins/annotation/utils.d.ts +0 -17
  290. package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +2 -3
  291. package/dist/types/plugins/block-type/pm-plugins/input-rule.d.ts +2 -6
  292. package/dist/types/plugins/caption/index.d.ts +0 -2
  293. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +2 -10
  294. package/dist/types/plugins/card/nodeviews/genericCard.d.ts +1 -0
  295. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -1
  296. package/dist/types/plugins/code-block/actions.d.ts +0 -4
  297. package/dist/types/plugins/code-block/pm-plugins/main-state.d.ts +0 -3
  298. package/dist/types/plugins/collab-edit/provider/index.d.ts +1 -2
  299. package/dist/types/plugins/collab-edit/provider/types.d.ts +1 -36
  300. package/dist/types/plugins/context-panel/index.d.ts +2 -3
  301. package/dist/types/plugins/data-consumer/index.d.ts +0 -2
  302. package/dist/types/plugins/date/utils/internal.d.ts +0 -1
  303. package/dist/types/plugins/extension/commands.d.ts +0 -1
  304. package/dist/types/plugins/extension/nodeviews/extension.d.ts +0 -5
  305. package/dist/types/plugins/feedback-dialog/index.d.ts +0 -2
  306. package/dist/types/plugins/floating-toolbar/ui/Button.d.ts +3 -1
  307. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
  308. package/dist/types/plugins/floating-toolbar/utils.d.ts +0 -2
  309. package/dist/types/plugins/fragment/index.d.ts +0 -2
  310. package/dist/types/plugins/help-dialog/commands.d.ts +0 -1
  311. package/dist/types/plugins/history/actions.d.ts +1 -2
  312. package/dist/types/plugins/layout/styles.d.ts +2 -1
  313. package/dist/types/plugins/list/utils/find.d.ts +0 -1
  314. package/dist/types/plugins/list/utils/indentation.d.ts +0 -1
  315. package/dist/types/plugins/list/utils/node.d.ts +0 -2
  316. package/dist/types/plugins/list/utils/selection.d.ts +0 -3
  317. package/dist/types/plugins/media/utils/media-common.d.ts +0 -5
  318. package/dist/types/plugins/mentions/types.d.ts +1 -2
  319. package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +2 -3
  320. package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +0 -6
  321. package/dist/types/plugins/mentions/ui/ToolbarMention/index.d.ts +1 -4
  322. package/dist/types/plugins/mobile-dimensions/index.d.ts +0 -1
  323. package/dist/types/plugins/paste/index.d.ts +0 -1
  324. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +6 -3
  325. package/dist/types/plugins/paste/util/index.d.ts +0 -6
  326. package/dist/types/plugins/quick-insert/assets/index.d.ts +0 -2
  327. package/dist/types/plugins/status/utils.d.ts +0 -3
  328. package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +0 -6
  329. package/dist/types/plugins/text-color/pm-plugins/main.d.ts +2 -12
  330. package/dist/types/plugins/text-formatting/pm-plugins/clear-formatting.d.ts +0 -1
  331. package/dist/types/plugins/text-formatting/utils.d.ts +0 -4
  332. package/dist/types/plugins/type-ahead/constants.d.ts +0 -4
  333. package/dist/types/plugins/type-ahead/pm-plugins/decorations.d.ts +0 -10
  334. package/dist/types/plugins/type-ahead/utils.d.ts +1 -2
  335. package/dist/types/test-utils.d.ts +4 -5
  336. package/dist/types/types/editor-appearance-component.d.ts +2 -2
  337. package/dist/types/types/editor-props.d.ts +55 -42
  338. package/dist/types/ui/Appearance/Chromeless.d.ts +0 -5
  339. package/dist/types/ui/Appearance/Comment/Comment.d.ts +0 -7
  340. package/dist/types/ui/Appearance/Comment/Toolbar.d.ts +3 -2
  341. package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +0 -4
  342. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +3 -3
  343. package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -5
  344. package/dist/types/ui/ColorPalette/Palettes/index.d.ts +1 -1
  345. package/dist/types/ui/ColorPalette/Palettes/type.d.ts +1 -1
  346. package/dist/types/ui/ColorPalette/index.d.ts +2 -1
  347. package/dist/types/ui/ColorPickerButton/index.d.ts +4 -2
  348. package/dist/types/ui/ConfigPanel/types.d.ts +0 -3
  349. package/dist/types/ui/ConfigPanel/utils.d.ts +2 -3
  350. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  351. package/dist/types/ui/ElementBrowser/ModalElementBrowser.d.ts +0 -3
  352. package/dist/types/ui/ElementBrowser/constants.d.ts +0 -1
  353. package/dist/types/ui/ElementBrowser/types.d.ts +0 -5
  354. package/dist/types/ui/Resizer/utils.d.ts +0 -1
  355. package/dist/types/ui/styles.d.ts +0 -1
  356. package/dist/types/utils/index.d.ts +6 -65
  357. package/dist/types/utils/input-rules.d.ts +1 -2
  358. package/dist/types/utils/table.d.ts +0 -1
  359. package/package.json +23 -24
  360. package/report.api.md +155 -146
  361. package/dist/cjs/labs/next/presets/preset.js +0 -101
  362. package/dist/cjs/plugins/analytics/types/type-ahead.js +0 -5
  363. package/dist/cjs/plugins/collab-edit/provider/channel.js +0 -313
  364. package/dist/cjs/plugins/collab-edit/provider/logger.js +0 -17
  365. package/dist/cjs/plugins/collab-edit/provider/mock-users.js +0 -19
  366. package/dist/cjs/plugins/data-consumer/plugin-key.js +0 -9
  367. package/dist/cjs/plugins/media/toolbar/toolbar-messages.js +0 -15
  368. package/dist/cjs/profiler/render-count.js +0 -60
  369. package/dist/cjs/ui/ColorPalette/Color/index.js +0 -9
  370. package/dist/cjs/ui/ConfigPanel/FieldDescription.js +0 -19
  371. package/dist/cjs/ui/WithPluginState/types.js +0 -5
  372. package/dist/es2019/labs/next/presets/preset.js +0 -68
  373. package/dist/es2019/plugins/analytics/types/type-ahead.js +0 -1
  374. package/dist/es2019/plugins/collab-edit/provider/channel.js +0 -179
  375. package/dist/es2019/plugins/collab-edit/provider/logger.js +0 -8
  376. package/dist/es2019/plugins/collab-edit/provider/mock-users.js +0 -12
  377. package/dist/es2019/plugins/data-consumer/plugin-key.js +0 -2
  378. package/dist/es2019/plugins/media/toolbar/toolbar-messages.js +0 -8
  379. package/dist/es2019/profiler/render-count.js +0 -53
  380. package/dist/es2019/ui/ColorPalette/Color/index.js +0 -2
  381. package/dist/es2019/ui/ConfigPanel/FieldDescription.js +0 -12
  382. package/dist/es2019/ui/WithPluginState/types.js +0 -1
  383. package/dist/esm/labs/next/presets/preset.js +0 -93
  384. package/dist/esm/plugins/analytics/types/type-ahead.js +0 -1
  385. package/dist/esm/plugins/collab-edit/provider/channel.js +0 -305
  386. package/dist/esm/plugins/collab-edit/provider/logger.js +0 -10
  387. package/dist/esm/plugins/collab-edit/provider/mock-users.js +0 -12
  388. package/dist/esm/plugins/data-consumer/plugin-key.js +0 -2
  389. package/dist/esm/plugins/media/toolbar/toolbar-messages.js +0 -8
  390. package/dist/esm/profiler/render-count.js +0 -49
  391. package/dist/esm/ui/ColorPalette/Color/index.js +0 -2
  392. package/dist/esm/ui/ConfigPanel/FieldDescription.js +0 -11
  393. package/dist/esm/ui/WithPluginState/types.js +0 -1
  394. package/dist/types/labs/next/presets/preset.d.ts +0 -46
  395. package/dist/types/plugins/analytics/types/type-ahead.d.ts +0 -1
  396. package/dist/types/plugins/collab-edit/provider/channel.d.ts +0 -48
  397. package/dist/types/plugins/collab-edit/provider/logger.d.ts +0 -1
  398. package/dist/types/plugins/collab-edit/provider/mock-users.d.ts +0 -6
  399. package/dist/types/plugins/data-consumer/plugin-key.d.ts +0 -2
  400. package/dist/types/plugins/media/toolbar/toolbar-messages.d.ts +0 -7
  401. package/dist/types/profiler/render-count.d.ts +0 -14
  402. package/dist/types/ui/ColorPalette/Color/index.d.ts +0 -2
  403. package/dist/types/ui/ConfigPanel/FieldDescription.d.ts +0 -6
  404. package/dist/types/ui/WithPluginState/types.d.ts +0 -10
@@ -1,179 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { utils } from '@atlaskit/util-service-support';
3
- import { EventEmitter2 } from 'eventemitter2';
4
- import { getVersion, sendableSteps } from '@atlaskit/prosemirror-collab';
5
- import { logger } from './logger';
6
- export class Channel {
7
- constructor(config, pubSubClient) {
8
- _defineProperty(this, "eventEmitter", new EventEmitter2());
9
- this.config = config;
10
- this.pubSubClient = pubSubClient;
11
- }
12
-
13
- /**
14
- * Get initial document from service
15
- */
16
- async getDocument() {
17
- try {
18
- const {
19
- doc,
20
- version
21
- } = await utils.requestService(this.config, {
22
- path: `document/${this.config.docId}`
23
- });
24
- return {
25
- doc,
26
- version
27
- };
28
- } catch (err) {
29
- logger(`Collab-Edit: Document "${this.config.docId}" does not exist. Creating one locally.`);
30
- return {
31
- doc: {},
32
- version: 1
33
- };
34
- }
35
- }
36
-
37
- /**
38
- * Connect to pubsub to start receiving events
39
- */
40
- async connect() {
41
- const {
42
- docId
43
- } = this.config;
44
- const {
45
- doc,
46
- version
47
- } = await this.getDocument();
48
- this.pubSubClient.on('CONNECT', () => {
49
- logger('Connected to FPS-service');
50
- });
51
- await this.pubSubClient.join([`ari:cloud::fabric:collab-service/${docId}`]);
52
- this.pubSubClient.on('avi:pf-collab-service:steps:created', (_event, payload) => {
53
- logger('Received FPS-payload', {
54
- payload
55
- });
56
- this.emit('data', payload);
57
- }).on('avi:pf-collab-service:telepointer:updated', (_event, payload) => {
58
- logger('Received telepointer-payload', {
59
- payload
60
- });
61
- this.emit('telepointer', payload);
62
- });
63
- this.eventEmitter.emit('connected', {
64
- doc,
65
- version
66
- });
67
- }
68
- debounce(getState) {
69
- logger(`Debouncing steps`);
70
- if (this.debounced) {
71
- clearTimeout(this.debounced);
72
- }
73
- this.debounced = window.setTimeout(() => {
74
- logger(`Sending debounced`);
75
- this.sendSteps(getState(), getState);
76
- }, 250);
77
- }
78
-
79
- /**
80
- * Send steps to service
81
- */
82
- async sendSteps(state, getState, localSteps) {
83
- if (this.isSending) {
84
- this.debounce(getState);
85
- return;
86
- }
87
- const version = getVersion(state);
88
-
89
- // Don't send any steps before we're ready.
90
- if (typeof version === undefined) {
91
- return;
92
- }
93
- const {
94
- steps
95
- } = localSteps || sendableSteps(state) || {
96
- steps: []
97
- }; // sendableSteps can return null..
98
-
99
- if (steps.length === 0) {
100
- logger(`No steps to send. Aborting.`);
101
- return;
102
- }
103
- this.isSending = true;
104
- try {
105
- const response = await utils.requestService(this.config, {
106
- path: `document/${this.config.docId}/steps`,
107
- requestInit: {
108
- method: 'POST',
109
- headers: {
110
- 'Content-Type': 'application/json'
111
- },
112
- body: JSON.stringify({
113
- version,
114
- steps
115
- })
116
- }
117
- });
118
- this.isSending = false;
119
- logger(`Steps sent and accepted by service.`);
120
- this.emit('data', response);
121
- } catch (err) {
122
- this.isSending = false;
123
- logger(`Error sending steps: "${err}"`);
124
- }
125
- }
126
-
127
- /**
128
- * Get steps from version x to latest
129
- */
130
- async getSteps(version) {
131
- return await utils.requestService(this.config, {
132
- path: `document/${this.config.docId}/steps`,
133
- queryParams: {
134
- version
135
- }
136
- });
137
- }
138
-
139
- /**
140
- * Send telepointer
141
- */
142
- async sendTelepointer(data) {
143
- logger(`Sending telepointer`, data);
144
- await utils.requestService(this.config, {
145
- path: `document/${this.config.docId}/telepointer`,
146
- requestInit: {
147
- method: 'POST',
148
- headers: {
149
- 'Content-Type': 'application/json'
150
- },
151
- body: JSON.stringify(data)
152
- }
153
- });
154
- }
155
-
156
- /**
157
- * Subscribe to events emitted by this channel
158
- */
159
- on(evt, handler) {
160
- this.eventEmitter.on(evt, handler);
161
- return this;
162
- }
163
-
164
- /**
165
- * Unsubscribe from events emitted by this channel
166
- */
167
- off(evt, handler) {
168
- this.eventEmitter.off(evt, handler);
169
- return this;
170
- }
171
-
172
- /**
173
- * Emit events to subscribers
174
- */
175
- emit(evt, data) {
176
- this.eventEmitter.emit(evt, data);
177
- return this;
178
- }
179
- }
@@ -1,8 +0,0 @@
1
- export const logger = (msg, data = null, style = 'color:blue;font-weight:bold;') => {
2
- // eslint-disable-next-line no-console
3
- console.log(`%cCollab-Edit: ${msg}`, style);
4
- if (data) {
5
- // eslint-disable-next-line no-console
6
- console.log(data);
7
- }
8
- };
@@ -1,12 +0,0 @@
1
- const participants = ['Awilda Mcentire', 'Katie Iddings', 'Serafina Mcdowell', 'Eun Knopp', 'Walker Reighard', 'Keely Muth', 'Allie April', 'Rosamond Paton', 'Lashawnda Peppard', 'Hubert Feingold', 'Idalia Mcquaig', 'Wyatt Byer', 'Genevieve Reeder', 'Dona Elton', 'Jerilyn Holte', 'Salina Erhardt', 'Velda Latour', 'Regina Richer', 'Natisha Tiger', 'Glynda Stuckey', 'Wilson Woodberry', 'Elvie Furtado', 'Lasandra Palmatier', 'Louise Mijares', 'Herma Vanleer', 'Titus Plante', 'James Fiscus', 'Ina Ramero', 'Jeanene Bernabe', 'Lida Lepine', 'Rosalina Palka', 'Dayle Grossi', 'Zack Leister', 'Isobel Fay', 'Elouise Kluge', 'Twyla Machin', 'Diane Herrington', 'Fumiko Elders', 'Kennith Howe', 'Doloris Mccollom', 'Daryl Wherry', 'Sade Albury', 'Roy Cork', 'Hunter Hultgren', 'Mi Miley', 'Isabelle Halperin', 'Kayla Starke', 'Allyson Woomer', 'Sirena Politte', 'Patricia Scovil'];
2
- export const getParticipant = userId => {
3
- const id = +userId.split('/')[1];
4
- // eslint-disable-next-line no-bitwise
5
- const name = participants[(id | 0) % participants.length];
6
- return {
7
- userId,
8
- name,
9
- avatar: `https://api.adorable.io/avatars/80/${name.replace(/\s/g, '')}.png`,
10
- email: `${name.replace(/\s/g, '').toLocaleLowerCase()}@atlassian.com`
11
- };
12
- };
@@ -1,2 +0,0 @@
1
- import { PluginKey } from 'prosemirror-state';
2
- export const pluginKey = new PluginKey('dataConsumerMarkPlugin');
@@ -1,8 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export const toolbarMessages = defineMessages({
3
- annotate: {
4
- id: 'fabric.editor.annotate',
5
- defaultMessage: 'Annotate',
6
- description: 'Annotate an image by drawing arrows, adding text, or scribbles.'
7
- }
8
- });
@@ -1,53 +0,0 @@
1
- import React, { useRef } from 'react';
2
- import uuid from 'uuid';
3
- import { useComponentRenderTracking } from '@atlaskit/editor-common/utils';
4
- import { RenderCountProfiler as RenderCountProfilerClass } from '@atlaskit/editor-common/utils';
5
- export let ProfiledComponentIds;
6
- (function (ProfiledComponentIds) {
7
- ProfiledComponentIds["editor"] = "Editor";
8
- ProfiledComponentIds["appearance"] = "FullPageEditor";
9
- ProfiledComponentIds["reactEditorView"] = "ReactEditorView";
10
- ProfiledComponentIds["contentArea"] = "FullPageContentArea";
11
- ProfiledComponentIds["toolbar"] = "FullPageToolbar";
12
- ProfiledComponentIds["mention"] = "MentionNodeView";
13
- })(ProfiledComponentIds || (ProfiledComponentIds = {}));
14
- const CoreRenderCountProfiler = ({
15
- componentId
16
- }) => {
17
- const {
18
- current: instanceId
19
- } = useRef(uuid());
20
- const onRender = ({
21
- renderCount
22
- }) => {
23
- const profiler = RenderCountProfilerClass.getInstance({
24
- store: window
25
- });
26
- profiler.setRenderCount({
27
- componentId,
28
- instanceId,
29
- renderCount
30
- });
31
- };
32
- useComponentRenderTracking({
33
- onRender,
34
- propsDiffingOptions: {
35
- enabled: false
36
- },
37
- zeroBasedCount: false
38
- });
39
- return null;
40
- };
41
- export const RenderCountProfiler = ({
42
- componentId
43
- }) => {
44
- const profiler = RenderCountProfilerClass.getInstance({
45
- store: window
46
- });
47
- if (profiler.isEnabled()) {
48
- return /*#__PURE__*/React.createElement(CoreRenderCountProfiler, {
49
- componentId: componentId
50
- });
51
- }
52
- return null;
53
- };
@@ -1,2 +0,0 @@
1
- import { Color } from '@atlaskit/editor-common/ui-color';
2
- export default Color;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { HelperMessage } from '@atlaskit/form';
3
- const FieldDescription = function ({
4
- error,
5
- description
6
- }) {
7
- if (error || !description) {
8
- return null;
9
- }
10
- return /*#__PURE__*/React.createElement(HelperMessage, null, description);
11
- };
12
- export default FieldDescription;
@@ -1 +0,0 @@
1
- export {};
@@ -1,93 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _construct from "@babel/runtime/helpers/construct";
3
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
- import _createClass from "@babel/runtime/helpers/createClass";
6
- export var Preset = /*#__PURE__*/function () {
7
- function Preset() {
8
- _classCallCheck(this, Preset);
9
- for (var _len = arguments.length, more = new Array(_len), _key = 0; _key < _len; _key++) {
10
- more[_key] = arguments[_key];
11
- }
12
- this.data = [].concat(more) || [];
13
- }
14
- _createClass(Preset, [{
15
- key: "add",
16
- value: function add(nextOrTuple) {
17
- var newPreset = _construct(Preset, [nextOrTuple].concat(_toConsumableArray(this.data)));
18
- // TODO: remove this `this.data.push`,
19
- // once refactoring `create-plugins-list` to address this complexity:
20
- /**
21
- * preset.add(x)
22
- * preset.add(y)
23
- * preset.add(z)
24
- */
25
- // to:
26
- /**
27
- * immutablePreset = preset.add(x).add(foo).add(bar)
28
- * presetWithY = presetWithY.add(y)
29
- * presetWithZ = preset.add(z)
30
- */
31
- this.data.push(nextOrTuple);
32
- return newPreset;
33
- }
34
- }, {
35
- key: "has",
36
- value: function has(plugin) {
37
- return this.data.some(function (pluginPreset) {
38
- if (Array.isArray(pluginPreset)) {
39
- return pluginPreset[0] === plugin;
40
- }
41
- return pluginPreset === plugin;
42
- });
43
- }
44
- }, {
45
- key: "getEditorPlugins",
46
- value: function getEditorPlugins(excludes) {
47
- var editorPlugins = this.processEditorPlugins();
48
- return this.removeExcludedPlugins(editorPlugins, excludes);
49
- }
50
- }, {
51
- key: "processEditorPlugins",
52
- value: function processEditorPlugins() {
53
- var cache = new Map();
54
- this.data.forEach(function (pluginEntry) {
55
- if (Array.isArray(pluginEntry)) {
56
- var _pluginEntry = _slicedToArray(pluginEntry, 2),
57
- fn = _pluginEntry[0],
58
- options = _pluginEntry[1];
59
- cache.set(fn, options);
60
- } else {
61
- /**
62
- * Prevent usage of same plugin twice without override.
63
- * [
64
- * plugin1,
65
- * [plugin1, { option1: value }],
66
- * plugin1, // This will throw
67
- * ]
68
- */
69
- if (cache.has(pluginEntry) && cache.get(pluginEntry) === undefined) {
70
- throw new Error("".concat(pluginEntry, " is already included!"));
71
- }
72
- cache.set(pluginEntry, undefined);
73
- }
74
- });
75
- var plugins = [];
76
- cache.forEach(function (options, fn) {
77
- plugins.push(fn(options));
78
- });
79
- return plugins;
80
- }
81
- }, {
82
- key: "removeExcludedPlugins",
83
- value: function removeExcludedPlugins(plugins, excludes) {
84
- if (excludes) {
85
- return plugins.filter(function (plugin) {
86
- return !plugin || !excludes.has(plugin.name);
87
- });
88
- }
89
- return plugins;
90
- }
91
- }]);
92
- return Preset;
93
- }();
@@ -1 +0,0 @@
1
- export {};
@@ -1,305 +0,0 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
- import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import { utils } from '@atlaskit/util-service-support';
8
- import { EventEmitter2 } from 'eventemitter2';
9
- import { getVersion, sendableSteps } from '@atlaskit/prosemirror-collab';
10
- import { logger } from './logger';
11
- export var Channel = /*#__PURE__*/function () {
12
- function Channel(config, pubSubClient) {
13
- _classCallCheck(this, Channel);
14
- _defineProperty(this, "eventEmitter", new EventEmitter2());
15
- this.config = config;
16
- this.pubSubClient = pubSubClient;
17
- }
18
-
19
- /**
20
- * Get initial document from service
21
- */
22
- _createClass(Channel, [{
23
- key: "getDocument",
24
- value: function () {
25
- var _getDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26
- var _yield$utils$requestS, doc, version;
27
- return _regeneratorRuntime.wrap(function _callee$(_context) {
28
- while (1) {
29
- switch (_context.prev = _context.next) {
30
- case 0:
31
- _context.prev = 0;
32
- _context.next = 3;
33
- return utils.requestService(this.config, {
34
- path: "document/".concat(this.config.docId)
35
- });
36
- case 3:
37
- _yield$utils$requestS = _context.sent;
38
- doc = _yield$utils$requestS.doc;
39
- version = _yield$utils$requestS.version;
40
- return _context.abrupt("return", {
41
- doc: doc,
42
- version: version
43
- });
44
- case 9:
45
- _context.prev = 9;
46
- _context.t0 = _context["catch"](0);
47
- logger("Collab-Edit: Document \"".concat(this.config.docId, "\" does not exist. Creating one locally."));
48
- return _context.abrupt("return", {
49
- doc: {},
50
- version: 1
51
- });
52
- case 13:
53
- case "end":
54
- return _context.stop();
55
- }
56
- }
57
- }, _callee, this, [[0, 9]]);
58
- }));
59
- function getDocument() {
60
- return _getDocument.apply(this, arguments);
61
- }
62
- return getDocument;
63
- }()
64
- /**
65
- * Connect to pubsub to start receiving events
66
- */
67
- }, {
68
- key: "connect",
69
- value: function () {
70
- var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
71
- var _this = this;
72
- var docId, _yield$this$getDocume, doc, version;
73
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
74
- while (1) {
75
- switch (_context2.prev = _context2.next) {
76
- case 0:
77
- docId = this.config.docId;
78
- _context2.next = 3;
79
- return this.getDocument();
80
- case 3:
81
- _yield$this$getDocume = _context2.sent;
82
- doc = _yield$this$getDocume.doc;
83
- version = _yield$this$getDocume.version;
84
- this.pubSubClient.on('CONNECT', function () {
85
- logger('Connected to FPS-service');
86
- });
87
- _context2.next = 9;
88
- return this.pubSubClient.join(["ari:cloud::fabric:collab-service/".concat(docId)]);
89
- case 9:
90
- this.pubSubClient.on('avi:pf-collab-service:steps:created', function (_event, payload) {
91
- logger('Received FPS-payload', {
92
- payload: payload
93
- });
94
- _this.emit('data', payload);
95
- }).on('avi:pf-collab-service:telepointer:updated', function (_event, payload) {
96
- logger('Received telepointer-payload', {
97
- payload: payload
98
- });
99
- _this.emit('telepointer', payload);
100
- });
101
- this.eventEmitter.emit('connected', {
102
- doc: doc,
103
- version: version
104
- });
105
- case 11:
106
- case "end":
107
- return _context2.stop();
108
- }
109
- }
110
- }, _callee2, this);
111
- }));
112
- function connect() {
113
- return _connect.apply(this, arguments);
114
- }
115
- return connect;
116
- }()
117
- }, {
118
- key: "debounce",
119
- value: function debounce(getState) {
120
- var _this2 = this;
121
- logger("Debouncing steps");
122
- if (this.debounced) {
123
- clearTimeout(this.debounced);
124
- }
125
- this.debounced = window.setTimeout(function () {
126
- logger("Sending debounced");
127
- _this2.sendSteps(getState(), getState);
128
- }, 250);
129
- }
130
-
131
- /**
132
- * Send steps to service
133
- */
134
- }, {
135
- key: "sendSteps",
136
- value: function () {
137
- var _sendSteps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(state, getState, localSteps) {
138
- var version, _ref, steps, response;
139
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
140
- while (1) {
141
- switch (_context3.prev = _context3.next) {
142
- case 0:
143
- if (!this.isSending) {
144
- _context3.next = 3;
145
- break;
146
- }
147
- this.debounce(getState);
148
- return _context3.abrupt("return");
149
- case 3:
150
- version = getVersion(state); // Don't send any steps before we're ready.
151
- if (!(_typeof(version) === undefined)) {
152
- _context3.next = 6;
153
- break;
154
- }
155
- return _context3.abrupt("return");
156
- case 6:
157
- _ref = localSteps || sendableSteps(state) || {
158
- steps: []
159
- }, steps = _ref.steps; // sendableSteps can return null..
160
- if (!(steps.length === 0)) {
161
- _context3.next = 10;
162
- break;
163
- }
164
- logger("No steps to send. Aborting.");
165
- return _context3.abrupt("return");
166
- case 10:
167
- this.isSending = true;
168
- _context3.prev = 11;
169
- _context3.next = 14;
170
- return utils.requestService(this.config, {
171
- path: "document/".concat(this.config.docId, "/steps"),
172
- requestInit: {
173
- method: 'POST',
174
- headers: {
175
- 'Content-Type': 'application/json'
176
- },
177
- body: JSON.stringify({
178
- version: version,
179
- steps: steps
180
- })
181
- }
182
- });
183
- case 14:
184
- response = _context3.sent;
185
- this.isSending = false;
186
- logger("Steps sent and accepted by service.");
187
- this.emit('data', response);
188
- _context3.next = 24;
189
- break;
190
- case 20:
191
- _context3.prev = 20;
192
- _context3.t0 = _context3["catch"](11);
193
- this.isSending = false;
194
- logger("Error sending steps: \"".concat(_context3.t0, "\""));
195
- case 24:
196
- case "end":
197
- return _context3.stop();
198
- }
199
- }
200
- }, _callee3, this, [[11, 20]]);
201
- }));
202
- function sendSteps(_x, _x2, _x3) {
203
- return _sendSteps.apply(this, arguments);
204
- }
205
- return sendSteps;
206
- }()
207
- /**
208
- * Get steps from version x to latest
209
- */
210
- }, {
211
- key: "getSteps",
212
- value: function () {
213
- var _getSteps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(version) {
214
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
215
- while (1) {
216
- switch (_context4.prev = _context4.next) {
217
- case 0:
218
- _context4.next = 2;
219
- return utils.requestService(this.config, {
220
- path: "document/".concat(this.config.docId, "/steps"),
221
- queryParams: {
222
- version: version
223
- }
224
- });
225
- case 2:
226
- return _context4.abrupt("return", _context4.sent);
227
- case 3:
228
- case "end":
229
- return _context4.stop();
230
- }
231
- }
232
- }, _callee4, this);
233
- }));
234
- function getSteps(_x4) {
235
- return _getSteps.apply(this, arguments);
236
- }
237
- return getSteps;
238
- }()
239
- /**
240
- * Send telepointer
241
- */
242
- }, {
243
- key: "sendTelepointer",
244
- value: function () {
245
- var _sendTelepointer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data) {
246
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
247
- while (1) {
248
- switch (_context5.prev = _context5.next) {
249
- case 0:
250
- logger("Sending telepointer", data);
251
- _context5.next = 3;
252
- return utils.requestService(this.config, {
253
- path: "document/".concat(this.config.docId, "/telepointer"),
254
- requestInit: {
255
- method: 'POST',
256
- headers: {
257
- 'Content-Type': 'application/json'
258
- },
259
- body: JSON.stringify(data)
260
- }
261
- });
262
- case 3:
263
- case "end":
264
- return _context5.stop();
265
- }
266
- }
267
- }, _callee5, this);
268
- }));
269
- function sendTelepointer(_x5) {
270
- return _sendTelepointer.apply(this, arguments);
271
- }
272
- return sendTelepointer;
273
- }()
274
- /**
275
- * Subscribe to events emitted by this channel
276
- */
277
- }, {
278
- key: "on",
279
- value: function on(evt, handler) {
280
- this.eventEmitter.on(evt, handler);
281
- return this;
282
- }
283
-
284
- /**
285
- * Unsubscribe from events emitted by this channel
286
- */
287
- }, {
288
- key: "off",
289
- value: function off(evt, handler) {
290
- this.eventEmitter.off(evt, handler);
291
- return this;
292
- }
293
-
294
- /**
295
- * Emit events to subscribers
296
- */
297
- }, {
298
- key: "emit",
299
- value: function emit(evt, data) {
300
- this.eventEmitter.emit(evt, data);
301
- return this;
302
- }
303
- }]);
304
- return Channel;
305
- }();