@atlaskit/editor-common 111.20.4 → 111.20.6

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,22 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 111.20.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`6197fb38452ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6197fb38452ae) -
8
+ [ux] Sets height auto explicitly when static position is applied to address latent bug discovered
9
+ by ForgeAdfRenderer.
10
+ - Updated dependencies
11
+
12
+ ## 111.20.5
13
+
14
+ ### Patch Changes
15
+
16
+ - [`64fe39d800a84`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64fe39d800a84) -
17
+ Improve ExperienceCheckPopupMutation logic to be more performant
18
+ - Updated dependencies
19
+
3
20
  ## 111.20.4
4
21
 
5
22
  ### Patch Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ExperienceCheckPopupMutation = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -21,18 +22,10 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
21
22
  * - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
22
23
  */
23
24
  var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__PURE__*/function () {
24
- function ExperienceCheckPopupMutation(_ref) {
25
- var getEditorDom = _ref.getEditorDom,
26
- getTarget = _ref.getTarget,
27
- nestedElementQuery = _ref.nestedElementQuery,
28
- _ref$type = _ref.type,
29
- type = _ref$type === void 0 ? 'editorRoot' : _ref$type;
25
+ function ExperienceCheckPopupMutation(config) {
30
26
  (0, _classCallCheck2.default)(this, ExperienceCheckPopupMutation);
31
27
  (0, _defineProperty2.default)(this, "observers", []);
32
- this.getEditorDom = getEditorDom;
33
- this.getTarget = getTarget;
34
- this.nestedElementQuery = nestedElementQuery;
35
- this.type = type;
28
+ this.config = config;
36
29
  }
37
30
 
38
31
  /**
@@ -41,13 +34,14 @@ var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__P
41
34
  return (0, _createClass2.default)(ExperienceCheckPopupMutation, [{
42
35
  key: "getObserveTargets",
43
36
  value: function getObserveTargets() {
44
- switch (this.type) {
37
+ var config = this.config;
38
+ switch (config.type) {
45
39
  case 'inline':
46
- return this.getInlineTargets();
40
+ return this.getInlineTargets(config);
47
41
  case 'editorRoot':
48
- return this.getEditorRootTargets();
42
+ return this.getEditorRootTargets(config);
49
43
  case 'editorContent':
50
- return this.getEditorContentTargets();
44
+ return this.getEditorContentTargets(config);
51
45
  }
52
46
  }
53
47
 
@@ -58,8 +52,8 @@ var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__P
58
52
  */
59
53
  }, {
60
54
  key: "getEditorContentTargets",
61
- value: function getEditorContentTargets() {
62
- var target = this.getTarget();
55
+ value: function getEditorContentTargets(config) {
56
+ var target = config.getTarget();
63
57
  if (!target) {
64
58
  return [];
65
59
  }
@@ -87,8 +81,8 @@ var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__P
87
81
  */
88
82
  }, {
89
83
  key: "getInlineTargets",
90
- value: function getInlineTargets() {
91
- var target = this.getTarget();
84
+ value: function getInlineTargets(config) {
85
+ var target = config.getTarget();
92
86
  if (!target) {
93
87
  return [];
94
88
  }
@@ -102,26 +96,13 @@ var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__P
102
96
  */
103
97
  }, {
104
98
  key: "getEditorRootTargets",
105
- value: function getEditorRootTargets() {
99
+ value: function getEditorRootTargets(config) {
106
100
  var targets = [];
107
- var editorDom = this.getEditorDom();
101
+ var editorDom = config.getEditorDom();
108
102
  if (editorDom) {
109
103
  var editorRoot = editorDom.closest('.akEditor') || editorDom.parentElement;
110
104
  if (editorRoot instanceof HTMLElement) {
111
105
  targets.push(editorRoot);
112
- var wrappers = editorRoot.querySelectorAll('[data-editor-popup]');
113
- var _iterator2 = _createForOfIteratorHelper(wrappers),
114
- _step2;
115
- try {
116
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
117
- var wrapper = _step2.value;
118
- targets.push(wrapper);
119
- }
120
- } catch (err) {
121
- _iterator2.e(err);
122
- } finally {
123
- _iterator2.f();
124
- }
125
106
  }
126
107
  }
127
108
  return targets;
@@ -130,8 +111,7 @@ var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__P
130
111
  key: "start",
131
112
  value: function start(callback) {
132
113
  var _this = this;
133
- this.stop();
134
- var target = this.getTarget();
114
+ var target = this.config.type === 'editorRoot' ? this.config.getEditorDom() : this.config.getTarget();
135
115
  var doc = (0, _browserApis.getDocument)();
136
116
  if (!target || !doc) {
137
117
  callback({
@@ -141,78 +121,58 @@ var ExperienceCheckPopupMutation = exports.ExperienceCheckPopupMutation = /*#__P
141
121
  return;
142
122
  }
143
123
  var observeTargets = this.getObserveTargets();
144
- var query = this.nestedElementQuery;
124
+ var query = this.config.nestedElementQuery;
125
+ var subtree = this.config.type === 'inline' && this.config.subtree === true;
145
126
  var observe = function observe(el) {
146
127
  var observer = new MutationObserver(onMutation);
147
128
  observer.observe(el, {
148
- childList: true
129
+ childList: true,
130
+ subtree: subtree
149
131
  });
150
132
  _this.observers.push(observer);
151
133
  };
152
134
  var onMutation = function onMutation(mutations) {
153
- var _iterator3 = _createForOfIteratorHelper(mutations),
154
- _step3;
155
- try {
156
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
157
- var mutation = _step3.value;
158
- if (mutation.type !== 'childList') {
159
- continue;
160
- }
161
- var _iterator4 = _createForOfIteratorHelper(mutation.addedNodes),
162
- _step4;
163
- try {
164
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
165
- var node = _step4.value;
166
- if (!(node instanceof HTMLElement)) {
167
- continue;
168
- }
169
- var found = (0, _experienceUtils.popupWithNestedElement)(node, query) || node.matches(query) || !!node.querySelector(query);
170
- if (found) {
171
- callback({
172
- status: 'success'
173
- });
174
- return;
175
- }
176
- }
177
- } catch (err) {
178
- _iterator4.e(err);
179
- } finally {
180
- _iterator4.f();
181
- }
182
- }
183
- } catch (err) {
184
- _iterator3.e(err);
185
- } finally {
186
- _iterator3.f();
135
+ var found = mutations.some(function (_ref) {
136
+ var type = _ref.type,
137
+ addedNodes = _ref.addedNodes;
138
+ return type === 'childList' && (0, _toConsumableArray2.default)(addedNodes).some(function (node) {
139
+ return node instanceof HTMLElement && ((0, _experienceUtils.popupWithNestedElement)(node, query) || node.matches(query) || node.querySelector(query) !== null);
140
+ });
141
+ });
142
+ if (found) {
143
+ callback({
144
+ status: 'success'
145
+ });
146
+ return;
187
147
  }
188
148
  };
189
- var _iterator5 = _createForOfIteratorHelper(observeTargets),
190
- _step5;
149
+ var _iterator2 = _createForOfIteratorHelper(observeTargets),
150
+ _step2;
191
151
  try {
192
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
193
- var observeTarget = _step5.value;
152
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
153
+ var observeTarget = _step2.value;
194
154
  observe(observeTarget);
195
155
  }
196
156
  } catch (err) {
197
- _iterator5.e(err);
157
+ _iterator2.e(err);
198
158
  } finally {
199
- _iterator5.f();
159
+ _iterator2.f();
200
160
  }
201
161
  }
202
162
  }, {
203
163
  key: "stop",
204
164
  value: function stop() {
205
- var _iterator6 = _createForOfIteratorHelper(this.observers),
206
- _step6;
165
+ var _iterator3 = _createForOfIteratorHelper(this.observers),
166
+ _step3;
207
167
  try {
208
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
209
- var observer = _step6.value;
168
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
169
+ var observer = _step3.value;
210
170
  observer.disconnect();
211
171
  }
212
172
  } catch (err) {
213
- _iterator6.e(err);
173
+ _iterator3.e(err);
214
174
  } finally {
215
- _iterator6.f();
175
+ _iterator3.f();
216
176
  }
217
177
  this.observers = [];
218
178
  }
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "111.20.3";
22
+ var packageVersion = "0.0.0-development";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -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 = "111.20.3";
27
+ var packageVersion = "0.0.0-development";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -15,6 +15,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
15
15
  var _react = _interopRequireDefault(require("react"));
16
16
  var _react2 = require("@emotion/react");
17
17
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
19
20
  var _utils = require("../../utils");
20
21
  var _breakout = require("../../utils/breakout");
@@ -258,7 +259,7 @@ var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
258
259
 
259
260
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
260
261
  var mediaWrapperStyle = exports.mediaWrapperStyle = function mediaWrapperStyle(props) {
261
- return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\tposition: relative;\n\n\t", "\n\n\t/* Editor */\n & > figure {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t/* Comments on media project adds comment badge as child of the media wrapper,\n\tthus we need to exclude it so that style is applied to intended div */\n\t& > div:not([data-media-badges='true']) {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t& * [data-mark-annotation-type='inlineComment'] {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&[data-node-type='embedCard'] > div {\n\t\twidth: 100%;\n\t}\n\n\t/* Renderer */\n\t[data-node-type='media'] {\n\t\tposition: static !important;\n\n\t\t> div {\n\t\t\tposition: absolute;\n\t\t\theight: 100%;\n\t\t}\n\t}\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative');
262
+ return (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\tposition: relative;\n\n\t", "\n\n\t/* Editor */\n & > figure {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t/* Comments on media project adds comment badge as child of the media wrapper,\n\tthus we need to exclude it so that style is applied to intended div */\n\t& > div:not([data-media-badges='true']) {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t& * [data-mark-annotation-type='inlineComment'] {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&[data-node-type='embedCard'] > div {\n\t\twidth: 100%;\n\t}\n\n\t/* Renderer */\n\t[data-node-type='media'] {\n\t\tposition: static !important;\n\t\t", "\n\n\t\t> div {\n\t\t\tposition: absolute;\n\t\t\theight: 100%;\n\t\t}\n\t}\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative', (0, _platformFeatureFlags.fg)('platform_forge_ui_support_images_in_adfrenderer') ? 'height: auto !important;' : '');
262
263
  };
263
264
  var MediaWrapper = exports.MediaWrapper = function MediaWrapper(_ref3) {
264
265
  var children = _ref3.children,
@@ -11,30 +11,25 @@ import { popupWithNestedElement } from './experience-utils';
11
11
  */
12
12
 
13
13
  export class ExperienceCheckPopupMutation {
14
- constructor({
15
- getEditorDom,
16
- getTarget,
17
- nestedElementQuery,
18
- type = 'editorRoot'
19
- }) {
14
+ constructor(config) {
20
15
  _defineProperty(this, "observers", []);
21
- this.getEditorDom = getEditorDom;
22
- this.getTarget = getTarget;
23
- this.nestedElementQuery = nestedElementQuery;
24
- this.type = type;
16
+ this.config = config;
25
17
  }
26
18
 
27
19
  /**
28
20
  * Returns the list of DOM elements to observe based on popup type.
29
21
  */
30
22
  getObserveTargets() {
31
- switch (this.type) {
23
+ const {
24
+ config
25
+ } = this;
26
+ switch (config.type) {
32
27
  case 'inline':
33
- return this.getInlineTargets();
28
+ return this.getInlineTargets(config);
34
29
  case 'editorRoot':
35
- return this.getEditorRootTargets();
30
+ return this.getEditorRootTargets(config);
36
31
  case 'editorContent':
37
- return this.getEditorContentTargets();
32
+ return this.getEditorContentTargets(config);
38
33
  }
39
34
  }
40
35
 
@@ -43,8 +38,8 @@ export class ExperienceCheckPopupMutation {
43
38
  * [data-editor-popup] wrappers within it. Content-level popups and modals
44
39
  * appear in portal containers.
45
40
  */
46
- getEditorContentTargets() {
47
- const target = this.getTarget();
41
+ getEditorContentTargets(config) {
42
+ const target = config.getTarget();
48
43
  if (!target) {
49
44
  return [];
50
45
  }
@@ -61,8 +56,8 @@ export class ExperienceCheckPopupMutation {
61
56
  * The caller is responsible for resolving the correct container
62
57
  * (e.g. the toolbar button-group) via the getTarget function.
63
58
  */
64
- getInlineTargets() {
65
- const target = this.getTarget();
59
+ getInlineTargets(config) {
60
+ const target = config.getTarget();
66
61
  if (!target) {
67
62
  return [];
68
63
  }
@@ -74,24 +69,19 @@ export class ExperienceCheckPopupMutation {
74
69
  * The editorDom is the ProseMirror element, but popups appear as direct children
75
70
  * of the parent .akEditor container. So we observe the parent of editorDom.
76
71
  */
77
- getEditorRootTargets() {
72
+ getEditorRootTargets(config) {
78
73
  const targets = [];
79
- const editorDom = this.getEditorDom();
74
+ const editorDom = config.getEditorDom();
80
75
  if (editorDom) {
81
76
  const editorRoot = editorDom.closest('.akEditor') || editorDom.parentElement;
82
77
  if (editorRoot instanceof HTMLElement) {
83
78
  targets.push(editorRoot);
84
- const wrappers = editorRoot.querySelectorAll('[data-editor-popup]');
85
- for (const wrapper of wrappers) {
86
- targets.push(wrapper);
87
- }
88
79
  }
89
80
  }
90
81
  return targets;
91
82
  }
92
83
  start(callback) {
93
- this.stop();
94
- const target = this.getTarget();
84
+ const target = this.config.type === 'editorRoot' ? this.config.getEditorDom() : this.config.getTarget();
95
85
  const doc = getDocument();
96
86
  if (!target || !doc) {
97
87
  callback({
@@ -101,31 +91,26 @@ export class ExperienceCheckPopupMutation {
101
91
  return;
102
92
  }
103
93
  const observeTargets = this.getObserveTargets();
104
- const query = this.nestedElementQuery;
94
+ const query = this.config.nestedElementQuery;
95
+ const subtree = this.config.type === 'inline' && this.config.subtree === true;
105
96
  const observe = el => {
106
97
  const observer = new MutationObserver(onMutation);
107
98
  observer.observe(el, {
108
- childList: true
99
+ childList: true,
100
+ subtree
109
101
  });
110
102
  this.observers.push(observer);
111
103
  };
112
104
  const onMutation = mutations => {
113
- for (const mutation of mutations) {
114
- if (mutation.type !== 'childList') {
115
- continue;
116
- }
117
- for (const node of mutation.addedNodes) {
118
- if (!(node instanceof HTMLElement)) {
119
- continue;
120
- }
121
- const found = popupWithNestedElement(node, query) || node.matches(query) || !!node.querySelector(query);
122
- if (found) {
123
- callback({
124
- status: 'success'
125
- });
126
- return;
127
- }
128
- }
105
+ const found = mutations.some(({
106
+ type,
107
+ addedNodes
108
+ }) => type === 'childList' && [...addedNodes].some(node => node instanceof HTMLElement && (popupWithNestedElement(node, query) || node.matches(query) || node.querySelector(query) !== null)));
109
+ if (found) {
110
+ callback({
111
+ status: 'success'
112
+ });
113
+ return;
129
114
  }
130
115
  };
131
116
  for (const observeTarget of observeTargets) {
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "111.20.3";
7
+ const packageVersion = "0.0.0-development";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "111.20.3";
17
+ const packageVersion = "0.0.0-development";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -8,6 +8,7 @@ import React from 'react';
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { akEditorDefaultLayoutWidth, akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
11
+ import { fg } from '@atlaskit/platform-feature-flags';
11
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
13
  import { nonWrappedLayouts } from '../../utils';
13
14
  import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
@@ -320,6 +321,7 @@ export const mediaWrapperStyle = props => css`
320
321
  /* Renderer */
321
322
  [data-node-type='media'] {
322
323
  position: static !important;
324
+ ${fg('platform_forge_ui_support_images_in_adfrenderer') ? 'height: auto !important;' : ''}
323
325
 
324
326
  > div {
325
327
  position: absolute;
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/createClass";
3
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
@@ -16,18 +17,10 @@ import { popupWithNestedElement } from './experience-utils';
16
17
  */
17
18
 
18
19
  export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
19
- function ExperienceCheckPopupMutation(_ref) {
20
- var getEditorDom = _ref.getEditorDom,
21
- getTarget = _ref.getTarget,
22
- nestedElementQuery = _ref.nestedElementQuery,
23
- _ref$type = _ref.type,
24
- type = _ref$type === void 0 ? 'editorRoot' : _ref$type;
20
+ function ExperienceCheckPopupMutation(config) {
25
21
  _classCallCheck(this, ExperienceCheckPopupMutation);
26
22
  _defineProperty(this, "observers", []);
27
- this.getEditorDom = getEditorDom;
28
- this.getTarget = getTarget;
29
- this.nestedElementQuery = nestedElementQuery;
30
- this.type = type;
23
+ this.config = config;
31
24
  }
32
25
 
33
26
  /**
@@ -36,13 +29,14 @@ export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
36
29
  return _createClass(ExperienceCheckPopupMutation, [{
37
30
  key: "getObserveTargets",
38
31
  value: function getObserveTargets() {
39
- switch (this.type) {
32
+ var config = this.config;
33
+ switch (config.type) {
40
34
  case 'inline':
41
- return this.getInlineTargets();
35
+ return this.getInlineTargets(config);
42
36
  case 'editorRoot':
43
- return this.getEditorRootTargets();
37
+ return this.getEditorRootTargets(config);
44
38
  case 'editorContent':
45
- return this.getEditorContentTargets();
39
+ return this.getEditorContentTargets(config);
46
40
  }
47
41
  }
48
42
 
@@ -53,8 +47,8 @@ export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
53
47
  */
54
48
  }, {
55
49
  key: "getEditorContentTargets",
56
- value: function getEditorContentTargets() {
57
- var target = this.getTarget();
50
+ value: function getEditorContentTargets(config) {
51
+ var target = config.getTarget();
58
52
  if (!target) {
59
53
  return [];
60
54
  }
@@ -82,8 +76,8 @@ export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
82
76
  */
83
77
  }, {
84
78
  key: "getInlineTargets",
85
- value: function getInlineTargets() {
86
- var target = this.getTarget();
79
+ value: function getInlineTargets(config) {
80
+ var target = config.getTarget();
87
81
  if (!target) {
88
82
  return [];
89
83
  }
@@ -97,26 +91,13 @@ export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
97
91
  */
98
92
  }, {
99
93
  key: "getEditorRootTargets",
100
- value: function getEditorRootTargets() {
94
+ value: function getEditorRootTargets(config) {
101
95
  var targets = [];
102
- var editorDom = this.getEditorDom();
96
+ var editorDom = config.getEditorDom();
103
97
  if (editorDom) {
104
98
  var editorRoot = editorDom.closest('.akEditor') || editorDom.parentElement;
105
99
  if (editorRoot instanceof HTMLElement) {
106
100
  targets.push(editorRoot);
107
- var wrappers = editorRoot.querySelectorAll('[data-editor-popup]');
108
- var _iterator2 = _createForOfIteratorHelper(wrappers),
109
- _step2;
110
- try {
111
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
112
- var wrapper = _step2.value;
113
- targets.push(wrapper);
114
- }
115
- } catch (err) {
116
- _iterator2.e(err);
117
- } finally {
118
- _iterator2.f();
119
- }
120
101
  }
121
102
  }
122
103
  return targets;
@@ -125,8 +106,7 @@ export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
125
106
  key: "start",
126
107
  value: function start(callback) {
127
108
  var _this = this;
128
- this.stop();
129
- var target = this.getTarget();
109
+ var target = this.config.type === 'editorRoot' ? this.config.getEditorDom() : this.config.getTarget();
130
110
  var doc = getDocument();
131
111
  if (!target || !doc) {
132
112
  callback({
@@ -136,78 +116,58 @@ export var ExperienceCheckPopupMutation = /*#__PURE__*/function () {
136
116
  return;
137
117
  }
138
118
  var observeTargets = this.getObserveTargets();
139
- var query = this.nestedElementQuery;
119
+ var query = this.config.nestedElementQuery;
120
+ var subtree = this.config.type === 'inline' && this.config.subtree === true;
140
121
  var observe = function observe(el) {
141
122
  var observer = new MutationObserver(onMutation);
142
123
  observer.observe(el, {
143
- childList: true
124
+ childList: true,
125
+ subtree: subtree
144
126
  });
145
127
  _this.observers.push(observer);
146
128
  };
147
129
  var onMutation = function onMutation(mutations) {
148
- var _iterator3 = _createForOfIteratorHelper(mutations),
149
- _step3;
150
- try {
151
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
152
- var mutation = _step3.value;
153
- if (mutation.type !== 'childList') {
154
- continue;
155
- }
156
- var _iterator4 = _createForOfIteratorHelper(mutation.addedNodes),
157
- _step4;
158
- try {
159
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
160
- var node = _step4.value;
161
- if (!(node instanceof HTMLElement)) {
162
- continue;
163
- }
164
- var found = popupWithNestedElement(node, query) || node.matches(query) || !!node.querySelector(query);
165
- if (found) {
166
- callback({
167
- status: 'success'
168
- });
169
- return;
170
- }
171
- }
172
- } catch (err) {
173
- _iterator4.e(err);
174
- } finally {
175
- _iterator4.f();
176
- }
177
- }
178
- } catch (err) {
179
- _iterator3.e(err);
180
- } finally {
181
- _iterator3.f();
130
+ var found = mutations.some(function (_ref) {
131
+ var type = _ref.type,
132
+ addedNodes = _ref.addedNodes;
133
+ return type === 'childList' && _toConsumableArray(addedNodes).some(function (node) {
134
+ return node instanceof HTMLElement && (popupWithNestedElement(node, query) || node.matches(query) || node.querySelector(query) !== null);
135
+ });
136
+ });
137
+ if (found) {
138
+ callback({
139
+ status: 'success'
140
+ });
141
+ return;
182
142
  }
183
143
  };
184
- var _iterator5 = _createForOfIteratorHelper(observeTargets),
185
- _step5;
144
+ var _iterator2 = _createForOfIteratorHelper(observeTargets),
145
+ _step2;
186
146
  try {
187
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
188
- var observeTarget = _step5.value;
147
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
148
+ var observeTarget = _step2.value;
189
149
  observe(observeTarget);
190
150
  }
191
151
  } catch (err) {
192
- _iterator5.e(err);
152
+ _iterator2.e(err);
193
153
  } finally {
194
- _iterator5.f();
154
+ _iterator2.f();
195
155
  }
196
156
  }
197
157
  }, {
198
158
  key: "stop",
199
159
  value: function stop() {
200
- var _iterator6 = _createForOfIteratorHelper(this.observers),
201
- _step6;
160
+ var _iterator3 = _createForOfIteratorHelper(this.observers),
161
+ _step3;
202
162
  try {
203
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
204
- var observer = _step6.value;
163
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
164
+ var observer = _step3.value;
205
165
  observer.disconnect();
206
166
  }
207
167
  } catch (err) {
208
- _iterator6.e(err);
168
+ _iterator3.e(err);
209
169
  } finally {
210
- _iterator6.f();
170
+ _iterator3.f();
211
171
  }
212
172
  this.observers = [];
213
173
  }
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "111.20.3";
13
+ var packageVersion = "0.0.0-development";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "111.20.3";
24
+ var packageVersion = "0.0.0-development";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -12,6 +12,7 @@ import React from 'react';
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  import { css, jsx } from '@emotion/react';
14
14
  import { akEditorDefaultLayoutWidth, akEditorFullPageMaxWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
16
17
  import { nonWrappedLayouts } from '../../utils';
17
18
  import { calcBreakoutWidth, calcWideWidth } from '../../utils/breakout';
@@ -248,7 +249,7 @@ var RenderFallbackContainer = function RenderFallbackContainer(_ref2) {
248
249
 
249
250
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation
250
251
  export var mediaWrapperStyle = function mediaWrapperStyle(props) {
251
- return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\tposition: relative;\n\n\t", "\n\n\t/* Editor */\n & > figure {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t/* Comments on media project adds comment badge as child of the media wrapper,\n\tthus we need to exclude it so that style is applied to intended div */\n\t& > div:not([data-media-badges='true']) {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t& * [data-mark-annotation-type='inlineComment'] {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&[data-node-type='embedCard'] > div {\n\t\twidth: 100%;\n\t}\n\n\t/* Renderer */\n\t[data-node-type='media'] {\n\t\tposition: static !important;\n\n\t\t> div {\n\t\t\tposition: absolute;\n\t\t\theight: 100%;\n\t\t}\n\t}\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative');
252
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\tposition: relative;\n\n\t", "\n\n\t/* Editor */\n & > figure {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t/* Comments on media project adds comment badge as child of the media wrapper,\n\tthus we need to exclude it so that style is applied to intended div */\n\t& > div:not([data-media-badges='true']) {\n\t\tposition: ", ";\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\n\t& * [data-mark-annotation-type='inlineComment'] {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t&[data-node-type='embedCard'] > div {\n\t\twidth: 100%;\n\t}\n\n\t/* Renderer */\n\t[data-node-type='media'] {\n\t\tposition: static !important;\n\t\t", "\n\n\t\t> div {\n\t\t\tposition: absolute;\n\t\t\theight: 100%;\n\t\t}\n\t}\n"])), RenderFallbackContainer(props), props.hasFallbackContainer ? 'absolute' : 'relative', props.hasFallbackContainer ? 'absolute' : 'relative', fg('platform_forge_ui_support_images_in_adfrenderer') ? 'height: auto !important;' : '');
252
253
  };
253
254
  export var MediaWrapper = function MediaWrapper(_ref3) {
254
255
  var children = _ref3.children,
@@ -6,19 +6,32 @@ import type { ExperienceCheck, ExperienceCheckCallback } from './ExperienceCheck
6
6
  * - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
7
7
  */
8
8
  export type PopupCheckType = 'inline' | 'editorRoot' | 'editorContent';
9
- export type ExperienceCheckPopupMutationConfig = {
9
+ type InlineConfig = {
10
+ getTarget: () => HTMLElement | undefined | null;
11
+ nestedElementQuery: string;
12
+ /**
13
+ * Observe the entire subtree for mutations, not just direct children.
14
+ * Use with caution — only enable when the observed DOM subtree is small/lightweight
15
+ * (e.g. a single toolbar button). Enabling on large subtrees can cause performance issues.
16
+ */
17
+ subtree?: boolean;
18
+ type: 'inline';
19
+ };
20
+ type EditorRootConfig = {
10
21
  getEditorDom: () => HTMLElement | undefined | null;
22
+ nestedElementQuery: string;
23
+ type: 'editorRoot';
24
+ };
25
+ type EditorContentConfig = {
11
26
  getTarget: () => HTMLElement | undefined | null;
12
27
  nestedElementQuery: string;
13
- type?: PopupCheckType;
28
+ type: 'editorContent';
14
29
  };
30
+ export type ExperienceCheckPopupMutationConfig = InlineConfig | EditorRootConfig | EditorContentConfig;
15
31
  export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
16
- private getEditorDom;
17
- private getTarget;
18
- private nestedElementQuery;
32
+ private config;
19
33
  private observers;
20
- private type;
21
- constructor({ getEditorDom, getTarget, nestedElementQuery, type, }: ExperienceCheckPopupMutationConfig);
34
+ constructor(config: ExperienceCheckPopupMutationConfig);
22
35
  /**
23
36
  * Returns the list of DOM elements to observe based on popup type.
24
37
  */
@@ -44,3 +57,4 @@ export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
44
57
  start(callback: ExperienceCheckCallback): void;
45
58
  stop(): void;
46
59
  }
60
+ export {};
@@ -6,19 +6,32 @@ import type { ExperienceCheck, ExperienceCheckCallback } from './ExperienceCheck
6
6
  * - 'editorContent': Content-level popups or modals in portal containers (e.g., block menu)
7
7
  */
8
8
  export type PopupCheckType = 'inline' | 'editorRoot' | 'editorContent';
9
- export type ExperienceCheckPopupMutationConfig = {
9
+ type InlineConfig = {
10
+ getTarget: () => HTMLElement | undefined | null;
11
+ nestedElementQuery: string;
12
+ /**
13
+ * Observe the entire subtree for mutations, not just direct children.
14
+ * Use with caution — only enable when the observed DOM subtree is small/lightweight
15
+ * (e.g. a single toolbar button). Enabling on large subtrees can cause performance issues.
16
+ */
17
+ subtree?: boolean;
18
+ type: 'inline';
19
+ };
20
+ type EditorRootConfig = {
10
21
  getEditorDom: () => HTMLElement | undefined | null;
22
+ nestedElementQuery: string;
23
+ type: 'editorRoot';
24
+ };
25
+ type EditorContentConfig = {
11
26
  getTarget: () => HTMLElement | undefined | null;
12
27
  nestedElementQuery: string;
13
- type?: PopupCheckType;
28
+ type: 'editorContent';
14
29
  };
30
+ export type ExperienceCheckPopupMutationConfig = InlineConfig | EditorRootConfig | EditorContentConfig;
15
31
  export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
16
- private getEditorDom;
17
- private getTarget;
18
- private nestedElementQuery;
32
+ private config;
19
33
  private observers;
20
- private type;
21
- constructor({ getEditorDom, getTarget, nestedElementQuery, type, }: ExperienceCheckPopupMutationConfig);
34
+ constructor(config: ExperienceCheckPopupMutationConfig);
22
35
  /**
23
36
  * Returns the list of DOM elements to observe based on popup type.
24
37
  */
@@ -44,3 +57,4 @@ export declare class ExperienceCheckPopupMutation implements ExperienceCheck {
44
57
  start(callback: ExperienceCheckCallback): void;
45
58
  stop(): void;
46
59
  }
60
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "111.20.4",
3
+ "version": "111.20.6",
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/"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@atlaskit/activity-provider": "^2.5.0",
33
- "@atlaskit/adf-schema": "^51.5.0",
33
+ "@atlaskit/adf-schema": "^52.0.0",
34
34
  "@atlaskit/adf-utils": "^19.27.0",
35
35
  "@atlaskit/afm-i18n-platform-editor-editor-common": "2.18.0",
36
36
  "@atlaskit/analytics-listeners": "^10.0.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/codemod-utils": "^4.2.0",
43
43
  "@atlaskit/css": "^0.19.0",
44
44
  "@atlaskit/custom-steps": "^0.16.0",
45
- "@atlaskit/dropdown-menu": "^16.4.0",
45
+ "@atlaskit/dropdown-menu": "^16.5.0",
46
46
  "@atlaskit/editor-json-transformer": "^8.31.0",
47
47
  "@atlaskit/editor-palette": "^2.1.0",
48
48
  "@atlaskit/editor-prosemirror": "^7.3.0",
@@ -73,7 +73,7 @@
73
73
  "@atlaskit/primitives": "^18.0.0",
74
74
  "@atlaskit/profilecard": "^24.37.0",
75
75
  "@atlaskit/prosemirror-history": "^0.2.0",
76
- "@atlaskit/react-ufo": "^5.3.0",
76
+ "@atlaskit/react-ufo": "^5.4.0",
77
77
  "@atlaskit/section-message": "^8.12.0",
78
78
  "@atlaskit/smart-card": "^43.25.0",
79
79
  "@atlaskit/smart-user-picker": "^9.0.0",
@@ -82,7 +82,7 @@
82
82
  "@atlaskit/task-decision": "^19.2.0",
83
83
  "@atlaskit/textfield": "^8.2.0",
84
84
  "@atlaskit/theme": "^21.0.0",
85
- "@atlaskit/tmp-editor-statsig": "^31.0.0",
85
+ "@atlaskit/tmp-editor-statsig": "^31.3.0",
86
86
  "@atlaskit/tokens": "^11.0.0",
87
87
  "@atlaskit/tooltip": "^20.14.0",
88
88
  "@atlaskit/width-detector": "^5.0.0",
@@ -268,6 +268,9 @@
268
268
  "platform_editor_native_anchor_patch_2": {
269
269
  "type": "boolean"
270
270
  },
271
+ "platform_forge_ui_support_images_in_adfrenderer": {
272
+ "type": "boolean"
273
+ },
271
274
  "platform_editor_toolbar_aifc_placement_overridden": {
272
275
  "type": "boolean"
273
276
  }