@atlaskit/editor-common 93.2.0 → 93.2.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,14 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 93.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150725](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150725)
8
+ [`46e9eccf1d0bc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/46e9eccf1d0bc) -
9
+ ED-24117: refactors image loader for react 18
10
+ - Updated dependencies
11
+
3
12
  ## 93.2.0
4
13
 
5
14
  ### Minor Changes
@@ -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 = "93.2.0";
20
+ var packageVersion = "93.2.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 = "93.2.0";
27
+ var packageVersion = "93.2.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.withImageLoader = void 0;
8
+ exports.withImageLoaderOld = exports.withImageLoader = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -15,11 +15,12 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
15
15
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
  var _react = _interopRequireWildcard(require("react"));
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  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
20
  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
21
  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
22
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
- var withImageLoader = exports.withImageLoader = function withImageLoader(Wrapped) {
23
+ var withImageLoaderOld = exports.withImageLoaderOld = function withImageLoaderOld(Wrapped) {
23
24
  return /*#__PURE__*/function (_Component) {
24
25
  (0, _inherits2.default)(WithImageLoader, _Component);
25
26
  var _super = _createSuper(WithImageLoader);
@@ -100,4 +101,92 @@ var withImageLoader = exports.withImageLoader = function withImageLoader(Wrapped
100
101
  }]);
101
102
  return WithImageLoader;
102
103
  }(_react.Component);
104
+ };
105
+ var withImageLoaderNew = function withImageLoaderNew(Wrapped) {
106
+ return /*#__PURE__*/function (_Component2) {
107
+ (0, _inherits2.default)(WithImageLoader, _Component2);
108
+ var _super2 = _createSuper(WithImageLoader);
109
+ function WithImageLoader() {
110
+ var _this2;
111
+ (0, _classCallCheck2.default)(this, WithImageLoader);
112
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
113
+ args[_key2] = arguments[_key2];
114
+ }
115
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
116
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "state", {
117
+ imageStatus: 'loading'
118
+ });
119
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "onLoad", function () {
120
+ _this2.setState({
121
+ imageStatus: 'complete'
122
+ });
123
+ var onExternalImageLoaded = _this2.props.onExternalImageLoaded;
124
+ if (onExternalImageLoaded && _this2.img) {
125
+ onExternalImageLoaded({
126
+ width: _this2.img.naturalWidth,
127
+ height: _this2.img.naturalHeight
128
+ });
129
+ }
130
+ });
131
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "onError", function () {
132
+ _this2.setState({
133
+ imageStatus: 'error'
134
+ });
135
+ });
136
+ return _this2;
137
+ }
138
+ (0, _createClass2.default)(WithImageLoader, [{
139
+ key: "componentDidMount",
140
+ value: function componentDidMount() {
141
+ this.fetchImage(this.props);
142
+ }
143
+ }, {
144
+ key: "componentDidUpdate",
145
+ value: function componentDidUpdate(newProps) {
146
+ if (newProps.url !== this.props.url) {
147
+ this.setState({
148
+ imageStatus: 'loading'
149
+ });
150
+ this.fetchImage(newProps);
151
+ }
152
+ }
153
+ }, {
154
+ key: "componentWillUnmount",
155
+ value: function componentWillUnmount() {
156
+ if (this.img) {
157
+ this.img.removeEventListener('load', this.onLoad);
158
+ this.img.removeEventListener('error', this.onError);
159
+ this.img = null;
160
+ }
161
+ }
162
+ }, {
163
+ key: "fetchImage",
164
+ value: function fetchImage(_ref2) {
165
+ var url = _ref2.url;
166
+ if (url) {
167
+ if (!this.img) {
168
+ this.img = new Image();
169
+ this.img.addEventListener('load', this.onLoad);
170
+ this.img.addEventListener('error', this.onError);
171
+ }
172
+ this.img.src = url;
173
+ }
174
+ }
175
+ }, {
176
+ key: "render",
177
+ value: function render() {
178
+ var imageStatus = this.state.imageStatus;
179
+ return /*#__PURE__*/_react.default.createElement(Wrapped, (0, _extends2.default)({}, this.props, {
180
+ imageStatus: imageStatus
181
+ }));
182
+ }
183
+ }]);
184
+ return WithImageLoader;
185
+ }(_react.Component);
186
+ };
187
+ var withImageLoader = exports.withImageLoader = function withImageLoader(Wrapped) {
188
+ if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2')) {
189
+ return withImageLoaderNew(Wrapped);
190
+ }
191
+ return withImageLoaderOld(Wrapped);
103
192
  };
@@ -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 = "93.2.0";
4
+ const packageVersion = "93.2.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 = "93.2.0";
16
+ const packageVersion = "93.2.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,7 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { Component } from 'react';
4
- export const withImageLoader = Wrapped => class WithImageLoader extends Component {
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ export const withImageLoaderOld = Wrapped => class WithImageLoader extends Component {
5
6
  constructor(...args) {
6
7
  super(...args);
7
8
  _defineProperty(this, "state", {
@@ -65,4 +66,75 @@ export const withImageLoader = Wrapped => class WithImageLoader extends Componen
65
66
  imageStatus: imageStatus
66
67
  }));
67
68
  }
69
+ };
70
+ const withImageLoaderNew = Wrapped => class WithImageLoader extends Component {
71
+ constructor(...args) {
72
+ super(...args);
73
+ _defineProperty(this, "state", {
74
+ imageStatus: 'loading'
75
+ });
76
+ _defineProperty(this, "onLoad", () => {
77
+ this.setState({
78
+ imageStatus: 'complete'
79
+ });
80
+ const {
81
+ onExternalImageLoaded
82
+ } = this.props;
83
+ if (onExternalImageLoaded && this.img) {
84
+ onExternalImageLoaded({
85
+ width: this.img.naturalWidth,
86
+ height: this.img.naturalHeight
87
+ });
88
+ }
89
+ });
90
+ _defineProperty(this, "onError", () => {
91
+ this.setState({
92
+ imageStatus: 'error'
93
+ });
94
+ });
95
+ }
96
+ componentDidMount() {
97
+ this.fetchImage(this.props);
98
+ }
99
+ componentDidUpdate(newProps) {
100
+ if (newProps.url !== this.props.url) {
101
+ this.setState({
102
+ imageStatus: 'loading'
103
+ });
104
+ this.fetchImage(newProps);
105
+ }
106
+ }
107
+ componentWillUnmount() {
108
+ if (this.img) {
109
+ this.img.removeEventListener('load', this.onLoad);
110
+ this.img.removeEventListener('error', this.onError);
111
+ this.img = null;
112
+ }
113
+ }
114
+ fetchImage({
115
+ url
116
+ }) {
117
+ if (url) {
118
+ if (!this.img) {
119
+ this.img = new Image();
120
+ this.img.addEventListener('load', this.onLoad);
121
+ this.img.addEventListener('error', this.onError);
122
+ }
123
+ this.img.src = url;
124
+ }
125
+ }
126
+ render() {
127
+ const {
128
+ imageStatus
129
+ } = this.state;
130
+ return /*#__PURE__*/React.createElement(Wrapped, _extends({}, this.props, {
131
+ imageStatus: imageStatus
132
+ }));
133
+ }
134
+ };
135
+ export const withImageLoader = Wrapped => {
136
+ if (fg('platform_editor_react18_phase2')) {
137
+ return withImageLoaderNew(Wrapped);
138
+ }
139
+ return withImageLoaderOld(Wrapped);
68
140
  };
@@ -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 = "93.2.0";
10
+ var packageVersion = "93.2.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 = "93.2.0";
24
+ var packageVersion = "93.2.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -9,7 +9,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
10
10
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
11
11
  import React, { Component } from 'react';
12
- export var withImageLoader = function withImageLoader(Wrapped) {
12
+ import { fg } from '@atlaskit/platform-feature-flags';
13
+ export var withImageLoaderOld = function withImageLoaderOld(Wrapped) {
13
14
  return /*#__PURE__*/function (_Component) {
14
15
  _inherits(WithImageLoader, _Component);
15
16
  var _super = _createSuper(WithImageLoader);
@@ -90,4 +91,92 @@ export var withImageLoader = function withImageLoader(Wrapped) {
90
91
  }]);
91
92
  return WithImageLoader;
92
93
  }(Component);
94
+ };
95
+ var withImageLoaderNew = function withImageLoaderNew(Wrapped) {
96
+ return /*#__PURE__*/function (_Component2) {
97
+ _inherits(WithImageLoader, _Component2);
98
+ var _super2 = _createSuper(WithImageLoader);
99
+ function WithImageLoader() {
100
+ var _this2;
101
+ _classCallCheck(this, WithImageLoader);
102
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
103
+ args[_key2] = arguments[_key2];
104
+ }
105
+ _this2 = _super2.call.apply(_super2, [this].concat(args));
106
+ _defineProperty(_assertThisInitialized(_this2), "state", {
107
+ imageStatus: 'loading'
108
+ });
109
+ _defineProperty(_assertThisInitialized(_this2), "onLoad", function () {
110
+ _this2.setState({
111
+ imageStatus: 'complete'
112
+ });
113
+ var onExternalImageLoaded = _this2.props.onExternalImageLoaded;
114
+ if (onExternalImageLoaded && _this2.img) {
115
+ onExternalImageLoaded({
116
+ width: _this2.img.naturalWidth,
117
+ height: _this2.img.naturalHeight
118
+ });
119
+ }
120
+ });
121
+ _defineProperty(_assertThisInitialized(_this2), "onError", function () {
122
+ _this2.setState({
123
+ imageStatus: 'error'
124
+ });
125
+ });
126
+ return _this2;
127
+ }
128
+ _createClass(WithImageLoader, [{
129
+ key: "componentDidMount",
130
+ value: function componentDidMount() {
131
+ this.fetchImage(this.props);
132
+ }
133
+ }, {
134
+ key: "componentDidUpdate",
135
+ value: function componentDidUpdate(newProps) {
136
+ if (newProps.url !== this.props.url) {
137
+ this.setState({
138
+ imageStatus: 'loading'
139
+ });
140
+ this.fetchImage(newProps);
141
+ }
142
+ }
143
+ }, {
144
+ key: "componentWillUnmount",
145
+ value: function componentWillUnmount() {
146
+ if (this.img) {
147
+ this.img.removeEventListener('load', this.onLoad);
148
+ this.img.removeEventListener('error', this.onError);
149
+ this.img = null;
150
+ }
151
+ }
152
+ }, {
153
+ key: "fetchImage",
154
+ value: function fetchImage(_ref2) {
155
+ var url = _ref2.url;
156
+ if (url) {
157
+ if (!this.img) {
158
+ this.img = new Image();
159
+ this.img.addEventListener('load', this.onLoad);
160
+ this.img.addEventListener('error', this.onError);
161
+ }
162
+ this.img.src = url;
163
+ }
164
+ }
165
+ }, {
166
+ key: "render",
167
+ value: function render() {
168
+ var imageStatus = this.state.imageStatus;
169
+ return /*#__PURE__*/React.createElement(Wrapped, _extends({}, this.props, {
170
+ imageStatus: imageStatus
171
+ }));
172
+ }
173
+ }]);
174
+ return WithImageLoader;
175
+ }(Component);
176
+ };
177
+ export var withImageLoader = function withImageLoader(Wrapped) {
178
+ if (fg('platform_editor_react18_phase2')) {
179
+ return withImageLoaderNew(Wrapped);
180
+ }
181
+ return withImageLoaderOld(Wrapped);
93
182
  };
@@ -1,4 +1,5 @@
1
- import React, { type ComponentType } from 'react';
1
+ import React from 'react';
2
+ import type { ComponentType } from 'react';
2
3
  export interface ImageLoaderProps {
3
4
  url?: string;
4
5
  onExternalImageLoaded?: (dimensions: {
@@ -11,4 +12,5 @@ export interface ImageLoaderState {
11
12
  imageStatus: ImageStatus;
12
13
  }
13
14
  export type ImageStatus = 'complete' | 'loading' | 'error';
15
+ export declare const withImageLoaderOld: <P extends {}>(Wrapped: ComponentType<React.PropsWithChildren<P & ImageLoaderProps>>) => React.ComponentClass<P & ImageLoaderProps>;
14
16
  export declare const withImageLoader: <P extends {}>(Wrapped: ComponentType<React.PropsWithChildren<P & ImageLoaderProps>>) => React.ComponentClass<P & ImageLoaderProps>;
@@ -1,4 +1,5 @@
1
- import React, { type ComponentType } from 'react';
1
+ import React from 'react';
2
+ import type { ComponentType } from 'react';
2
3
  export interface ImageLoaderProps {
3
4
  url?: string;
4
5
  onExternalImageLoaded?: (dimensions: {
@@ -11,4 +12,5 @@ export interface ImageLoaderState {
11
12
  imageStatus: ImageStatus;
12
13
  }
13
14
  export type ImageStatus = 'complete' | 'loading' | 'error';
15
+ export declare const withImageLoaderOld: <P extends {}>(Wrapped: ComponentType<React.PropsWithChildren<P & ImageLoaderProps>>) => React.ComponentClass<P & ImageLoaderProps>;
14
16
  export declare const withImageLoader: <P extends {}>(Wrapped: ComponentType<React.PropsWithChildren<P & ImageLoaderProps>>) => React.ComponentClass<P & ImageLoaderProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "93.2.0",
3
+ "version": "93.2.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/"
@@ -137,7 +137,7 @@
137
137
  "@atlaskit/media-file-preview": "^0.9.0",
138
138
  "@atlaskit/media-picker": "^66.7.0",
139
139
  "@atlaskit/media-ui": "^25.15.0",
140
- "@atlaskit/media-viewer": "49.0.1",
140
+ "@atlaskit/media-viewer": "49.1.0",
141
141
  "@atlaskit/mention": "^23.3.0",
142
142
  "@atlaskit/menu": "^2.12.0",
143
143
  "@atlaskit/onboarding": "^11.2.0",
@@ -145,7 +145,7 @@
145
145
  "@atlaskit/primitives": "^12.2.0",
146
146
  "@atlaskit/profilecard": "^20.4.0",
147
147
  "@atlaskit/section-message": "^6.6.0",
148
- "@atlaskit/smart-card": "^29.2.0",
148
+ "@atlaskit/smart-card": "^29.3.0",
149
149
  "@atlaskit/smart-user-picker": "^6.10.0",
150
150
  "@atlaskit/spinner": "^16.3.0",
151
151
  "@atlaskit/task-decision": "^17.11.0",
@@ -265,6 +265,9 @@
265
265
  "platform_editor_react18_mention_with_provider": {
266
266
  "type": "boolean"
267
267
  },
268
+ "platform_editor_react18_phase2": {
269
+ "type": "boolean"
270
+ },
268
271
  "cc_page_experiences_live_search_wysiwyg": {
269
272
  "type": "boolean"
270
273
  },