@atlaskit/editor-core 172.3.2 → 173.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/cjs/index.js +0 -6
  3. package/dist/cjs/plugins/base/index.js +8 -0
  4. package/dist/cjs/plugins/base/pm-plugins/composition.js +60 -0
  5. package/dist/cjs/plugins/breakout/index.js +5 -4
  6. package/dist/cjs/plugins/breakout/ui/LayoutButton.js +1 -3
  7. package/dist/cjs/plugins/card/pm-plugins/doc.js +8 -1
  8. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +2 -36
  9. package/dist/cjs/plugins/collab-edit/plugin-state.js +16 -9
  10. package/dist/cjs/plugins/collab-edit/utils.js +16 -2
  11. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
  12. package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +20 -15
  13. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
  14. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +3 -3
  15. package/dist/cjs/plugins/paste/actions.js +13 -0
  16. package/dist/cjs/plugins/paste/commands.js +44 -0
  17. package/dist/cjs/plugins/paste/handlers.js +48 -7
  18. package/dist/cjs/plugins/paste/index.js +3 -2
  19. package/dist/cjs/plugins/paste/pm-plugins/main.js +34 -9
  20. package/dist/cjs/plugins/paste/pm-plugins/plugin-factory.js +62 -0
  21. package/dist/cjs/plugins/paste/reducer.js +47 -0
  22. package/dist/cjs/plugins/paste/types.js +5 -0
  23. package/dist/cjs/plugins/placeholder/index.js +3 -1
  24. package/dist/cjs/plugins/placeholder-text/index.js +9 -3
  25. package/dist/cjs/plugins/status/ui/statusPicker.js +4 -1
  26. package/dist/cjs/plugins/table/commands-with-analytics.js +59 -52
  27. package/dist/cjs/plugins/table/index.js +53 -36
  28. package/dist/cjs/plugins/table/toolbar.js +136 -20
  29. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  30. package/dist/cjs/plugins/tasks-and-decisions/commands.js +1 -16
  31. package/dist/cjs/plugins/type-ahead/constants.js +3 -1
  32. package/dist/cjs/plugins/type-ahead/messages.js +16 -1
  33. package/dist/cjs/plugins/type-ahead/pm-plugins/main.js +1 -1
  34. package/dist/cjs/plugins/type-ahead/pm-plugins/reducer.js +2 -2
  35. package/dist/cjs/plugins/type-ahead/ui/AssistiveText.js +143 -0
  36. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +59 -11
  37. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +156 -31
  38. package/dist/cjs/plugins/type-ahead/ui/TypeAheadListItem.js +55 -29
  39. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
  40. package/dist/cjs/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
  41. package/dist/cjs/plugins/type-ahead/utils.js +1 -1
  42. package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +8 -0
  43. package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +2 -6
  44. package/dist/cjs/ui/PortalProvider/index.js +26 -32
  45. package/dist/cjs/utils/index.js +8 -1
  46. package/dist/cjs/utils/selection.js +6 -8
  47. package/dist/cjs/version-wrapper.js +1 -1
  48. package/dist/cjs/version.json +1 -1
  49. package/dist/es2019/index.js +1 -1
  50. package/dist/es2019/plugins/base/index.js +5 -0
  51. package/dist/es2019/plugins/base/pm-plugins/composition.js +45 -0
  52. package/dist/es2019/plugins/breakout/index.js +5 -4
  53. package/dist/es2019/plugins/breakout/ui/LayoutButton.js +1 -3
  54. package/dist/es2019/plugins/card/pm-plugins/doc.js +10 -1
  55. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +3 -40
  56. package/dist/es2019/plugins/collab-edit/plugin-state.js +9 -3
  57. package/dist/es2019/plugins/collab-edit/utils.js +17 -3
  58. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
  59. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +15 -7
  60. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +9 -5
  61. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
  62. package/dist/es2019/plugins/paste/actions.js +6 -0
  63. package/dist/es2019/plugins/paste/commands.js +27 -0
  64. package/dist/es2019/plugins/paste/handlers.js +50 -8
  65. package/dist/es2019/plugins/paste/index.js +3 -2
  66. package/dist/es2019/plugins/paste/pm-plugins/main.js +29 -6
  67. package/dist/es2019/plugins/paste/pm-plugins/plugin-factory.js +33 -0
  68. package/dist/es2019/plugins/paste/reducer.js +24 -0
  69. package/dist/es2019/plugins/paste/types.js +1 -0
  70. package/dist/es2019/plugins/placeholder/index.js +2 -1
  71. package/dist/es2019/plugins/placeholder-text/index.js +13 -3
  72. package/dist/es2019/plugins/status/ui/statusPicker.js +5 -1
  73. package/dist/es2019/plugins/table/commands-with-analytics.js +6 -3
  74. package/dist/es2019/plugins/table/index.js +22 -4
  75. package/dist/es2019/plugins/table/toolbar.js +118 -14
  76. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  77. package/dist/es2019/plugins/tasks-and-decisions/commands.js +0 -9
  78. package/dist/es2019/plugins/type-ahead/constants.js +1 -0
  79. package/dist/es2019/plugins/type-ahead/messages.js +16 -1
  80. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +1 -1
  81. package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +2 -2
  82. package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +95 -0
  83. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +49 -12
  84. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +143 -29
  85. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +64 -31
  86. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
  87. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
  88. package/dist/es2019/plugins/type-ahead/utils.js +1 -1
  89. package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +17 -0
  90. package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
  91. package/dist/es2019/ui/PortalProvider/index.js +5 -8
  92. package/dist/es2019/utils/index.js +6 -0
  93. package/dist/es2019/utils/selection.js +1 -9
  94. package/dist/es2019/version-wrapper.js +1 -1
  95. package/dist/es2019/version.json +1 -1
  96. package/dist/esm/index.js +1 -1
  97. package/dist/esm/plugins/base/index.js +7 -0
  98. package/dist/esm/plugins/base/pm-plugins/composition.js +45 -0
  99. package/dist/esm/plugins/breakout/index.js +5 -4
  100. package/dist/esm/plugins/breakout/ui/LayoutButton.js +1 -3
  101. package/dist/esm/plugins/card/pm-plugins/doc.js +8 -1
  102. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +3 -37
  103. package/dist/esm/plugins/collab-edit/plugin-state.js +9 -3
  104. package/dist/esm/plugins/collab-edit/utils.js +17 -3
  105. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
  106. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +20 -15
  107. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
  108. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
  109. package/dist/esm/plugins/paste/actions.js +6 -0
  110. package/dist/esm/plugins/paste/commands.js +31 -0
  111. package/dist/esm/plugins/paste/handlers.js +46 -8
  112. package/dist/esm/plugins/paste/index.js +3 -2
  113. package/dist/esm/plugins/paste/pm-plugins/main.js +27 -6
  114. package/dist/esm/plugins/paste/pm-plugins/plugin-factory.js +46 -0
  115. package/dist/esm/plugins/paste/reducer.js +34 -0
  116. package/dist/esm/plugins/paste/types.js +1 -0
  117. package/dist/esm/plugins/placeholder/index.js +2 -1
  118. package/dist/esm/plugins/placeholder-text/index.js +9 -3
  119. package/dist/esm/plugins/status/ui/statusPicker.js +4 -1
  120. package/dist/esm/plugins/table/commands-with-analytics.js +56 -49
  121. package/dist/esm/plugins/table/index.js +54 -37
  122. package/dist/esm/plugins/table/toolbar.js +124 -15
  123. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  124. package/dist/esm/plugins/tasks-and-decisions/commands.js +0 -12
  125. package/dist/esm/plugins/type-ahead/constants.js +1 -0
  126. package/dist/esm/plugins/type-ahead/messages.js +16 -1
  127. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +1 -1
  128. package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +2 -2
  129. package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +129 -0
  130. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +56 -12
  131. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +151 -32
  132. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +54 -31
  133. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
  134. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
  135. package/dist/esm/plugins/type-ahead/utils.js +1 -1
  136. package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +7 -0
  137. package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
  138. package/dist/esm/ui/PortalProvider/index.js +26 -35
  139. package/dist/esm/utils/index.js +4 -0
  140. package/dist/esm/utils/selection.js +1 -7
  141. package/dist/esm/version-wrapper.js +1 -1
  142. package/dist/esm/version.json +1 -1
  143. package/dist/types/index.d.ts +1 -1
  144. package/dist/types/plugins/base/pm-plugins/composition.d.ts +8 -0
  145. package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
  146. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
  147. package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
  148. package/dist/types/plugins/paste/actions.d.ts +15 -0
  149. package/dist/types/plugins/paste/commands.d.ts +16 -0
  150. package/dist/types/plugins/paste/handlers.d.ts +1 -1
  151. package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -3
  152. package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
  153. package/dist/types/plugins/paste/reducer.d.ts +3 -0
  154. package/dist/types/plugins/paste/types.d.ts +6 -0
  155. package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
  156. package/dist/types/plugins/tasks-and-decisions/commands.d.ts +0 -2
  157. package/dist/types/plugins/type-ahead/constants.d.ts +1 -0
  158. package/dist/types/plugins/type-ahead/messages.d.ts +15 -0
  159. package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
  160. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
  161. package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
  162. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
  163. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
  164. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  165. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  166. package/dist/types/utils/index.d.ts +1 -0
  167. package/dist/types/utils/selection.d.ts +1 -2
  168. package/dist/types-ts4.0/index.d.ts +1 -1
  169. package/dist/types-ts4.0/plugins/base/pm-plugins/composition.d.ts +8 -0
  170. package/dist/types-ts4.0/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
  171. package/dist/types-ts4.0/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
  172. package/dist/types-ts4.0/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
  173. package/dist/types-ts4.0/plugins/paste/actions.d.ts +15 -0
  174. package/dist/types-ts4.0/plugins/paste/commands.d.ts +16 -0
  175. package/dist/types-ts4.0/plugins/paste/handlers.d.ts +1 -1
  176. package/dist/types-ts4.0/plugins/paste/pm-plugins/main.d.ts +3 -3
  177. package/dist/types-ts4.0/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
  178. package/dist/types-ts4.0/plugins/paste/reducer.d.ts +3 -0
  179. package/dist/types-ts4.0/plugins/paste/types.d.ts +6 -0
  180. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
  181. package/dist/types-ts4.0/plugins/tasks-and-decisions/commands.d.ts +0 -2
  182. package/dist/types-ts4.0/plugins/type-ahead/constants.d.ts +1 -0
  183. package/dist/types-ts4.0/plugins/type-ahead/messages.d.ts +15 -0
  184. package/dist/types-ts4.0/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
  185. package/dist/types-ts4.0/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
  186. package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
  187. package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
  188. package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
  189. package/dist/types-ts4.0/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  190. package/dist/types-ts4.0/ui/ContentStyles/index.d.ts +2 -2
  191. package/dist/types-ts4.0/utils/index.d.ts +1 -0
  192. package/dist/types-ts4.0/utils/selection.d.ts +1 -2
  193. package/package.json +30 -31
  194. package/report.api.md +161 -49
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Selection } from 'prosemirror-state';
3
3
  import { DecorationSet } from 'prosemirror-view';
4
4
  import { ReplaceStep } from 'prosemirror-transform';
5
+ import { browser } from '@atlaskit/editor-common/utils';
5
6
  import { Participants } from './participants';
6
7
  import { findPointers, createTelepointers, getPositionOfTelepointer } from './utils';
7
8
 
@@ -142,7 +143,7 @@ export class PluginState {
142
143
  this.decorationSet = this.decorationSet.map(tr.mapping, tr.doc, {
143
144
  // Reapplies decorators those got removed by the state change
144
145
  onRemove: spec => {
145
- if (spec.pointer && spec.pointer.sessionId) {
146
+ if (spec.pointer && spec.pointer.sessionId && spec.key === `telepointer-${spec.pointer.sessionId}`) {
146
147
  const step = tr.steps.filter(isReplaceStep)[0];
147
148
 
148
149
  if (step) {
@@ -194,9 +195,14 @@ export class PluginState {
194
195
  if (deco.from === selection.from && deco.to === selection.to) {
195
196
  if (!hasTelepointerDimClass) {
196
197
  deco.type.toDOM.classList.add(TELEPOINTER_DIM_CLASS);
197
- }
198
+ } // Browser condition here to fix ED-14722 where telepointer
199
+ // decorations with side -1 in Firefox causes backspace issues.
200
+ // This is likely caused by contenteditable quirks in Firefox
201
+
198
202
 
199
- deco.type.side = -1;
203
+ if (!browser.gecko) {
204
+ deco.type.side = -1;
205
+ }
200
206
  } else {
201
207
  if (hasTelepointerDimClass) {
202
208
  deco.type.toDOM.classList.remove(TELEPOINTER_DIM_CLASS);
@@ -3,7 +3,7 @@ import { Selection, TextSelection } from 'prosemirror-state';
3
3
  import { Decoration } from 'prosemirror-view';
4
4
  import * as themeColors from '@atlaskit/theme/colors';
5
5
  import { hexToRgba } from '@atlaskit/adf-schema';
6
- import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
6
+ import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
7
7
  import { addAnalytics } from '../analytics/utils';
8
8
  import { EVENT_TYPE, ACTION, ACTION_SUBJECT } from '../analytics/types';
9
9
  export const colors = [themeColors.R100, themeColors.R300, themeColors.R500, themeColors.Y100, themeColors.Y300, themeColors.Y500, themeColors.G100, themeColors.G300, themeColors.G500, themeColors.T100, themeColors.T300, themeColors.T500, themeColors.B100, themeColors.B300, themeColors.B500, themeColors.P100, themeColors.P300, themeColors.P500, themeColors.N70, themeColors.N200, themeColors.N800].map(solid => ({
@@ -50,18 +50,32 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial) =>
50
50
  }));
51
51
  }
52
52
 
53
+ const spaceJoinerBefore = document.createElement('span');
54
+ spaceJoinerBefore.textContent = ZERO_WIDTH_JOINER;
55
+ const spaceJoinerAfter = document.createElement('span');
56
+ spaceJoinerAfter.textContent = ZERO_WIDTH_JOINER;
53
57
  const cursor = document.createElement('span');
54
- cursor.textContent = ZERO_WIDTH_SPACE;
58
+ cursor.textContent = ZERO_WIDTH_JOINER;
55
59
  cursor.className = `telepointer color-${color} telepointer-selection-badge`;
56
60
  cursor.style.cssText = `${style({
57
61
  color: avatarColor.color.solid
58
62
  })};`;
59
63
  cursor.setAttribute('data-initial', initial);
60
- return decorations.concat(Decoration.widget(to, cursor, {
64
+ return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
65
+ pointer: {
66
+ sessionId
67
+ },
68
+ key: `telepointer-${sessionId}-zero`
69
+ })).concat(Decoration.widget(to, cursor, {
61
70
  pointer: {
62
71
  sessionId
63
72
  },
64
73
  key: `telepointer-${sessionId}`
74
+ })).concat(Decoration.widget(to, spaceJoinerBefore, {
75
+ pointer: {
76
+ sessionId
77
+ },
78
+ key: `telepointer-${sessionId}-zero`
65
79
  }));
66
80
  };
67
81
  export const replaceDocument = (doc, state, version, options, reserveCursor) => {
@@ -26,9 +26,10 @@ function getSpellCheck(featureFlags) {
26
26
 
27
27
 
28
28
  export function createFeatureFlagsFromProps(props) {
29
- var _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags, _props$featureFlags2, _props$allowTables, _props$featureFlags3, _props$featureFlags4, _props$allowTables2, _props$featureFlags5, _props$featureFlags6, _props$allowTables3, _props$featureFlags7, _props$featureFlags8, _props$allowTables4, _props$allowTables5, _props$featureFlags9, _props$featureFlags10, _props$allowTables6, _props$allowExtension, _props$featureFlags11, _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$collabEdit, _props$collabEdit2, _props$featureFlags31, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39;
29
+ var _props$featureFlags, _props$allowTextColor, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _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$allowTables5, _props$featureFlags10, _props$featureFlags11, _props$allowTables6, _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, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40;
30
30
 
31
31
  const normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
32
+ const tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
32
33
  return { ...normalizedFeatureFlags,
33
34
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
34
35
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
@@ -42,29 +43,30 @@ export function createFeatureFlagsFromProps(props) {
42
43
  singleLayout: typeof props.allowLayouts === 'object' && !!((_props$allowLayouts = props.allowLayouts) !== null && _props$allowLayouts !== void 0 && _props$allowLayouts.UNSAFE_allowSingleColumnLayout),
43
44
  undoRedoButtons: props.UNSAFE_allowUndoRedoButtons,
44
45
  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,
45
- stickyHeadersOptimization: typeof ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags2 = props.featureFlags) !== null && _props$featureFlags2 !== void 0 && _props$featureFlags2.stickyHeadersOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
46
- initialRenderOptimization: typeof ((_props$featureFlags3 = props.featureFlags) === null || _props$featureFlags3 === void 0 ? void 0 : _props$featureFlags3.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.initialRenderOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
47
- mouseMoveOptimization: typeof ((_props$featureFlags5 = props.featureFlags) === null || _props$featureFlags5 === void 0 ? void 0 : _props$featureFlags5.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags6 = props.featureFlags) !== null && _props$featureFlags6 !== void 0 && _props$featureFlags6.mouseMoveOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
48
- tableRenderOptimization: typeof ((_props$featureFlags7 = props.featureFlags) === null || _props$featureFlags7 === void 0 ? void 0 : _props$featureFlags7.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags8 = props.featureFlags) !== null && _props$featureFlags8 !== void 0 && _props$featureFlags8.tableRenderOptimization) : typeof props.allowTables === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
49
- tableOverflowShadowsOptimization: typeof ((_props$featureFlags9 = props.featureFlags) === null || _props$featureFlags9 === void 0 ? void 0 : _props$featureFlags9.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags10 = props.featureFlags) !== null && _props$featureFlags10 !== void 0 && _props$featureFlags10.tableOverflowShadowsOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
46
+ stickyHeadersOptimization: typeof ((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.stickyHeadersOptimization) === 'boolean' ? !!((_props$featureFlags3 = props.featureFlags) !== null && _props$featureFlags3 !== void 0 && _props$featureFlags3.stickyHeadersOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables = props.allowTables) !== null && _props$allowTables !== void 0 && _props$allowTables.stickyHeadersOptimization),
47
+ initialRenderOptimization: typeof ((_props$featureFlags4 = props.featureFlags) === null || _props$featureFlags4 === void 0 ? void 0 : _props$featureFlags4.initialRenderOptimization) === 'boolean' ? !!((_props$featureFlags5 = props.featureFlags) !== null && _props$featureFlags5 !== void 0 && _props$featureFlags5.initialRenderOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables2 = props.allowTables) !== null && _props$allowTables2 !== void 0 && _props$allowTables2.initialRenderOptimization),
48
+ mouseMoveOptimization: typeof ((_props$featureFlags6 = props.featureFlags) === null || _props$featureFlags6 === void 0 ? void 0 : _props$featureFlags6.mouseMoveOptimization) === 'boolean' ? !!((_props$featureFlags7 = props.featureFlags) !== null && _props$featureFlags7 !== void 0 && _props$featureFlags7.mouseMoveOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables3 = props.allowTables) !== null && _props$allowTables3 !== void 0 && _props$allowTables3.mouseMoveOptimization),
49
+ tableRenderOptimization: typeof ((_props$featureFlags8 = props.featureFlags) === null || _props$featureFlags8 === void 0 ? void 0 : _props$featureFlags8.tableRenderOptimization) === 'boolean' ? !!((_props$featureFlags9 = props.featureFlags) !== null && _props$featureFlags9 !== void 0 && _props$featureFlags9.tableRenderOptimization) : typeof props.allowTables === 'object' && typeof ((_props$allowTables4 = props.allowTables) === null || _props$allowTables4 === void 0 ? void 0 : _props$allowTables4.tableRenderOptimization) === 'boolean' ? (_props$allowTables5 = props.allowTables) === null || _props$allowTables5 === void 0 ? void 0 : _props$allowTables5.tableRenderOptimization : true,
50
+ tableOverflowShadowsOptimization: typeof ((_props$featureFlags10 = props.featureFlags) === null || _props$featureFlags10 === void 0 ? void 0 : _props$featureFlags10.tableOverflowShadowsOptimization) === 'boolean' ? !!((_props$featureFlags11 = props.featureFlags) !== null && _props$featureFlags11 !== void 0 && _props$featureFlags11.tableOverflowShadowsOptimization) : typeof props.allowTables === 'object' && !!((_props$allowTables6 = props.allowTables) !== null && _props$allowTables6 !== void 0 && _props$allowTables6.tableOverflowShadowsOptimization),
50
51
  extendFloatingToolbar: Boolean(typeof props.allowExtension === 'object' && ((_props$allowExtension = props.allowExtension) === null || _props$allowExtension === void 0 ? void 0 : _props$allowExtension.allowExtendFloatingToolbars)),
51
- useUnpredictableInputRule: Boolean(typeof ((_props$featureFlags11 = props.featureFlags) === null || _props$featureFlags11 === void 0 ? void 0 : _props$featureFlags11.useUnpredictableInputRule) === 'boolean' ? !!((_props$featureFlags12 = props.featureFlags) !== null && _props$featureFlags12 !== void 0 && _props$featureFlags12.useUnpredictableInputRule) : props.UNSAFE_allowUndoRedoButtons ? false : true),
52
- showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags13 = props.featureFlags) === null || _props$featureFlags13 === void 0 ? void 0 : _props$featureFlags13.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags14 = props.featureFlags) !== null && _props$featureFlags14 !== void 0 && _props$featureFlags14.showAvatarGroupAsPlugin) : false),
53
- errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags15 = props.featureFlags) === null || _props$featureFlags15 === void 0 ? void 0 : _props$featureFlags15.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags16 = props.featureFlags) !== null && _props$featureFlags16 !== void 0 && _props$featureFlags16.useErrorBoundaryDocStructure) : false),
54
- synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags17 = props.featureFlags) === null || _props$featureFlags17 === void 0 ? void 0 : _props$featureFlags17.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags18 = props.featureFlags) !== null && _props$featureFlags18 !== void 0 && _props$featureFlags18.synchronyErrorDocStructure) : false),
55
- enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags19 = props.featureFlags) === null || _props$featureFlags19 === void 0 ? void 0 : _props$featureFlags19.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags20 = props.featureFlags) !== null && _props$featureFlags20 !== void 0 && _props$featureFlags20.enableViewUpdateSubscription) : false),
56
- plainTextPasteLinkification: Boolean(typeof ((_props$featureFlags21 = props.featureFlags) === null || _props$featureFlags21 === void 0 ? void 0 : _props$featureFlags21.plainTextPasteLinkification) === 'boolean' ? !!((_props$featureFlags22 = props.featureFlags) !== null && _props$featureFlags22 !== void 0 && _props$featureFlags22.plainTextPasteLinkification) : false),
57
- collabAvatarScroll: Boolean(typeof ((_props$featureFlags23 = props.featureFlags) === null || _props$featureFlags23 === void 0 ? void 0 : _props$featureFlags23.collabAvatarScroll) === 'boolean' ? !!((_props$featureFlags24 = props.featureFlags) !== null && _props$featureFlags24 !== void 0 && _props$featureFlags24.collabAvatarScroll) : false),
58
- ufo: Boolean(typeof ((_props$featureFlags25 = props.featureFlags) === null || _props$featureFlags25 === void 0 ? void 0 : _props$featureFlags25.ufo) === 'boolean' ? !!((_props$featureFlags26 = props.featureFlags) !== null && _props$featureFlags26 !== void 0 && _props$featureFlags26.ufo) : false),
59
- twoLineEditorToolbar: Boolean(typeof ((_props$featureFlags27 = props.featureFlags) === null || _props$featureFlags27 === void 0 ? void 0 : _props$featureFlags27.twoLineEditorToolbar) === 'boolean' ? !!((_props$featureFlags28 = props.featureFlags) !== null && _props$featureFlags28 !== void 0 && _props$featureFlags28.twoLineEditorToolbar) : false),
60
- saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags29 = props.featureFlags) === null || _props$featureFlags29 === void 0 ? void 0 : _props$featureFlags29.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags30 = props.featureFlags) !== null && _props$featureFlags30 !== void 0 && _props$featureFlags30.saferDispatchedTransactions) : false)),
52
+ useUnpredictableInputRule: Boolean(typeof ((_props$featureFlags12 = props.featureFlags) === null || _props$featureFlags12 === void 0 ? void 0 : _props$featureFlags12.useUnpredictableInputRule) === 'boolean' ? !!((_props$featureFlags13 = props.featureFlags) !== null && _props$featureFlags13 !== void 0 && _props$featureFlags13.useUnpredictableInputRule) : props.UNSAFE_allowUndoRedoButtons ? false : true),
53
+ showAvatarGroupAsPlugin: Boolean(typeof ((_props$featureFlags14 = props.featureFlags) === null || _props$featureFlags14 === void 0 ? void 0 : _props$featureFlags14.showAvatarGroupAsPlugin) === 'boolean' ? !!((_props$featureFlags15 = props.featureFlags) !== null && _props$featureFlags15 !== void 0 && _props$featureFlags15.showAvatarGroupAsPlugin) : false),
54
+ errorBoundaryDocStructure: Boolean(typeof ((_props$featureFlags16 = props.featureFlags) === null || _props$featureFlags16 === void 0 ? void 0 : _props$featureFlags16.useErrorBoundaryDocStructure) === 'boolean' ? !!((_props$featureFlags17 = props.featureFlags) !== null && _props$featureFlags17 !== void 0 && _props$featureFlags17.useErrorBoundaryDocStructure) : false),
55
+ synchronyErrorDocStructure: Boolean(typeof ((_props$featureFlags18 = props.featureFlags) === null || _props$featureFlags18 === void 0 ? void 0 : _props$featureFlags18.synchronyErrorDocStructure) === 'boolean' ? !!((_props$featureFlags19 = props.featureFlags) !== null && _props$featureFlags19 !== void 0 && _props$featureFlags19.synchronyErrorDocStructure) : false),
56
+ enableViewUpdateSubscription: Boolean(typeof ((_props$featureFlags20 = props.featureFlags) === null || _props$featureFlags20 === void 0 ? void 0 : _props$featureFlags20.enableViewUpdateSubscription) === 'boolean' ? !!((_props$featureFlags21 = props.featureFlags) !== null && _props$featureFlags21 !== void 0 && _props$featureFlags21.enableViewUpdateSubscription) : false),
57
+ plainTextPasteLinkification: Boolean(typeof ((_props$featureFlags22 = props.featureFlags) === null || _props$featureFlags22 === void 0 ? void 0 : _props$featureFlags22.plainTextPasteLinkification) === 'boolean' ? !!((_props$featureFlags23 = props.featureFlags) !== null && _props$featureFlags23 !== void 0 && _props$featureFlags23.plainTextPasteLinkification) : false),
58
+ 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),
59
+ 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),
60
+ 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),
61
+ saferDispatchedTransactions: Boolean(typeof normalizedFeatureFlags.saferDispatchedTransactions === 'boolean' && !!normalizedFeatureFlags.saferDispatchedTransactions || (typeof ((_props$featureFlags30 = props.featureFlags) === null || _props$featureFlags30 === void 0 ? void 0 : _props$featureFlags30.saferDispatchedTransactions) === 'boolean' ? !!((_props$featureFlags31 = props.featureFlags) !== null && _props$featureFlags31 !== void 0 && _props$featureFlags31.saferDispatchedTransactions) : false)),
61
62
  useNativeCollabPlugin: Boolean(typeof ((_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.useNativePlugin) === 'boolean' ? !!((_props$collabEdit2 = props.collabEdit) !== null && _props$collabEdit2 !== void 0 && _props$collabEdit2.useNativePlugin) : false),
62
- chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags31 = props.featureFlags) === null || _props$featureFlags31 === void 0 ? void 0 : _props$featureFlags31.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
63
- viewChangingExperimentToolbarStyle: typeof ((_props$featureFlags32 = props.featureFlags) === null || _props$featureFlags32 === void 0 ? void 0 : _props$featureFlags32['view-changing-experiment-toolbar-style']) === 'string' ? props.featureFlags['view-changing-experiment-toolbar-style'] || undefined : undefined,
64
- showHoverPreview: Boolean(typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33.showHoverPreview) === 'boolean' ? !!((_props$featureFlags34 = props.featureFlags) !== null && _props$featureFlags34 !== void 0 && _props$featureFlags34.showHoverPreview) : false),
65
- indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags35 = props.featureFlags) === null || _props$featureFlags35 === void 0 ? void 0 : _props$featureFlags35.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags36 = props.featureFlags) !== null && _props$featureFlags36 !== void 0 && _props$featureFlags36.indentationButtonsInTheToolbar) : false)),
66
- floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags37 = props.featureFlags) === null || _props$featureFlags37 === void 0 ? void 0 : _props$featureFlags37.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags38 = props.featureFlags) !== null && _props$featureFlags38 !== void 0 && _props$featureFlags38.floatingToolbarCopyButton) : false)),
67
- floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags39 = props.featureFlags) === null || _props$featureFlags39 === void 0 ? void 0 : _props$featureFlags39['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
63
+ chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags32 = props.featureFlags) === null || _props$featureFlags32 === void 0 ? void 0 : _props$featureFlags32.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
64
+ viewChangingExperimentToolbarStyle: typeof ((_props$featureFlags33 = props.featureFlags) === null || _props$featureFlags33 === void 0 ? void 0 : _props$featureFlags33['view-changing-experiment-toolbar-style']) === 'string' ? props.featureFlags['view-changing-experiment-toolbar-style'] || undefined : undefined,
65
+ tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
66
+ showHoverPreview: Boolean(typeof ((_props$featureFlags34 = props.featureFlags) === null || _props$featureFlags34 === void 0 ? void 0 : _props$featureFlags34.showHoverPreview) === 'boolean' ? !!((_props$featureFlags35 = props.featureFlags) !== null && _props$featureFlags35 !== void 0 && _props$featureFlags35.showHoverPreview) : false),
67
+ indentationButtonsInTheToolbar: Boolean(typeof normalizedFeatureFlags.indentationButtonsInTheToolbar === 'boolean' && !!normalizedFeatureFlags.indentationButtonsInTheToolbar || (typeof ((_props$featureFlags36 = props.featureFlags) === null || _props$featureFlags36 === void 0 ? void 0 : _props$featureFlags36.indentationButtonsInTheToolbar) === 'boolean' ? !!((_props$featureFlags37 = props.featureFlags) !== null && _props$featureFlags37 !== void 0 && _props$featureFlags37.indentationButtonsInTheToolbar) : false)),
68
+ floatingToolbarCopyButton: Boolean(typeof normalizedFeatureFlags.floatingToolbarCopyButton === 'boolean' && !!normalizedFeatureFlags.floatingToolbarCopyButton || (typeof ((_props$featureFlags38 = props.featureFlags) === null || _props$featureFlags38 === void 0 ? void 0 : _props$featureFlags38.floatingToolbarCopyButton) === 'boolean' ? !!((_props$featureFlags39 = props.featureFlags) !== null && _props$featureFlags39 !== void 0 && _props$featureFlags39.floatingToolbarCopyButton) : false)),
69
+ floatingToolbarLinkSettingsButton: typeof ((_props$featureFlags40 = props.featureFlags) === null || _props$featureFlags40 === void 0 ? void 0 : _props$featureFlags40['floating-toolbar-link-settings-button']) === 'string' ? props.featureFlags['floating-toolbar-link-settings-button'] || undefined : undefined,
68
70
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags)
69
71
  };
70
72
  }
@@ -32,11 +32,18 @@ export default class Dropdown extends Component {
32
32
  isOpen: false
33
33
  });
34
34
 
35
- _defineProperty(this, "renderArrayOptions", options => jsx(DropdownMenu, {
36
- hide: this.hide,
37
- dispatchCommand: this.props.dispatchCommand,
38
- items: options
39
- }));
35
+ _defineProperty(this, "renderArrayOptions", options => {
36
+ const {
37
+ showSelected,
38
+ dispatchCommand
39
+ } = this.props;
40
+ return jsx(DropdownMenu, {
41
+ hide: this.hide,
42
+ dispatchCommand: dispatchCommand,
43
+ items: options,
44
+ showSelected: showSelected
45
+ });
46
+ });
40
47
 
41
48
  _defineProperty(this, "toggleOpen", () => {
42
49
  this.setState({
@@ -66,7 +73,8 @@ export default class Dropdown extends Component {
66
73
  hideExpandIcon,
67
74
  disabled,
68
75
  tooltip,
69
- buttonTestId
76
+ buttonTestId,
77
+ dropdownWidth
70
78
  } = this.props;
71
79
  let trigger;
72
80
 
@@ -104,7 +112,7 @@ export default class Dropdown extends Component {
104
112
 
105
113
 
106
114
  const fitTolerance = 10;
107
- const fitWidth = Array.isArray(options) ? menuItemDimensions.width : options.width;
115
+ const fitWidth = Array.isArray(options) ? dropdownWidth || menuItemDimensions.width : options.width;
108
116
  const fitHeight = Array.isArray(options) ? options.length * menuItemDimensions.height + itemSpacing * 2 : options.height;
109
117
  return jsx(UiDropdown, {
110
118
  mountTo: mountPoint,
@@ -47,6 +47,7 @@ class Dropdown extends Component {
47
47
  const itemContent = jsx(ButtonItem, {
48
48
  key: idx,
49
49
  iconBefore: this.renderSelected(item, intl),
50
+ iconAfter: item.elemAfter,
50
51
  onClick: () => {
51
52
  /**
52
53
  * The order of dispatching the event and hide() is important, because
@@ -76,21 +77,24 @@ class Dropdown extends Component {
76
77
  }
77
78
 
78
79
  renderSelected(item, intl) {
80
+ const {
81
+ showSelected = true
82
+ } = this.props;
79
83
  const {
80
84
  selected
81
85
  } = item;
82
86
 
83
- if (selected !== undefined) {
84
- return selected ? jsx(EditorDoneIcon, {
87
+ if (showSelected && selected) {
88
+ return jsx(EditorDoneIcon, {
85
89
  primaryColor: token('color.icon.selected', B400),
86
90
  size: "small",
87
91
  label: intl.formatMessage(messages.confirmModalOK)
88
- }) : jsx("span", {
89
- css: spacer
90
92
  });
91
93
  }
92
94
 
93
- return;
95
+ return jsx("span", {
96
+ css: spacer
97
+ });
94
98
  }
95
99
 
96
100
  }
@@ -88,8 +88,6 @@ export const isSameItem = (leftItem, rightItem) => {
88
88
  case 'extensions-placeholder':
89
89
  return compareItemWithKeys(leftItem, rightItem);
90
90
  }
91
-
92
- return true;
93
91
  };
94
92
  export const areSameItems = (leftArr, rightArr) => {
95
93
  if (leftArr === undefined && rightArr === undefined) {
@@ -245,7 +243,9 @@ class Toolbar extends Component {
245
243
  hideExpandIcon: item.hideExpandIcon,
246
244
  mountPoint: popupsMountPoint,
247
245
  boundariesElement: popupsBoundariesElement,
248
- scrollableElement: popupsScrollableElement
246
+ scrollableElement: popupsScrollableElement,
247
+ dropdownWidth: item.dropdownWidth,
248
+ showSelected: item.showSelected
249
249
  });
250
250
 
251
251
  case 'select':
@@ -0,0 +1,6 @@
1
+ export let PastePluginActionTypes;
2
+
3
+ (function (PastePluginActionTypes) {
4
+ PastePluginActionTypes["START_TRACKING_PASTED_MACRO_POSITIONS"] = "START_TRACKING_PASTED_MACRO_POSITIONS";
5
+ PastePluginActionTypes["STOP_TRACKING_PASTED_MACRO_POSITIONS"] = "STOP_TRACKING_PASTED_MACRO_POSITIONS";
6
+ })(PastePluginActionTypes || (PastePluginActionTypes = {}));
@@ -0,0 +1,27 @@
1
+ import { createCommand } from './pm-plugins/plugin-factory';
2
+ import { PastePluginActionTypes as ActionTypes } from './actions';
3
+ /**
4
+ * Use this to register macro link positions during a paste operation, that you
5
+ * want to track in a document over time, through any document changes.
6
+ *
7
+ * @param positions a map of string keys (custom position references) and position values e.g. { ['my-key-1']: 11 }
8
+ *
9
+ * **Context**: This is neccessary if there is an async process or an unknown period of time
10
+ * between obtaining an original position, and wanting to know about what its final eventual
11
+ * value. In that scenario, positions will need to be actively tracked and mapped in plugin
12
+ * state so that they can be mapped through any other independent document change transactions being
13
+ * dispatched to the editor that could affect their value.
14
+ */
15
+
16
+ export const startTrackingPastedMacroPositions = pastedMacroPositions => createCommand(() => {
17
+ return {
18
+ type: ActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS,
19
+ pastedMacroPositions
20
+ };
21
+ });
22
+ export const stopTrackingPastedMacroPositions = pastedMacroPositionKeys => createCommand(() => {
23
+ return {
24
+ type: ActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS,
25
+ pastedMacroPositionKeys
26
+ };
27
+ });
@@ -2,6 +2,7 @@ import { closeHistory } from 'prosemirror-history';
2
2
  import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
3
3
  import { TextSelection, NodeSelection } from 'prosemirror-state';
4
4
  import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
5
+ import uuid from 'uuid/v4';
5
6
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
6
7
  import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell } from '../../utils';
7
8
  import { mapSlice } from '../../utils/slice';
@@ -15,7 +16,9 @@ import { pluginKey as textFormattingPluginKey } from '../text-formatting/pm-plug
15
16
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
16
17
  import { isListNode, isListItemNode } from '../list/utils/node';
17
18
  import { canLinkBeCreatedInRange } from '../hyperlink/pm-plugins/main';
18
- import { insertSliceForLists } from './edge-cases'; // remove text attribute from mention for copy/paste (GDPR)
19
+ import { insertSliceForLists } from './edge-cases';
20
+ import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
21
+ import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory'; // remove text attribute from mention for copy/paste (GDPR)
19
22
 
20
23
  export function handleMention(slice, schema) {
21
24
  return mapSlice(slice, node => {
@@ -297,12 +300,21 @@ async function getSmartLinkAdf(text, type, cardOptions) {
297
300
  return await provider.resolve(text, type);
298
301
  }
299
302
 
300
- function insertAutoMacro(slice, macro, view) {
303
+ function insertAutoMacro(slice, macro, view, from, to) {
301
304
  if (view) {
302
305
  // insert the text or linkified/md-converted clipboard data
303
306
  const selection = view.state.tr.selection;
304
- const tr = view.state.tr.replaceSelection(slice);
305
- const before = tr.mapping.map(selection.from, -1);
307
+ let tr;
308
+ let before;
309
+
310
+ if (typeof from === 'number' && typeof to === 'number') {
311
+ tr = view.state.tr.replaceRange(from, to, slice);
312
+ before = tr.mapping.map(from, -1);
313
+ } else {
314
+ tr = view.state.tr.replaceSelection(slice);
315
+ before = tr.mapping.map(selection.from, -1);
316
+ }
317
+
306
318
  view.dispatch(tr); // replace the text with the macro as a separate transaction
307
319
  // so the autoconversion generates 2 undo steps
308
320
 
@@ -339,11 +351,35 @@ export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoC
339
351
  return insertAutoMacro(slice, macro, view);
340
352
  }
341
353
 
354
+ if (!view) {
355
+ throw new Error('View is missing');
356
+ }
357
+
358
+ const trackingId = uuid();
359
+ const trackingFrom = `handleMacroAutoConvert-from-${trackingId}`;
360
+ const trackingTo = `handleMacroAutoConvert-to-${trackingId}`;
361
+ startTrackingPastedMacroPositions({
362
+ [trackingFrom]: state.selection.from,
363
+ [trackingTo]: state.selection.to
364
+ })(state, dispatch);
342
365
  getSmartLinkAdf(text, 'inline', cardsOptions).then(() => {
366
+ // we use view.state rather than state because state becomes a stale
367
+ // state reference after getSmartLinkAdf's async work
368
+ const {
369
+ pastedMacroPositions
370
+ } = getPastePluginState(view.state);
371
+
343
372
  if (dispatch) {
344
- handleMarkdown(slice)(state, dispatch);
373
+ handleMarkdown(slice, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
345
374
  }
346
- }).catch(() => insertAutoMacro(slice, macro, view));
375
+ }).catch(() => {
376
+ const {
377
+ pastedMacroPositions
378
+ } = getPastePluginState(view.state);
379
+ insertAutoMacro(slice, macro, view, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo]);
380
+ }).finally(() => {
381
+ stopTrackingPastedMacroPositions([trackingFrom, trackingTo])(view.state, dispatch);
382
+ });
347
383
  return true;
348
384
  }
349
385
 
@@ -471,10 +507,16 @@ export function handleExpandPasteInTable(slice) {
471
507
  return false;
472
508
  };
473
509
  }
474
- export function handleMarkdown(markdownSlice) {
510
+ export function handleMarkdown(markdownSlice, from, to) {
475
511
  return (state, dispatch) => {
476
512
  const tr = closeHistory(state.tr);
477
- tr.replaceSelection(markdownSlice);
513
+
514
+ if (typeof from === 'number' && typeof to === 'number') {
515
+ tr.replaceRange(from, to, markdownSlice);
516
+ } else {
517
+ tr.replaceSelection(markdownSlice);
518
+ }
519
+
478
520
  queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
479
521
 
480
522
  if (dispatch) {
@@ -13,8 +13,9 @@ const pastePlugin = ({
13
13
  plugin: ({
14
14
  schema,
15
15
  providerFactory,
16
- dispatchAnalyticsEvent
17
- }) => createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory)
16
+ dispatchAnalyticsEvent,
17
+ dispatch
18
+ }) => createPlugin(schema, dispatchAnalyticsEvent, dispatch, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory)
18
19
  }];
19
20
  }
20
21
 
@@ -1,8 +1,8 @@
1
1
  import { Slice, Fragment } from 'prosemirror-model';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
- import { PluginKey } from 'prosemirror-state';
4
3
  import uuid from 'uuid';
5
4
  import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
5
+ import { mapChildren } from '../../../utils/slice';
6
6
  import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
7
7
  sendPasteAnalyticsEvent;
8
8
  import * as clipboard from '../../../utils/clipboard';
@@ -14,7 +14,7 @@ import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from
14
14
  import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
15
15
  import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelIntoListWithAnalytics } from './analytics';
16
16
  import { analyticsPluginKey, PasteTypes } from '../../analytics';
17
- import { insideTable, measurements } from '../../../utils';
17
+ import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
18
18
  import { measureRender } from '@atlaskit/editor-common/utils';
19
19
  import { transformSliceToCorrectMediaWrapper, unwrapNestedMediaElements } from '../../media/utils/media-common';
20
20
  import { upgradeTextToLists, splitParagraphs } from '../../list/transforms';
@@ -27,16 +27,17 @@ import { clipboardTextSerializer } from './clipboard-text-serializer';
27
27
  import { htmlHasIncompleteTable, tryRebuildCompleteTableHtml, isPastedFromTinyMCEConfluence } from '../util/tinyMCE';
28
28
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
29
29
  import { extractSliceFromStep } from '../../../utils/step';
30
- export const stateKey = new PluginKey('pastePlugin');
30
+ import { pluginKey as stateKey, createPluginState } from './plugin-factory';
31
+ export { pluginKey as stateKey } from './plugin-factory';
31
32
  export { md } from '../md';
32
- export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory) {
33
+ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory) {
33
34
  const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
34
35
 
35
36
  function getMarkdownSlice(text, openStart, openEnd) {
36
37
  let textInput = text;
37
38
 
38
- if (textInput.includes(':\\\\')) {
39
- textInput = textInput.replace(/:\\\\/g, ':\\\\\\\\');
39
+ if (textInput.includes('\\')) {
40
+ textInput = textInput.replace(/\\/g, '\\\\');
40
41
  }
41
42
 
42
43
  const doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
@@ -71,6 +72,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
71
72
  let pastedFromBitBucket = false;
72
73
  return new SafePlugin({
73
74
  key: stateKey,
75
+ state: createPluginState(dispatch, {
76
+ pastedMacroPositions: {}
77
+ }),
74
78
  props: {
75
79
  // For serialising to plain text
76
80
  clipboardTextSerializer,
@@ -269,6 +273,25 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
269
273
  }
270
274
 
271
275
  return handleMarkdownWithAnalytics(view, event, markdownSlice)(state, dispatch);
276
+ }
277
+
278
+ if (isRichText && isInsideBlockQuote(state)) {
279
+ //If pasting inside blockquote
280
+ //Skip the blockquote node and keep remaining nodes as they are
281
+ const {
282
+ blockquote
283
+ } = schema.nodes;
284
+ const children = [];
285
+ mapChildren(slice.content, node => {
286
+ if (node.type === blockquote) {
287
+ for (let i = 0; i < node.childCount; i++) {
288
+ children.push(node.child(i));
289
+ }
290
+ } else {
291
+ children.push(node);
292
+ }
293
+ });
294
+ slice = new Slice(Fragment.fromArray(children), slice.openStart, slice.openEnd);
272
295
  } // finally, handle rich-text copy-paste
273
296
 
274
297
 
@@ -0,0 +1,33 @@
1
+ import { PluginKey } from 'prosemirror-state';
2
+ import { pluginFactory } from '../../../utils/plugin-state-factory';
3
+ import { reducer } from '../reducer';
4
+ export const pluginKey = new PluginKey('pastePlugin');
5
+ export const {
6
+ createPluginState,
7
+ createCommand,
8
+ getPluginState
9
+ } = pluginFactory(pluginKey, reducer, {
10
+ mapping: (tr, pluginState) => {
11
+ if (tr.docChanged) {
12
+ let atLeastOnePositionChanged = false;
13
+ const positionsMappedThroughChanges = Object.entries(pluginState.pastedMacroPositions).reduce((acc, [key, position]) => {
14
+ const mappedPosition = tr.mapping.map(position);
15
+
16
+ if (position !== mappedPosition) {
17
+ atLeastOnePositionChanged = true;
18
+ }
19
+
20
+ acc[key] = tr.mapping.map(position);
21
+ return acc;
22
+ }, {});
23
+
24
+ if (atLeastOnePositionChanged) {
25
+ return { ...pluginState,
26
+ pastedMacroPositions: positionsMappedThroughChanges
27
+ };
28
+ }
29
+ }
30
+
31
+ return pluginState;
32
+ }
33
+ });
@@ -0,0 +1,24 @@
1
+ import { PastePluginActionTypes as ActionTypes } from './actions';
2
+ export const reducer = (state, action) => {
3
+ switch (action.type) {
4
+ case ActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS:
5
+ {
6
+ return { ...state,
7
+ pastedMacroPositions: { ...state.pastedMacroPositions,
8
+ ...action.pastedMacroPositions
9
+ }
10
+ };
11
+ }
12
+
13
+ case ActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS:
14
+ {
15
+ const filteredMacroPositions = Object.fromEntries(Object.entries(state.pastedMacroPositions).filter(([key]) => !action.pastedMacroPositionKeys.includes(key)));
16
+ return { ...state,
17
+ pastedMacroPositions: filteredMacroPositions
18
+ };
19
+ }
20
+
21
+ default:
22
+ return state;
23
+ }
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import { placeHolderClassName } from './styles';
8
8
  export const pluginKey = new PluginKey('placeholderPlugin');
9
9
  import { focusStateKey } from '../base/pm-plugins/focus-handler';
10
10
  import { isTypeAheadOpen } from '../type-ahead/utils';
11
+ import { isComposing } from '../base/pm-plugins/composition';
11
12
 
12
13
  function getPlaceholderState(editorState) {
13
14
  return pluginKey.getState(editorState);
@@ -138,7 +139,7 @@ export function createPlugin(defaultPlaceholderText, placeholderHints, bracketPl
138
139
  pos
139
140
  } = getPlaceholderState(editorState);
140
141
 
141
- if (hasPlaceholder && placeholderText && pos !== undefined) {
142
+ if (hasPlaceholder && placeholderText && pos !== undefined && !isComposing(editorState)) {
142
143
  return createPlaceholderDecoration(editorState, placeholderText, pos);
143
144
  }
144
145
 
@@ -69,10 +69,20 @@ export function createPlugin(dispatch, options) {
69
69
  const placeholderNodeType = newState.schema.nodes.placeholder;
70
70
 
71
71
  if (adjacentNode && adjacentNode.type === placeholderNodeType && didPlaceholderExistBeforeTxn) {
72
- // Check that cursor has moved forward in the document **and** that there is content before the cursor
73
- const wasContentAdded = oldState.selection.$head.pos < newState.selection.$head.pos && !isNodeEmpty(newState.selection.$head.nodeBefore);
72
+ var _$newHead$nodeBefore;
74
73
 
75
- if (wasContentAdded) {
74
+ const {
75
+ $head: $newHead
76
+ } = newState.selection;
77
+ const {
78
+ $head: $oldHead
79
+ } = oldState.selection; // Check that cursor has moved forward in the document **and** that there is content before the cursor
80
+
81
+ const cursorMoved = $oldHead.pos < $newHead.pos;
82
+ const nodeBeforeHasContent = !isNodeEmpty($newHead.nodeBefore);
83
+ const nodeBeforeIsInline = (_$newHead$nodeBefore = $newHead.nodeBefore) === null || _$newHead$nodeBefore === void 0 ? void 0 : _$newHead$nodeBefore.type.isInline;
84
+
85
+ if (cursorMoved && (nodeBeforeHasContent || nodeBeforeIsInline)) {
76
86
  const {
77
87
  $from,
78
88
  $to
@@ -38,7 +38,11 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
38
38
  _defineProperty(this, "handleClickOutside", event => {
39
39
  event.preventDefault();
40
40
  this.inputMethod = InputMethod.blur;
41
- this.props.closeStatusPicker();
41
+ const selectedText = window.getSelection();
42
+
43
+ if (!selectedText) {
44
+ this.props.closeStatusPicker();
45
+ }
42
46
  });
43
47
 
44
48
  _defineProperty(this, "handleEscapeKeydown", event => {