@atlaskit/editor-core 172.0.3 → 172.1.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 (197) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/cjs/create-editor/ReactEditorView.js +11 -2
  3. package/dist/cjs/create-editor/ReactEditorViewContext.js +15 -0
  4. package/dist/cjs/create-editor/create-plugins-list.js +2 -1
  5. package/dist/cjs/editor.js +7 -1
  6. package/dist/cjs/labs/next/mobile.js +5 -3
  7. package/dist/cjs/messages.js +5 -0
  8. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  9. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
  10. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +8 -0
  11. package/dist/cjs/plugins/card/pm-plugins/doc.js +2 -26
  12. package/dist/cjs/plugins/card/toolbar.js +118 -86
  13. package/dist/cjs/plugins/code-block/nodeviews/code-block.js +9 -2
  14. package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +37 -1
  15. package/dist/cjs/plugins/code-block/toolbar.js +3 -1
  16. package/dist/cjs/plugins/code-block/ui/class-names.js +2 -0
  17. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
  18. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -1
  19. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +42 -2
  20. package/dist/cjs/plugins/hyperlink/Toolbar.js +43 -8
  21. package/dist/cjs/plugins/media/commands/helpers.js +1 -8
  22. package/dist/cjs/plugins/media/index.js +1 -1
  23. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +0 -10
  24. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
  25. package/dist/cjs/plugins/media/picker-facade.js +1 -0
  26. package/dist/cjs/plugins/media/pm-plugins/main.js +3 -13
  27. package/dist/cjs/plugins/paste/handlers.js +9 -20
  28. package/dist/cjs/plugins/paste/md.js +8 -2
  29. package/dist/cjs/plugins/paste/newline-md-plugin.js +67 -0
  30. package/dist/cjs/plugins/paste/paragraph-md-plugin.js +72 -0
  31. package/dist/cjs/plugins/table/commands/hover.js +4 -4
  32. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  33. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  34. package/dist/cjs/plugins/table/utils/decoration.js +53 -3
  35. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
  36. package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +3 -2
  37. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +78 -53
  38. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +1 -1
  39. package/dist/cjs/ui/Addon/ClickAreaBlock/index.js +7 -2
  40. package/dist/cjs/ui/Addon/ClickAreaMobile/index.js +8 -2
  41. package/dist/cjs/ui/Appearance/Comment/Comment.js +13 -13
  42. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +8 -7
  43. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  44. package/dist/cjs/ui/Appearance/Mobile.js +4 -2
  45. package/dist/cjs/ui/AppearanceComponents/Mobile.js +5 -4
  46. package/dist/cjs/ui/DropList/index.js +1 -1
  47. package/dist/cjs/ui/DropdownMenu/index.js +5 -5
  48. package/dist/cjs/ui/with-outer-listeners.js +105 -50
  49. package/dist/cjs/utils/deprecation-warnings.js +4 -0
  50. package/dist/cjs/utils/linking-utils.js +40 -1
  51. package/dist/cjs/version-wrapper.js +1 -1
  52. package/dist/cjs/version.json +1 -1
  53. package/dist/es2019/create-editor/ReactEditorView.js +11 -2
  54. package/dist/es2019/create-editor/ReactEditorViewContext.js +3 -0
  55. package/dist/es2019/create-editor/create-plugins-list.js +2 -1
  56. package/dist/es2019/editor.js +7 -1
  57. package/dist/es2019/labs/next/mobile.js +5 -3
  58. package/dist/es2019/messages.js +5 -0
  59. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  60. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
  61. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +10 -0
  62. package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -24
  63. package/dist/es2019/plugins/card/toolbar.js +114 -86
  64. package/dist/es2019/plugins/code-block/nodeviews/code-block.js +9 -2
  65. package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +40 -2
  66. package/dist/es2019/plugins/code-block/toolbar.js +2 -1
  67. package/dist/es2019/plugins/code-block/ui/class-names.js +2 -0
  68. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
  69. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
  70. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +37 -0
  71. package/dist/es2019/plugins/hyperlink/Toolbar.js +40 -9
  72. package/dist/es2019/plugins/media/commands/helpers.js +0 -2
  73. package/dist/es2019/plugins/media/index.js +1 -1
  74. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +0 -7
  75. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
  76. package/dist/es2019/plugins/media/picker-facade.js +1 -0
  77. package/dist/es2019/plugins/media/pm-plugins/main.js +3 -13
  78. package/dist/es2019/plugins/paste/handlers.js +7 -19
  79. package/dist/es2019/plugins/paste/md.js +6 -2
  80. package/dist/es2019/plugins/paste/newline-md-plugin.js +56 -0
  81. package/dist/es2019/plugins/paste/paragraph-md-plugin.js +61 -0
  82. package/dist/es2019/plugins/table/commands/hover.js +4 -4
  83. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  84. package/dist/es2019/plugins/table/ui/common-styles.js +39 -2
  85. package/dist/es2019/plugins/table/utils/decoration.js +60 -24
  86. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
  87. package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +4 -3
  88. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +78 -59
  89. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
  90. package/dist/es2019/ui/Addon/ClickAreaBlock/index.js +6 -2
  91. package/dist/es2019/ui/Addon/ClickAreaMobile/index.js +7 -2
  92. package/dist/es2019/ui/Appearance/Comment/Comment.js +12 -6
  93. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +7 -2
  94. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  95. package/dist/es2019/ui/Appearance/Mobile.js +4 -2
  96. package/dist/es2019/ui/AppearanceComponents/Mobile.js +5 -4
  97. package/dist/es2019/ui/DropList/index.js +1 -1
  98. package/dist/es2019/ui/DropdownMenu/index.js +10 -6
  99. package/dist/es2019/ui/with-outer-listeners.js +83 -33
  100. package/dist/es2019/utils/deprecation-warnings.js +4 -0
  101. package/dist/es2019/utils/linking-utils.js +37 -0
  102. package/dist/es2019/version-wrapper.js +1 -1
  103. package/dist/es2019/version.json +1 -1
  104. package/dist/esm/create-editor/ReactEditorView.js +11 -2
  105. package/dist/esm/create-editor/ReactEditorViewContext.js +3 -0
  106. package/dist/esm/create-editor/create-plugins-list.js +2 -1
  107. package/dist/esm/editor.js +7 -1
  108. package/dist/esm/labs/next/mobile.js +5 -3
  109. package/dist/esm/messages.js +5 -0
  110. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  111. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +1 -1
  112. package/dist/esm/plugins/card/nodeviews/inlineCard.js +9 -0
  113. package/dist/esm/plugins/card/pm-plugins/doc.js +1 -20
  114. package/dist/esm/plugins/card/toolbar.js +108 -83
  115. package/dist/esm/plugins/code-block/nodeviews/code-block.js +9 -2
  116. package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +37 -2
  117. package/dist/esm/plugins/code-block/toolbar.js +2 -1
  118. package/dist/esm/plugins/code-block/ui/class-names.js +2 -0
  119. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -3
  120. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +3 -2
  121. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +41 -2
  122. package/dist/esm/plugins/hyperlink/Toolbar.js +43 -10
  123. package/dist/esm/plugins/media/commands/helpers.js +0 -4
  124. package/dist/esm/plugins/media/index.js +1 -1
  125. package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +0 -8
  126. package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +2 -3
  127. package/dist/esm/plugins/media/picker-facade.js +1 -0
  128. package/dist/esm/plugins/media/pm-plugins/main.js +3 -15
  129. package/dist/esm/plugins/paste/handlers.js +11 -22
  130. package/dist/esm/plugins/paste/md.js +6 -2
  131. package/dist/esm/plugins/paste/newline-md-plugin.js +58 -0
  132. package/dist/esm/plugins/paste/paragraph-md-plugin.js +63 -0
  133. package/dist/esm/plugins/table/commands/hover.js +4 -4
  134. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +2 -1
  135. package/dist/esm/plugins/table/ui/common-styles.js +1 -1
  136. package/dist/esm/plugins/table/utils/decoration.js +50 -3
  137. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -0
  138. package/dist/esm/plugins/type-ahead/ui/InputQuery.js +4 -3
  139. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +77 -51
  140. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +2 -2
  141. package/dist/esm/ui/Addon/ClickAreaBlock/index.js +7 -2
  142. package/dist/esm/ui/Addon/ClickAreaMobile/index.js +8 -2
  143. package/dist/esm/ui/Appearance/Comment/Comment.js +12 -12
  144. package/dist/esm/ui/Appearance/FullPage/FullPage.js +7 -6
  145. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +2 -1
  146. package/dist/esm/ui/Appearance/Mobile.js +4 -2
  147. package/dist/esm/ui/AppearanceComponents/Mobile.js +5 -4
  148. package/dist/esm/ui/DropList/index.js +1 -1
  149. package/dist/esm/ui/DropdownMenu/index.js +5 -5
  150. package/dist/esm/ui/with-outer-listeners.js +105 -51
  151. package/dist/esm/utils/deprecation-warnings.js +4 -0
  152. package/dist/esm/utils/linking-utils.js +37 -0
  153. package/dist/esm/version-wrapper.js +1 -1
  154. package/dist/esm/version.json +1 -1
  155. package/dist/types/create-editor/ReactEditorView.d.ts +2 -0
  156. package/dist/types/create-editor/ReactEditorViewContext.d.ts +8 -0
  157. package/dist/types/messages.d.ts +5 -0
  158. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  159. package/dist/types/plugins/analytics/types/events.d.ts +2 -2
  160. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  161. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +3 -0
  162. package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -2
  163. package/dist/types/plugins/card/toolbar.d.ts +1 -0
  164. package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +4 -1
  165. package/dist/types/plugins/code-block/ui/class-names.d.ts +2 -0
  166. package/dist/types/plugins/hyperlink/types.d.ts +1 -0
  167. package/dist/types/plugins/media/commands/helpers.d.ts +0 -1
  168. package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +0 -1
  169. package/dist/types/plugins/media/nodeviews/mediaNodeView/media.d.ts +0 -1
  170. package/dist/types/plugins/media/pm-plugins/main.d.ts +0 -2
  171. package/dist/types/plugins/media/pm-plugins/types.d.ts +0 -2
  172. package/dist/types/plugins/paste/newline-md-plugin.d.ts +2 -0
  173. package/dist/types/plugins/paste/paragraph-md-plugin.d.ts +2 -0
  174. package/dist/types/plugins/table/utils/decoration.d.ts +1 -1
  175. package/dist/types/types/editor-appearance-component.d.ts +1 -0
  176. package/dist/types/types/feature-flags.d.ts +9 -0
  177. package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +1 -0
  178. package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -0
  179. package/dist/types/ui/Appearance/FullPage/FullPage.d.ts +1 -0
  180. package/dist/types/ui/Appearance/Mobile.d.ts +1 -1
  181. package/dist/types/ui/AppearanceComponents/Mobile.d.ts +2 -1
  182. package/dist/types/ui/Dropdown/index.d.ts +1 -1
  183. package/dist/types/ui/with-outer-listeners.d.ts +2 -1
  184. package/dist/types/utils/linking-utils.d.ts +1 -0
  185. package/package.json +31 -33
  186. package/dist/cjs/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -77
  187. package/dist/cjs/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -118
  188. package/dist/cjs/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -70
  189. package/dist/es2019/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
  190. package/dist/es2019/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -97
  191. package/dist/es2019/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -53
  192. package/dist/esm/plugins/type-ahead/ui/DynamicHeightListItem.js +0 -51
  193. package/dist/esm/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.js +0 -101
  194. package/dist/esm/plugins/type-ahead/ui/hooks/use-resize-observer.js +0 -48
  195. package/dist/types/plugins/type-ahead/ui/DynamicHeightListItem.d.ts +0 -21
  196. package/dist/types/plugins/type-ahead/ui/hooks/use-dynamic-list-height-calculation.d.ts +0 -25
  197. package/dist/types/plugins/type-ahead/ui/hooks/use-resize-observer.d.ts +0 -8
@@ -65,8 +65,6 @@ export class MediaPluginStateImplementation {
65
65
 
66
66
  _defineProperty(this, "mediaGroupNodes", {});
67
67
 
68
- _defineProperty(this, "mobileUploadComplete", {});
69
-
70
68
  _defineProperty(this, "pendingTask", Promise.resolve(null));
71
69
 
72
70
  _defineProperty(this, "destroyed", false);
@@ -177,7 +175,7 @@ export class MediaPluginStateImplementation {
177
175
  });
178
176
 
179
177
  _defineProperty(this, "insertFile", (mediaState, onMediaStateChanged, pickerType) => {
180
- var _this$mediaOptions2;
178
+ var _mediaState$collectio, _this$mediaOptions2;
181
179
 
182
180
  const {
183
181
  state
@@ -185,14 +183,10 @@ export class MediaPluginStateImplementation {
185
183
  const mediaStateWithContext = { ...mediaState,
186
184
  contextId: this.contextIdentifierProvider ? this.contextIdentifierProvider.objectId : undefined
187
185
  };
188
- const collection = this.collectionFromProvider();
186
+ const collection = (_mediaState$collectio = mediaState.collection) !== null && _mediaState$collectio !== void 0 ? _mediaState$collectio : this.collectionFromProvider();
189
187
 
190
188
  if (collection === undefined) {
191
189
  return;
192
- }
193
-
194
- if (this.mediaOptions && this.mediaOptions.allowMarkingUploadsAsIncomplete) {
195
- this.mobileUploadComplete[mediaStateWithContext.id] = false;
196
190
  } // We need to dispatch the change to event dispatcher only for successful files
197
191
 
198
192
 
@@ -390,16 +384,12 @@ export class MediaPluginStateImplementation {
390
384
  attrs.collection = state.collection;
391
385
  }
392
386
 
393
- this.updateMediaNodeAttrs(state.id, attrs, isMediaSingle(this.view.state.schema, state.fileMimeType)); // mark mobile upload as complete
394
-
395
- this.mobileUploadComplete[attrs.id] = true;
387
+ this.updateMediaNodeAttrs(state.id, attrs, isMediaSingle(this.view.state.schema, state.fileMimeType));
396
388
  delete this.mediaGroupNodes[state.id];
397
389
  break;
398
390
  }
399
391
  });
400
392
 
401
- _defineProperty(this, "isMobileUploadCompleted", mediaId => helpers.isMobileUploadCompleted(this, mediaId));
402
-
403
393
  _defineProperty(this, "removeNodeById", state => {
404
394
  const {
405
395
  id
@@ -2,10 +2,10 @@ 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 { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue, insideTableCell } from '../../utils';
5
+ import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell } from '../../utils';
6
6
  import { mapSlice } from '../../utils/slice';
7
7
  import { INPUT_METHOD } from '../analytics';
8
- import { insertCard, queueCardsFromChangedTr } from '../card/pm-plugins/doc';
8
+ import { queueCardsFromChangedTr } from '../card/pm-plugins/doc';
9
9
  import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
10
10
  import { linkifyContent } from '../hyperlink/utils';
11
11
  import { runMacroAutoConvert } from '../macro';
@@ -286,7 +286,7 @@ export function handlePastePreservingMarks(slice) {
286
286
  };
287
287
  }
288
288
 
289
- async function isLinkSmart(text, type, cardOptions) {
289
+ async function getSmartLinkAdf(text, type, cardOptions) {
290
290
  if (!cardOptions.provider) {
291
291
  throw Error('No card provider found');
292
292
  }
@@ -312,7 +312,7 @@ function insertAutoMacro(slice, macro, view) {
312
312
  }
313
313
 
314
314
  export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoConverter) {
315
- return (state, _dispatch, view) => {
315
+ return (state, dispatch, view) => {
316
316
  let macro = null; // try to use auto convert from extension provider first
317
317
 
318
318
  if (extensionAutoConverter) {
@@ -337,22 +337,10 @@ export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoC
337
337
  return insertAutoMacro(slice, macro, view);
338
338
  }
339
339
 
340
- isLinkSmart(text, 'inline', cardsOptions).then(cardData => {
341
- if (!view) {
342
- throw new Error('Missing view');
343
- }
344
-
345
- const {
346
- schema,
347
- tr
348
- } = view.state;
349
- const cardAdf = processRawValue(schema, cardData);
350
-
351
- if (!cardAdf) {
352
- throw new Error('Received invalid ADF from CardProvider');
340
+ getSmartLinkAdf(text, 'inline', cardsOptions).then(() => {
341
+ if (dispatch) {
342
+ handleMarkdown(slice)(state, dispatch);
353
343
  }
354
-
355
- view.dispatch(insertCard(tr, cardAdf, schema));
356
344
  }).catch(() => insertAutoMacro(slice, macro, view));
357
345
  return true;
358
346
  }
@@ -1,11 +1,15 @@
1
1
  import MarkdownIt from 'markdown-it';
2
2
  import linkify from './linkify-md-plugin';
3
+ import newline from './newline-md-plugin';
4
+ import paragraph from './paragraph-md-plugin';
3
5
  export const md = MarkdownIt('zero', {
4
6
  html: false
5
7
  });
6
8
  md.enable([// Process html entity - {, ¯, ", ...
7
9
  'entity', // Process escaped chars and hardbreaks
8
- 'escape', 'newline']); // enable modified version of linkify plugin
10
+ 'escape', 'newline']);
11
+ md.use(paragraph); // enable modified version of linkify plugin
9
12
  // @see https://product-fabric.atlassian.net/browse/ED-3097
10
13
 
11
- md.use(linkify);
14
+ md.use(linkify);
15
+ md.use(newline);
@@ -0,0 +1,56 @@
1
+ // ED-15363: modified version of the original newline plugin
2
+ // https://github.com/markdown-it/markdown-it/blob/master/lib/rules_inline/newline.js
3
+ const newline = (state, silent) => {
4
+ let pmax,
5
+ // ED-15363: unread variables
6
+ // max,
7
+ // ws,
8
+ pos = state.pos;
9
+
10
+ if (state.src.charCodeAt(pos) !== 0x0a
11
+ /* \n */
12
+ ) {
13
+ return false;
14
+ }
15
+
16
+ pmax = state.pending.length - 1; // ED-15363: unread variable
17
+ // max = state.posMax;
18
+ // ' \n' -> hardbreak
19
+ // Lookup in pending chars is bad practice! Don't copy to other rules!
20
+ // Pending string is stored in concat mode, indexed lookups will cause
21
+ // convertion to flat mode.
22
+
23
+ if (!silent) {
24
+ if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
25
+ if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
26
+ // ED-15363: We commented out this logic to preserve trailing whitespaces
27
+ // for each line of text when pasting plain text
28
+ // // Find whitespaces tail of pending chars.
29
+ // ws = pmax - 1;
30
+ // while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 0x20) {
31
+ // ws--;
32
+ // }
33
+ // state.pending = state.pending.slice(0, ws);
34
+ state.push('hardbreak', 'br', 0);
35
+ } else {
36
+ state.pending = state.pending.slice(0, -1);
37
+ state.push('softbreak', 'br', 0);
38
+ }
39
+ } else {
40
+ state.push('softbreak', 'br', 0);
41
+ }
42
+ }
43
+
44
+ pos++; // ED-15363: We commented out this logic from the original library to
45
+ // preserve leading whitespaces for each line of text when pasting plain
46
+ // text (to preserve whitespace-based indentation).
47
+ // // skip heading spaces for next line
48
+ // while (pos < max && isSpace(state.src.charCodeAt(pos))) {
49
+ // pos++;
50
+ // }
51
+
52
+ state.pos = pos;
53
+ return true;
54
+ };
55
+
56
+ export default (md => md.inline.ruler.at('newline', newline));
@@ -0,0 +1,61 @@
1
+ // ED-15363: modified version of the original paragraph plugin
2
+ // https://github.com/markdown-it/markdown-it/blob/master/lib/rules_block/paragraph.js
3
+ const paragraph = (state, startLine) => {
4
+ let content,
5
+ terminate,
6
+ i,
7
+ l,
8
+ token,
9
+ oldParentType,
10
+ nextLine = startLine + 1,
11
+ terminatorRules = state.md.block.ruler.getRules('paragraph'),
12
+ endLine = state.lineMax;
13
+ oldParentType = state.parentType;
14
+ state.parentType = 'paragraph'; // jump line-by-line until empty one or EOF
15
+
16
+ for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
17
+ // this would be a code block normally, but after paragraph
18
+ // it's considered a lazy continuation regardless of what's there
19
+ if (state.sCount[nextLine] - state.blkIndent > 3) {
20
+ continue;
21
+ } // quirk for blockquotes, this line should already be checked by that rule
22
+
23
+
24
+ if (state.sCount[nextLine] < 0) {
25
+ continue;
26
+ } // Some tags can terminate paragraph without empty line.
27
+
28
+
29
+ terminate = false;
30
+
31
+ for (i = 0, l = terminatorRules.length; i < l; i++) {
32
+ if (terminatorRules[i](state, nextLine, endLine, true)) {
33
+ terminate = true;
34
+ break;
35
+ }
36
+ }
37
+
38
+ if (terminate) {
39
+ break;
40
+ }
41
+ } // ED-15363: We removed .trim() from this logic from the original library to
42
+ // preserve leading whitespaces at the beginning and end of paragraph blocks
43
+ // when pasting plain text (to preserve whitespace-based indentation, at the
44
+ // beginning and end of paragraphs).
45
+ // content = state.getLines(startLine, nextLine, state.blkIndent, false) .trim()
46
+
47
+
48
+ content = state.getLines(startLine, nextLine, state.blkIndent, false);
49
+ state.line = nextLine;
50
+ token = state.push('paragraph_open', 'p', 1);
51
+ token.map = [startLine, state.line];
52
+ token = state.push('inline', '', 0);
53
+ token.content = content;
54
+ token.map = [startLine, state.line];
55
+ token.children = [];
56
+ token = state.push('paragraph_close', 'p', -1);
57
+ state.parentType = oldParentType;
58
+ return true;
59
+ };
60
+
61
+ export default (md => md.block.ruler.at('paragraph', paragraph));
@@ -37,13 +37,13 @@ export const hoverMergedCells = () => createCommand(state => {
37
37
  };
38
38
  }, tr => tr.setMeta('addToHistory', false));
39
39
  export const hoverColumns = (hoveredColumns, isInDanger) => createCommand(state => {
40
- const cells = getCellsInColumn(hoveredColumns)(state.selection);
40
+ const cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
41
41
 
42
42
  if (!cells) {
43
43
  return false;
44
44
  }
45
45
 
46
- const decorations = createControlsHoverDecoration(cells, 'column', isInDanger);
46
+ const decorations = createControlsHoverDecoration(cells, 'column', state.tr, isInDanger);
47
47
  return {
48
48
  type: 'HOVER_COLUMNS',
49
49
  data: {
@@ -60,7 +60,7 @@ export const hoverRows = (hoveredRows, isInDanger) => createCommand(state => {
60
60
  return false;
61
61
  }
62
62
 
63
- const decorations = createControlsHoverDecoration(cells, 'row', isInDanger);
63
+ const decorations = createControlsHoverDecoration(cells, 'row', state.tr, isInDanger);
64
64
  return {
65
65
  type: 'HOVER_ROWS',
66
66
  data: {
@@ -86,7 +86,7 @@ export const hoverTable = (isInDanger, isSelected) => createCommand(state => {
86
86
  return false;
87
87
  }
88
88
 
89
- const decorations = createControlsHoverDecoration(cells, 'table', isInDanger, isSelected);
89
+ const decorations = createControlsHoverDecoration(cells, 'table', state.tr, isInDanger, isSelected);
90
90
  return {
91
91
  type: 'HOVER_TABLE',
92
92
  data: {
@@ -72,7 +72,8 @@ export default class CornerControls extends Component {
72
72
  }),
73
73
  style: {
74
74
  top: this.props.stickyTop !== undefined ? `${this.props.stickyTop}px` : undefined
75
- }
75
+ },
76
+ contentEditable: false
76
77
  }, /*#__PURE__*/React.createElement("button", {
77
78
  type: "button",
78
79
  className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {
@@ -79,6 +79,22 @@ export const tableStyles = props => {
79
79
 
80
80
  td.${ClassName.TABLE_CELL} {
81
81
  background-color: ${tableCellBackgroundColor(props)};
82
+
83
+ // ED-15246: Trello card is visible through a border of a table border
84
+ // This fixes a border issue caused by relative positioned table cells
85
+ &::after {
86
+ height: 100%;
87
+ content: '';
88
+ border-left: 1px solid ${tableBorderColor(props)};
89
+ border-bottom: 1px solid ${tableBorderColor(props)};
90
+ position: absolute;
91
+ right: 0px;
92
+ top: 0px;
93
+ bottom: 0;
94
+ width: 100%;
95
+ display: inline-block;
96
+ pointer-events: none;
97
+ }
82
98
  }
83
99
  }
84
100
 
@@ -500,8 +516,6 @@ export const tableStyles = props => {
500
516
  /* Table */
501
517
  .${ClassName.TABLE_NODE_WRAPPER} > table {
502
518
  table-layout: fixed;
503
- // Fixes Chrome border clipping bug ED-15245
504
- background: ${tableBorderColor(props)};
505
519
 
506
520
  .${ClassName.COLUMN_CONTROLS_DECORATIONS} + * {
507
521
  margin-top: 0;
@@ -538,6 +552,7 @@ export const tableStyles = props => {
538
552
  right: 0;
539
553
  top: 0;
540
554
  bottom: 0;
555
+ width: 100%;
541
556
  pointer-events: none;
542
557
  }
543
558
  .${ClassName.SELECTED_CELL} {
@@ -545,10 +560,32 @@ export const tableStyles = props => {
545
560
  }
546
561
  .${ClassName.SELECTED_CELL}::after {
547
562
  background: ${tableCellSelectedColor};
563
+ z-index: ${akEditorSmallZIndex};
548
564
  }
549
565
  th.${ClassName.HOVERED_CELL_IN_DANGER}::after,
550
566
  td.${ClassName.HOVERED_CELL_IN_DANGER}::after {
551
567
  background: ${tableCellDeleteColor};
568
+ z-index: ${akEditorUnitZIndex * 100};
569
+ }
570
+ // ED-15246: Trello card is visible through a border of a table border
571
+ td.${ClassName.HOVERED_CELL}, td.${ClassName.SELECTED_CELL} {
572
+ &::after {
573
+ height: 100%;
574
+ width: 100%;
575
+ border: 1px solid ${tableBorderSelectedColor};
576
+ content: '';
577
+ position: absolute;
578
+ left: -1px;
579
+ top: -1px;
580
+ bottom: 0;
581
+ z-index: ${akEditorSmallZIndex};
582
+ display: inline-block;
583
+ pointer-events: none;
584
+ }
585
+ &.${ClassName.HOVERED_CELL_IN_DANGER}::after {
586
+ border: 1px solid ${tableBorderDeleteColor};
587
+ z-index: ${akEditorUnitZIndex * 100};
588
+ }
552
589
  }
553
590
  }
554
591
  .${ClassName.ROW_CONTROLS_WRAPPER} {
@@ -13,40 +13,76 @@ export const createCellHoverDecoration = (cells, type) => cells.map(cell => Deco
13
13
  }, {
14
14
  key: TableDecorations.CELL_CONTROLS_HOVER
15
15
  }));
16
- export const createControlsHoverDecoration = (cells, type, danger, selected) => cells.map(cell => {
17
- const classes = [ClassName.HOVERED_CELL];
16
+ export const createControlsHoverDecoration = (cells, type, tr, danger, selected) => {
17
+ const table = findTable(tr.selection);
18
18
 
19
- if (danger) {
20
- classes.push(ClassName.HOVERED_CELL_IN_DANGER);
19
+ if (!table) {
20
+ return [];
21
21
  }
22
22
 
23
- if (selected) {
24
- classes.push(ClassName.SELECTED_CELL);
25
- }
23
+ const map = TableMap.get(table.node);
24
+ const [min, max] = cells.reduce(([min, max], cell) => {
25
+ if (min === null || cell.pos < min) {
26
+ min = cell.pos;
27
+ }
26
28
 
27
- classes.push(type === 'column' ? ClassName.HOVERED_COLUMN : type === 'row' ? ClassName.HOVERED_ROW : ClassName.HOVERED_TABLE);
28
- let key;
29
+ if (max === null || cell.pos > max) {
30
+ max = cell.pos;
31
+ }
32
+
33
+ return [min, max];
34
+ }, [null, null]);
29
35
 
30
- switch (type) {
31
- case 'row':
32
- key = TableDecorations.ROW_CONTROLS_HOVER;
33
- break;
36
+ if (min === null || max === null) {
37
+ return [];
38
+ }
34
39
 
35
- case 'column':
36
- key = TableDecorations.COLUMN_CONTROLS_HOVER;
37
- break;
40
+ let updatedCells = cells.map(x => x.pos); // ED-15246 fixed trello card table overflow issue
41
+ // If columns / rows have been merged the hovered selection is different to the actual selection
42
+ // So If the table cells are in danger we want to create a "rectangle" selection
43
+ // to match the "clicked" selection
38
44
 
39
- default:
40
- key = TableDecorations.TABLE_CONTROLS_HOVER;
41
- break;
45
+ if (danger) {
46
+ const rect = map.rectBetween(min - table.start, max - table.start);
47
+ updatedCells = map.cellsInRect(rect).map(x => x + table.start);
42
48
  }
43
49
 
44
- return Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
45
- class: classes.join(' ')
46
- }, {
47
- key
50
+ return updatedCells.map(pos => {
51
+ const cell = tr.doc.nodeAt(pos);
52
+ const classes = [ClassName.HOVERED_CELL];
53
+
54
+ if (danger) {
55
+ classes.push(ClassName.HOVERED_CELL_IN_DANGER);
56
+ }
57
+
58
+ if (selected) {
59
+ classes.push(ClassName.SELECTED_CELL);
60
+ }
61
+
62
+ classes.push(type === 'column' ? ClassName.HOVERED_COLUMN : type === 'row' ? ClassName.HOVERED_ROW : ClassName.HOVERED_TABLE);
63
+ let key;
64
+
65
+ switch (type) {
66
+ case 'row':
67
+ key = TableDecorations.ROW_CONTROLS_HOVER;
68
+ break;
69
+
70
+ case 'column':
71
+ key = TableDecorations.COLUMN_CONTROLS_HOVER;
72
+ break;
73
+
74
+ default:
75
+ key = TableDecorations.TABLE_CONTROLS_HOVER;
76
+ break;
77
+ }
78
+
79
+ return Decoration.node(pos, pos + cell.nodeSize, {
80
+ class: classes.join(' ')
81
+ }, {
82
+ key
83
+ });
48
84
  });
49
- });
85
+ };
50
86
  export const createColumnSelectedDecoration = tr => {
51
87
  const {
52
88
  selection,
@@ -20,6 +20,7 @@ class Task extends ReactNodeView {
20
20
  state: isChecked ? 'DONE' : 'TODO',
21
21
  localId: taskId
22
22
  });
23
+ tr.setMeta('scrollIntoView', false);
23
24
  this.view.dispatch(tr);
24
25
  });
25
26
 
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React, { useRef, useEffect, useCallback, Fragment } from 'react';
2
+ import React, { useRef, useCallback, Fragment, useLayoutEffect } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { keyName as keyNameNormalized } from 'w3c-keyname';
5
5
  import { browser, ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/utils';
@@ -85,6 +85,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
85
85
  addPrefixTrigger: true,
86
86
  setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED
87
87
  });
88
+ stopDefault = true;
88
89
  break;
89
90
 
90
91
  case 'Backspace':
@@ -146,7 +147,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
146
147
  (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.focus();
147
148
  return false;
148
149
  }, [onQueryFocus]);
149
- useEffect(() => {
150
+ useLayoutEffect(() => {
150
151
  if (!ref.current) {
151
152
  return;
152
153
  }
@@ -307,7 +308,7 @@ export const InputQuery = /*#__PURE__*/React.memo(({
307
308
  }
308
309
  };
309
310
  }, [triggerQueryPrefix, cleanedInputContent, onQueryFocus, cancel, checkKeyEvent]);
310
- useEffect(() => {
311
+ useLayoutEffect(() => {
311
312
  const hasReopenQuery = typeof reopenQuery === 'string' && reopenQuery.trim().length > 0;
312
313
 
313
314
  if (ref.current && forceFocus) {