@atlaskit/editor-core 187.37.2 → 187.37.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.37.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e0f15f5af8a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0f15f5af8a) - Fix invalid getPos issue happening for Media and Media group nodeviews
8
+
3
9
  ## 187.37.2
4
10
 
5
11
  ### Patch Changes
@@ -32,7 +32,17 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
32
32
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
33
  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; } }
34
34
  var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props) {
35
- var pos = props.getPos();
35
+ /**
36
+ * ED-19831
37
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
38
+ * directly to confluence since this bug is now iun production.
39
+ */
40
+ var pos;
41
+ try {
42
+ pos = typeof props.getPos === 'function' ? props.getPos() : undefined;
43
+ } catch (e) {
44
+ pos = undefined;
45
+ }
36
46
  if (typeof pos !== 'number') {
37
47
  return false;
38
48
  }
@@ -469,7 +469,19 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
469
469
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "checkAndUpdateSelectionType", function () {
470
470
  var getPos = _this2.getPos;
471
471
  var selection = _this2.view.state.selection;
472
- var isNodeSelected = (0, _nodes.isNodeSelectedOrInRange)(selection.$anchor.pos, selection.$head.pos, getPos(), _this2.node.nodeSize);
472
+
473
+ /**
474
+ * ED-19831
475
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
476
+ * directly to confluence since this bug is now iun production.
477
+ */
478
+ var pos;
479
+ try {
480
+ pos = typeof getPos === 'function' ? getPos() : undefined;
481
+ } catch (e) {
482
+ pos = undefined;
483
+ }
484
+ var isNodeSelected = (0, _nodes.isNodeSelectedOrInRange)(selection.$anchor.pos, selection.$head.pos, pos, _this2.node.nodeSize);
473
485
  _this2.selectionType = isNodeSelected;
474
486
  return isNodeSelected;
475
487
  });
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.37.2";
9
+ var version = "187.37.3";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -13,7 +13,17 @@ import { injectIntl } from 'react-intl-next';
13
13
  import { messages } from './messages';
14
14
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
15
15
  const isMediaGroupSelectedFromProps = props => {
16
- const pos = props.getPos();
16
+ /**
17
+ * ED-19831
18
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
19
+ * directly to confluence since this bug is now iun production.
20
+ */
21
+ let pos;
22
+ try {
23
+ pos = typeof props.getPos === 'function' ? props.getPos() : undefined;
24
+ } catch (e) {
25
+ pos = undefined;
26
+ }
17
27
  if (typeof pos !== 'number') {
18
28
  return false;
19
29
  }
@@ -373,7 +373,19 @@ class MediaSingleNodeView extends ReactNodeView {
373
373
  const {
374
374
  selection
375
375
  } = this.view.state;
376
- const isNodeSelected = isNodeSelectedOrInRange(selection.$anchor.pos, selection.$head.pos, getPos(), this.node.nodeSize);
376
+
377
+ /**
378
+ * ED-19831
379
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
380
+ * directly to confluence since this bug is now iun production.
381
+ */
382
+ let pos;
383
+ try {
384
+ pos = typeof getPos === 'function' ? getPos() : undefined;
385
+ } catch (e) {
386
+ pos = undefined;
387
+ }
388
+ const isNodeSelected = isNodeSelectedOrInRange(selection.$anchor.pos, selection.$head.pos, pos, this.node.nodeSize);
377
389
  this.selectionType = isNodeSelected;
378
390
  return isNodeSelected;
379
391
  });
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.37.2";
2
+ export const version = "187.37.3";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -25,7 +25,17 @@ import { injectIntl } from 'react-intl-next';
25
25
  import { messages } from './messages';
26
26
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
27
27
  var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props) {
28
- var pos = props.getPos();
28
+ /**
29
+ * ED-19831
30
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
31
+ * directly to confluence since this bug is now iun production.
32
+ */
33
+ var pos;
34
+ try {
35
+ pos = typeof props.getPos === 'function' ? props.getPos() : undefined;
36
+ } catch (e) {
37
+ pos = undefined;
38
+ }
29
39
  if (typeof pos !== 'number') {
30
40
  return false;
31
41
  }
@@ -460,7 +460,19 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
460
460
  _defineProperty(_assertThisInitialized(_this2), "checkAndUpdateSelectionType", function () {
461
461
  var getPos = _this2.getPos;
462
462
  var selection = _this2.view.state.selection;
463
- var isNodeSelected = isNodeSelectedOrInRange(selection.$anchor.pos, selection.$head.pos, getPos(), _this2.node.nodeSize);
463
+
464
+ /**
465
+ * ED-19831
466
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
467
+ * directly to confluence since this bug is now iun production.
468
+ */
469
+ var pos;
470
+ try {
471
+ pos = typeof getPos === 'function' ? getPos() : undefined;
472
+ } catch (e) {
473
+ pos = undefined;
474
+ }
475
+ var isNodeSelected = isNodeSelectedOrInRange(selection.$anchor.pos, selection.$head.pos, pos, _this2.node.nodeSize);
464
476
  _this2.selectionType = isNodeSelected;
465
477
  return isNodeSelected;
466
478
  });
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.37.2";
2
+ export var version = "187.37.3";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.37.2",
3
+ "version": "187.37.3",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"