@atlaskit/editor-plugin-breakout 6.2.6 → 6.3.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 +20 -0
- package/dist/cjs/pm-plugins/get-guidelines.js +1 -1
- package/dist/cjs/pm-plugins/pragmatic-resizer.js +1 -4
- package/dist/cjs/pm-plugins/resizer-callbacks.js +8 -17
- package/dist/cjs/pm-plugins/resizing-mark-view.js +3 -21
- package/dist/es2019/pm-plugins/get-guidelines.js +1 -1
- package/dist/es2019/pm-plugins/pragmatic-resizer.js +1 -4
- package/dist/es2019/pm-plugins/resizer-callbacks.js +8 -17
- package/dist/es2019/pm-plugins/resizing-mark-view.js +3 -21
- package/dist/esm/pm-plugins/get-guidelines.js +1 -1
- package/dist/esm/pm-plugins/pragmatic-resizer.js +1 -4
- package/dist/esm/pm-plugins/resizer-callbacks.js +8 -17
- package/dist/esm/pm-plugins/resizing-mark-view.js +3 -21
- package/dist/types/pm-plugins/resizer-callbacks.d.ts +1 -2
- package/dist/types-ts4.5/pm-plugins/resizer-callbacks.d.ts +1 -2
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-breakout
|
|
2
2
|
|
|
3
|
+
## 6.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d0a60ac78aa7e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d0a60ac78aa7e) -
|
|
8
|
+
Remove platform_editor_breakout_resizing_width_changes FG
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 6.3.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`8677e7b660127`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8677e7b660127) -
|
|
16
|
+
EDITOR-3792 Rollup max width changes previously gated with editor_tinymce_full_width_mode into
|
|
17
|
+
combined frontend/backend flag confluence_max_width_content_appearance
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 6.2.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -55,7 +55,7 @@ var getGuidelines = exports.getGuidelines = (0, _memoizeOne.default)(function (i
|
|
|
55
55
|
exposure: true
|
|
56
56
|
}) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
57
57
|
var fullWidth = width ? Math.min(WIDTHS.FULL, width - 2 * padding - _editorSharedStyles.akEditorGutterPadding) : undefined;
|
|
58
|
-
var maxWidth = width && (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) ? Math.min(WIDTHS.MAX, width - 2 * padding - _editorSharedStyles.akEditorGutterPadding) : undefined;
|
|
58
|
+
var maxWidth = width && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) ? Math.min(WIDTHS.MAX, width - 2 * padding - _editorSharedStyles.akEditorGutterPadding) : undefined;
|
|
59
59
|
guidelines.push({
|
|
60
60
|
key: GUIDELINE_KEYS.lineLengthLeft,
|
|
61
61
|
position: {
|
|
@@ -12,7 +12,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _bindEventListener = require("bind-event-listener");
|
|
13
13
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
14
14
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
15
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
17
16
|
var _disableNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview");
|
|
18
17
|
var _preventUnhandled = require("@atlaskit/pragmatic-drag-and-drop/prevent-unhandled");
|
|
@@ -73,9 +72,7 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
|
|
|
73
72
|
var handle = document.createElement('div');
|
|
74
73
|
handle.contentEditable = 'false';
|
|
75
74
|
handle.classList.add('pm-breakout-resize-handle-container');
|
|
76
|
-
|
|
77
|
-
handle.style.gridColumn = side === 'left' ? '1' : '3';
|
|
78
|
-
}
|
|
75
|
+
handle.style.gridColumn = side === 'left' ? '1' : '3';
|
|
79
76
|
var rail = document.createElement('div');
|
|
80
77
|
rail.classList.add('pm-breakout-resize-handle-rail');
|
|
81
78
|
if (side === 'left') {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createResizerCallbacks = createResizerCallbacks;
|
|
7
7
|
exports.getProposedWidth = getProposedWidth;
|
|
8
8
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
10
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
11
|
var _setBreakoutWidth = require("../editor-commands/set-breakout-width");
|
|
@@ -40,7 +39,7 @@ function getProposedWidth(_ref) {
|
|
|
40
39
|
// the node width may be greater than the container width so we resize using the smaller value
|
|
41
40
|
var proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
|
|
42
41
|
var snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL)];
|
|
43
|
-
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
42
|
+
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
44
43
|
snapPoints.push(Math.min(containerWidth, WIDTHS.MAX));
|
|
45
44
|
}
|
|
46
45
|
for (var _i = 0, _snapPoints = snapPoints; _i < _snapPoints.length; _i++) {
|
|
@@ -49,12 +48,11 @@ function getProposedWidth(_ref) {
|
|
|
49
48
|
return snapPoint;
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
var hardMax = (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) ? Math.min(containerWidth, WIDTHS.MAX) : Math.min(containerWidth, WIDTHS.FULL);
|
|
51
|
+
var hardMax = (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true) ? Math.min(containerWidth, WIDTHS.MAX) : Math.min(containerWidth, WIDTHS.FULL);
|
|
53
52
|
return Math.max(WIDTHS.MIN, Math.min(proposedWidth, hardMax));
|
|
54
53
|
}
|
|
55
54
|
function createResizerCallbacks(_ref2) {
|
|
56
55
|
var dom = _ref2.dom,
|
|
57
|
-
contentDOM = _ref2.contentDOM,
|
|
58
56
|
view = _ref2.view,
|
|
59
57
|
mark = _ref2.mark,
|
|
60
58
|
api = _ref2.api;
|
|
@@ -132,12 +130,9 @@ function createResizerCallbacks(_ref2) {
|
|
|
132
130
|
return tr;
|
|
133
131
|
});
|
|
134
132
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
} else {
|
|
139
|
-
contentDOM.style.setProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY, "".concat(newWidth, "px"));
|
|
140
|
-
}
|
|
133
|
+
|
|
134
|
+
// dom is used for width calculations
|
|
135
|
+
dom.style.setProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY, "".concat(newWidth, "px"));
|
|
141
136
|
},
|
|
142
137
|
onDrop: function onDrop(_ref7) {
|
|
143
138
|
var _api$guideline2, _api$editorViewMode;
|
|
@@ -154,7 +149,7 @@ function createResizerCallbacks(_ref2) {
|
|
|
154
149
|
return guideline.key.startsWith('full_width') && guideline.active;
|
|
155
150
|
});
|
|
156
151
|
var isResizedToMaxWidth = false;
|
|
157
|
-
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
152
|
+
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
158
153
|
isResizedToMaxWidth = !!guidelines.find(function (guideline) {
|
|
159
154
|
return guideline.key.startsWith('max_width') && guideline.active;
|
|
160
155
|
});
|
|
@@ -172,18 +167,14 @@ function createResizerCallbacks(_ref2) {
|
|
|
172
167
|
api: api,
|
|
173
168
|
source: source
|
|
174
169
|
});
|
|
175
|
-
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
170
|
+
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
176
171
|
if (isResizedToMaxWidth) {
|
|
177
172
|
newWidth = WIDTHS.MAX;
|
|
178
173
|
}
|
|
179
174
|
}
|
|
180
175
|
var isEditMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'edit';
|
|
181
176
|
(0, _setBreakoutWidth.setBreakoutWidth)(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
|
|
182
|
-
|
|
183
|
-
dom.style.removeProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY);
|
|
184
|
-
} else {
|
|
185
|
-
contentDOM.style.removeProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY);
|
|
186
|
-
}
|
|
177
|
+
dom.style.removeProperty(_resizingMarkView.LOCAL_RESIZE_PROPERTY);
|
|
187
178
|
if (node) {
|
|
188
179
|
var resizedPayload = (0, _analytics.generateResizedEventPayload)({
|
|
189
180
|
node: node,
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
13
|
var _pragmaticResizer = require("./pragmatic-resizer");
|
|
15
14
|
var _resizerCallbacks = require("./resizer-callbacks");
|
|
@@ -47,14 +46,9 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
|
|
|
47
46
|
dom.style.justifyContent = 'center';
|
|
48
47
|
|
|
49
48
|
// contentDOM - styles
|
|
50
|
-
|
|
51
|
-
contentDOM.style.gridColumn = '2';
|
|
52
|
-
} else {
|
|
53
|
-
contentDOM.style.gridRow = '1';
|
|
54
|
-
contentDOM.style.gridColumn = '1';
|
|
55
|
-
}
|
|
49
|
+
contentDOM.style.gridColumn = '2';
|
|
56
50
|
contentDOM.style.zIndex = '1';
|
|
57
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_breakout_resizing_vc90_fix', 'isEnabled', true)
|
|
51
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_breakout_resizing_vc90_fix', 'isEnabled', true)) {
|
|
58
52
|
if (mark.attrs.width) {
|
|
59
53
|
dom.style.gridTemplateColumns = "auto max(var(--ak-editor--breakout-min-width), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), var(--ak-editor--breakout-fallback-width))) auto");
|
|
60
54
|
} else {
|
|
@@ -65,20 +59,9 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
|
|
|
65
59
|
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
|
-
} else if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_width_changes')) {
|
|
69
|
-
if (mark.attrs.width) {
|
|
70
|
-
dom.style.gridTemplateColumns = "auto min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), var(--ak-editor--breakout-fallback-width)) auto");
|
|
71
|
-
} else {
|
|
72
|
-
if (mark.attrs.mode === 'wide') {
|
|
73
|
-
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
74
|
-
}
|
|
75
|
-
if (mark.attrs.mode === 'full-width') {
|
|
76
|
-
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
62
|
} else {
|
|
80
63
|
if (mark.attrs.width) {
|
|
81
|
-
|
|
64
|
+
dom.style.gridTemplateColumns = "auto min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), var(--ak-editor--breakout-fallback-width)) auto");
|
|
82
65
|
} else {
|
|
83
66
|
if (mark.attrs.mode === 'wide') {
|
|
84
67
|
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
@@ -118,7 +101,6 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
|
|
|
118
101
|
value: function setupResizerCallbacks(dom, contentDOM, view, mark, api) {
|
|
119
102
|
var callbacks = (0, _resizerCallbacks.createResizerCallbacks)({
|
|
120
103
|
dom: dom,
|
|
121
|
-
contentDOM: contentDOM,
|
|
122
104
|
view: view,
|
|
123
105
|
mark: mark,
|
|
124
106
|
api: api
|
|
@@ -46,7 +46,7 @@ export const getGuidelines = memoizeOne((isResizing, newWidth, getEditorWidth, n
|
|
|
46
46
|
exposure: true
|
|
47
47
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
48
48
|
const fullWidth = width ? Math.min(WIDTHS.FULL, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
49
|
-
const maxWidth = width && expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
49
|
+
const maxWidth = width && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
50
50
|
guidelines.push({
|
|
51
51
|
key: GUIDELINE_KEYS.lineLengthLeft,
|
|
52
52
|
position: {
|
|
@@ -3,7 +3,6 @@ import { bind } from 'bind-event-listener';
|
|
|
3
3
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
4
|
import uuid from 'uuid/v4';
|
|
5
5
|
import { breakoutMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
8
7
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
9
8
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
@@ -60,9 +59,7 @@ export const createPragmaticResizer = ({
|
|
|
60
59
|
const handle = document.createElement('div');
|
|
61
60
|
handle.contentEditable = 'false';
|
|
62
61
|
handle.classList.add('pm-breakout-resize-handle-container');
|
|
63
|
-
|
|
64
|
-
handle.style.gridColumn = side === 'left' ? '1' : '3';
|
|
65
|
-
}
|
|
62
|
+
handle.style.gridColumn = side === 'left' ? '1' : '3';
|
|
66
63
|
const rail = document.createElement('div');
|
|
67
64
|
rail.classList.add('pm-breakout-resize-handle-rail');
|
|
68
65
|
if (side === 'left') {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidth, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
|
|
@@ -34,7 +33,7 @@ export function getProposedWidth({
|
|
|
34
33
|
// the node width may be greater than the container width so we resize using the smaller value
|
|
35
34
|
const proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
|
|
36
35
|
const snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL)];
|
|
37
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
36
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
38
37
|
snapPoints.push(Math.min(containerWidth, WIDTHS.MAX));
|
|
39
38
|
}
|
|
40
39
|
for (const snapPoint of snapPoints) {
|
|
@@ -42,12 +41,11 @@ export function getProposedWidth({
|
|
|
42
41
|
return snapPoint;
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
const hardMax = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? Math.min(containerWidth, WIDTHS.MAX) : Math.min(containerWidth, WIDTHS.FULL);
|
|
44
|
+
const hardMax = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? Math.min(containerWidth, WIDTHS.MAX) : Math.min(containerWidth, WIDTHS.FULL);
|
|
46
45
|
return Math.max(WIDTHS.MIN, Math.min(proposedWidth, hardMax));
|
|
47
46
|
}
|
|
48
47
|
export function createResizerCallbacks({
|
|
49
48
|
dom,
|
|
50
|
-
contentDOM,
|
|
51
49
|
view,
|
|
52
50
|
mark,
|
|
53
51
|
api
|
|
@@ -129,12 +127,9 @@ export function createResizerCallbacks({
|
|
|
129
127
|
return tr;
|
|
130
128
|
});
|
|
131
129
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} else {
|
|
136
|
-
contentDOM.style.setProperty(LOCAL_RESIZE_PROPERTY, `${newWidth}px`);
|
|
137
|
-
}
|
|
130
|
+
|
|
131
|
+
// dom is used for width calculations
|
|
132
|
+
dom.style.setProperty(LOCAL_RESIZE_PROPERTY, `${newWidth}px`);
|
|
138
133
|
},
|
|
139
134
|
onDrop({
|
|
140
135
|
location,
|
|
@@ -150,7 +145,7 @@ export function createResizerCallbacks({
|
|
|
150
145
|
});
|
|
151
146
|
const isResizedToFullWidth = !!guidelines.find(guideline => guideline.key.startsWith('full_width') && guideline.active);
|
|
152
147
|
let isResizedToMaxWidth = false;
|
|
153
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
148
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
154
149
|
isResizedToMaxWidth = !!guidelines.find(guideline => guideline.key.startsWith('max_width') && guideline.active);
|
|
155
150
|
}
|
|
156
151
|
guidelines = getGuidelines(false, 0, getEditorWidth);
|
|
@@ -166,18 +161,14 @@ export function createResizerCallbacks({
|
|
|
166
161
|
api,
|
|
167
162
|
source
|
|
168
163
|
});
|
|
169
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
164
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
170
165
|
if (isResizedToMaxWidth) {
|
|
171
166
|
newWidth = WIDTHS.MAX;
|
|
172
167
|
}
|
|
173
168
|
}
|
|
174
169
|
const isEditMode = (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'edit';
|
|
175
170
|
setBreakoutWidth(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
|
|
176
|
-
|
|
177
|
-
dom.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
178
|
-
} else {
|
|
179
|
-
contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
180
|
-
}
|
|
171
|
+
dom.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
181
172
|
if (node) {
|
|
182
173
|
const resizedPayload = generateResizedEventPayload({
|
|
183
174
|
node,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { createPragmaticResizer } from './pragmatic-resizer';
|
|
6
5
|
import { createResizerCallbacks } from './resizer-callbacks';
|
|
@@ -33,14 +32,9 @@ export class ResizingMarkView {
|
|
|
33
32
|
dom.style.justifyContent = 'center';
|
|
34
33
|
|
|
35
34
|
// contentDOM - styles
|
|
36
|
-
|
|
37
|
-
contentDOM.style.gridColumn = '2';
|
|
38
|
-
} else {
|
|
39
|
-
contentDOM.style.gridRow = '1';
|
|
40
|
-
contentDOM.style.gridColumn = '1';
|
|
41
|
-
}
|
|
35
|
+
contentDOM.style.gridColumn = '2';
|
|
42
36
|
contentDOM.style.zIndex = '1';
|
|
43
|
-
if (expValEquals('platform_editor_breakout_resizing_vc90_fix', 'isEnabled', true)
|
|
37
|
+
if (expValEquals('platform_editor_breakout_resizing_vc90_fix', 'isEnabled', true)) {
|
|
44
38
|
if (mark.attrs.width) {
|
|
45
39
|
dom.style.gridTemplateColumns = `auto max(var(--ak-editor--breakout-min-width), min(var(${LOCAL_RESIZE_PROPERTY}, ${mark.attrs.width}px), var(--ak-editor--breakout-fallback-width))) auto`;
|
|
46
40
|
} else {
|
|
@@ -51,20 +45,9 @@ export class ResizingMarkView {
|
|
|
51
45
|
contentDOM.style.width = `max(var(--ak-editor--line-length), min(var(${LOCAL_RESIZE_PROPERTY}, var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
|
-
} else if (fg('platform_editor_breakout_resizing_width_changes')) {
|
|
55
|
-
if (mark.attrs.width) {
|
|
56
|
-
dom.style.gridTemplateColumns = `auto min(var(${LOCAL_RESIZE_PROPERTY}, ${mark.attrs.width}px), var(--ak-editor--breakout-fallback-width)) auto`;
|
|
57
|
-
} else {
|
|
58
|
-
if (mark.attrs.mode === 'wide') {
|
|
59
|
-
contentDOM.style.width = `max(var(--ak-editor--line-length), min(var(${LOCAL_RESIZE_PROPERTY}, var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
60
|
-
}
|
|
61
|
-
if (mark.attrs.mode === 'full-width') {
|
|
62
|
-
contentDOM.style.width = `max(var(--ak-editor--line-length), min(var(${LOCAL_RESIZE_PROPERTY}, var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
48
|
} else {
|
|
66
49
|
if (mark.attrs.width) {
|
|
67
|
-
|
|
50
|
+
dom.style.gridTemplateColumns = `auto min(var(${LOCAL_RESIZE_PROPERTY}, ${mark.attrs.width}px), var(--ak-editor--breakout-fallback-width)) auto`;
|
|
68
51
|
} else {
|
|
69
52
|
if (mark.attrs.mode === 'wide') {
|
|
70
53
|
contentDOM.style.width = `max(var(--ak-editor--line-length), min(var(${LOCAL_RESIZE_PROPERTY}, var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
@@ -102,7 +85,6 @@ export class ResizingMarkView {
|
|
|
102
85
|
setupResizerCallbacks(dom, contentDOM, view, mark, api) {
|
|
103
86
|
const callbacks = createResizerCallbacks({
|
|
104
87
|
dom,
|
|
105
|
-
contentDOM,
|
|
106
88
|
view,
|
|
107
89
|
mark,
|
|
108
90
|
api
|
|
@@ -48,7 +48,7 @@ export var getGuidelines = memoizeOne(function (isResizing, newWidth, getEditorW
|
|
|
48
48
|
exposure: true
|
|
49
49
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
50
50
|
var fullWidth = width ? Math.min(WIDTHS.FULL, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
51
|
-
var maxWidth = width && expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
51
|
+
var maxWidth = width && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
52
52
|
guidelines.push({
|
|
53
53
|
key: GUIDELINE_KEYS.lineLengthLeft,
|
|
54
54
|
position: {
|
|
@@ -5,7 +5,6 @@ import { bind } from 'bind-event-listener';
|
|
|
5
5
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
6
6
|
import uuid from 'uuid/v4';
|
|
7
7
|
import { breakoutMessages as messages } from '@atlaskit/editor-common/messages';
|
|
8
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
10
9
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
11
10
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
@@ -63,9 +62,7 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref2) {
|
|
|
63
62
|
var handle = document.createElement('div');
|
|
64
63
|
handle.contentEditable = 'false';
|
|
65
64
|
handle.classList.add('pm-breakout-resize-handle-container');
|
|
66
|
-
|
|
67
|
-
handle.style.gridColumn = side === 'left' ? '1' : '3';
|
|
68
|
-
}
|
|
65
|
+
handle.style.gridColumn = side === 'left' ? '1' : '3';
|
|
69
66
|
var rail = document.createElement('div');
|
|
70
67
|
rail.classList.add('pm-breakout-resize-handle-rail');
|
|
71
68
|
if (side === 'left') {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { akEditorGutterPaddingDynamic, akEditorGutterPadding, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorCalculatedWideLayoutWidth, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
4
|
import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
|
|
@@ -33,7 +32,7 @@ export function getProposedWidth(_ref) {
|
|
|
33
32
|
// the node width may be greater than the container width so we resize using the smaller value
|
|
34
33
|
var proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
|
|
35
34
|
var snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL)];
|
|
36
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
35
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
37
36
|
snapPoints.push(Math.min(containerWidth, WIDTHS.MAX));
|
|
38
37
|
}
|
|
39
38
|
for (var _i = 0, _snapPoints = snapPoints; _i < _snapPoints.length; _i++) {
|
|
@@ -42,12 +41,11 @@ export function getProposedWidth(_ref) {
|
|
|
42
41
|
return snapPoint;
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
var hardMax = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? Math.min(containerWidth, WIDTHS.MAX) : Math.min(containerWidth, WIDTHS.FULL);
|
|
44
|
+
var hardMax = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? Math.min(containerWidth, WIDTHS.MAX) : Math.min(containerWidth, WIDTHS.FULL);
|
|
46
45
|
return Math.max(WIDTHS.MIN, Math.min(proposedWidth, hardMax));
|
|
47
46
|
}
|
|
48
47
|
export function createResizerCallbacks(_ref2) {
|
|
49
48
|
var dom = _ref2.dom,
|
|
50
|
-
contentDOM = _ref2.contentDOM,
|
|
51
49
|
view = _ref2.view,
|
|
52
50
|
mark = _ref2.mark,
|
|
53
51
|
api = _ref2.api;
|
|
@@ -125,12 +123,9 @@ export function createResizerCallbacks(_ref2) {
|
|
|
125
123
|
return tr;
|
|
126
124
|
});
|
|
127
125
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else {
|
|
132
|
-
contentDOM.style.setProperty(LOCAL_RESIZE_PROPERTY, "".concat(newWidth, "px"));
|
|
133
|
-
}
|
|
126
|
+
|
|
127
|
+
// dom is used for width calculations
|
|
128
|
+
dom.style.setProperty(LOCAL_RESIZE_PROPERTY, "".concat(newWidth, "px"));
|
|
134
129
|
},
|
|
135
130
|
onDrop: function onDrop(_ref7) {
|
|
136
131
|
var _api$guideline2, _api$editorViewMode;
|
|
@@ -147,7 +142,7 @@ export function createResizerCallbacks(_ref2) {
|
|
|
147
142
|
return guideline.key.startsWith('full_width') && guideline.active;
|
|
148
143
|
});
|
|
149
144
|
var isResizedToMaxWidth = false;
|
|
150
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
145
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
151
146
|
isResizedToMaxWidth = !!guidelines.find(function (guideline) {
|
|
152
147
|
return guideline.key.startsWith('max_width') && guideline.active;
|
|
153
148
|
});
|
|
@@ -165,18 +160,14 @@ export function createResizerCallbacks(_ref2) {
|
|
|
165
160
|
api: api,
|
|
166
161
|
source: source
|
|
167
162
|
});
|
|
168
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
163
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
169
164
|
if (isResizedToMaxWidth) {
|
|
170
165
|
newWidth = WIDTHS.MAX;
|
|
171
166
|
}
|
|
172
167
|
}
|
|
173
168
|
var isEditMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'edit';
|
|
174
169
|
setBreakoutWidth(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
|
|
175
|
-
|
|
176
|
-
dom.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
177
|
-
} else {
|
|
178
|
-
contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
179
|
-
}
|
|
170
|
+
dom.style.removeProperty(LOCAL_RESIZE_PROPERTY);
|
|
180
171
|
if (node) {
|
|
181
172
|
var resizedPayload = generateResizedEventPayload({
|
|
182
173
|
node: node,
|
|
@@ -4,7 +4,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
8
|
import { createPragmaticResizer } from './pragmatic-resizer';
|
|
10
9
|
import { createResizerCallbacks } from './resizer-callbacks';
|
|
@@ -40,14 +39,9 @@ export var ResizingMarkView = /*#__PURE__*/function () {
|
|
|
40
39
|
dom.style.justifyContent = 'center';
|
|
41
40
|
|
|
42
41
|
// contentDOM - styles
|
|
43
|
-
|
|
44
|
-
contentDOM.style.gridColumn = '2';
|
|
45
|
-
} else {
|
|
46
|
-
contentDOM.style.gridRow = '1';
|
|
47
|
-
contentDOM.style.gridColumn = '1';
|
|
48
|
-
}
|
|
42
|
+
contentDOM.style.gridColumn = '2';
|
|
49
43
|
contentDOM.style.zIndex = '1';
|
|
50
|
-
if (expValEquals('platform_editor_breakout_resizing_vc90_fix', 'isEnabled', true)
|
|
44
|
+
if (expValEquals('platform_editor_breakout_resizing_vc90_fix', 'isEnabled', true)) {
|
|
51
45
|
if (mark.attrs.width) {
|
|
52
46
|
dom.style.gridTemplateColumns = "auto max(var(--ak-editor--breakout-min-width), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), var(--ak-editor--breakout-fallback-width))) auto");
|
|
53
47
|
} else {
|
|
@@ -58,20 +52,9 @@ export var ResizingMarkView = /*#__PURE__*/function () {
|
|
|
58
52
|
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
59
53
|
}
|
|
60
54
|
}
|
|
61
|
-
} else if (fg('platform_editor_breakout_resizing_width_changes')) {
|
|
62
|
-
if (mark.attrs.width) {
|
|
63
|
-
dom.style.gridTemplateColumns = "auto min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), var(--ak-editor--breakout-fallback-width)) auto");
|
|
64
|
-
} else {
|
|
65
|
-
if (mark.attrs.mode === 'wide') {
|
|
66
|
-
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
67
|
-
}
|
|
68
|
-
if (mark.attrs.mode === 'full-width') {
|
|
69
|
-
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--full-width-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
55
|
} else {
|
|
73
56
|
if (mark.attrs.width) {
|
|
74
|
-
|
|
57
|
+
dom.style.gridTemplateColumns = "auto min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), var(--ak-editor--breakout-fallback-width)) auto");
|
|
75
58
|
} else {
|
|
76
59
|
if (mark.attrs.mode === 'wide') {
|
|
77
60
|
contentDOM.style.width = "max(var(--ak-editor--line-length), min(var(".concat(LOCAL_RESIZE_PROPERTY, ", var(--ak-editor--breakout-wide-layout-width)), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))");
|
|
@@ -111,7 +94,6 @@ export var ResizingMarkView = /*#__PURE__*/function () {
|
|
|
111
94
|
value: function setupResizerCallbacks(dom, contentDOM, view, mark, api) {
|
|
112
95
|
var callbacks = createResizerCallbacks({
|
|
113
96
|
dom: dom,
|
|
114
|
-
contentDOM: contentDOM,
|
|
115
97
|
view: view,
|
|
116
98
|
mark: mark,
|
|
117
99
|
api: api
|
|
@@ -10,9 +10,8 @@ export declare function getProposedWidth({ initialWidth, location, api, source,
|
|
|
10
10
|
location: DragLocationHistory;
|
|
11
11
|
source: ElementDragPayload;
|
|
12
12
|
}): number;
|
|
13
|
-
export declare function createResizerCallbacks({ dom,
|
|
13
|
+
export declare function createResizerCallbacks({ dom, view, mark, api, }: {
|
|
14
14
|
api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
|
|
15
|
-
contentDOM: HTMLElement;
|
|
16
15
|
dom: HTMLElement;
|
|
17
16
|
mark: Mark;
|
|
18
17
|
view: EditorView;
|
|
@@ -10,9 +10,8 @@ export declare function getProposedWidth({ initialWidth, location, api, source,
|
|
|
10
10
|
location: DragLocationHistory;
|
|
11
11
|
source: ElementDragPayload;
|
|
12
12
|
}): number;
|
|
13
|
-
export declare function createResizerCallbacks({ dom,
|
|
13
|
+
export declare function createResizerCallbacks({ dom, view, mark, api, }: {
|
|
14
14
|
api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
|
|
15
|
-
contentDOM: HTMLElement;
|
|
16
15
|
dom: HTMLElement;
|
|
17
16
|
mark: Mark;
|
|
18
17
|
view: EditorView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-breakout",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "Breakout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
45
45
|
"@atlaskit/theme": "^21.0.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^15.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^15.9.0",
|
|
47
47
|
"@atlaskit/tokens": "^8.4.0",
|
|
48
48
|
"@atlaskit/tooltip": "^20.11.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
@@ -101,9 +101,6 @@
|
|
|
101
101
|
"platform-feature-flags": {
|
|
102
102
|
"platform-editor-single-player-expand": {
|
|
103
103
|
"type": "boolean"
|
|
104
|
-
},
|
|
105
|
-
"platform_editor_breakout_resizing_width_changes": {
|
|
106
|
-
"type": "boolean"
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
106
|
}
|