@atlaskit/editor-plugin-breakout 2.7.1 → 2.7.2
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 +13 -0
- package/dist/cjs/pm-plugins/get-guidelines.js +23 -6
- package/dist/cjs/pm-plugins/resizer-callbacks.js +8 -0
- package/dist/cjs/pm-plugins/utils/analytics.js +16 -1
- package/dist/es2019/pm-plugins/get-guidelines.js +23 -6
- package/dist/es2019/pm-plugins/resizer-callbacks.js +9 -1
- package/dist/es2019/pm-plugins/utils/analytics.js +16 -0
- package/dist/esm/pm-plugins/get-guidelines.js +23 -6
- package/dist/esm/pm-plugins/resizer-callbacks.js +9 -1
- package/dist/esm/pm-plugins/utils/analytics.js +15 -0
- package/dist/types/pm-plugins/utils/analytics.d.ts +5 -0
- package/dist/types-ts4.5/pm-plugins/utils/analytics.d.ts +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-breakout
|
|
2
2
|
|
|
3
|
+
## 2.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#168573](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/168573)
|
|
8
|
+
[`8c337a8701dfb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c337a8701dfb) -
|
|
9
|
+
Adds resized analytics for nodes that support breakout mark.
|
|
10
|
+
- [#169278](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/169278)
|
|
11
|
+
[`3ff87a0248416`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3ff87a0248416) -
|
|
12
|
+
[ux] ED-28232 fix guidelines location on full width pages for new resizing experience behind
|
|
13
|
+
platform_editor_breakout_resizing
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 2.7.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -8,6 +8,7 @@ exports.getGuidelines = void 0;
|
|
|
8
8
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
12
|
var WIDTHS = {
|
|
12
13
|
MIN: _editorSharedStyles.akEditorDefaultLayoutWidth,
|
|
13
14
|
WIDE: _editorSharedStyles.akEditorCalculatedWideLayoutWidth,
|
|
@@ -44,23 +45,39 @@ var getGuidelines = exports.getGuidelines = (0, _memoizeOne.default)(function (i
|
|
|
44
45
|
var _ref = getEditorWidth() || {},
|
|
45
46
|
width = _ref.width,
|
|
46
47
|
lineLength = _ref.lineLength;
|
|
47
|
-
// TODO: ED-28109 - use breakoutWideScaleRatio to calculate wide guideline
|
|
48
48
|
var fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() - _editorSharedStyles.akEditorGutterPadding) : undefined;
|
|
49
|
-
if (
|
|
49
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
|
|
50
50
|
guidelines.push({
|
|
51
51
|
key: "".concat(GUIDELINE_KEYS.lineLength, "_left"),
|
|
52
52
|
position: {
|
|
53
|
-
x: -roundToNearest(
|
|
53
|
+
x: -roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
|
|
54
54
|
},
|
|
55
|
-
active: newWidth ===
|
|
55
|
+
active: newWidth === WIDTHS.MIN
|
|
56
56
|
});
|
|
57
57
|
guidelines.push({
|
|
58
58
|
key: "".concat(GUIDELINE_KEYS.lineLength, "_right"),
|
|
59
59
|
position: {
|
|
60
|
-
x: roundToNearest(
|
|
60
|
+
x: roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
|
|
61
61
|
},
|
|
62
|
-
active: newWidth ===
|
|
62
|
+
active: newWidth === WIDTHS.MIN
|
|
63
63
|
});
|
|
64
|
+
} else {
|
|
65
|
+
if (lineLength) {
|
|
66
|
+
guidelines.push({
|
|
67
|
+
key: "".concat(GUIDELINE_KEYS.lineLength, "_left"),
|
|
68
|
+
position: {
|
|
69
|
+
x: -roundToNearest(lineLength / 2 + innerPaddingOffset)
|
|
70
|
+
},
|
|
71
|
+
active: newWidth === lineLength
|
|
72
|
+
});
|
|
73
|
+
guidelines.push({
|
|
74
|
+
key: "".concat(GUIDELINE_KEYS.lineLength, "_right"),
|
|
75
|
+
position: {
|
|
76
|
+
x: roundToNearest(lineLength / 2 + innerPaddingOffset)
|
|
77
|
+
},
|
|
78
|
+
active: newWidth === lineLength
|
|
79
|
+
});
|
|
80
|
+
}
|
|
64
81
|
}
|
|
65
82
|
guidelines.push({
|
|
66
83
|
key: "".concat(GUIDELINE_KEYS.wide, "_left"),
|
|
@@ -126,6 +126,14 @@ function createResizerCallbacks(_ref2) {
|
|
|
126
126
|
});
|
|
127
127
|
(0, _setBreakoutWidth.setBreakoutWidth)(newWidth, mode, pos)(view.state, view.dispatch);
|
|
128
128
|
contentDOM.style.removeProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY);
|
|
129
|
+
if (node && (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
|
|
130
|
+
var resizedPayload = (0, _analytics.generateResizedEventPayload)({
|
|
131
|
+
node: node,
|
|
132
|
+
prevWidth: initialWidth,
|
|
133
|
+
newWidth: newWidth
|
|
134
|
+
});
|
|
135
|
+
payloads.push(resizedPayload);
|
|
136
|
+
}
|
|
129
137
|
api === null || api === void 0 || api.core.actions.execute(function (_ref6) {
|
|
130
138
|
var _api$userIntent2;
|
|
131
139
|
var tr = _ref6.tr;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.generateResizeFrameRatePayloads = void 0;
|
|
6
|
+
exports.generateResizedEventPayload = exports.generateResizeFrameRatePayloads = void 0;
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var generateResizeFrameRatePayloads = exports.generateResizeFrameRatePayloads = function generateResizeFrameRatePayloads(props) {
|
|
9
9
|
return props.frameRateSamples.map(function (frameRateSample, index) {
|
|
@@ -20,4 +20,19 @@ var generateResizeFrameRatePayloads = exports.generateResizeFrameRatePayloads =
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
|
+
};
|
|
24
|
+
var generateResizedEventPayload = exports.generateResizedEventPayload = function generateResizedEventPayload(_ref) {
|
|
25
|
+
var node = _ref.node,
|
|
26
|
+
prevWidth = _ref.prevWidth,
|
|
27
|
+
newWidth = _ref.newWidth;
|
|
28
|
+
return {
|
|
29
|
+
action: _analytics.ACTION.RESIZED,
|
|
30
|
+
actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
|
|
31
|
+
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
32
|
+
attributes: {
|
|
33
|
+
nodeType: node.type.name,
|
|
34
|
+
prevWidth: prevWidth,
|
|
35
|
+
newWidth: newWidth
|
|
36
|
+
}
|
|
37
|
+
};
|
|
23
38
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
2
|
import { EXPAND_CONTAINER_PADDING, LAYOUT_COLUMN_PADDING, resizerHandleThumbWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorCalculatedWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
const WIDTHS = {
|
|
5
6
|
MIN: akEditorDefaultLayoutWidth,
|
|
6
7
|
WIDE: akEditorCalculatedWideLayoutWidth,
|
|
@@ -35,23 +36,39 @@ export const getGuidelines = memoizeOne((isResizing, newWidth, getEditorWidth, n
|
|
|
35
36
|
width,
|
|
36
37
|
lineLength
|
|
37
38
|
} = getEditorWidth() || {};
|
|
38
|
-
// TODO: ED-28109 - use breakoutWideScaleRatio to calculate wide guideline
|
|
39
39
|
const fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * akEditorGutterPaddingDynamic() - akEditorGutterPadding) : undefined;
|
|
40
|
-
if (
|
|
40
|
+
if (fg('platform_editor_breakout_resizing_hello_release')) {
|
|
41
41
|
guidelines.push({
|
|
42
42
|
key: `${GUIDELINE_KEYS.lineLength}_left`,
|
|
43
43
|
position: {
|
|
44
|
-
x: -roundToNearest(
|
|
44
|
+
x: -roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
|
|
45
45
|
},
|
|
46
|
-
active: newWidth ===
|
|
46
|
+
active: newWidth === WIDTHS.MIN
|
|
47
47
|
});
|
|
48
48
|
guidelines.push({
|
|
49
49
|
key: `${GUIDELINE_KEYS.lineLength}_right`,
|
|
50
50
|
position: {
|
|
51
|
-
x: roundToNearest(
|
|
51
|
+
x: roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
|
|
52
52
|
},
|
|
53
|
-
active: newWidth ===
|
|
53
|
+
active: newWidth === WIDTHS.MIN
|
|
54
54
|
});
|
|
55
|
+
} else {
|
|
56
|
+
if (lineLength) {
|
|
57
|
+
guidelines.push({
|
|
58
|
+
key: `${GUIDELINE_KEYS.lineLength}_left`,
|
|
59
|
+
position: {
|
|
60
|
+
x: -roundToNearest(lineLength / 2 + innerPaddingOffset)
|
|
61
|
+
},
|
|
62
|
+
active: newWidth === lineLength
|
|
63
|
+
});
|
|
64
|
+
guidelines.push({
|
|
65
|
+
key: `${GUIDELINE_KEYS.lineLength}_right`,
|
|
66
|
+
position: {
|
|
67
|
+
x: roundToNearest(lineLength / 2 + innerPaddingOffset)
|
|
68
|
+
},
|
|
69
|
+
active: newWidth === lineLength
|
|
70
|
+
});
|
|
71
|
+
}
|
|
55
72
|
}
|
|
56
73
|
guidelines.push({
|
|
57
74
|
key: `${GUIDELINE_KEYS.wide}_left`,
|
|
@@ -3,7 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
|
|
4
4
|
import { getGuidelines } from './get-guidelines';
|
|
5
5
|
import { LOCAL_RESIZE_PROPERTY } from './resizing-mark-view';
|
|
6
|
-
import { generateResizeFrameRatePayloads } from './utils/analytics';
|
|
6
|
+
import { generateResizeFrameRatePayloads, generateResizedEventPayload } from './utils/analytics';
|
|
7
7
|
import { measureFramerate, reduceResizeFrameRateSamples } from './utils/measure-framerate';
|
|
8
8
|
const RESIZE_RATIO = 2;
|
|
9
9
|
const SNAP_GAP = 10;
|
|
@@ -122,6 +122,14 @@ export function createResizerCallbacks({
|
|
|
122
122
|
});
|
|
123
123
|
setBreakoutWidth(newWidth, mode, pos)(view.state, view.dispatch);
|
|
124
124
|
contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
125
|
+
if (node && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
126
|
+
const resizedPayload = generateResizedEventPayload({
|
|
127
|
+
node,
|
|
128
|
+
prevWidth: initialWidth,
|
|
129
|
+
newWidth
|
|
130
|
+
});
|
|
131
|
+
payloads.push(resizedPayload);
|
|
132
|
+
}
|
|
125
133
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
126
134
|
tr
|
|
127
135
|
}) => {
|
|
@@ -12,4 +12,20 @@ export const generateResizeFrameRatePayloads = props => {
|
|
|
12
12
|
isInitialSample: index === 0
|
|
13
13
|
}
|
|
14
14
|
}));
|
|
15
|
+
};
|
|
16
|
+
export const generateResizedEventPayload = ({
|
|
17
|
+
node,
|
|
18
|
+
prevWidth,
|
|
19
|
+
newWidth
|
|
20
|
+
}) => {
|
|
21
|
+
return {
|
|
22
|
+
action: ACTION.RESIZED,
|
|
23
|
+
actionSubject: ACTION_SUBJECT.ELEMENT,
|
|
24
|
+
eventType: EVENT_TYPE.TRACK,
|
|
25
|
+
attributes: {
|
|
26
|
+
nodeType: node.type.name,
|
|
27
|
+
prevWidth,
|
|
28
|
+
newWidth
|
|
29
|
+
}
|
|
30
|
+
};
|
|
15
31
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
2
|
import { EXPAND_CONTAINER_PADDING, LAYOUT_COLUMN_PADDING, resizerHandleThumbWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorCalculatedWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
var WIDTHS = {
|
|
5
6
|
MIN: akEditorDefaultLayoutWidth,
|
|
6
7
|
WIDE: akEditorCalculatedWideLayoutWidth,
|
|
@@ -37,23 +38,39 @@ export var getGuidelines = memoizeOne(function (isResizing, newWidth, getEditorW
|
|
|
37
38
|
var _ref = getEditorWidth() || {},
|
|
38
39
|
width = _ref.width,
|
|
39
40
|
lineLength = _ref.lineLength;
|
|
40
|
-
// TODO: ED-28109 - use breakoutWideScaleRatio to calculate wide guideline
|
|
41
41
|
var fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * akEditorGutterPaddingDynamic() - akEditorGutterPadding) : undefined;
|
|
42
|
-
if (
|
|
42
|
+
if (fg('platform_editor_breakout_resizing_hello_release')) {
|
|
43
43
|
guidelines.push({
|
|
44
44
|
key: "".concat(GUIDELINE_KEYS.lineLength, "_left"),
|
|
45
45
|
position: {
|
|
46
|
-
x: -roundToNearest(
|
|
46
|
+
x: -roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
|
|
47
47
|
},
|
|
48
|
-
active: newWidth ===
|
|
48
|
+
active: newWidth === WIDTHS.MIN
|
|
49
49
|
});
|
|
50
50
|
guidelines.push({
|
|
51
51
|
key: "".concat(GUIDELINE_KEYS.lineLength, "_right"),
|
|
52
52
|
position: {
|
|
53
|
-
x: roundToNearest(
|
|
53
|
+
x: roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
|
|
54
54
|
},
|
|
55
|
-
active: newWidth ===
|
|
55
|
+
active: newWidth === WIDTHS.MIN
|
|
56
56
|
});
|
|
57
|
+
} else {
|
|
58
|
+
if (lineLength) {
|
|
59
|
+
guidelines.push({
|
|
60
|
+
key: "".concat(GUIDELINE_KEYS.lineLength, "_left"),
|
|
61
|
+
position: {
|
|
62
|
+
x: -roundToNearest(lineLength / 2 + innerPaddingOffset)
|
|
63
|
+
},
|
|
64
|
+
active: newWidth === lineLength
|
|
65
|
+
});
|
|
66
|
+
guidelines.push({
|
|
67
|
+
key: "".concat(GUIDELINE_KEYS.lineLength, "_right"),
|
|
68
|
+
position: {
|
|
69
|
+
x: roundToNearest(lineLength / 2 + innerPaddingOffset)
|
|
70
|
+
},
|
|
71
|
+
active: newWidth === lineLength
|
|
72
|
+
});
|
|
73
|
+
}
|
|
57
74
|
}
|
|
58
75
|
guidelines.push({
|
|
59
76
|
key: "".concat(GUIDELINE_KEYS.wide, "_left"),
|
|
@@ -3,7 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
|
|
4
4
|
import { getGuidelines } from './get-guidelines';
|
|
5
5
|
import { LOCAL_RESIZE_PROPERTY } from './resizing-mark-view';
|
|
6
|
-
import { generateResizeFrameRatePayloads } from './utils/analytics';
|
|
6
|
+
import { generateResizeFrameRatePayloads, generateResizedEventPayload } from './utils/analytics';
|
|
7
7
|
import { measureFramerate, reduceResizeFrameRateSamples } from './utils/measure-framerate';
|
|
8
8
|
var RESIZE_RATIO = 2;
|
|
9
9
|
var SNAP_GAP = 10;
|
|
@@ -119,6 +119,14 @@ export function createResizerCallbacks(_ref2) {
|
|
|
119
119
|
});
|
|
120
120
|
setBreakoutWidth(newWidth, mode, pos)(view.state, view.dispatch);
|
|
121
121
|
contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
122
|
+
if (node && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
123
|
+
var resizedPayload = generateResizedEventPayload({
|
|
124
|
+
node: node,
|
|
125
|
+
prevWidth: initialWidth,
|
|
126
|
+
newWidth: newWidth
|
|
127
|
+
});
|
|
128
|
+
payloads.push(resizedPayload);
|
|
129
|
+
}
|
|
122
130
|
api === null || api === void 0 || api.core.actions.execute(function (_ref6) {
|
|
123
131
|
var _api$userIntent2;
|
|
124
132
|
var tr = _ref6.tr;
|
|
@@ -14,4 +14,19 @@ export var generateResizeFrameRatePayloads = function generateResizeFrameRatePay
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
});
|
|
17
|
+
};
|
|
18
|
+
export var generateResizedEventPayload = function generateResizedEventPayload(_ref) {
|
|
19
|
+
var node = _ref.node,
|
|
20
|
+
prevWidth = _ref.prevWidth,
|
|
21
|
+
newWidth = _ref.newWidth;
|
|
22
|
+
return {
|
|
23
|
+
action: ACTION.RESIZED,
|
|
24
|
+
actionSubject: ACTION_SUBJECT.ELEMENT,
|
|
25
|
+
eventType: EVENT_TYPE.TRACK,
|
|
26
|
+
attributes: {
|
|
27
|
+
nodeType: node.type.name,
|
|
28
|
+
prevWidth: prevWidth,
|
|
29
|
+
newWidth: newWidth
|
|
30
|
+
}
|
|
31
|
+
};
|
|
17
32
|
};
|
|
@@ -5,3 +5,8 @@ export declare const generateResizeFrameRatePayloads: (props: {
|
|
|
5
5
|
frameRateSamples: number[];
|
|
6
6
|
originalNode: PMNode;
|
|
7
7
|
}) => BreakoutEventPayload[];
|
|
8
|
+
export declare const generateResizedEventPayload: ({ node, prevWidth, newWidth, }: {
|
|
9
|
+
node: PMNode;
|
|
10
|
+
prevWidth: number;
|
|
11
|
+
newWidth: number;
|
|
12
|
+
}) => BreakoutEventPayload;
|
|
@@ -5,3 +5,8 @@ export declare const generateResizeFrameRatePayloads: (props: {
|
|
|
5
5
|
frameRateSamples: number[];
|
|
6
6
|
originalNode: PMNode;
|
|
7
7
|
}) => BreakoutEventPayload[];
|
|
8
|
+
export declare const generateResizedEventPayload: ({ node, prevWidth, newWidth, }: {
|
|
9
|
+
node: PMNode;
|
|
10
|
+
prevWidth: number;
|
|
11
|
+
newWidth: number;
|
|
12
|
+
}) => BreakoutEventPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-breakout",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Breakout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
50
50
|
"@atlaskit/theme": "^18.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^6.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^6.1.0",
|
|
52
52
|
"@atlaskit/tokens": "^5.1.0",
|
|
53
53
|
"@atlaskit/tooltip": "^20.3.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|