@atlaskit/editor-common 94.5.1 → 94.6.1

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,28 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 94.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#157477](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157477)
8
+ [`b62c7289b73f2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b62c7289b73f2) -
9
+ ED-24722 Clean up platform.editor.media.inline-image.base-support FF
10
+
11
+ ## 94.6.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#157489](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157489)
16
+ [`00657197923b2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/00657197923b2) -
17
+ We are testing replacing findDOMNode with an explicit ref behind a feature flag. If this fix is
18
+ successful it will be available in a later release.
19
+
20
+ ### Patch Changes
21
+
22
+ - [#157432](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157432)
23
+ [`f42393192e79d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f42393192e79d) -
24
+ set button appearance to subtle to remove unwanted grey border
25
+
3
26
  ## 94.5.1
4
27
 
5
28
  ### Patch Changes
@@ -5,8 +5,7 @@
5
5
  "target": "es5",
6
6
  "composite": true,
7
7
  "outDir": "../dist",
8
- "rootDir": "../",
9
- "baseUrl": "../"
8
+ "rootDir": "../"
10
9
  },
11
10
  "include": [
12
11
  "../src/**/*.ts",
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.mediaInlineImagesEnabled = void 0;
7
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
7
  /**
9
8
  * Enable media inline images feature based on
10
- * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages and platform FF platform.editor.media.inline-image.base-support
9
+ * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages
11
10
  *
12
11
  * The reason not using mediaOption as param is because MediaOption is from editor-plugin-media
13
12
  * we want to avoid circular deps
@@ -16,5 +15,5 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  * @returns boolean
17
16
  */
18
17
  var mediaInlineImagesEnabled = exports.mediaInlineImagesEnabled = function mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) {
19
- return allowMediaInline && allowMediaInlineImages && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.media.inline-image.base-support');
18
+ return allowMediaInline && allowMediaInlineImages;
20
19
  };
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "94.5.1";
20
+ var packageVersion = "94.6.1";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "94.5.1";
27
+ var packageVersion = "94.6.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -137,6 +137,12 @@ Object.defineProperty(exports, "PanelTextInput", {
137
137
  return _PanelTextInput.default;
138
138
  }
139
139
  });
140
+ Object.defineProperty(exports, "PlainOutsideClickTargetRefContext", {
141
+ enumerable: true,
142
+ get: function get() {
143
+ return _withOuterListeners.PlainOutsideClickTargetRefContext;
144
+ }
145
+ });
140
146
  Object.defineProperty(exports, "Popup", {
141
147
  enumerable: true,
142
148
  get: function get() {
@@ -404,7 +410,7 @@ var _Popup = _interopRequireWildcard(require("./Popup"));
404
410
  var _UnsupportedBlock = _interopRequireDefault(require("./UnsupportedBlock"));
405
411
  var _UnsupportedInline = _interopRequireDefault(require("./UnsupportedInline"));
406
412
  var _BaseTheme = require("./BaseTheme");
407
- var _withOuterListeners = _interopRequireDefault(require("./with-outer-listeners"));
413
+ var _withOuterListeners = _interopRequireWildcard(require("./with-outer-listeners"));
408
414
  var _WidthProvider = require("./WidthProvider");
409
415
  var _OverflowShadow = _interopRequireWildcard(require("./OverflowShadow"));
410
416
  var _shadowObserver = require("./OverflowShadow/shadowObserver");
@@ -5,6 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.PlainOutsideClickTargetRefContext = void 0;
8
9
  exports.default = withOuterListeners;
9
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -15,10 +16,14 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
15
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
17
  var _react = _interopRequireWildcard(require("react"));
17
18
  var _reactDom = _interopRequireDefault(require("react-dom"));
19
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
19
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
22
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
21
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ // Use this context to pass in the reference of the element that should be considered as the outside click target
25
+ // The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
26
+ var PlainOutsideClickTargetRefContext = exports.PlainOutsideClickTargetRefContext = /*#__PURE__*/_react.default.createContext(function () {});
22
27
  function withOuterListeners(Component) {
23
28
  return /*#__PURE__*/function (_PureComponent) {
24
29
  (0, _inherits2.default)(WithOutsideClick, _PureComponent);
@@ -30,13 +35,14 @@ function withOuterListeners(Component) {
30
35
  args[_key] = arguments[_key];
31
36
  }
32
37
  _this = _super.call.apply(_super, [this].concat(args));
38
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "outsideClickTargetRef", /*#__PURE__*/_react.default.createRef());
33
39
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function (evt) {
34
- var domNode = _reactDom.default.findDOMNode((0, _assertThisInitialized2.default)(_this)); // eslint-disable-line react/no-find-dom-node
40
+ var _this$outsideClickTar;
41
+ var domNode = (0, _platformFeatureFlags.fg)('platform_editor_replace_finddomnode_in_common') ? (_this$outsideClickTar = _this.outsideClickTargetRef.current) === null || _this$outsideClickTar === void 0 ? void 0 : _this$outsideClickTar.deref() : _reactDom.default.findDOMNode((0, _assertThisInitialized2.default)(_this)); // eslint-disable-line react/no-find-dom-node
35
42
 
36
43
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
37
- if (_this.props.handleClickOutside) {
38
- _this.props.handleClickOutside(evt);
39
- }
44
+ var _this$props$handleCli, _this$props;
45
+ (_this$props$handleCli = (_this$props = _this.props).handleClickOutside) === null || _this$props$handleCli === void 0 || _this$props$handleCli.call(_this$props, evt);
40
46
  }
41
47
  });
42
48
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleKeydown", function (evt) {
@@ -44,6 +50,9 @@ function withOuterListeners(Component) {
44
50
  _this.props.handleEscapeKeydown(evt);
45
51
  }
46
52
  });
53
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setOutsideClickTargetRef", function (el) {
54
+ _this.outsideClickTargetRef.current = el && new WeakRef(el);
55
+ });
47
56
  return _this;
48
57
  }
49
58
  (0, _createClass2.default)(WithOutsideClick, [{
@@ -69,7 +78,9 @@ function withOuterListeners(Component) {
69
78
  }, {
70
79
  key: "render",
71
80
  value: function render() {
72
- return /*#__PURE__*/_react.default.createElement(Component, this.props);
81
+ return /*#__PURE__*/_react.default.createElement(PlainOutsideClickTargetRefContext.Provider, {
82
+ value: this.setOutsideClickTargetRef
83
+ }, /*#__PURE__*/_react.default.createElement(Component, this.props));
73
84
  }
74
85
  }]);
75
86
  return WithOutsideClick;
@@ -218,6 +218,7 @@ var ColorPickerButton = function ColorPickerButton(props) {
218
218
  content: title,
219
219
  position: "top"
220
220
  }, (0, _react2.jsx)(_standardButton.default, {
221
+ appearance: 'subtle',
221
222
  ref: buttonRef,
222
223
  "aria-label": title,
223
224
  "aria-expanded": props.isAriaExpanded ? isPopupOpen : undefined,
@@ -41,10 +41,11 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
41
41
  }
42
42
  _this = _super.call.apply(_super, [this].concat(args));
43
43
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function (evt) {
44
+ var _this$props$outsideCl;
44
45
  if (!_this.props.isActiveComponent || !_this.props.handleClickOutside) {
45
46
  return;
46
47
  }
47
- var domNode = (0, _platformFeatureFlags.fg)('platform_editor_replace_finddomnode_in_common') ? _this.props.outsideClickTargetRef.current : _reactDom.default.findDOMNode((0, _assertThisInitialized2.default)(_this));
48
+ var domNode = (0, _platformFeatureFlags.fg)('platform_editor_replace_finddomnode_in_common') ? (_this$props$outsideCl = _this.props.outsideClickTargetRef.current) === null || _this$props$outsideCl === void 0 ? void 0 : _this$props$outsideCl.deref() : _reactDom.default.findDOMNode((0, _assertThisInitialized2.default)(_this));
48
49
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
49
50
  var _this$props$editorVie;
50
51
  _this.props.handleClickOutside(evt);
@@ -122,7 +123,7 @@ function withReactEditorViewOuterListeners(Component) {
122
123
  setActiveComponent = _useState2[1];
123
124
  var outsideClickTargetRef = (0, _react.useRef)(null);
124
125
  var setOutsideClickTargetRef = (0, _react.useCallback)(function (el) {
125
- outsideClickTargetRef.current = el;
126
+ outsideClickTargetRef.current = el && new WeakRef(el);
126
127
  }, [outsideClickTargetRef]);
127
128
  (0, _react.useEffect)(function () {
128
129
  requestAnimationFrame(function () {
@@ -1,8 +1,6 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
-
3
1
  /**
4
2
  * Enable media inline images feature based on
5
- * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages and platform FF platform.editor.media.inline-image.base-support
3
+ * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages
6
4
  *
7
5
  * The reason not using mediaOption as param is because MediaOption is from editor-plugin-media
8
6
  * we want to avoid circular deps
@@ -11,5 +9,5 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
9
  * @returns boolean
12
10
  */
13
11
  export const mediaInlineImagesEnabled = (allowMediaInline, allowMediaInlineImages) => {
14
- return allowMediaInline && allowMediaInlineImages && getBooleanFF('platform.editor.media.inline-image.base-support');
12
+ return allowMediaInline && allowMediaInlineImages;
15
13
  };
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "94.5.1";
4
+ const packageVersion = "94.6.1";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "94.5.1";
16
+ const packageVersion = "94.6.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -7,7 +7,7 @@ export { default as Popup, findOverflowScrollParent } from './Popup';
7
7
  export { default as UnsupportedBlock } from './UnsupportedBlock';
8
8
  export { default as UnsupportedInline } from './UnsupportedInline';
9
9
  export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
10
- export { default as withOuterListeners } from './with-outer-listeners';
10
+ export { default as withOuterListeners, PlainOutsideClickTargetRefContext } from './with-outer-listeners';
11
11
  export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint } from './WidthProvider';
12
12
  export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
13
13
  export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shadowObserver';
@@ -1,17 +1,22 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { PureComponent } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ // Use this context to pass in the reference of the element that should be considered as the outside click target
6
+ // The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
7
+ export const PlainOutsideClickTargetRefContext = /*#__PURE__*/React.createContext(() => {});
4
8
  export default function withOuterListeners(Component) {
5
9
  return class WithOutsideClick extends PureComponent {
6
10
  constructor(...args) {
7
11
  super(...args);
12
+ _defineProperty(this, "outsideClickTargetRef", /*#__PURE__*/React.createRef());
8
13
  _defineProperty(this, "handleClick", evt => {
9
- const domNode = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node
14
+ var _this$outsideClickTar;
15
+ const domNode = fg('platform_editor_replace_finddomnode_in_common') ? (_this$outsideClickTar = this.outsideClickTargetRef.current) === null || _this$outsideClickTar === void 0 ? void 0 : _this$outsideClickTar.deref() : ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node
10
16
 
11
17
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
12
- if (this.props.handleClickOutside) {
13
- this.props.handleClickOutside(evt);
14
- }
18
+ var _this$props$handleCli, _this$props;
19
+ (_this$props$handleCli = (_this$props = this.props).handleClickOutside) === null || _this$props$handleCli === void 0 ? void 0 : _this$props$handleCli.call(_this$props, evt);
15
20
  }
16
21
  });
17
22
  _defineProperty(this, "handleKeydown", evt => {
@@ -19,6 +24,9 @@ export default function withOuterListeners(Component) {
19
24
  this.props.handleEscapeKeydown(evt);
20
25
  }
21
26
  });
27
+ _defineProperty(this, "setOutsideClickTargetRef", el => {
28
+ this.outsideClickTargetRef.current = el && new WeakRef(el);
29
+ });
22
30
  }
23
31
  componentDidMount() {
24
32
  if (this.props.handleClickOutside) {
@@ -37,7 +45,9 @@ export default function withOuterListeners(Component) {
37
45
  }
38
46
  }
39
47
  render() {
40
- return /*#__PURE__*/React.createElement(Component, this.props);
48
+ return /*#__PURE__*/React.createElement(PlainOutsideClickTargetRefContext.Provider, {
49
+ value: this.setOutsideClickTargetRef
50
+ }, /*#__PURE__*/React.createElement(Component, this.props));
41
51
  }
42
52
  };
43
53
  }
@@ -198,6 +198,7 @@ const ColorPickerButton = props => {
198
198
  content: title,
199
199
  position: "top"
200
200
  }, jsx(Button, {
201
+ appearance: 'subtle',
201
202
  ref: buttonRef,
202
203
  "aria-label": title,
203
204
  "aria-expanded": props.isAriaExpanded ? isPopupOpen : undefined,
@@ -13,10 +13,11 @@ class WithOutsideClick extends PureComponent {
13
13
  constructor(...args) {
14
14
  super(...args);
15
15
  _defineProperty(this, "handleClick", evt => {
16
+ var _this$props$outsideCl;
16
17
  if (!this.props.isActiveComponent || !this.props.handleClickOutside) {
17
18
  return;
18
19
  }
19
- const domNode = fg('platform_editor_replace_finddomnode_in_common') ? this.props.outsideClickTargetRef.current : ReactDOM.findDOMNode(this);
20
+ const domNode = fg('platform_editor_replace_finddomnode_in_common') ? (_this$props$outsideCl = this.props.outsideClickTargetRef.current) === null || _this$props$outsideCl === void 0 ? void 0 : _this$props$outsideCl.deref() : ReactDOM.findDOMNode(this);
20
21
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
21
22
  var _this$props$editorVie;
22
23
  this.props.handleClickOutside(evt);
@@ -83,7 +84,7 @@ export default function withReactEditorViewOuterListeners(Component) {
83
84
  const [isActiveComponent, setActiveComponent] = useState(false);
84
85
  const outsideClickTargetRef = useRef(null);
85
86
  const setOutsideClickTargetRef = useCallback(el => {
86
- outsideClickTargetRef.current = el;
87
+ outsideClickTargetRef.current = el && new WeakRef(el);
87
88
  }, [outsideClickTargetRef]);
88
89
  useEffect(() => {
89
90
  requestAnimationFrame(() => {
@@ -1,8 +1,6 @@
1
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
-
3
1
  /**
4
2
  * Enable media inline images feature based on
5
- * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages and platform FF platform.editor.media.inline-image.base-support
3
+ * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages
6
4
  *
7
5
  * The reason not using mediaOption as param is because MediaOption is from editor-plugin-media
8
6
  * we want to avoid circular deps
@@ -11,5 +9,5 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
9
  * @returns boolean
12
10
  */
13
11
  export var mediaInlineImagesEnabled = function mediaInlineImagesEnabled(allowMediaInline, allowMediaInlineImages) {
14
- return allowMediaInline && allowMediaInlineImages && getBooleanFF('platform.editor.media.inline-image.base-support');
12
+ return allowMediaInline && allowMediaInlineImages;
15
13
  };
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "94.5.1";
10
+ var packageVersion = "94.6.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "94.5.1";
24
+ var packageVersion = "94.6.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -7,7 +7,7 @@ export { default as Popup, findOverflowScrollParent } from './Popup';
7
7
  export { default as UnsupportedBlock } from './UnsupportedBlock';
8
8
  export { default as UnsupportedInline } from './UnsupportedInline';
9
9
  export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
10
- export { default as withOuterListeners } from './with-outer-listeners';
10
+ export { default as withOuterListeners, PlainOutsideClickTargetRefContext } from './with-outer-listeners';
11
11
  export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint } from './WidthProvider';
12
12
  export { default as overflowShadow, shadowClassNames } from './OverflowShadow';
13
13
  export { shadowObserverClassNames, ShadowObserver } from './OverflowShadow/shadowObserver';
@@ -9,6 +9,10 @@ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
10
  import React, { PureComponent } from 'react';
11
11
  import ReactDOM from 'react-dom';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
13
+ // Use this context to pass in the reference of the element that should be considered as the outside click target
14
+ // The outside click target is the element that should be clicked outside of to trigger the `handleClickOutside` event
15
+ export var PlainOutsideClickTargetRefContext = /*#__PURE__*/React.createContext(function () {});
12
16
  export default function withOuterListeners(Component) {
13
17
  return /*#__PURE__*/function (_PureComponent) {
14
18
  _inherits(WithOutsideClick, _PureComponent);
@@ -20,13 +24,14 @@ export default function withOuterListeners(Component) {
20
24
  args[_key] = arguments[_key];
21
25
  }
22
26
  _this = _super.call.apply(_super, [this].concat(args));
27
+ _defineProperty(_assertThisInitialized(_this), "outsideClickTargetRef", /*#__PURE__*/React.createRef());
23
28
  _defineProperty(_assertThisInitialized(_this), "handleClick", function (evt) {
24
- var domNode = ReactDOM.findDOMNode(_assertThisInitialized(_this)); // eslint-disable-line react/no-find-dom-node
29
+ var _this$outsideClickTar;
30
+ var domNode = fg('platform_editor_replace_finddomnode_in_common') ? (_this$outsideClickTar = _this.outsideClickTargetRef.current) === null || _this$outsideClickTar === void 0 ? void 0 : _this$outsideClickTar.deref() : ReactDOM.findDOMNode(_assertThisInitialized(_this)); // eslint-disable-line react/no-find-dom-node
25
31
 
26
32
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
27
- if (_this.props.handleClickOutside) {
28
- _this.props.handleClickOutside(evt);
29
- }
33
+ var _this$props$handleCli, _this$props;
34
+ (_this$props$handleCli = (_this$props = _this.props).handleClickOutside) === null || _this$props$handleCli === void 0 || _this$props$handleCli.call(_this$props, evt);
30
35
  }
31
36
  });
32
37
  _defineProperty(_assertThisInitialized(_this), "handleKeydown", function (evt) {
@@ -34,6 +39,9 @@ export default function withOuterListeners(Component) {
34
39
  _this.props.handleEscapeKeydown(evt);
35
40
  }
36
41
  });
42
+ _defineProperty(_assertThisInitialized(_this), "setOutsideClickTargetRef", function (el) {
43
+ _this.outsideClickTargetRef.current = el && new WeakRef(el);
44
+ });
37
45
  return _this;
38
46
  }
39
47
  _createClass(WithOutsideClick, [{
@@ -59,7 +67,9 @@ export default function withOuterListeners(Component) {
59
67
  }, {
60
68
  key: "render",
61
69
  value: function render() {
62
- return /*#__PURE__*/React.createElement(Component, this.props);
70
+ return /*#__PURE__*/React.createElement(PlainOutsideClickTargetRefContext.Provider, {
71
+ value: this.setOutsideClickTargetRef
72
+ }, /*#__PURE__*/React.createElement(Component, this.props));
63
73
  }
64
74
  }]);
65
75
  return WithOutsideClick;
@@ -211,6 +211,7 @@ var ColorPickerButton = function ColorPickerButton(props) {
211
211
  content: title,
212
212
  position: "top"
213
213
  }, jsx(Button, {
214
+ appearance: 'subtle',
214
215
  ref: buttonRef,
215
216
  "aria-label": title,
216
217
  "aria-expanded": props.isAriaExpanded ? isPopupOpen : undefined,
@@ -30,10 +30,11 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
30
30
  }
31
31
  _this = _super.call.apply(_super, [this].concat(args));
32
32
  _defineProperty(_assertThisInitialized(_this), "handleClick", function (evt) {
33
+ var _this$props$outsideCl;
33
34
  if (!_this.props.isActiveComponent || !_this.props.handleClickOutside) {
34
35
  return;
35
36
  }
36
- var domNode = fg('platform_editor_replace_finddomnode_in_common') ? _this.props.outsideClickTargetRef.current : ReactDOM.findDOMNode(_assertThisInitialized(_this));
37
+ var domNode = fg('platform_editor_replace_finddomnode_in_common') ? (_this$props$outsideCl = _this.props.outsideClickTargetRef.current) === null || _this$props$outsideCl === void 0 ? void 0 : _this$props$outsideCl.deref() : ReactDOM.findDOMNode(_assertThisInitialized(_this));
37
38
  if (!domNode || evt.target instanceof Node && !domNode.contains(evt.target)) {
38
39
  var _this$props$editorVie;
39
40
  _this.props.handleClickOutside(evt);
@@ -111,7 +112,7 @@ export default function withReactEditorViewOuterListeners(Component) {
111
112
  setActiveComponent = _useState2[1];
112
113
  var outsideClickTargetRef = useRef(null);
113
114
  var setOutsideClickTargetRef = useCallback(function (el) {
114
- outsideClickTargetRef.current = el;
115
+ outsideClickTargetRef.current = el && new WeakRef(el);
115
116
  }, [outsideClickTargetRef]);
116
117
  useEffect(function () {
117
118
  requestAnimationFrame(function () {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Enable media inline images feature based on
3
- * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages and platform FF platform.editor.media.inline-image.base-support
3
+ * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages
4
4
  *
5
5
  * The reason not using mediaOption as param is because MediaOption is from editor-plugin-media
6
6
  * we want to avoid circular deps
@@ -10,7 +10,7 @@ export type { Position as PopupPosition, Props as PopupProps } from './Popup';
10
10
  export { default as UnsupportedBlock } from './UnsupportedBlock';
11
11
  export { default as UnsupportedInline } from './UnsupportedInline';
12
12
  export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
13
- export { default as withOuterListeners } from './with-outer-listeners';
13
+ export { default as withOuterListeners, PlainOutsideClickTargetRefContext, } from './with-outer-listeners';
14
14
  export type { WithOutsideClickProps } from './with-outer-listeners';
15
15
  export type { CardEventClickHandler, CardSurroundings, EventHandlers, LinkEventClickHandler, MentionEventHandler, MentionEventHandlers, SmartCardEventClickHandler, } from './EventHandlers';
16
16
  export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint, } from './WidthProvider';
@@ -5,5 +5,6 @@ export interface WithOutsideClickProps {
5
5
  handleClickOutside?: SimpleEventHandler<MouseEvent>;
6
6
  handleEscapeKeydown?: SimpleEventHandler<KeyboardEvent>;
7
7
  }
8
+ export declare const PlainOutsideClickTargetRefContext: React.Context<(el: HTMLElement | null) => void>;
8
9
  export default function withOuterListeners<P>(Component: React.ComponentType<React.PropsWithChildren<P>>): ComponentClass<P & WithOutsideClickProps>;
9
10
  export {};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Enable media inline images feature based on
3
- * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages and platform FF platform.editor.media.inline-image.base-support
3
+ * mediaOptions.featureFlags.mediaInline, mediaOptions.allowMediaInlineImages
4
4
  *
5
5
  * The reason not using mediaOption as param is because MediaOption is from editor-plugin-media
6
6
  * we want to avoid circular deps
@@ -10,7 +10,7 @@ export type { Position as PopupPosition, Props as PopupProps } from './Popup';
10
10
  export { default as UnsupportedBlock } from './UnsupportedBlock';
11
11
  export { default as UnsupportedInline } from './UnsupportedInline';
12
12
  export { BaseTheme, mapBreakpointToLayoutMaxWidth } from './BaseTheme';
13
- export { default as withOuterListeners } from './with-outer-listeners';
13
+ export { default as withOuterListeners, PlainOutsideClickTargetRefContext, } from './with-outer-listeners';
14
14
  export type { WithOutsideClickProps } from './with-outer-listeners';
15
15
  export type { CardEventClickHandler, CardSurroundings, EventHandlers, LinkEventClickHandler, MentionEventHandler, MentionEventHandlers, SmartCardEventClickHandler, } from './EventHandlers';
16
16
  export { WidthContext, WidthConsumer, WidthProvider, createWidthContext, getBreakpoint, } from './WidthProvider';
@@ -5,5 +5,6 @@ export interface WithOutsideClickProps {
5
5
  handleClickOutside?: SimpleEventHandler<MouseEvent>;
6
6
  handleEscapeKeydown?: SimpleEventHandler<KeyboardEvent>;
7
7
  }
8
+ export declare const PlainOutsideClickTargetRefContext: React.Context<(el: HTMLElement | null) => void>;
8
9
  export default function withOuterListeners<P>(Component: React.ComponentType<React.PropsWithChildren<P>>): ComponentClass<P & WithOutsideClickProps>;
9
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "94.5.1",
3
+ "version": "94.6.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -231,9 +231,6 @@
231
231
  "platform_editor_breakout_use_css": {
232
232
  "type": "boolean"
233
233
  },
234
- "platform.editor.media.inline-image.base-support": {
235
- "type": "boolean"
236
- },
237
234
  "platform.linking-platform.datasource-assets_objects": {
238
235
  "type": "boolean"
239
236
  },