@atlaskit/editor-core 166.0.3 → 166.0.4

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 (82) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -2
  3. package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +0 -1
  4. package/dist/cjs/plugins/collab-edit/index.js +2 -2
  5. package/dist/cjs/plugins/collab-edit/provider/channel.js +2 -2
  6. package/dist/cjs/plugins/extension/context-panel.js +2 -2
  7. package/dist/cjs/plugins/extension/plugin-factory.js +1 -4
  8. package/dist/cjs/plugins/extension/pm-plugins/main.js +13 -36
  9. package/dist/cjs/plugins/extension/utils.js +12 -57
  10. package/dist/cjs/plugins/feedback-dialog/index.js +0 -1
  11. package/dist/cjs/plugins/find-replace/utils/batch-decorations.js +0 -1
  12. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +2 -2
  13. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  14. package/dist/cjs/plugins/macro/actions.js +2 -2
  15. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +2 -2
  16. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
  17. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +2 -2
  18. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +2 -2
  19. package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +2 -2
  20. package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +2 -2
  21. package/dist/cjs/ui/ConfigPanel/transformers.js +2 -2
  22. package/dist/cjs/version-wrapper.js +1 -1
  23. package/dist/cjs/version.json +1 -1
  24. package/dist/es2019/plugins/extension/plugin-factory.js +1 -3
  25. package/dist/es2019/plugins/extension/pm-plugins/main.js +12 -38
  26. package/dist/es2019/plugins/extension/utils.js +2 -37
  27. package/dist/es2019/version-wrapper.js +1 -1
  28. package/dist/es2019/version.json +1 -1
  29. package/dist/esm/actions/index.js +1 -1
  30. package/dist/esm/create-editor/ErrorBoundary.js +1 -1
  31. package/dist/esm/editor.js +1 -2
  32. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +1 -1
  33. package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +0 -1
  34. package/dist/esm/plugins/collab-edit/index.js +1 -1
  35. package/dist/esm/plugins/collab-edit/provider/channel.js +1 -1
  36. package/dist/esm/plugins/custom-autoformat/doc.js +1 -1
  37. package/dist/esm/plugins/custom-autoformat/index.js +1 -1
  38. package/dist/esm/plugins/extension/actions.js +1 -1
  39. package/dist/esm/plugins/extension/context-panel.js +1 -1
  40. package/dist/esm/plugins/extension/plugin-factory.js +1 -3
  41. package/dist/esm/plugins/extension/pm-plugins/main.js +12 -35
  42. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +1 -1
  43. package/dist/esm/plugins/extension/utils.js +9 -51
  44. package/dist/esm/plugins/feedback-dialog/index.js +1 -2
  45. package/dist/esm/plugins/feedback-dialog/loadJiraCollectorDialogScript.js +1 -1
  46. package/dist/esm/plugins/find-replace/utils/batch-decorations.js +1 -2
  47. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +1 -1
  48. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  49. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -2
  50. package/dist/esm/plugins/image-upload/pm-plugins/main.js +1 -1
  51. package/dist/esm/plugins/macro/actions.js +1 -1
  52. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +1 -1
  53. package/dist/esm/plugins/media/nodeviews/mediaInline.js +1 -2
  54. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +1 -1
  55. package/dist/esm/plugins/media/nodeviews/mediaNodeView/media.js +1 -1
  56. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
  57. package/dist/esm/plugins/media/picker-facade.js +1 -1
  58. package/dist/esm/plugins/media/pm-plugins/main.js +1 -1
  59. package/dist/esm/plugins/media/toolbar/utils.js +1 -1
  60. package/dist/esm/plugins/media/ui/MediaPicker/PickerFacadeProvider.js +1 -1
  61. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +1 -1
  62. package/dist/esm/plugins/media/utils/check-media-type.js +1 -1
  63. package/dist/esm/plugins/paste/handlers.js +1 -1
  64. package/dist/esm/plugins/paste/pm-plugins/main.js +1 -1
  65. package/dist/esm/plugins/quick-insert/index.js +1 -1
  66. package/dist/esm/plugins/tasks-and-decisions/ui/Task/task-item-with-providers.js +1 -1
  67. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +1 -1
  68. package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +1 -1
  69. package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +1 -1
  70. package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +1 -1
  71. package/dist/esm/ui/ConfigPanel/transformers.js +1 -1
  72. package/dist/esm/ui/LinkSearch/index.js +1 -1
  73. package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
  74. package/dist/esm/utils/action.js +1 -1
  75. package/dist/esm/utils/clipboard.js +1 -1
  76. package/dist/esm/utils/extensions.js +1 -1
  77. package/dist/esm/version-wrapper.js +1 -1
  78. package/dist/esm/version.json +1 -1
  79. package/dist/types/plugins/extension/pm-plugins/main.d.ts +1 -2
  80. package/dist/types/plugins/extension/types.d.ts +0 -1
  81. package/dist/types/plugins/extension/utils.d.ts +1 -3
  82. package/package.json +1 -1
@@ -1,25 +1,15 @@
1
1
  import { findParentNodeOfType, findSelectedNodeOfType, findDomRefAtPos } from 'prosemirror-utils';
2
2
  import { closestElement } from '../../utils/dom';
3
3
  import { findNodePosByLocalIds } from '../../utils/nodes-by-localIds';
4
-
5
- const getSelectedExtensionByTransaction = (transaction, searchParent = true) => {
6
- return _getSelectedExtension(transaction.doc.type.schema, transaction.selection, searchParent);
7
- };
8
-
9
4
  export const getSelectedExtension = (state, searchParent = false) => {
10
- return _getSelectedExtension(state.schema, state.selection, searchParent);
11
- };
12
-
13
- const _getSelectedExtension = (schema, selection, searchParent) => {
14
5
  const {
15
6
  inlineExtension,
16
7
  extension,
17
8
  bodiedExtension
18
- } = schema.nodes;
9
+ } = state.schema.nodes;
19
10
  const nodeTypes = [extension, bodiedExtension, inlineExtension];
20
- return findSelectedNodeOfType(nodeTypes)(selection) || searchParent && findParentNodeOfType(nodeTypes)(selection) || undefined;
11
+ return findSelectedNodeOfType(nodeTypes)(state.selection) || searchParent && findParentNodeOfType(nodeTypes)(state.selection) || undefined;
21
12
  };
22
-
23
13
  export const findExtensionWithLocalId = (state, localId) => {
24
14
  const selectedExtension = getSelectedExtension(state, true);
25
15
 
@@ -72,29 +62,4 @@ export const getNodeTypesReferenced = (ids, state) => {
72
62
  export const findNodePosWithLocalId = (state, localId) => {
73
63
  const nodes = findNodePosByLocalIds(state, [localId]);
74
64
  return nodes.length >= 1 ? nodes[0] : undefined;
75
- };
76
- export const onSelectionChanged = (tr, state) => {
77
- const selectedExtension = getSelectedExtensionByTransaction(tr, true);
78
- const hasUnselectedExtension = !!state.element && !selectedExtension;
79
- /*
80
- * We use this to indicate to our plugin that the selection has changed.
81
- *
82
- * - ignore if shouldRefreshEditButton already set
83
- * - restrict to scenarios when an extension is
84
- * - a) actually selected
85
- * - b) or un-selected (not accounting for selection extensionA -> extensionB)
86
- *
87
- * The rest of the logic will be handled in Extension main plugin view update().
88
- *
89
- * Known issue: typing inside of a bodiedExtension will trigger state changes each keystroke
90
- * as the toolbar always being open while it is focused.
91
- */
92
-
93
- if (!state.shouldRefreshEditButton && (selectedExtension || hasUnselectedExtension)) {
94
- return { ...state,
95
- shouldRefreshEditButton: true
96
- };
97
- }
98
-
99
- return state;
100
65
  };
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "166.0.3";
2
+ export const version = "166.0.4";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "166.0.3",
3
+ "version": "166.0.4",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,8 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import { Node } from 'prosemirror-model';
7
7
  import { TextSelection } from 'prosemirror-state';
8
8
  import { toJSON } from '../utils';
@@ -1,3 +1,4 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
12
 
@@ -1,3 +1,4 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -14,8 +15,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
14
15
 
15
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
17
 
17
- import _regeneratorRuntime from "@babel/runtime/regenerator";
18
-
19
18
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
20
19
 
21
20
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import { RESOLVE_METHOD } from './../../analytics/types/inline-comment-events';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import { AnnotationTypes } from '@atlaskit/adf-schema';
@@ -52,7 +52,6 @@ var _pluginFactory = pluginFactory(inlineCommentPluginKey, reducer, {
52
52
  } // return same pluginState if mappings did not change
53
53
 
54
54
 
55
- // return same pluginState if mappings did not change
56
55
  if (mappedBookmark === bookmark && mappedDecorationSet === draftDecorationSet) {
57
56
  return pluginState;
58
57
  }
@@ -1,6 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import { collab } from 'prosemirror-collab';
5
5
  import { createPlugin, pluginKey } from './plugin';
6
6
  import { sendTransaction } from './events/send-transaction';
@@ -1,9 +1,9 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/createClass";
5
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
6
- import _regeneratorRuntime from "@babel/runtime/regenerator";
7
7
  import { utils } from '@atlaskit/util-service-support';
8
8
  import { EventEmitter2 } from 'eventemitter2';
9
9
  import { getVersion, sendableSteps } from 'prosemirror-collab';
@@ -1,5 +1,5 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import { closeHistory } from 'prosemirror-history';
4
4
  import { processRawValue } from '../../utils';
5
5
  import { autoformatAction } from './utils';
@@ -1,6 +1,6 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
 
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
 
@@ -1,6 +1,6 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
 
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
 
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  import _typeof from "@babel/runtime/helpers/typeof";
@@ -7,7 +8,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
7
8
 
8
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
10
 
10
- import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  import React from 'react';
12
12
  import { getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
13
13
  import { getPluginState } from './pm-plugins/main';
@@ -7,7 +7,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
7
7
  import { pluginFactory } from '../../utils/plugin-state-factory';
8
8
  import reducer from './reducer';
9
9
  import { pluginKey } from './plugin-key';
10
- import { onSelectionChanged } from './utils';
11
10
  var factory = pluginFactory(pluginKey, reducer, {
12
11
  mapping: function mapping(tr, state) {
13
12
  var _ref = state,
@@ -26,8 +25,7 @@ var factory = pluginFactory(pluginKey, reducer, {
26
25
  return _objectSpread(_objectSpread({}, state), {}, {
27
26
  positions: positions
28
27
  });
29
- },
30
- onSelectionChanged: onSelectionChanged
28
+ }
31
29
  });
32
30
  export var createPluginState = factory.createPluginState;
33
31
  export var createCommand = factory.createCommand;
@@ -1,6 +1,6 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { getExtensionModuleNode } from '@atlaskit/editor-common/extensions';
6
6
  import { createSelectionClickHandler } from '../../selection/utils';
@@ -251,7 +251,6 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
251
251
  var useLongPressSelection = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
252
252
  var options = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
253
253
  var state = createPluginState(dispatch, {
254
- shouldRefreshEditButton: false,
255
254
  showEditButton: false,
256
255
  showContextPanel: false
257
256
  });
@@ -275,45 +274,25 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
275
274
  element = _getPluginState.element,
276
275
  localId = _getPluginState.localId,
277
276
  extensionProvider = _getPluginState.extensionProvider,
278
- showContextPanel = _getPluginState.showContextPanel,
279
- shouldRefreshEditButton = _getPluginState.shouldRefreshEditButton;
277
+ showContextPanel = _getPluginState.showContextPanel; // This fetches the selected extension node, either by keyboard selection or click for all types of extensions
280
278
 
281
- if (!shouldRefreshEditButton) {
282
- return false;
283
- } // This fetches the selected extension node, either by keyboard selection or click for all types of extensions
284
279
 
285
-
286
- var selectedExtension = getSelectedExtension(state, true); // If our selection isn't on an extension node, clear some state and hide the config panel
280
+ var selectedExtension = getSelectedExtension(state, true);
287
281
 
288
282
  if (!selectedExtension) {
289
283
  if (showContextPanel) {
290
284
  clearEditingContext(state, dispatch);
291
285
  }
292
286
 
293
- updateState({
294
- shouldRefreshEditButton: false,
295
- localId: undefined,
296
- element: undefined,
297
- showEditButton: false,
298
- updateExtension: undefined
299
- })(state, dispatch);
300
287
  return;
301
- } // By this point we're certain we've selected an extension node.
302
- // But we need to determine if the selection has changed to another
303
- // extension node or remained on the same node.
304
-
288
+ }
305
289
 
306
290
  var node = selectedExtension.node;
307
291
  var newElement = getSelectedDomElement(state.schema, domAtPos, selectedExtension); // New node is selection
308
292
 
309
- var hasSelectedNodeChanged = node.attrs.localId ? localId !== node.attrs.localId : // This is the current assumption and it's wrong but we are keeping it
293
+ if (node.attrs.localId ? localId !== node.attrs.localId : // This is the current assumption and it's wrong but we are keeping it
310
294
  // as fallback in case we need to turn off `allowLocalIdGeneration`
311
- element !== newElement;
312
- var nextState = {
313
- shouldRefreshEditButton: false
314
- };
315
-
316
- if (hasSelectedNodeChanged) {
295
+ element !== newElement) {
317
296
  if (showContextPanel) {
318
297
  clearEditingContext(state, dispatch);
319
298
  }
@@ -324,20 +303,20 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
324
303
  var showEditButton = shouldShowEditButton(extensionHandler, extensionProvider);
325
304
  var updateExtension = getUpdateExtensionPromise(view, extensionHandler, extensionProvider).catch(function () {// do nothing;
326
305
  });
327
- Object.assign(nextState, {
306
+ updateState({
328
307
  localId: node.attrs.localId,
308
+ showContextPanel: false,
329
309
  element: newElement,
330
310
  showEditButton: showEditButton,
331
311
  updateExtension: updateExtension
332
- });
312
+ })(state, dispatch);
333
313
  } // New DOM element doesn't necessarily mean it's a new Node
334
314
  else if (element !== newElement) {
335
- Object.assign(nextState, {
315
+ updateState({
336
316
  element: newElement
337
- });
317
+ })(state, dispatch);
338
318
  }
339
319
 
340
- updateState(nextState)(state, dispatch);
341
320
  return true;
342
321
  },
343
322
  destroy: function destroy() {
@@ -354,9 +333,7 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
354
333
  inlineExtension: ExtensionNodeView(portalProviderAPI, eventDispatcher, providerFactory, extensionHandlers, extensionNodeViewOptions)
355
334
  },
356
335
  handleClickOn: createSelectionClickHandler(['extension', 'bodiedExtension'], function (target) {
357
- // Clicked on anything around the extension content
358
- // or specifically on the content border of a bodied extension
359
- return !target.closest('.extension-content') || target.classList.contains('extension-content');
336
+ return !target.closest('.extension-content');
360
337
  }, {
361
338
  useLongPressSelection: useLongPressSelection
362
339
  })
@@ -1,3 +1,4 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
 
@@ -1,32 +1,15 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
1
  import { findParentNodeOfType, findSelectedNodeOfType, findDomRefAtPos } from 'prosemirror-utils';
8
2
  import { closestElement } from '../../utils/dom';
9
3
  import { findNodePosByLocalIds } from '../../utils/nodes-by-localIds';
10
-
11
- var getSelectedExtensionByTransaction = function getSelectedExtensionByTransaction(transaction) {
12
- var searchParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13
- return _getSelectedExtension(transaction.doc.type.schema, transaction.selection, searchParent);
14
- };
15
-
16
4
  export var getSelectedExtension = function getSelectedExtension(state) {
17
5
  var searchParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
18
- return _getSelectedExtension(state.schema, state.selection, searchParent);
19
- };
20
-
21
- var _getSelectedExtension = function _getSelectedExtension(schema, selection, searchParent) {
22
- var _schema$nodes = schema.nodes,
23
- inlineExtension = _schema$nodes.inlineExtension,
24
- extension = _schema$nodes.extension,
25
- bodiedExtension = _schema$nodes.bodiedExtension;
6
+ var _state$schema$nodes = state.schema.nodes,
7
+ inlineExtension = _state$schema$nodes.inlineExtension,
8
+ extension = _state$schema$nodes.extension,
9
+ bodiedExtension = _state$schema$nodes.bodiedExtension;
26
10
  var nodeTypes = [extension, bodiedExtension, inlineExtension];
27
- return findSelectedNodeOfType(nodeTypes)(selection) || searchParent && findParentNodeOfType(nodeTypes)(selection) || undefined;
11
+ return findSelectedNodeOfType(nodeTypes)(state.selection) || searchParent && findParentNodeOfType(nodeTypes)(state.selection) || undefined;
28
12
  };
29
-
30
13
  export var findExtensionWithLocalId = function findExtensionWithLocalId(state, localId) {
31
14
  var selectedExtension = getSelectedExtension(state, true);
32
15
 
@@ -38,10 +21,10 @@ export var findExtensionWithLocalId = function findExtensionWithLocalId(state, l
38
21
  return selectedExtension;
39
22
  }
40
23
 
41
- var _state$schema$nodes = state.schema.nodes,
42
- inlineExtension = _state$schema$nodes.inlineExtension,
43
- extension = _state$schema$nodes.extension,
44
- bodiedExtension = _state$schema$nodes.bodiedExtension;
24
+ var _state$schema$nodes2 = state.schema.nodes,
25
+ inlineExtension = _state$schema$nodes2.inlineExtension,
26
+ extension = _state$schema$nodes2.extension,
27
+ bodiedExtension = _state$schema$nodes2.bodiedExtension;
45
28
  var nodeTypes = [extension, bodiedExtension, inlineExtension];
46
29
  var matched;
47
30
  state.doc.descendants(function (node, pos) {
@@ -81,29 +64,4 @@ export var getNodeTypesReferenced = function getNodeTypesReferenced(ids, state)
81
64
  export var findNodePosWithLocalId = function findNodePosWithLocalId(state, localId) {
82
65
  var nodes = findNodePosByLocalIds(state, [localId]);
83
66
  return nodes.length >= 1 ? nodes[0] : undefined;
84
- };
85
- export var onSelectionChanged = function onSelectionChanged(tr, state) {
86
- var selectedExtension = getSelectedExtensionByTransaction(tr, true);
87
- var hasUnselectedExtension = !!state.element && !selectedExtension;
88
- /*
89
- * We use this to indicate to our plugin that the selection has changed.
90
- *
91
- * - ignore if shouldRefreshEditButton already set
92
- * - restrict to scenarios when an extension is
93
- * - a) actually selected
94
- * - b) or un-selected (not accounting for selection extensionA -> extensionB)
95
- *
96
- * The rest of the logic will be handled in Extension main plugin view update().
97
- *
98
- * Known issue: typing inside of a bodiedExtension will trigger state changes each keystroke
99
- * as the toolbar always being open while it is focused.
100
- */
101
-
102
- if (!state.shouldRefreshEditButton && (selectedExtension || hasUnselectedExtension)) {
103
- return _objectSpread(_objectSpread({}, state), {}, {
104
- shouldRefreshEditButton: true
105
- });
106
- }
107
-
108
- return state;
109
67
  };
@@ -1,7 +1,7 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
 
6
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
7
 
@@ -74,7 +74,6 @@ export var openFeedbackDialog = /*#__PURE__*/function () {
74
74
  case 13:
75
75
  timeoutId = window.setTimeout(showJiraCollectorDialog, 0); // Return the timoutId for consumers to call clearTimeout if they need to.
76
76
 
77
- // Return the timoutId for consumers to call clearTimeout if they need to.
78
77
  resolve(timeoutId);
79
78
 
80
79
  case 15:
@@ -1,5 +1,5 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import getDeviceInfo from './getDeviceInfo';
4
4
  import getBrowserInfo from './getBrowserInfo';
5
5
  var JIRA_ISSUE_COLLECTOR_URL = 'https://product-fabric.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e-T/-w0bwo4/b/14/e73395c53c3b10fde2303f4bf74ffbf6/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-US&collectorId=98644b9c';
@@ -1,7 +1,7 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
- import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  import { createDecorations, findDecorationFromMatch } from './index';
6
6
  import { getPluginState } from '../plugin'; // max number of decorations to apply at once
7
7
 
@@ -248,7 +248,6 @@ var BatchDecorations = /*#__PURE__*/function () {
248
248
  } // only get those decorations whose from >= startPos
249
249
 
250
250
 
251
- // only get those decorations whose from >= startPos
252
251
  for (var i = 0; i < decorationsToRemove.length; i++) {
253
252
  if (decorationsToRemove[i].from >= startPos) {
254
253
  break;
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import React, { useEffect, useState } from 'react';
5
5
  import Loadable from 'react-loadable';
6
6
  import { getContextualToolbarItemsFromModule } from '@atlaskit/editor-common/extensions';
@@ -1,3 +1,4 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
 
@@ -1,4 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
5
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
@@ -12,8 +13,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
12
13
 
13
14
  var _templateObject, _templateObject2, _templateObject3;
14
15
 
15
- import _regeneratorRuntime from "@babel/runtime/regenerator";
16
-
17
16
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
18
17
 
19
18
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
@@ -1,6 +1,6 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
 
5
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
 
@@ -1,11 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
 
4
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
6
 
6
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
8
 
8
- import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
  import assert from 'assert';
10
10
  import { Selection, NodeSelection, TextSelection } from 'prosemirror-state';
11
11
  import { safeInsert, replaceSelectedNode, findSelectedNodeOfType, replaceParentNodeOfType } from 'prosemirror-utils';
@@ -1,3 +1,4 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
12
 
@@ -5,6 +5,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
8
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
9
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
9
10
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
11
 
@@ -12,8 +13,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
12
13
 
13
14
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
15
 
15
- import _regeneratorRuntime from "@babel/runtime/regenerator";
16
-
17
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
17
 
19
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -1,8 +1,8 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import uuidV4 from 'uuid/v4';
7
7
  import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
8
8
  import { getMediaClient, isMediaBlobUrl as _isMediaBlobUrl, getAttrsFromUrl, isImageRepresentationReady } from '@atlaskit/media-client';
@@ -1,3 +1,4 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -6,7 +7,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
 
@@ -1,5 +1,6 @@
1
1
  import _get from "@babel/runtime/helpers/get";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
5
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
5
6
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -8,7 +9,6 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
9
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
10
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
11
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
- import _regeneratorRuntime from "@babel/runtime/regenerator";
12
12
 
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
 
@@ -1,8 +1,8 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
4
5
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import { isImagePreview } from '@atlaskit/media-picker';
7
7
 
8
8
  var PickerFacade = /*#__PURE__*/function () {