@atlaskit/react-ufo 4.7.4 → 4.7.5
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 +7 -0
- package/dist/cjs/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.js +115 -0
- package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +16 -0
- package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.js +80 -0
- package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +16 -0
- package/dist/esm/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.js +109 -0
- package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +16 -0
- package/dist/types/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.d.ts +14 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.d.ts +14 -0
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/ufo-interaction-ignore
|
|
2
2
|
|
|
3
|
+
## 4.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1a2a53c0d8141`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1a2a53c0d8141) -
|
|
8
|
+
Ignore style mutations from adding drag and drop anchor names
|
|
9
|
+
|
|
3
10
|
## 4.7.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
var _featureFlagsAccessed = require("../../../../feature-flags-accessed");
|
|
11
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
// copied from '@atlaskit/tmp-editor-statsig/expVal' to avoid circular dependency
|
|
15
|
+
var expVal = function expVal(experimentName, experimentParam, defaultValue) {
|
|
16
|
+
// If client is not initialized, we return the default value
|
|
17
|
+
if (!_featureGateJsClient.default.initializeCompleted()) {
|
|
18
|
+
return defaultValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils
|
|
22
|
+
var experimentValue = _featureGateJsClient.default.getExperimentValue(experimentName, experimentParam, defaultValue);
|
|
23
|
+
(0, _featureFlagsAccessed.addFeatureFlagAccessed)("".concat(experimentName, ":").concat(experimentParam), experimentValue);
|
|
24
|
+
return experimentValue;
|
|
25
|
+
};
|
|
26
|
+
var isDnDStyleChange = function isDnDStyleChange(style) {
|
|
27
|
+
return style.startsWith('anchor-name: --node-anchor');
|
|
28
|
+
};
|
|
29
|
+
var parseStyleSet = function parseStyleSet(style) {
|
|
30
|
+
if (!style) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
var set = new Set();
|
|
34
|
+
var _iterator = _createForOfIteratorHelper(style.split(';')),
|
|
35
|
+
_step;
|
|
36
|
+
try {
|
|
37
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
38
|
+
var part = _step.value;
|
|
39
|
+
var t = part.trim();
|
|
40
|
+
if (t) {
|
|
41
|
+
set.add(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
_iterator.e(err);
|
|
46
|
+
} finally {
|
|
47
|
+
_iterator.f();
|
|
48
|
+
}
|
|
49
|
+
return set;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
54
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
55
|
+
* This should be removed once DnD has been fixed.
|
|
56
|
+
* @param mutation - The mutation record to check
|
|
57
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
58
|
+
*/
|
|
59
|
+
function isDnDStyleMutation(_ref) {
|
|
60
|
+
var target = _ref.target,
|
|
61
|
+
attributeName = _ref.attributeName,
|
|
62
|
+
oldValue = _ref.oldValue,
|
|
63
|
+
newValue = _ref.newValue;
|
|
64
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (!expVal('platform_editor_tables_scaling_css', 'excludeDnD', false)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!(target instanceof Element)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (attributeName !== 'style') {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
var oldStyles = parseStyleSet(oldValue);
|
|
77
|
+
var newStyles = parseStyleSet(newValue);
|
|
78
|
+
var isDnDMutation = false;
|
|
79
|
+
var _iterator2 = _createForOfIteratorHelper(oldStyles !== null && oldStyles !== void 0 ? oldStyles : []),
|
|
80
|
+
_step2;
|
|
81
|
+
try {
|
|
82
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
83
|
+
var s = _step2.value;
|
|
84
|
+
if (!(newStyles !== null && newStyles !== void 0 && newStyles.has(s))) {
|
|
85
|
+
if (!isDnDStyleChange(s)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
isDnDMutation = true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch (err) {
|
|
92
|
+
_iterator2.e(err);
|
|
93
|
+
} finally {
|
|
94
|
+
_iterator2.f();
|
|
95
|
+
}
|
|
96
|
+
var _iterator3 = _createForOfIteratorHelper(newStyles !== null && newStyles !== void 0 ? newStyles : []),
|
|
97
|
+
_step3;
|
|
98
|
+
try {
|
|
99
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
100
|
+
var _s = _step3.value;
|
|
101
|
+
if (!(oldStyles !== null && oldStyles !== void 0 && oldStyles.has(_s))) {
|
|
102
|
+
if (!isDnDStyleChange(_s)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
isDnDMutation = true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} catch (err) {
|
|
109
|
+
_iterator3.e(err);
|
|
110
|
+
} finally {
|
|
111
|
+
_iterator3.f();
|
|
112
|
+
}
|
|
113
|
+
return isDnDMutation;
|
|
114
|
+
}
|
|
115
|
+
var _default = exports.default = isDnDStyleMutation;
|
|
@@ -13,6 +13,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
15
|
var _vcUtils = require("../../vc-observer/media-wrapper/vc-utils");
|
|
16
|
+
var _isDndStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation"));
|
|
16
17
|
var _isNonVisualStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation"));
|
|
17
18
|
var _rllPlaceholders = require("../../vc-observer/observers/rll-placeholders");
|
|
18
19
|
var _intersectionObserver = require("./intersection-observer");
|
|
@@ -320,6 +321,21 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
|
|
|
320
321
|
}
|
|
321
322
|
};
|
|
322
323
|
}
|
|
324
|
+
if ((0, _isDndStyleMutation.default)({
|
|
325
|
+
target: target,
|
|
326
|
+
attributeName: attributeName,
|
|
327
|
+
oldValue: oldValue,
|
|
328
|
+
newValue: newValue
|
|
329
|
+
})) {
|
|
330
|
+
return {
|
|
331
|
+
type: 'mutation:attribute:non-visual-style',
|
|
332
|
+
mutationData: {
|
|
333
|
+
attributeName: attributeName,
|
|
334
|
+
oldValue: oldValue,
|
|
335
|
+
newValue: newValue
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
323
339
|
if ((0, _isNonVisualStyleMutation.default)({
|
|
324
340
|
target: target,
|
|
325
341
|
attributeName: attributeName,
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { addFeatureFlagAccessed } from '../../../../feature-flags-accessed';
|
|
4
|
+
|
|
5
|
+
// copied from '@atlaskit/tmp-editor-statsig/expVal' to avoid circular dependency
|
|
6
|
+
const expVal = (experimentName, experimentParam, defaultValue) => {
|
|
7
|
+
// If client is not initialized, we return the default value
|
|
8
|
+
if (!FeatureGates.initializeCompleted()) {
|
|
9
|
+
return defaultValue;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils
|
|
13
|
+
const experimentValue = FeatureGates.getExperimentValue(experimentName, experimentParam, defaultValue);
|
|
14
|
+
addFeatureFlagAccessed(`${experimentName}:${experimentParam}`, experimentValue);
|
|
15
|
+
return experimentValue;
|
|
16
|
+
};
|
|
17
|
+
const isDnDStyleChange = style => {
|
|
18
|
+
return style.startsWith('anchor-name: --node-anchor');
|
|
19
|
+
};
|
|
20
|
+
const parseStyleSet = style => {
|
|
21
|
+
if (!style) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const set = new Set();
|
|
25
|
+
for (const part of style.split(';')) {
|
|
26
|
+
const t = part.trim();
|
|
27
|
+
if (t) {
|
|
28
|
+
set.add(t);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return set;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
36
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
37
|
+
* This should be removed once DnD has been fixed.
|
|
38
|
+
* @param mutation - The mutation record to check
|
|
39
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
40
|
+
*/
|
|
41
|
+
function isDnDStyleMutation({
|
|
42
|
+
target,
|
|
43
|
+
attributeName,
|
|
44
|
+
oldValue,
|
|
45
|
+
newValue
|
|
46
|
+
}) {
|
|
47
|
+
if (!fg('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (!expVal('platform_editor_tables_scaling_css', 'excludeDnD', false)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (!(target instanceof Element)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
if (attributeName !== 'style') {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const oldStyles = parseStyleSet(oldValue);
|
|
60
|
+
const newStyles = parseStyleSet(newValue);
|
|
61
|
+
let isDnDMutation = false;
|
|
62
|
+
for (const s of oldStyles !== null && oldStyles !== void 0 ? oldStyles : []) {
|
|
63
|
+
if (!(newStyles !== null && newStyles !== void 0 && newStyles.has(s))) {
|
|
64
|
+
if (!isDnDStyleChange(s)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
isDnDMutation = true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const s of newStyles !== null && newStyles !== void 0 ? newStyles : []) {
|
|
71
|
+
if (!(oldStyles !== null && oldStyles !== void 0 && oldStyles.has(s))) {
|
|
72
|
+
if (!isDnDStyleChange(s)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
isDnDMutation = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return isDnDMutation;
|
|
79
|
+
}
|
|
80
|
+
export default isDnDStyleMutation;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
4
|
+
import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
|
|
4
5
|
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
5
6
|
import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
|
|
6
7
|
import { createIntersectionObserver } from './intersection-observer';
|
|
@@ -223,6 +224,21 @@ export default class ViewportObserver {
|
|
|
223
224
|
}
|
|
224
225
|
};
|
|
225
226
|
}
|
|
227
|
+
if (isDnDStyleMutation({
|
|
228
|
+
target,
|
|
229
|
+
attributeName,
|
|
230
|
+
oldValue,
|
|
231
|
+
newValue
|
|
232
|
+
})) {
|
|
233
|
+
return {
|
|
234
|
+
type: 'mutation:attribute:non-visual-style',
|
|
235
|
+
mutationData: {
|
|
236
|
+
attributeName,
|
|
237
|
+
oldValue,
|
|
238
|
+
newValue
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
226
242
|
if (isNonVisualStyleMutation({
|
|
227
243
|
target,
|
|
228
244
|
attributeName,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { addFeatureFlagAccessed } from '../../../../feature-flags-accessed';
|
|
7
|
+
|
|
8
|
+
// copied from '@atlaskit/tmp-editor-statsig/expVal' to avoid circular dependency
|
|
9
|
+
var expVal = function expVal(experimentName, experimentParam, defaultValue) {
|
|
10
|
+
// If client is not initialized, we return the default value
|
|
11
|
+
if (!FeatureGates.initializeCompleted()) {
|
|
12
|
+
return defaultValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @atlaskit/platform/use-recommended-utils
|
|
16
|
+
var experimentValue = FeatureGates.getExperimentValue(experimentName, experimentParam, defaultValue);
|
|
17
|
+
addFeatureFlagAccessed("".concat(experimentName, ":").concat(experimentParam), experimentValue);
|
|
18
|
+
return experimentValue;
|
|
19
|
+
};
|
|
20
|
+
var isDnDStyleChange = function isDnDStyleChange(style) {
|
|
21
|
+
return style.startsWith('anchor-name: --node-anchor');
|
|
22
|
+
};
|
|
23
|
+
var parseStyleSet = function parseStyleSet(style) {
|
|
24
|
+
if (!style) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
var set = new Set();
|
|
28
|
+
var _iterator = _createForOfIteratorHelper(style.split(';')),
|
|
29
|
+
_step;
|
|
30
|
+
try {
|
|
31
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
32
|
+
var part = _step.value;
|
|
33
|
+
var t = part.trim();
|
|
34
|
+
if (t) {
|
|
35
|
+
set.add(t);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
_iterator.e(err);
|
|
40
|
+
} finally {
|
|
41
|
+
_iterator.f();
|
|
42
|
+
}
|
|
43
|
+
return set;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
48
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
49
|
+
* This should be removed once DnD has been fixed.
|
|
50
|
+
* @param mutation - The mutation record to check
|
|
51
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
52
|
+
*/
|
|
53
|
+
function isDnDStyleMutation(_ref) {
|
|
54
|
+
var target = _ref.target,
|
|
55
|
+
attributeName = _ref.attributeName,
|
|
56
|
+
oldValue = _ref.oldValue,
|
|
57
|
+
newValue = _ref.newValue;
|
|
58
|
+
if (!fg('platform_editor_exclude_dnd_anchor_name_from_ttvc')) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
if (!expVal('platform_editor_tables_scaling_css', 'excludeDnD', false)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (!(target instanceof Element)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (attributeName !== 'style') {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
var oldStyles = parseStyleSet(oldValue);
|
|
71
|
+
var newStyles = parseStyleSet(newValue);
|
|
72
|
+
var isDnDMutation = false;
|
|
73
|
+
var _iterator2 = _createForOfIteratorHelper(oldStyles !== null && oldStyles !== void 0 ? oldStyles : []),
|
|
74
|
+
_step2;
|
|
75
|
+
try {
|
|
76
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
77
|
+
var s = _step2.value;
|
|
78
|
+
if (!(newStyles !== null && newStyles !== void 0 && newStyles.has(s))) {
|
|
79
|
+
if (!isDnDStyleChange(s)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
isDnDMutation = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
_iterator2.e(err);
|
|
87
|
+
} finally {
|
|
88
|
+
_iterator2.f();
|
|
89
|
+
}
|
|
90
|
+
var _iterator3 = _createForOfIteratorHelper(newStyles !== null && newStyles !== void 0 ? newStyles : []),
|
|
91
|
+
_step3;
|
|
92
|
+
try {
|
|
93
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
94
|
+
var _s = _step3.value;
|
|
95
|
+
if (!(oldStyles !== null && oldStyles !== void 0 && oldStyles.has(_s))) {
|
|
96
|
+
if (!isDnDStyleChange(_s)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
isDnDMutation = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} catch (err) {
|
|
103
|
+
_iterator3.e(err);
|
|
104
|
+
} finally {
|
|
105
|
+
_iterator3.f();
|
|
106
|
+
}
|
|
107
|
+
return isDnDMutation;
|
|
108
|
+
}
|
|
109
|
+
export default isDnDStyleMutation;
|
|
@@ -8,6 +8,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
8
8
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { isContainedWithinMediaWrapper } from '../../vc-observer/media-wrapper/vc-utils';
|
|
11
|
+
import isDnDStyleMutation from '../../vc-observer/observers/non-visual-styles/is-dnd-style-mutation';
|
|
11
12
|
import isNonVisualStyleMutation from '../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation';
|
|
12
13
|
import { RLLPlaceholderHandlers } from '../../vc-observer/observers/rll-placeholders';
|
|
13
14
|
import { createIntersectionObserver } from './intersection-observer';
|
|
@@ -311,6 +312,21 @@ var ViewportObserver = /*#__PURE__*/function () {
|
|
|
311
312
|
}
|
|
312
313
|
};
|
|
313
314
|
}
|
|
315
|
+
if (isDnDStyleMutation({
|
|
316
|
+
target: target,
|
|
317
|
+
attributeName: attributeName,
|
|
318
|
+
oldValue: oldValue,
|
|
319
|
+
newValue: newValue
|
|
320
|
+
})) {
|
|
321
|
+
return {
|
|
322
|
+
type: 'mutation:attribute:non-visual-style',
|
|
323
|
+
mutationData: {
|
|
324
|
+
attributeName: attributeName,
|
|
325
|
+
oldValue: oldValue,
|
|
326
|
+
newValue: newValue
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
314
330
|
if (isNonVisualStyleMutation({
|
|
315
331
|
target: target,
|
|
316
332
|
attributeName: attributeName,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
3
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
4
|
+
* This should be removed once DnD has been fixed.
|
|
5
|
+
* @param mutation - The mutation record to check
|
|
6
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
7
|
+
*/
|
|
8
|
+
declare function isDnDStyleMutation({ target, attributeName, oldValue, newValue, }: {
|
|
9
|
+
target?: Node | null;
|
|
10
|
+
attributeName?: string | null;
|
|
11
|
+
oldValue?: string | undefined | null;
|
|
12
|
+
newValue?: string | undefined | null;
|
|
13
|
+
}): boolean;
|
|
14
|
+
export default isDnDStyleMutation;
|
package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-dnd-style-mutation.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a mutation record represents a style change from Editor's
|
|
3
|
+
* drag and drop feature, which don't cause visual shifts.
|
|
4
|
+
* This should be removed once DnD has been fixed.
|
|
5
|
+
* @param mutation - The mutation record to check
|
|
6
|
+
* @returns boolean indicating if this is a DnD style mutation
|
|
7
|
+
*/
|
|
8
|
+
declare function isDnDStyleMutation({ target, attributeName, oldValue, newValue, }: {
|
|
9
|
+
target?: Node | null;
|
|
10
|
+
attributeName?: string | null;
|
|
11
|
+
oldValue?: string | undefined | null;
|
|
12
|
+
newValue?: string | undefined | null;
|
|
13
|
+
}): boolean;
|
|
14
|
+
export default isDnDStyleMutation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/react-ufo",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.5",
|
|
4
4
|
"description": "Parts of React UFO that are publicly available",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"atlaskit:src": "src/index.ts",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@atlaskit/browser-apis": "^0.0.1",
|
|
30
|
+
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
30
31
|
"@atlaskit/interaction-context": "^3.0.0",
|
|
31
32
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
33
|
"@babel/runtime": "^7.0.0",
|
|
@@ -149,6 +150,9 @@
|
|
|
149
150
|
"platform_ufo_enable_late_mutation_label_stacks": {
|
|
150
151
|
"type": "boolean"
|
|
151
152
|
},
|
|
153
|
+
"platform_editor_exclude_dnd_anchor_name_from_ttvc": {
|
|
154
|
+
"type": "boolean"
|
|
155
|
+
},
|
|
152
156
|
"platform_ufo_enable_finish_interaction_transition": {
|
|
153
157
|
"type": "boolean"
|
|
154
158
|
}
|