@atlaskit/editor-core 172.3.2 → 173.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 (189) hide show
  1. package/CHANGELOG.md +45 -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/version-wrapper.js +1 -1
  47. package/dist/cjs/version.json +1 -1
  48. package/dist/es2019/index.js +1 -1
  49. package/dist/es2019/plugins/base/index.js +5 -0
  50. package/dist/es2019/plugins/base/pm-plugins/composition.js +45 -0
  51. package/dist/es2019/plugins/breakout/index.js +5 -4
  52. package/dist/es2019/plugins/breakout/ui/LayoutButton.js +1 -3
  53. package/dist/es2019/plugins/card/pm-plugins/doc.js +10 -1
  54. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +3 -40
  55. package/dist/es2019/plugins/collab-edit/plugin-state.js +9 -3
  56. package/dist/es2019/plugins/collab-edit/utils.js +17 -3
  57. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
  58. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +15 -7
  59. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +9 -5
  60. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +3 -3
  61. package/dist/es2019/plugins/paste/actions.js +6 -0
  62. package/dist/es2019/plugins/paste/commands.js +27 -0
  63. package/dist/es2019/plugins/paste/handlers.js +50 -8
  64. package/dist/es2019/plugins/paste/index.js +3 -2
  65. package/dist/es2019/plugins/paste/pm-plugins/main.js +29 -6
  66. package/dist/es2019/plugins/paste/pm-plugins/plugin-factory.js +33 -0
  67. package/dist/es2019/plugins/paste/reducer.js +24 -0
  68. package/dist/es2019/plugins/paste/types.js +1 -0
  69. package/dist/es2019/plugins/placeholder/index.js +2 -1
  70. package/dist/es2019/plugins/placeholder-text/index.js +13 -3
  71. package/dist/es2019/plugins/status/ui/statusPicker.js +5 -1
  72. package/dist/es2019/plugins/table/commands-with-analytics.js +6 -3
  73. package/dist/es2019/plugins/table/index.js +22 -4
  74. package/dist/es2019/plugins/table/toolbar.js +118 -14
  75. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  76. package/dist/es2019/plugins/tasks-and-decisions/commands.js +0 -9
  77. package/dist/es2019/plugins/type-ahead/constants.js +1 -0
  78. package/dist/es2019/plugins/type-ahead/messages.js +16 -1
  79. package/dist/es2019/plugins/type-ahead/pm-plugins/main.js +1 -1
  80. package/dist/es2019/plugins/type-ahead/pm-plugins/reducer.js +2 -2
  81. package/dist/es2019/plugins/type-ahead/ui/AssistiveText.js +95 -0
  82. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +49 -12
  83. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +143 -29
  84. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +64 -31
  85. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
  86. package/dist/es2019/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
  87. package/dist/es2019/plugins/type-ahead/utils.js +1 -1
  88. package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +17 -0
  89. package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
  90. package/dist/es2019/ui/PortalProvider/index.js +5 -8
  91. package/dist/es2019/utils/index.js +6 -0
  92. package/dist/es2019/version-wrapper.js +1 -1
  93. package/dist/es2019/version.json +1 -1
  94. package/dist/esm/index.js +1 -1
  95. package/dist/esm/plugins/base/index.js +7 -0
  96. package/dist/esm/plugins/base/pm-plugins/composition.js +45 -0
  97. package/dist/esm/plugins/breakout/index.js +5 -4
  98. package/dist/esm/plugins/breakout/ui/LayoutButton.js +1 -3
  99. package/dist/esm/plugins/card/pm-plugins/doc.js +8 -1
  100. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +3 -37
  101. package/dist/esm/plugins/collab-edit/plugin-state.js +9 -3
  102. package/dist/esm/plugins/collab-edit/utils.js +17 -3
  103. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +24 -22
  104. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +20 -15
  105. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +8 -5
  106. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +3 -3
  107. package/dist/esm/plugins/paste/actions.js +6 -0
  108. package/dist/esm/plugins/paste/commands.js +31 -0
  109. package/dist/esm/plugins/paste/handlers.js +46 -8
  110. package/dist/esm/plugins/paste/index.js +3 -2
  111. package/dist/esm/plugins/paste/pm-plugins/main.js +27 -6
  112. package/dist/esm/plugins/paste/pm-plugins/plugin-factory.js +46 -0
  113. package/dist/esm/plugins/paste/reducer.js +34 -0
  114. package/dist/esm/plugins/paste/types.js +1 -0
  115. package/dist/esm/plugins/placeholder/index.js +2 -1
  116. package/dist/esm/plugins/placeholder-text/index.js +9 -3
  117. package/dist/esm/plugins/status/ui/statusPicker.js +4 -1
  118. package/dist/esm/plugins/table/commands-with-analytics.js +56 -49
  119. package/dist/esm/plugins/table/index.js +54 -37
  120. package/dist/esm/plugins/table/toolbar.js +124 -15
  121. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
  122. package/dist/esm/plugins/tasks-and-decisions/commands.js +0 -12
  123. package/dist/esm/plugins/type-ahead/constants.js +1 -0
  124. package/dist/esm/plugins/type-ahead/messages.js +16 -1
  125. package/dist/esm/plugins/type-ahead/pm-plugins/main.js +1 -1
  126. package/dist/esm/plugins/type-ahead/pm-plugins/reducer.js +2 -2
  127. package/dist/esm/plugins/type-ahead/ui/AssistiveText.js +129 -0
  128. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +56 -12
  129. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +151 -32
  130. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +54 -31
  131. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +3 -3
  132. package/dist/esm/plugins/type-ahead/ui/WrapperTypeAhead.js +5 -2
  133. package/dist/esm/plugins/type-ahead/utils.js +1 -1
  134. package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +7 -0
  135. package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +2 -5
  136. package/dist/esm/ui/PortalProvider/index.js +26 -35
  137. package/dist/esm/utils/index.js +4 -0
  138. package/dist/esm/version-wrapper.js +1 -1
  139. package/dist/esm/version.json +1 -1
  140. package/dist/types/index.d.ts +1 -1
  141. package/dist/types/plugins/base/pm-plugins/composition.d.ts +8 -0
  142. package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
  143. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
  144. package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
  145. package/dist/types/plugins/paste/actions.d.ts +15 -0
  146. package/dist/types/plugins/paste/commands.d.ts +16 -0
  147. package/dist/types/plugins/paste/handlers.d.ts +1 -1
  148. package/dist/types/plugins/paste/pm-plugins/main.d.ts +3 -3
  149. package/dist/types/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
  150. package/dist/types/plugins/paste/reducer.d.ts +3 -0
  151. package/dist/types/plugins/paste/types.d.ts +6 -0
  152. package/dist/types/plugins/table/commands-with-analytics.d.ts +5 -5
  153. package/dist/types/plugins/tasks-and-decisions/commands.d.ts +0 -2
  154. package/dist/types/plugins/type-ahead/constants.d.ts +1 -0
  155. package/dist/types/plugins/type-ahead/messages.d.ts +15 -0
  156. package/dist/types/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
  157. package/dist/types/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
  158. package/dist/types/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
  159. package/dist/types/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
  160. package/dist/types/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
  161. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  162. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  163. package/dist/types/utils/index.d.ts +1 -0
  164. package/dist/types-ts4.0/index.d.ts +1 -1
  165. package/dist/types-ts4.0/plugins/base/pm-plugins/composition.d.ts +8 -0
  166. package/dist/types-ts4.0/plugins/code-block/pm-plugins/ide-ux.d.ts +1 -4
  167. package/dist/types-ts4.0/plugins/floating-toolbar/ui/Dropdown.d.ts +2 -0
  168. package/dist/types-ts4.0/plugins/floating-toolbar/ui/DropdownMenu.d.ts +1 -0
  169. package/dist/types-ts4.0/plugins/paste/actions.d.ts +15 -0
  170. package/dist/types-ts4.0/plugins/paste/commands.d.ts +16 -0
  171. package/dist/types-ts4.0/plugins/paste/handlers.d.ts +1 -1
  172. package/dist/types-ts4.0/plugins/paste/pm-plugins/main.d.ts +3 -3
  173. package/dist/types-ts4.0/plugins/paste/pm-plugins/plugin-factory.d.ts +3 -0
  174. package/dist/types-ts4.0/plugins/paste/reducer.d.ts +3 -0
  175. package/dist/types-ts4.0/plugins/paste/types.d.ts +6 -0
  176. package/dist/types-ts4.0/plugins/table/commands-with-analytics.d.ts +5 -5
  177. package/dist/types-ts4.0/plugins/tasks-and-decisions/commands.d.ts +0 -2
  178. package/dist/types-ts4.0/plugins/type-ahead/constants.d.ts +1 -0
  179. package/dist/types-ts4.0/plugins/type-ahead/messages.d.ts +15 -0
  180. package/dist/types-ts4.0/plugins/type-ahead/ui/AssistiveText.d.ts +33 -0
  181. package/dist/types-ts4.0/plugins/type-ahead/ui/InputQuery.d.ts +3 -0
  182. package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadList.d.ts +6 -3
  183. package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadListItem.d.ts +2 -2
  184. package/dist/types-ts4.0/plugins/type-ahead/ui/TypeAheadPopup.d.ts +1 -1
  185. package/dist/types-ts4.0/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  186. package/dist/types-ts4.0/ui/ContentStyles/index.d.ts +2 -2
  187. package/dist/types-ts4.0/utils/index.d.ts +1 -0
  188. package/package.json +30 -31
  189. package/report.api.md +161 -49
@@ -147,9 +147,7 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
147
147
  boundariesElement: boundariesElement,
148
148
  scrollableElement: scrollableElement,
149
149
  stick: true,
150
- forcePlacement: true,
151
- scheduleExtraLayoutUpdates: true,
152
- waitForExtraLayoutUpdates: true
150
+ forcePlacement: true
153
151
  }, jsx("div", {
154
152
  css: toolbarButtonWrapper
155
153
  }, jsx(ToolbarButton, {
@@ -24,6 +24,7 @@ import { getFeatureFlags } from '../../feature-flags-context';
24
24
  */
25
25
 
26
26
  function replaceLinksToCards(tr, cardAdf, schema, request) {
27
+ var inlineCard = schema.nodes.inlineCard;
27
28
  var url = request.url;
28
29
 
29
30
  if (!isSafeUrl(url)) {
@@ -43,9 +44,15 @@ function replaceLinksToCards(tr, cardAdf, schema, request) {
43
44
 
44
45
  if (!replaceLink) {
45
46
  return;
46
- }
47
+ } // ED-5638: add an extra space after inline cards to avoid re-rendering them
48
+
47
49
 
48
50
  var nodes = [cardAdf];
51
+
52
+ if (cardAdf.type === inlineCard) {
53
+ nodes.push(schema.text(' '));
54
+ }
55
+
49
56
  tr.replaceWith(pos, pos + (node.text || url).length, nodes);
50
57
  return $pos.node($pos.depth - 1).type.name;
51
58
  }
@@ -1,5 +1,5 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PluginKey, TextSelection } from 'prosemirror-state';
2
+ import { TextSelection } from 'prosemirror-state';
3
3
  import { keydownHandler } from 'prosemirror-keymap';
4
4
  import { setTextSelection } from 'prosemirror-utils';
5
5
  import { getCursor } from '../../../utils';
@@ -9,48 +9,14 @@ import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bra
9
9
  import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
10
10
  import { getEndOfCurrentLine, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock, getLineInfo } from '../ide-ux/line-handling';
11
11
  import { insertIndent, outdent, indent, insertNewlineWithIndent } from '../ide-ux/commands';
12
- var codeBlockIDEKeyBindingsKey = new PluginKey('codeBlockIDEKeyBindings');
12
+ import { isComposing } from '../../base/pm-plugins/composition';
13
13
  export default new SafePlugin({
14
- key: codeBlockIDEKeyBindingsKey,
15
- state: {
16
- init: function init() {
17
- return {
18
- isComposing: false
19
- };
20
- },
21
- apply: function apply(tr, value) {
22
- var isComposing = tr.getMeta(codeBlockIDEKeyBindingsKey);
23
-
24
- if (typeof isComposing === 'undefined') {
25
- return value;
26
- }
27
-
28
- return {
29
- isComposing: isComposing
30
- };
31
- }
32
- },
33
14
  props: {
34
- handleDOMEvents: {
35
- compositionstart: function compositionstart(view, event) {
36
- var tr = view.state.tr;
37
- tr.setMeta(codeBlockIDEKeyBindingsKey, true);
38
- view.dispatch(tr);
39
- return false;
40
- },
41
- compositionend: function compositionend(view, event) {
42
- var tr = view.state.tr;
43
- tr.setMeta(codeBlockIDEKeyBindingsKey, false);
44
- view.dispatch(tr);
45
- return false;
46
- }
47
- },
48
15
  handleTextInput: function handleTextInput(view, from, to, text) {
49
16
  var state = view.state,
50
17
  dispatch = view.dispatch;
51
- var isComposing = codeBlockIDEKeyBindingsKey.getState(state).isComposing;
52
18
 
53
- if (isCursorInsideCodeBlock(state) && !isComposing) {
19
+ if (isCursorInsideCodeBlock(state) && !isComposing(state)) {
54
20
  var beforeText = getStartOfCurrentLine(state).text;
55
21
  var afterText = getEndOfCurrentLine(state).text; // If text is a closing bracket/quote and we've already inserted it, move the selection after
56
22
 
@@ -4,6 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import { Selection } from 'prosemirror-state';
5
5
  import { DecorationSet } from 'prosemirror-view';
6
6
  import { ReplaceStep } from 'prosemirror-transform';
7
+ import { browser } from '@atlaskit/editor-common/utils';
7
8
  import { Participants } from './participants';
8
9
  import { findPointers, createTelepointers, getPositionOfTelepointer } from './utils';
9
10
 
@@ -158,7 +159,7 @@ export var PluginState = /*#__PURE__*/function () {
158
159
  this.decorationSet = this.decorationSet.map(tr.mapping, tr.doc, {
159
160
  // Reapplies decorators those got removed by the state change
160
161
  onRemove: function onRemove(spec) {
161
- if (spec.pointer && spec.pointer.sessionId) {
162
+ if (spec.pointer && spec.pointer.sessionId && spec.key === "telepointer-".concat(spec.pointer.sessionId)) {
162
163
  var step = tr.steps.filter(isReplaceStep)[0];
163
164
 
164
165
  if (step) {
@@ -201,9 +202,14 @@ export var PluginState = /*#__PURE__*/function () {
201
202
  if (deco.from === selection.from && deco.to === selection.to) {
202
203
  if (!hasTelepointerDimClass) {
203
204
  deco.type.toDOM.classList.add(TELEPOINTER_DIM_CLASS);
204
- }
205
+ } // Browser condition here to fix ED-14722 where telepointer
206
+ // decorations with side -1 in Firefox causes backspace issues.
207
+ // This is likely caused by contenteditable quirks in Firefox
208
+
205
209
 
206
- deco.type.side = -1;
210
+ if (!browser.gecko) {
211
+ deco.type.side = -1;
212
+ }
207
213
  } else {
208
214
  if (hasTelepointerDimClass) {
209
215
  deco.type.toDOM.classList.remove(TELEPOINTER_DIM_CLASS);
@@ -5,7 +5,7 @@ import { Selection, TextSelection } from 'prosemirror-state';
5
5
  import { Decoration } from 'prosemirror-view';
6
6
  import * as themeColors from '@atlaskit/theme/colors';
7
7
  import { hexToRgba } from '@atlaskit/adf-schema';
8
- import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
8
+ import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
9
9
  import { addAnalytics } from '../analytics/utils';
10
10
  import { EVENT_TYPE, ACTION, ACTION_SUBJECT } from '../analytics/types';
11
11
  export var 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(function (solid) {
@@ -58,18 +58,32 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
58
58
  }));
59
59
  }
60
60
 
61
+ var spaceJoinerBefore = document.createElement('span');
62
+ spaceJoinerBefore.textContent = ZERO_WIDTH_JOINER;
63
+ var spaceJoinerAfter = document.createElement('span');
64
+ spaceJoinerAfter.textContent = ZERO_WIDTH_JOINER;
61
65
  var cursor = document.createElement('span');
62
- cursor.textContent = ZERO_WIDTH_SPACE;
66
+ cursor.textContent = ZERO_WIDTH_JOINER;
63
67
  cursor.className = "telepointer color-".concat(color, " telepointer-selection-badge");
64
68
  cursor.style.cssText = "".concat(style({
65
69
  color: avatarColor.color.solid
66
70
  }), ";");
67
71
  cursor.setAttribute('data-initial', initial);
68
- return decorations.concat(Decoration.widget(to, cursor, {
72
+ return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
73
+ pointer: {
74
+ sessionId: sessionId
75
+ },
76
+ key: "telepointer-".concat(sessionId, "-zero")
77
+ })).concat(Decoration.widget(to, cursor, {
69
78
  pointer: {
70
79
  sessionId: sessionId
71
80
  },
72
81
  key: "telepointer-".concat(sessionId)
82
+ })).concat(Decoration.widget(to, spaceJoinerBefore, {
83
+ pointer: {
84
+ sessionId: sessionId
85
+ },
86
+ key: "telepointer-".concat(sessionId, "-zero")
73
87
  }));
74
88
  };
75
89
  export var replaceDocument = function replaceDocument(doc, state, version, options, reserveCursor) {
@@ -33,9 +33,10 @@ function getSpellCheck(featureFlags) {
33
33
 
34
34
 
35
35
  export function createFeatureFlagsFromProps(props) {
36
- 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;
36
+ 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;
37
37
 
38
38
  var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
39
+ var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
39
40
  return _objectSpread(_objectSpread({}, normalizedFeatureFlags), {}, {
40
41
  newInsertionBehaviour: props.allowNewInsertionBehaviour,
41
42
  interactiveExpand: typeof props.allowExpand === 'boolean' ? props.allowExpand : Boolean(props.allowExpand && props.allowExpand.allowInteractiveExpand !== false),
@@ -49,29 +50,30 @@ export function createFeatureFlagsFromProps(props) {
49
50
  singleLayout: _typeof(props.allowLayouts) === 'object' && !!((_props$allowLayouts = props.allowLayouts) !== null && _props$allowLayouts !== void 0 && _props$allowLayouts.UNSAFE_allowSingleColumnLayout),
50
51
  undoRedoButtons: props.UNSAFE_allowUndoRedoButtons,
51
52
  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,
52
- 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),
53
- 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),
54
- 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),
55
- 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,
56
- 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),
53
+ 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),
54
+ 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),
55
+ 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),
56
+ 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,
57
+ 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),
57
58
  extendFloatingToolbar: Boolean(_typeof(props.allowExtension) === 'object' && ((_props$allowExtension = props.allowExtension) === null || _props$allowExtension === void 0 ? void 0 : _props$allowExtension.allowExtendFloatingToolbars)),
58
- 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),
59
- 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),
60
- 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),
61
- 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),
62
- 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),
63
- 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),
64
- 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),
65
- 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),
66
- 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),
67
- 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)),
59
+ 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),
60
+ 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),
61
+ 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),
62
+ 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),
63
+ 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),
64
+ 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),
65
+ 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),
66
+ 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),
67
+ 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),
68
+ 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)),
68
69
  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),
69
- chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags31 = props.featureFlags) === null || _props$featureFlags31 === void 0 ? void 0 : _props$featureFlags31.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
70
- 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,
71
- 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),
72
- 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)),
73
- 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)),
74
- 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,
70
+ chromeCursorHandlerFixedVersion: typeof ((_props$featureFlags32 = props.featureFlags) === null || _props$featureFlags32 === void 0 ? void 0 : _props$featureFlags32.chromeCursorHandlerFixedVersion) === 'string' ? Number(props.featureFlags.chromeCursorHandlerFixedVersion) || undefined : undefined,
71
+ 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,
72
+ tableCellOptionsInFloatingToolbar: typeof tableCellOptionsInFloatingToolbar === 'boolean' ? tableCellOptionsInFloatingToolbar : false,
73
+ 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),
74
+ 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)),
75
+ 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)),
76
+ 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,
75
77
  disableSpellcheckByBrowser: getSpellCheck(props.featureFlags)
76
78
  });
77
79
  }
@@ -55,10 +55,14 @@ var Dropdown = /*#__PURE__*/function (_Component) {
55
55
  });
56
56
 
57
57
  _defineProperty(_assertThisInitialized(_this), "renderArrayOptions", function (options) {
58
+ var _this$props = _this.props,
59
+ showSelected = _this$props.showSelected,
60
+ dispatchCommand = _this$props.dispatchCommand;
58
61
  return jsx(DropdownMenu, {
59
62
  hide: _this.hide,
60
- dispatchCommand: _this.props.dispatchCommand,
61
- items: options
63
+ dispatchCommand: dispatchCommand,
64
+ items: options,
65
+ showSelected: showSelected
62
66
  });
63
67
  });
64
68
 
@@ -81,18 +85,19 @@ var Dropdown = /*#__PURE__*/function (_Component) {
81
85
  key: "render",
82
86
  value: function render() {
83
87
  var isOpen = this.state.isOpen;
84
- var _this$props = this.props,
85
- title = _this$props.title,
86
- icon = _this$props.icon,
87
- options = _this$props.options,
88
- dispatchCommand = _this$props.dispatchCommand,
89
- mountPoint = _this$props.mountPoint,
90
- boundariesElement = _this$props.boundariesElement,
91
- scrollableElement = _this$props.scrollableElement,
92
- hideExpandIcon = _this$props.hideExpandIcon,
93
- disabled = _this$props.disabled,
94
- tooltip = _this$props.tooltip,
95
- buttonTestId = _this$props.buttonTestId;
88
+ var _this$props2 = this.props,
89
+ title = _this$props2.title,
90
+ icon = _this$props2.icon,
91
+ options = _this$props2.options,
92
+ dispatchCommand = _this$props2.dispatchCommand,
93
+ mountPoint = _this$props2.mountPoint,
94
+ boundariesElement = _this$props2.boundariesElement,
95
+ scrollableElement = _this$props2.scrollableElement,
96
+ hideExpandIcon = _this$props2.hideExpandIcon,
97
+ disabled = _this$props2.disabled,
98
+ tooltip = _this$props2.tooltip,
99
+ buttonTestId = _this$props2.buttonTestId,
100
+ dropdownWidth = _this$props2.dropdownWidth;
96
101
  var trigger;
97
102
 
98
103
  if (icon) {
@@ -129,7 +134,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
129
134
 
130
135
 
131
136
  var fitTolerance = 10;
132
- var fitWidth = Array.isArray(options) ? menuItemDimensions.width : options.width;
137
+ var fitWidth = Array.isArray(options) ? dropdownWidth || menuItemDimensions.width : options.width;
133
138
  var fitHeight = Array.isArray(options) ? options.length * menuItemDimensions.height + itemSpacing * 2 : options.height;
134
139
  return jsx(UiDropdown, {
135
140
  mountTo: mountPoint,
@@ -59,6 +59,7 @@ var Dropdown = /*#__PURE__*/function (_Component) {
59
59
  var itemContent = jsx(ButtonItem, {
60
60
  key: idx,
61
61
  iconBefore: _this.renderSelected(item, intl),
62
+ iconAfter: item.elemAfter,
62
63
  onClick: function onClick() {
63
64
  /**
64
65
  * The order of dispatching the event and hide() is important, because
@@ -89,19 +90,21 @@ var Dropdown = /*#__PURE__*/function (_Component) {
89
90
  }, {
90
91
  key: "renderSelected",
91
92
  value: function renderSelected(item, intl) {
93
+ var _this$props$showSelec = this.props.showSelected,
94
+ showSelected = _this$props$showSelec === void 0 ? true : _this$props$showSelec;
92
95
  var selected = item.selected;
93
96
 
94
- if (selected !== undefined) {
95
- return selected ? jsx(EditorDoneIcon, {
97
+ if (showSelected && selected) {
98
+ return jsx(EditorDoneIcon, {
96
99
  primaryColor: token('color.icon.selected', B400),
97
100
  size: "small",
98
101
  label: intl.formatMessage(messages.confirmModalOK)
99
- }) : jsx("span", {
100
- css: spacer
101
102
  });
102
103
  }
103
104
 
104
- return;
105
+ return jsx("span", {
106
+ css: spacer
107
+ });
105
108
  }
106
109
  }]);
107
110
 
@@ -100,8 +100,6 @@ export var isSameItem = function isSameItem(leftItem, rightItem) {
100
100
  case 'extensions-placeholder':
101
101
  return compareItemWithKeys(leftItem, rightItem);
102
102
  }
103
-
104
- return true;
105
103
  };
106
104
  export var areSameItems = function areSameItems(leftArr, rightArr) {
107
105
  if (leftArr === undefined && rightArr === undefined) {
@@ -286,7 +284,9 @@ var Toolbar = /*#__PURE__*/function (_Component) {
286
284
  hideExpandIcon: item.hideExpandIcon,
287
285
  mountPoint: popupsMountPoint,
288
286
  boundariesElement: popupsBoundariesElement,
289
- scrollableElement: popupsScrollableElement
287
+ scrollableElement: popupsScrollableElement,
288
+ dropdownWidth: item.dropdownWidth,
289
+ showSelected: item.showSelected
290
290
  });
291
291
 
292
292
  case 'select':
@@ -0,0 +1,6 @@
1
+ export var 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,31 @@
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 var startTrackingPastedMacroPositions = function startTrackingPastedMacroPositions(pastedMacroPositions) {
17
+ return createCommand(function () {
18
+ return {
19
+ type: ActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS,
20
+ pastedMacroPositions: pastedMacroPositions
21
+ };
22
+ });
23
+ };
24
+ export var stopTrackingPastedMacroPositions = function stopTrackingPastedMacroPositions(pastedMacroPositionKeys) {
25
+ return createCommand(function () {
26
+ return {
27
+ type: ActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS,
28
+ pastedMacroPositionKeys: pastedMacroPositionKeys
29
+ };
30
+ });
31
+ };
@@ -16,6 +16,7 @@ import { closeHistory } from 'prosemirror-history';
16
16
  import { Fragment, Node as PMNode, Slice } from 'prosemirror-model';
17
17
  import { TextSelection, NodeSelection } from 'prosemirror-state';
18
18
  import { findParentNodeOfType, hasParentNodeOfType, safeInsert } from 'prosemirror-utils';
19
+ import uuid from 'uuid/v4';
19
20
  import { replaceSelectedTable } from '@atlaskit/editor-tables/utils';
20
21
  import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell } from '../../utils';
21
22
  import { mapSlice } from '../../utils/slice';
@@ -29,7 +30,9 @@ import { pluginKey as textFormattingPluginKey } from '../text-formatting/pm-plug
29
30
  import { addReplaceSelectedTableAnalytics, applyTextMarksToSlice, hasOnlyNodesOfType } from './util';
30
31
  import { isListNode, isListItemNode } from '../list/utils/node';
31
32
  import { canLinkBeCreatedInRange } from '../hyperlink/pm-plugins/main';
32
- import { insertSliceForLists } from './edge-cases'; // remove text attribute from mention for copy/paste (GDPR)
33
+ import { insertSliceForLists } from './edge-cases';
34
+ import { startTrackingPastedMacroPositions, stopTrackingPastedMacroPositions } from './commands';
35
+ import { getPluginState as getPastePluginState } from './pm-plugins/plugin-factory'; // remove text attribute from mention for copy/paste (GDPR)
33
36
 
34
37
  export function handleMention(slice, schema) {
35
38
  return mapSlice(slice, function (node) {
@@ -323,12 +326,21 @@ function _getSmartLinkAdf() {
323
326
  return _getSmartLinkAdf.apply(this, arguments);
324
327
  }
325
328
 
326
- function insertAutoMacro(slice, macro, view) {
329
+ function insertAutoMacro(slice, macro, view, from, to) {
327
330
  if (view) {
328
331
  // insert the text or linkified/md-converted clipboard data
329
332
  var selection = view.state.tr.selection;
330
- var tr = view.state.tr.replaceSelection(slice);
331
- var before = tr.mapping.map(selection.from, -1);
333
+ var tr;
334
+ var before;
335
+
336
+ if (typeof from === 'number' && typeof to === 'number') {
337
+ tr = view.state.tr.replaceRange(from, to, slice);
338
+ before = tr.mapping.map(from, -1);
339
+ } else {
340
+ tr = view.state.tr.replaceSelection(slice);
341
+ before = tr.mapping.map(selection.from, -1);
342
+ }
343
+
332
344
  view.dispatch(tr); // replace the text with the macro as a separate transaction
333
345
  // so the autoconversion generates 2 undo steps
334
346
 
@@ -361,16 +373,36 @@ export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoC
361
373
  * if FF enabled, run through smart links and check for result
362
374
  */
363
375
  if (cardsOptions && cardsOptions.resolveBeforeMacros && cardsOptions.resolveBeforeMacros.length) {
376
+ var _startTrackingPastedM;
377
+
364
378
  if (cardsOptions.resolveBeforeMacros.indexOf(macro.attrs.extensionKey) < 0) {
365
379
  return insertAutoMacro(slice, macro, view);
366
380
  }
367
381
 
382
+ if (!view) {
383
+ throw new Error('View is missing');
384
+ }
385
+
386
+ var trackingId = uuid();
387
+ var trackingFrom = "handleMacroAutoConvert-from-".concat(trackingId);
388
+ var trackingTo = "handleMacroAutoConvert-to-".concat(trackingId);
389
+ startTrackingPastedMacroPositions((_startTrackingPastedM = {}, _defineProperty(_startTrackingPastedM, trackingFrom, state.selection.from), _defineProperty(_startTrackingPastedM, trackingTo, state.selection.to), _startTrackingPastedM))(state, dispatch);
368
390
  getSmartLinkAdf(text, 'inline', cardsOptions).then(function () {
391
+ // we use view.state rather than state because state becomes a stale
392
+ // state reference after getSmartLinkAdf's async work
393
+ var _getPastePluginState = getPastePluginState(view.state),
394
+ pastedMacroPositions = _getPastePluginState.pastedMacroPositions;
395
+
369
396
  if (dispatch) {
370
- handleMarkdown(slice)(state, dispatch);
397
+ handleMarkdown(slice, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo])(view.state, dispatch);
371
398
  }
372
399
  }).catch(function () {
373
- return insertAutoMacro(slice, macro, view);
400
+ var _getPastePluginState2 = getPastePluginState(view.state),
401
+ pastedMacroPositions = _getPastePluginState2.pastedMacroPositions;
402
+
403
+ insertAutoMacro(slice, macro, view, pastedMacroPositions[trackingFrom], pastedMacroPositions[trackingTo]);
404
+ }).finally(function () {
405
+ stopTrackingPastedMacroPositions([trackingFrom, trackingTo])(view.state, dispatch);
374
406
  });
375
407
  return true;
376
408
  }
@@ -490,10 +522,16 @@ export function handleExpandPasteInTable(slice) {
490
522
  return false;
491
523
  };
492
524
  }
493
- export function handleMarkdown(markdownSlice) {
525
+ export function handleMarkdown(markdownSlice, from, to) {
494
526
  return function (state, dispatch) {
495
527
  var tr = closeHistory(state.tr);
496
- tr.replaceSelection(markdownSlice);
528
+
529
+ if (typeof from === 'number' && typeof to === 'number') {
530
+ tr.replaceRange(from, to, markdownSlice);
531
+ } else {
532
+ tr.replaceSelection(markdownSlice);
533
+ }
534
+
497
535
  queueCardsFromChangedTr(state, tr, INPUT_METHOD.CLIPBOARD);
498
536
 
499
537
  if (dispatch) {
@@ -12,8 +12,9 @@ var pastePlugin = function pastePlugin(_ref) {
12
12
  plugin: function plugin(_ref2) {
13
13
  var schema = _ref2.schema,
14
14
  providerFactory = _ref2.providerFactory,
15
- dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent;
16
- return createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory);
15
+ dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
16
+ dispatch = _ref2.dispatch;
17
+ return createPlugin(schema, dispatchAnalyticsEvent, dispatch, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory);
17
18
  }
18
19
  }];
19
20
  }
@@ -2,9 +2,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { Slice, Fragment } from 'prosemirror-model';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
- import { PluginKey } from 'prosemirror-state';
6
5
  import uuid from 'uuid';
7
6
  import { MarkdownTransformer } from '@atlaskit/editor-markdown-transformer';
7
+ import { mapChildren } from '../../../utils/slice';
8
8
  import { getExtensionAutoConvertersFromProvider } from '@atlaskit/editor-common/extensions';
9
9
  sendPasteAnalyticsEvent;
10
10
  import * as clipboard from '../../../utils/clipboard';
@@ -16,7 +16,7 @@ import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks } from
16
16
  import { transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '../../code-block/utils';
17
17
  import { createPasteMeasurePayload, getContentNodeTypes, handlePasteAsPlainTextWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handleCodeBlockWithAnalytics, handleMediaSingleWithAnalytics, handlePastePreservingMarksWithAnalytics, handleMarkdownWithAnalytics, handleRichTextWithAnalytics, handleExpandWithAnalytics, handleSelectedTableWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, sendPasteAnalyticsEvent, handlePasteIntoCaptionWithAnalytics, handlePastePanelIntoListWithAnalytics } from './analytics';
18
18
  import { analyticsPluginKey, PasteTypes } from '../../analytics';
19
- import { insideTable, measurements } from '../../../utils';
19
+ import { isInsideBlockQuote, insideTable, measurements } from '../../../utils';
20
20
  import { measureRender } from '@atlaskit/editor-common/utils';
21
21
  import { transformSliceToCorrectMediaWrapper, unwrapNestedMediaElements } from '../../media/utils/media-common';
22
22
  import { upgradeTextToLists, splitParagraphs } from '../../list/transforms';
@@ -29,16 +29,17 @@ import { clipboardTextSerializer } from './clipboard-text-serializer';
29
29
  import { htmlHasIncompleteTable, tryRebuildCompleteTableHtml, isPastedFromTinyMCEConfluence } from '../util/tinyMCE';
30
30
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
31
31
  import { extractSliceFromStep } from '../../../utils/step';
32
- export var stateKey = new PluginKey('pastePlugin');
32
+ import { pluginKey as stateKey, createPluginState } from './plugin-factory';
33
+ export { pluginKey as stateKey } from './plugin-factory';
33
34
  export { md } from '../md';
34
- export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory) {
35
+ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, plainTextPasteLinkification, cardOptions, sanitizePrivateContent, providerFactory) {
35
36
  var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
36
37
 
37
38
  function getMarkdownSlice(text, openStart, openEnd) {
38
39
  var textInput = text;
39
40
 
40
- if (textInput.includes(':\\\\')) {
41
- textInput = textInput.replace(/:\\\\/g, ':\\\\\\\\');
41
+ if (textInput.includes('\\')) {
42
+ textInput = textInput.replace(/\\/g, '\\\\');
42
43
  }
43
44
 
44
45
  var doc = atlassianMarkDownParser.parse(escapeLinks(textInput));
@@ -103,6 +104,9 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
103
104
  var pastedFromBitBucket = false;
104
105
  return new SafePlugin({
105
106
  key: stateKey,
107
+ state: createPluginState(dispatch, {
108
+ pastedMacroPositions: {}
109
+ }),
106
110
  props: {
107
111
  // For serialising to plain text
108
112
  clipboardTextSerializer: clipboardTextSerializer,
@@ -295,6 +299,23 @@ export function createPlugin(schema, dispatchAnalyticsEvent, plainTextPasteLinki
295
299
  }
296
300
 
297
301
  return handleMarkdownWithAnalytics(view, event, markdownSlice)(state, dispatch);
302
+ }
303
+
304
+ if (isRichText && isInsideBlockQuote(state)) {
305
+ //If pasting inside blockquote
306
+ //Skip the blockquote node and keep remaining nodes as they are
307
+ var blockquote = schema.nodes.blockquote;
308
+ var children = [];
309
+ mapChildren(slice.content, function (node) {
310
+ if (node.type === blockquote) {
311
+ for (var i = 0; i < node.childCount; i++) {
312
+ children.push(node.child(i));
313
+ }
314
+ } else {
315
+ children.push(node);
316
+ }
317
+ });
318
+ slice = new Slice(Fragment.fromArray(children), slice.openStart, slice.openEnd);
298
319
  } // finally, handle rich-text copy-paste
299
320
 
300
321