@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
@@ -34,6 +34,7 @@ import Announcer from '../../../utils/announcer/announcer';
34
34
  import { injectIntl } from 'react-intl-next';
35
35
  import messages from './messages';
36
36
  import { token } from '@atlaskit/tokens';
37
+ import { decorationStateKey, ACTIONS } from '../../base/pm-plugins/decoration';
37
38
  var akGridSize = gridSize();
38
39
 
39
40
  var toolbarContainer = function toolbarContainer(theme) {
@@ -132,6 +133,44 @@ var Toolbar = /*#__PURE__*/function (_Component) {
132
133
  }
133
134
 
134
135
  _createClass(Toolbar, [{
136
+ key: "resetStyling",
137
+ value: // remove any decorations added by toolbar buttons i.e danger and selected styling
138
+ // this prevents https://product-fabric.atlassian.net/browse/ED-10207
139
+ function resetStyling(_ref) {
140
+ var table = _ref.table;
141
+
142
+ if (this.props.editorView) {
143
+ var _this$props$editorVie = this.props.editorView,
144
+ state = _this$props$editorVie.state,
145
+ dispatch = _this$props$editorVie.dispatch; // tables use their own decorations
146
+ // TODO fix for tables https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-617
147
+
148
+ if (table) {
149
+ return null;
150
+ }
151
+
152
+ dispatch(state.tr.setMeta(decorationStateKey, {
153
+ action: ACTIONS.DECORATION_REMOVE
154
+ }));
155
+ }
156
+ }
157
+ }, {
158
+ key: "componentDidUpdate",
159
+ value: function componentDidUpdate(prevProps) {
160
+ if (this.props.node !== prevProps.node) {
161
+ this.resetStyling({
162
+ table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
163
+ });
164
+ }
165
+ }
166
+ }, {
167
+ key: "componentWillUnmount",
168
+ value: function componentWillUnmount() {
169
+ this.resetStyling({
170
+ table: this.props.node.type.name === 'table'
171
+ });
172
+ }
173
+ }, {
135
174
  key: "render",
136
175
  value: function render() {
137
176
  var _this$props = this.props,
@@ -302,8 +341,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
302
341
  return null;
303
342
  }
304
343
 
305
- var _ref = getFeatureFlags(editorView.state) || {},
306
- extendFloatingToolbar = _ref.extendFloatingToolbar;
344
+ var _ref2 = getFeatureFlags(editorView.state) || {},
345
+ extendFloatingToolbar = _ref2.extendFloatingToolbar;
307
346
 
308
347
  if (!extendFloatingToolbar) {
309
348
  return null;
@@ -10,6 +10,7 @@ import { stateKey } from './pm-plugins/main';
10
10
  import { removeLink, editInsertedLink, updateLink, insertLinkWithAnalytics } from './commands';
11
11
  import HyperlinkAddToolbar from './ui/HyperlinkAddToolbar';
12
12
  import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
13
+ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
13
14
  import OpenIcon from '@atlaskit/icon/glyph/shortcut';
14
15
  import { normalizeUrl } from './utils';
15
16
  import { linkToolbarMessages as linkToolbarCommonMessages, linkMessages } from '../../messages';
@@ -17,20 +18,31 @@ import { isSafeUrl } from '@atlaskit/adf-schema';
17
18
  import { RECENT_SEARCH_HEIGHT_IN_PX, RECENT_SEARCH_WIDTH_IN_PX } from '../../ui/LinkSearch/ToolbarComponents';
18
19
  import { HyperlinkToolbarAppearance } from './HyperlinkToolbarAppearance';
19
20
  import { addAnalytics, ACTION_SUBJECT_ID } from '../analytics';
20
- import { buildVisitedLinkPayload } from '../../utils/linking-utils';
21
+ import { buildVisitedLinkPayload, buildOpenedSettingsPayload } from '../../utils/linking-utils';
21
22
  import { getCopyButtonConfig, showCopyButton } from '../copy-button/toolbar';
22
-
23
+ import { getFeatureFlags } from '../feature-flags-context';
23
24
  /* type guard for edit links */
25
+
24
26
  function isEditLink(linkMark) {
25
27
  return linkMark.pos !== undefined;
26
28
  }
27
29
 
30
+ var dispatchAnalytics = function dispatchAnalytics(dispatch, state, analyticsBuilder) {
31
+ if (dispatch) {
32
+ dispatch(addAnalytics(state, state.tr, analyticsBuilder(ACTION_SUBJECT_ID.HYPERLINK)));
33
+ }
34
+ };
35
+
28
36
  var visitHyperlink = function visitHyperlink() {
29
37
  return function (state, dispatch) {
30
- if (dispatch) {
31
- dispatch(addAnalytics(state, state.tr, buildVisitedLinkPayload(ACTION_SUBJECT_ID.HYPERLINK)));
32
- }
38
+ dispatchAnalytics(dispatch, state, buildVisitedLinkPayload);
39
+ return true;
40
+ };
41
+ };
33
42
 
43
+ var openLinkSettings = function openLinkSettings() {
44
+ return function (state, dispatch) {
45
+ dispatchAnalytics(dispatch, state, buildOpenedSettingsPayload);
34
46
  return true;
35
47
  };
36
48
  };
@@ -53,6 +65,29 @@ function getLinkText(activeLinkMark, state) {
53
65
  return activeLinkMark.node.text;
54
66
  }
55
67
 
68
+ var getCopyButtonGroup = function getCopyButtonGroup(state, intl, nodeType) {
69
+ return state && showCopyButton(state) ? [{
70
+ type: 'separator'
71
+ }, getCopyButtonConfig(state, intl.formatMessage, nodeType)] : [];
72
+ };
73
+
74
+ var getSettingsButtonGroup = function getSettingsButtonGroup(state, intl) {
75
+ var _getFeatureFlags = getFeatureFlags(state),
76
+ floatingToolbarLinkSettingsButton = _getFeatureFlags.floatingToolbarLinkSettingsButton;
77
+
78
+ return floatingToolbarLinkSettingsButton === 'true' ? [{
79
+ type: 'separator'
80
+ }, {
81
+ id: 'editor.link.settings',
82
+ type: 'button',
83
+ icon: CogIcon,
84
+ title: intl.formatMessage(linkToolbarCommonMessages.settingsLink),
85
+ onClick: openLinkSettings(),
86
+ href: 'https://id.atlassian.com/manage-profile/link-preferences',
87
+ target: '_blank'
88
+ }] : [];
89
+ };
90
+
56
91
  export var getToolbarConfig = function getToolbarConfig(options) {
57
92
  return function (state, intl, providerFactory) {
58
93
  var formatMessage = intl.formatMessage;
@@ -107,8 +142,8 @@ export var getToolbarConfig = function getToolbarConfig(options) {
107
142
  editorView: editorView,
108
143
  editorState: state,
109
144
  cardOptions: options === null || options === void 0 ? void 0 : options.cardOptions,
110
- providerFactory: providerFactory // platform={} // TODO: pass platform
111
-
145
+ providerFactory: providerFactory,
146
+ platform: options === null || options === void 0 ? void 0 : options.platform
112
147
  });
113
148
  }
114
149
  }, {
@@ -144,9 +179,7 @@ export var getToolbarConfig = function getToolbarConfig(options) {
144
179
  title: labelUnlink,
145
180
  icon: UnlinkIcon,
146
181
  tabIndex: null
147
- }].concat(_toConsumableArray(state && showCopyButton(state) ? [{
148
- type: 'separator'
149
- }, getCopyButtonConfig(state, intl.formatMessage, hyperLinkToolbar.nodeType)] : []))
182
+ }].concat(_toConsumableArray(getCopyButtonGroup(state, intl, hyperLinkToolbar.nodeType)), _toConsumableArray(getSettingsButtonGroup(state, intl)))
150
183
  });
151
184
  }
152
185
 
@@ -56,10 +56,6 @@ export var findMediaNode = function findMediaNode(mediaPluginState, id, isMediaS
56
56
 
57
57
  return mediaNodeWithPos;
58
58
  };
59
- export var isMobileUploadCompleted = function isMobileUploadCompleted(mediaPluginState, mediaId) {
60
- return !!mediaPluginState.mediaOptions && // This flag tells us that it's a 'mobile' env.
61
- !!mediaPluginState.mediaOptions.allowMarkingUploadsAsIncomplete && typeof mediaPluginState.mobileUploadComplete[mediaId] === 'boolean' ? mediaPluginState.mobileUploadComplete[mediaId] : undefined;
62
- };
63
59
  export var isMediaNode = function isMediaNode(pos, state) {
64
60
  var node = state.doc.nodeAt(pos);
65
61
  return node && ['media', 'mediaInline'].includes(node.type.name);
@@ -180,7 +180,7 @@ var mediaPlugin = function mediaPlugin(options) {
180
180
  title: formatMessage(messages.filesAndImages),
181
181
  description: formatMessage(messages.filesAndImagesDescription),
182
182
  priority: 400,
183
- keywords: ['attachment', 'gif', 'media', 'picture'],
183
+ keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video'],
184
184
  icon: function icon() {
185
185
  return /*#__PURE__*/React.createElement(IconImages, null);
186
186
  },
@@ -19,8 +19,6 @@ import React from 'react';
19
19
  import { SelectionBasedNodeView } from '../../../../nodeviews';
20
20
  import WithPluginState from '../../../../ui/WithPluginState';
21
21
  import { pluginKey as widthPluginKey } from '../../../width';
22
- import { isMobileUploadCompleted } from '../../commands/helpers';
23
- import { stateKey as mediaStateKey } from '../../pm-plugins/plugin-key';
24
22
  import MediaNode from './media';
25
23
  import { getAttrsFromUrl } from '@atlaskit/media-client';
26
24
  import { isMediaBlobUrlFromAttrs } from '../../utils/media-common';
@@ -89,7 +87,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
89
87
  url: url,
90
88
  mediaProvider: mediaProvider,
91
89
  contextIdentifierProvider: contextIdentifierProvider,
92
- uploadComplete: _this.uploadComplete(),
93
90
  mediaOptions: mediaOptions
94
91
  });
95
92
  };
@@ -158,11 +155,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
158
155
  var attrs = this.getAttrs();
159
156
  return isMediaBlobUrlFromAttrs(attrs);
160
157
  }
161
- }, {
162
- key: "uploadComplete",
163
- value: function uploadComplete() {
164
- return isMobileUploadCompleted(mediaStateKey.getState(this.view.state), this.node.attrs.id);
165
- }
166
158
  }, {
167
159
  key: "render",
168
160
  value: function render() {
@@ -116,7 +116,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
116
116
  value: function shouldComponentUpdate(nextProps, nextState) {
117
117
  var hasNewViewMediaClientConfig = !this.state.viewMediaClientConfig && nextState.viewMediaClientConfig;
118
118
 
119
- if (this.props.selected !== nextProps.selected || this.props.uploadComplete !== nextProps.uploadComplete || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || hasNewViewMediaClientConfig) {
119
+ if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || hasNewViewMediaClientConfig) {
120
120
  return true;
121
121
  }
122
122
 
@@ -185,7 +185,6 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
185
185
  var _this$props = this.props,
186
186
  node = _this$props.node,
187
187
  selected = _this$props.selected,
188
- uploadComplete = _this$props.uploadComplete,
189
188
  originalDimensions = _this$props.originalDimensions,
190
189
  isLoading = _this$props.isLoading,
191
190
  maxDimensions = _this$props.maxDimensions,
@@ -200,7 +199,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
200
199
  url = _node$attrs.url,
201
200
  alt = _node$attrs.alt;
202
201
 
203
- if (isLoading || type !== 'external' && (!viewMediaClientConfig || typeof uploadComplete === 'boolean' && !uploadComplete)) {
202
+ if (isLoading || type !== 'external' && !viewMediaClientConfig) {
204
203
  return /*#__PURE__*/React.createElement(MediaCardWrapper, {
205
204
  dimensions: originalDimensions
206
205
  }, /*#__PURE__*/React.createElement(CardLoading, null));
@@ -35,6 +35,7 @@ var PickerFacade = /*#__PURE__*/function () {
35
35
  fileName: file.name,
36
36
  fileSize: file.size,
37
37
  fileMimeType: file.type,
38
+ collection: file.collectionName,
38
39
  dimensions: dimensions,
39
40
  scaleFactor: scaleFactor,
40
41
  status: isErroredFile ? 'error' : undefined
@@ -84,8 +84,6 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
84
84
 
85
85
  _defineProperty(this, "mediaGroupNodes", {});
86
86
 
87
- _defineProperty(this, "mobileUploadComplete", {});
88
-
89
87
  _defineProperty(this, "pendingTask", Promise.resolve(null));
90
88
 
91
89
  _defineProperty(this, "destroyed", false);
@@ -269,7 +267,7 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
269
267
  });
270
268
 
271
269
  _defineProperty(this, "insertFile", function (mediaState, onMediaStateChanged, pickerType) {
272
- var _this$mediaOptions2;
270
+ var _mediaState$collectio, _this$mediaOptions2;
273
271
 
274
272
  var state = _this.view.state;
275
273
 
@@ -277,14 +275,10 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
277
275
  contextId: _this.contextIdentifierProvider ? _this.contextIdentifierProvider.objectId : undefined
278
276
  });
279
277
 
280
- var collection = _this.collectionFromProvider();
278
+ var collection = (_mediaState$collectio = mediaState.collection) !== null && _mediaState$collectio !== void 0 ? _mediaState$collectio : _this.collectionFromProvider();
281
279
 
282
280
  if (collection === undefined) {
283
281
  return;
284
- }
285
-
286
- if (_this.mediaOptions && _this.mediaOptions.allowMarkingUploadsAsIncomplete) {
287
- _this.mobileUploadComplete[mediaStateWithContext.id] = false;
288
282
  } // We need to dispatch the change to event dispatcher only for successful files
289
283
 
290
284
 
@@ -492,19 +486,13 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
492
486
  attrs.collection = state.collection;
493
487
  }
494
488
 
495
- _this.updateMediaNodeAttrs(state.id, attrs, isMediaSingle(_this.view.state.schema, state.fileMimeType)); // mark mobile upload as complete
489
+ _this.updateMediaNodeAttrs(state.id, attrs, isMediaSingle(_this.view.state.schema, state.fileMimeType));
496
490
 
497
-
498
- _this.mobileUploadComplete[attrs.id] = true;
499
491
  delete _this.mediaGroupNodes[state.id];
500
492
  break;
501
493
  }
502
494
  });
503
495
 
504
- _defineProperty(this, "isMobileUploadCompleted", function (mediaId) {
505
- return helpers.isMobileUploadCompleted(_this, mediaId);
506
- });
507
-
508
496
  _defineProperty(this, "removeNodeById", function (state) {
509
497
  var id = state.id;
510
498
  var mediaNodeWithPos = helpers.findMediaNode(_this, id, isImage(state.fileMimeType));
@@ -16,10 +16,10 @@ 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 { compose, insideTable, isParagraph, isText, isLinkMark, processRawValue, insideTableCell } from '../../utils';
19
+ import { compose, insideTable, isParagraph, isText, isLinkMark, insideTableCell } from '../../utils';
20
20
  import { mapSlice } from '../../utils/slice';
21
21
  import { INPUT_METHOD } from '../analytics';
22
- import { insertCard, queueCardsFromChangedTr } from '../card/pm-plugins/doc';
22
+ import { queueCardsFromChangedTr } from '../card/pm-plugins/doc';
23
23
  import { GapCursorSelection, Side } from '../selection/gap-cursor-selection';
24
24
  import { linkifyContent } from '../hyperlink/utils';
25
25
  import { runMacroAutoConvert } from '../macro';
@@ -281,12 +281,12 @@ export function handlePastePreservingMarks(slice) {
281
281
  };
282
282
  }
283
283
 
284
- function isLinkSmart(_x, _x2, _x3) {
285
- return _isLinkSmart.apply(this, arguments);
284
+ function getSmartLinkAdf(_x, _x2, _x3) {
285
+ return _getSmartLinkAdf.apply(this, arguments);
286
286
  }
287
287
 
288
- function _isLinkSmart() {
289
- _isLinkSmart = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, type, cardOptions) {
288
+ function _getSmartLinkAdf() {
289
+ _getSmartLinkAdf = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(text, type, cardOptions) {
290
290
  var provider;
291
291
  return _regeneratorRuntime.wrap(function _callee$(_context) {
292
292
  while (1) {
@@ -318,7 +318,7 @@ function _isLinkSmart() {
318
318
  }
319
319
  }, _callee);
320
320
  }));
321
- return _isLinkSmart.apply(this, arguments);
321
+ return _getSmartLinkAdf.apply(this, arguments);
322
322
  }
323
323
 
324
324
  function insertAutoMacro(slice, macro, view) {
@@ -338,7 +338,7 @@ function insertAutoMacro(slice, macro, view) {
338
338
  }
339
339
 
340
340
  export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoConverter) {
341
- return function (state, _dispatch, view) {
341
+ return function (state, dispatch, view) {
342
342
  var macro = null; // try to use auto convert from extension provider first
343
343
 
344
344
  if (extensionAutoConverter) {
@@ -363,21 +363,10 @@ export function handleMacroAutoConvert(text, slice, cardsOptions, extensionAutoC
363
363
  return insertAutoMacro(slice, macro, view);
364
364
  }
365
365
 
366
- isLinkSmart(text, 'inline', cardsOptions).then(function (cardData) {
367
- if (!view) {
368
- throw new Error('Missing view');
369
- }
370
-
371
- var _view$state = view.state,
372
- schema = _view$state.schema,
373
- tr = _view$state.tr;
374
- var cardAdf = processRawValue(schema, cardData);
375
-
376
- if (!cardAdf) {
377
- throw new Error('Received invalid ADF from CardProvider');
366
+ getSmartLinkAdf(text, 'inline', cardsOptions).then(function () {
367
+ if (dispatch) {
368
+ handleMarkdown(slice)(state, dispatch);
378
369
  }
379
-
380
- view.dispatch(insertCard(tr, cardAdf, schema));
381
370
  }).catch(function () {
382
371
  return insertAutoMacro(slice, macro, view);
383
372
  });
@@ -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 var 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,58 @@
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
+ var newline = function newline(state, silent) {
4
+ var 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 (function (md) {
57
+ return md.inline.ruler.at('newline', newline);
58
+ });
@@ -0,0 +1,63 @@
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
+ var paragraph = function paragraph(state, startLine) {
4
+ var 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 (function (md) {
62
+ return md.block.ruler.at('paragraph', paragraph);
63
+ });
@@ -46,13 +46,13 @@ export var hoverMergedCells = function hoverMergedCells() {
46
46
  };
47
47
  export var hoverColumns = function hoverColumns(hoveredColumns, isInDanger) {
48
48
  return createCommand(function (state) {
49
- var cells = getCellsInColumn(hoveredColumns)(state.selection);
49
+ var cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
50
50
 
51
51
  if (!cells) {
52
52
  return false;
53
53
  }
54
54
 
55
- var decorations = createControlsHoverDecoration(cells, 'column', isInDanger);
55
+ var decorations = createControlsHoverDecoration(cells, 'column', state.tr, isInDanger);
56
56
  return {
57
57
  type: 'HOVER_COLUMNS',
58
58
  data: {
@@ -73,7 +73,7 @@ export var hoverRows = function hoverRows(hoveredRows, isInDanger) {
73
73
  return false;
74
74
  }
75
75
 
76
- var decorations = createControlsHoverDecoration(cells, 'row', isInDanger);
76
+ var decorations = createControlsHoverDecoration(cells, 'row', state.tr, isInDanger);
77
77
  return {
78
78
  type: 'HOVER_ROWS',
79
79
  data: {
@@ -103,7 +103,7 @@ export var hoverTable = function hoverTable(isInDanger, isSelected) {
103
103
  return false;
104
104
  }
105
105
 
106
- var decorations = createControlsHoverDecoration(cells, 'table', isInDanger, isSelected);
106
+ var decorations = createControlsHoverDecoration(cells, 'table', state.tr, isInDanger, isSelected);
107
107
  return {
108
108
  type: 'HOVER_TABLE',
109
109
  data: {
@@ -93,7 +93,8 @@ var CornerControls = /*#__PURE__*/function (_Component) {
93
93
  }),
94
94
  style: {
95
95
  top: this.props.stickyTop !== undefined ? "".concat(this.props.stickyTop, "px") : undefined
96
- }
96
+ },
97
+ contentEditable: false
97
98
  }, /*#__PURE__*/React.createElement("button", {
98
99
  type: "button",
99
100
  className: classnames(ClassName.CONTROLS_CORNER_BUTTON, {