@atlaskit/editor-plugin-breakout 19.0.1 → 19.0.3
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 +16 -0
- package/dist/cjs/breakoutPlugin.js +1 -1
- package/dist/cjs/pm-plugins/get-guidelines.js +1 -2
- package/dist/cjs/pm-plugins/resize-width.js +2 -6
- package/dist/cjs/pm-plugins/resizer-callbacks.js +6 -15
- package/dist/cjs/pm-plugins/resizing-plugin.js +2 -2
- package/dist/cjs/pm-plugins/utils/single-player-expand.js +1 -1
- package/dist/es2019/breakoutPlugin.js +1 -1
- package/dist/es2019/entry-points/breakoutPlugin.js +1 -0
- package/dist/es2019/pm-plugins/get-guidelines.js +1 -2
- package/dist/es2019/pm-plugins/resize-width.js +1 -5
- package/dist/es2019/pm-plugins/resizer-callbacks.js +4 -13
- package/dist/es2019/pm-plugins/resizing-plugin.js +2 -2
- package/dist/es2019/pm-plugins/utils/single-player-expand.js +1 -1
- package/dist/esm/breakoutPlugin.js +1 -1
- package/dist/esm/entry-points/breakoutPlugin.js +1 -0
- package/dist/esm/pm-plugins/get-guidelines.js +1 -2
- package/dist/esm/pm-plugins/resize-width.js +1 -5
- package/dist/esm/pm-plugins/resizer-callbacks.js +6 -15
- package/dist/esm/pm-plugins/resizing-plugin.js +2 -2
- package/dist/esm/pm-plugins/utils/single-player-expand.js +1 -1
- package/dist/types/pm-plugins/resize-width.d.ts +0 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-breakout
|
|
2
2
|
|
|
3
|
+
## 19.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3f8ea6c51b718`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3f8ea6c51b718) -
|
|
8
|
+
Remove the rolled-out `editor_tinymce_full_width_mode` and
|
|
9
|
+
`confluence_max_width_content_appearance` experiments and make max-width content behavior
|
|
10
|
+
permanent.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 19.0.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 19.0.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -18,8 +18,8 @@ var _styles = require("@atlaskit/editor-common/styles");
|
|
|
18
18
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
19
19
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
20
20
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
21
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
22
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
23
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
24
24
|
var _resizingPlugin = require("./pm-plugins/resizing-plugin");
|
|
25
25
|
var _findBreakoutNode = require("./pm-plugins/utils/find-breakout-node");
|
|
@@ -8,7 +8,6 @@ exports.getGuidelines = exports.GUIDELINE_KEYS = 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 _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
11
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
13
12
|
var WIDTHS = {
|
|
14
13
|
MIN: _editorSharedStyles.akEditorDefaultLayoutWidth,
|
|
@@ -66,7 +65,7 @@ var getGuidelines = exports.getGuidelines = (0, _memoizeOne.default)(function (i
|
|
|
66
65
|
exposure: true
|
|
67
66
|
}) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
68
67
|
var fullWidth = width ? Math.min(WIDTHS.FULL, width - 2 * padding - _editorSharedStyles.akEditorGutterPadding) : undefined;
|
|
69
|
-
var maxWidth = width
|
|
68
|
+
var maxWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - _editorSharedStyles.akEditorGutterPadding) : undefined;
|
|
70
69
|
guidelines.push({
|
|
71
70
|
key: GUIDELINE_KEYS.lineLengthLeft,
|
|
72
71
|
position: {
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getResizeContainerWidth = exports.clampWidthToResizeBounds = exports.WIDTHS = void 0;
|
|
7
7
|
var _constants = require("@atlaskit/editor-shared-styles/constants");
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
8
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
10
9
|
var WIDTHS = exports.WIDTHS = {
|
|
11
10
|
FULL: _constants.akEditorFullWidthLayoutWidth,
|
|
@@ -21,9 +20,6 @@ var getResizeContainerWidth = exports.getResizeContainerWidth = function getResi
|
|
|
21
20
|
}) ? _constants.akEditorGutterPaddingReduced : (0, _constants.akEditorGutterPaddingDynamic)();
|
|
22
21
|
return editorWidth - 2 * padding - _constants.akEditorGutterPadding;
|
|
23
22
|
};
|
|
24
|
-
var getResizeHardMax = exports.getResizeHardMax = function getResizeHardMax(containerWidth) {
|
|
25
|
-
return (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);
|
|
26
|
-
};
|
|
27
23
|
var clampWidthToResizeBounds = exports.clampWidthToResizeBounds = function clampWidthToResizeBounds(proposedWidth, containerWidth) {
|
|
28
|
-
return Math.max(WIDTHS.MIN, Math.min(proposedWidth,
|
|
24
|
+
return Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth, WIDTHS.MAX));
|
|
29
25
|
};
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createResizerCallbacks = createResizerCallbacks;
|
|
7
7
|
exports.getProposedWidth = getProposedWidth;
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
8
|
var _setBreakoutWidth = require("../editor-commands/set-breakout-width");
|
|
10
9
|
var _getGuidelines = require("./get-guidelines");
|
|
11
10
|
var _resizeWidth = require("./resize-width");
|
|
@@ -26,10 +25,7 @@ function getProposedWidth(_ref) {
|
|
|
26
25
|
|
|
27
26
|
// the node width may be greater than the container width so we resize using the smaller value
|
|
28
27
|
var proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
|
|
29
|
-
var snapPoints = [_resizeWidth.WIDTHS.MIN, _resizeWidth.WIDTHS.WIDE, Math.min(containerWidth, _resizeWidth.WIDTHS.FULL)];
|
|
30
|
-
if ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
31
|
-
snapPoints.push(Math.min(containerWidth, _resizeWidth.WIDTHS.MAX));
|
|
32
|
-
}
|
|
28
|
+
var snapPoints = [_resizeWidth.WIDTHS.MIN, _resizeWidth.WIDTHS.WIDE, Math.min(containerWidth, _resizeWidth.WIDTHS.FULL), Math.min(containerWidth, _resizeWidth.WIDTHS.MAX)];
|
|
33
29
|
for (var _i = 0, _snapPoints = snapPoints; _i < _snapPoints.length; _i++) {
|
|
34
30
|
var snapPoint = _snapPoints[_i];
|
|
35
31
|
if (snapPoint - SNAP_GAP < proposedWidth && snapPoint + SNAP_GAP > proposedWidth) {
|
|
@@ -135,12 +131,9 @@ function createResizerCallbacks(_ref2) {
|
|
|
135
131
|
var isResizedToFullWidth = !!guidelines.find(function (guideline) {
|
|
136
132
|
return guideline.key.startsWith('full_width') && guideline.active;
|
|
137
133
|
});
|
|
138
|
-
var isResizedToMaxWidth =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return guideline.key.startsWith('max_width') && guideline.active;
|
|
142
|
-
});
|
|
143
|
-
}
|
|
134
|
+
var isResizedToMaxWidth = !!guidelines.find(function (guideline) {
|
|
135
|
+
return guideline.key.startsWith('max_width') && guideline.active;
|
|
136
|
+
});
|
|
144
137
|
guidelines = (0, _getGuidelines.getGuidelines)(false, 0, getEditorWidth);
|
|
145
138
|
api === null || api === void 0 || (_api$guideline2 = api.guideline) === null || _api$guideline2 === void 0 || (_api$guideline2 = _api$guideline2.actions) === null || _api$guideline2 === void 0 || _api$guideline2.displayGuideline(view)({
|
|
146
139
|
guidelines: guidelines
|
|
@@ -154,10 +147,8 @@ function createResizerCallbacks(_ref2) {
|
|
|
154
147
|
api: api,
|
|
155
148
|
source: source
|
|
156
149
|
});
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
newWidth = _resizeWidth.WIDTHS.MAX;
|
|
160
|
-
}
|
|
150
|
+
if (isResizedToMaxWidth) {
|
|
151
|
+
newWidth = _resizeWidth.WIDTHS.MAX;
|
|
161
152
|
}
|
|
162
153
|
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';
|
|
163
154
|
(0, _setBreakoutWidth.setBreakoutWidth)(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
|
|
@@ -163,7 +163,7 @@ var createResizingPlugin = exports.createResizingPlugin = function createResizin
|
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
var isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
|
|
166
|
-
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max'
|
|
166
|
+
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max';
|
|
167
167
|
var state = editorView.state;
|
|
168
168
|
var breakoutResizableNodes = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_resize_extensions') ? (0, _utils.getBreakoutResizableNodeTypesNew)(state.schema) : (0, _utils.getBreakoutResizableNodeTypes)(state.schema, isRuleAndPanelResizingEnabled);
|
|
169
169
|
var newTr = state.tr;
|
|
@@ -215,7 +215,7 @@ var createResizingPlugin = exports.createResizingPlugin = function createResizin
|
|
|
215
215
|
var isRuleAndPanelResizingEnabled = (0, _expValEquals.expValEquals)('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
|
|
216
216
|
var breakoutResizableNodes = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_resize_extensions') ? (0, _utils.getBreakoutResizableNodeTypesNew)(newState.schema) : (0, _utils.getBreakoutResizableNodeTypes)(newState.schema, isRuleAndPanelResizingEnabled);
|
|
217
217
|
var isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
|
|
218
|
-
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max'
|
|
218
|
+
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max';
|
|
219
219
|
var isPageLoadNormalizationEnabled = (0, _expValEquals.expValEquals)('platform_editor_add_breakout_marks_on_page_load', 'isEnabled', true) || (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_lovability_resize_extensions');
|
|
220
220
|
if (!isPageLoadNormalizationEnabled && !isRuleAndPanelResizingEnabled && (0, _document.isReplaceDocOperation)(transactions, oldState)) {
|
|
221
221
|
newState.doc.forEach(function (node, pos) {
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.updateExpandedStateNew = exports.updateExpandedState = void 0;
|
|
7
7
|
var _expand = require("@atlaskit/editor-common/expand");
|
|
8
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
8
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
9
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
10
10
|
var updateExpandedStateNew = exports.updateExpandedStateNew = function updateExpandedStateNew(_ref) {
|
|
11
11
|
var tr = _ref.tr,
|
|
12
12
|
node = _ref.node,
|
|
@@ -6,8 +6,8 @@ import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
|
|
|
6
6
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
7
7
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
8
8
|
import { akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
|
|
9
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
9
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
11
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
12
12
|
import { createResizingPlugin, resizingPluginKey } from './pm-plugins/resizing-plugin';
|
|
13
13
|
import { findSupportedNodeForBreakout } from './pm-plugins/utils/find-breakout-node';
|
|
@@ -1,7 +1,6 @@
|
|
|
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, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorCalculatedWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
6
5
|
const WIDTHS = {
|
|
7
6
|
MIN: akEditorDefaultLayoutWidth,
|
|
@@ -57,7 +56,7 @@ export const getGuidelines = memoizeOne((isResizing, newWidth, getEditorWidth, n
|
|
|
57
56
|
exposure: true
|
|
58
57
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
59
58
|
const fullWidth = width ? Math.min(WIDTHS.FULL, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
60
|
-
const maxWidth = width
|
|
59
|
+
const maxWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
61
60
|
guidelines.push({
|
|
62
61
|
key: GUIDELINE_KEYS.lineLengthLeft,
|
|
63
62
|
position: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullPageNarrowBreakout, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles/constants';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
3
|
const WIDTHS = {
|
|
5
4
|
FULL: akEditorFullWidthLayoutWidth,
|
|
@@ -16,9 +15,6 @@ export const getResizeContainerWidth = api => {
|
|
|
16
15
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
17
16
|
return editorWidth - 2 * padding - akEditorGutterPadding;
|
|
18
17
|
};
|
|
19
|
-
export const getResizeHardMax = containerWidth => {
|
|
20
|
-
return 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);
|
|
21
|
-
};
|
|
22
18
|
export const clampWidthToResizeBounds = (proposedWidth, containerWidth) => {
|
|
23
|
-
return Math.max(WIDTHS.MIN, Math.min(proposedWidth,
|
|
19
|
+
return Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth, WIDTHS.MAX));
|
|
24
20
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
1
|
import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
|
|
3
2
|
import { getGuidelines } from './get-guidelines';
|
|
4
3
|
import { clampWidthToResizeBounds, getResizeContainerWidth, WIDTHS } from './resize-width';
|
|
@@ -20,10 +19,7 @@ export function getProposedWidth({
|
|
|
20
19
|
|
|
21
20
|
// the node width may be greater than the container width so we resize using the smaller value
|
|
22
21
|
const proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
|
|
23
|
-
const snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL)];
|
|
24
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
25
|
-
snapPoints.push(Math.min(containerWidth, WIDTHS.MAX));
|
|
26
|
-
}
|
|
22
|
+
const snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL), Math.min(containerWidth, WIDTHS.MAX)];
|
|
27
23
|
for (const snapPoint of snapPoints) {
|
|
28
24
|
if (snapPoint - SNAP_GAP < proposedWidth && snapPoint + SNAP_GAP > proposedWidth) {
|
|
29
25
|
return snapPoint;
|
|
@@ -131,10 +127,7 @@ export function createResizerCallbacks({
|
|
|
131
127
|
originalNode: node
|
|
132
128
|
});
|
|
133
129
|
const isResizedToFullWidth = !!guidelines.find(guideline => guideline.key.startsWith('full_width') && guideline.active);
|
|
134
|
-
|
|
135
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
136
|
-
isResizedToMaxWidth = !!guidelines.find(guideline => guideline.key.startsWith('max_width') && guideline.active);
|
|
137
|
-
}
|
|
130
|
+
const isResizedToMaxWidth = !!guidelines.find(guideline => guideline.key.startsWith('max_width') && guideline.active);
|
|
138
131
|
guidelines = getGuidelines(false, 0, getEditorWidth);
|
|
139
132
|
api === null || api === void 0 ? void 0 : (_api$guideline2 = api.guideline) === null || _api$guideline2 === void 0 ? void 0 : (_api$guideline2$actio = _api$guideline2.actions) === null || _api$guideline2$actio === void 0 ? void 0 : _api$guideline2$actio.displayGuideline(view)({
|
|
140
133
|
guidelines
|
|
@@ -148,10 +141,8 @@ export function createResizerCallbacks({
|
|
|
148
141
|
api,
|
|
149
142
|
source
|
|
150
143
|
});
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
newWidth = WIDTHS.MAX;
|
|
154
|
-
}
|
|
144
|
+
if (isResizedToMaxWidth) {
|
|
145
|
+
newWidth = WIDTHS.MAX;
|
|
155
146
|
}
|
|
156
147
|
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';
|
|
157
148
|
setBreakoutWidth(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
|
|
@@ -159,7 +159,7 @@ export const createResizingPlugin = (api, getIntl, nodeViewPortalProviderAPI, op
|
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
const isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
|
|
162
|
-
const isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max'
|
|
162
|
+
const isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max';
|
|
163
163
|
const {
|
|
164
164
|
state
|
|
165
165
|
} = editorView;
|
|
@@ -215,7 +215,7 @@ export const createResizingPlugin = (api, getIntl, nodeViewPortalProviderAPI, op
|
|
|
215
215
|
const isRuleAndPanelResizingEnabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
|
|
216
216
|
const breakoutResizableNodes = isExperimentEnabled('platform_editor_lovability_resize_extensions') ? getBreakoutResizableNodeTypesNew(newState.schema) : getBreakoutResizableNodeTypes(newState.schema, isRuleAndPanelResizingEnabled);
|
|
217
217
|
const isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
|
|
218
|
-
const isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max'
|
|
218
|
+
const isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max';
|
|
219
219
|
const isPageLoadNormalizationEnabled = expValEquals('platform_editor_add_breakout_marks_on_page_load', 'isEnabled', true) || isExperimentEnabled('platform_editor_lovability_resize_extensions');
|
|
220
220
|
if (!isPageLoadNormalizationEnabled && !isRuleAndPanelResizingEnabled && isReplaceDocOperation(transactions, oldState)) {
|
|
221
221
|
newState.doc.forEach((node, pos) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
4
|
export const updateExpandedStateNew = ({
|
|
5
5
|
tr,
|
|
6
6
|
node,
|
|
@@ -12,8 +12,8 @@ import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
|
|
|
12
12
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
13
13
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
14
14
|
import { akEditorSwoopCubicBezier } from '@atlaskit/editor-shared-styles';
|
|
15
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
16
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
17
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
18
18
|
import { createResizingPlugin, resizingPluginKey } from './pm-plugins/resizing-plugin';
|
|
19
19
|
import { findSupportedNodeForBreakout } from './pm-plugins/utils/find-breakout-node';
|
|
@@ -1,7 +1,6 @@
|
|
|
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, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorCalculatedWideLayoutWidth, akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
6
5
|
var WIDTHS = {
|
|
7
6
|
MIN: akEditorDefaultLayoutWidth,
|
|
@@ -59,7 +58,7 @@ export var getGuidelines = memoizeOne(function (isResizing, newWidth, getEditorW
|
|
|
59
58
|
exposure: true
|
|
60
59
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
61
60
|
var fullWidth = width ? Math.min(WIDTHS.FULL, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
62
|
-
var maxWidth = width
|
|
61
|
+
var maxWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
|
|
63
62
|
guidelines.push({
|
|
64
63
|
key: GUIDELINE_KEYS.lineLengthLeft,
|
|
65
64
|
position: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullPageNarrowBreakout, akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles/constants';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
4
3
|
var WIDTHS = {
|
|
5
4
|
FULL: akEditorFullWidthLayoutWidth,
|
|
@@ -16,9 +15,6 @@ export var getResizeContainerWidth = function getResizeContainerWidth(api) {
|
|
|
16
15
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
17
16
|
return editorWidth - 2 * padding - akEditorGutterPadding;
|
|
18
17
|
};
|
|
19
|
-
export var getResizeHardMax = function getResizeHardMax(containerWidth) {
|
|
20
|
-
return 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);
|
|
21
|
-
};
|
|
22
18
|
export var clampWidthToResizeBounds = function clampWidthToResizeBounds(proposedWidth, containerWidth) {
|
|
23
|
-
return Math.max(WIDTHS.MIN, Math.min(proposedWidth,
|
|
19
|
+
return Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth, WIDTHS.MAX));
|
|
24
20
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
1
|
import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
|
|
3
2
|
import { getGuidelines } from './get-guidelines';
|
|
4
3
|
import { clampWidthToResizeBounds, getResizeContainerWidth, WIDTHS } from './resize-width';
|
|
@@ -19,10 +18,7 @@ export function getProposedWidth(_ref) {
|
|
|
19
18
|
|
|
20
19
|
// the node width may be greater than the container width so we resize using the smaller value
|
|
21
20
|
var proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
|
|
22
|
-
var snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL)];
|
|
23
|
-
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true)) {
|
|
24
|
-
snapPoints.push(Math.min(containerWidth, WIDTHS.MAX));
|
|
25
|
-
}
|
|
21
|
+
var snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.FULL), Math.min(containerWidth, WIDTHS.MAX)];
|
|
26
22
|
for (var _i = 0, _snapPoints = snapPoints; _i < _snapPoints.length; _i++) {
|
|
27
23
|
var snapPoint = _snapPoints[_i];
|
|
28
24
|
if (snapPoint - SNAP_GAP < proposedWidth && snapPoint + SNAP_GAP > proposedWidth) {
|
|
@@ -128,12 +124,9 @@ export function createResizerCallbacks(_ref2) {
|
|
|
128
124
|
var isResizedToFullWidth = !!guidelines.find(function (guideline) {
|
|
129
125
|
return guideline.key.startsWith('full_width') && guideline.active;
|
|
130
126
|
});
|
|
131
|
-
var isResizedToMaxWidth =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return guideline.key.startsWith('max_width') && guideline.active;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
127
|
+
var isResizedToMaxWidth = !!guidelines.find(function (guideline) {
|
|
128
|
+
return guideline.key.startsWith('max_width') && guideline.active;
|
|
129
|
+
});
|
|
137
130
|
guidelines = getGuidelines(false, 0, getEditorWidth);
|
|
138
131
|
api === null || api === void 0 || (_api$guideline2 = api.guideline) === null || _api$guideline2 === void 0 || (_api$guideline2 = _api$guideline2.actions) === null || _api$guideline2 === void 0 || _api$guideline2.displayGuideline(view)({
|
|
139
132
|
guidelines: guidelines
|
|
@@ -147,10 +140,8 @@ export function createResizerCallbacks(_ref2) {
|
|
|
147
140
|
api: api,
|
|
148
141
|
source: source
|
|
149
142
|
});
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
newWidth = WIDTHS.MAX;
|
|
153
|
-
}
|
|
143
|
+
if (isResizedToMaxWidth) {
|
|
144
|
+
newWidth = WIDTHS.MAX;
|
|
154
145
|
}
|
|
155
146
|
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';
|
|
156
147
|
setBreakoutWidth(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
|
|
@@ -156,7 +156,7 @@ export var createResizingPlugin = function createResizingPlugin(api, getIntl, no
|
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
var isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
|
|
159
|
-
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max'
|
|
159
|
+
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max';
|
|
160
160
|
var state = editorView.state;
|
|
161
161
|
var breakoutResizableNodes = isExperimentEnabled('platform_editor_lovability_resize_extensions') ? getBreakoutResizableNodeTypesNew(state.schema) : getBreakoutResizableNodeTypes(state.schema, isRuleAndPanelResizingEnabled);
|
|
162
162
|
var newTr = state.tr;
|
|
@@ -208,7 +208,7 @@ export var createResizingPlugin = function createResizingPlugin(api, getIntl, no
|
|
|
208
208
|
var isRuleAndPanelResizingEnabled = expValEquals('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true);
|
|
209
209
|
var breakoutResizableNodes = isExperimentEnabled('platform_editor_lovability_resize_extensions') ? getBreakoutResizableNodeTypesNew(newState.schema) : getBreakoutResizableNodeTypes(newState.schema, isRuleAndPanelResizingEnabled);
|
|
210
210
|
var isFullWidthEnabled = !((options === null || options === void 0 ? void 0 : options.allowBreakoutButton) === true);
|
|
211
|
-
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max'
|
|
211
|
+
var isMaxWidthEnabled = (options === null || options === void 0 ? void 0 : options.appearance) === 'max';
|
|
212
212
|
var isPageLoadNormalizationEnabled = expValEquals('platform_editor_add_breakout_marks_on_page_load', 'isEnabled', true) || isExperimentEnabled('platform_editor_lovability_resize_extensions');
|
|
213
213
|
if (!isPageLoadNormalizationEnabled && !isRuleAndPanelResizingEnabled && isReplaceDocOperation(transactions, oldState)) {
|
|
214
214
|
newState.doc.forEach(function (node, pos) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expandedState } from '@atlaskit/editor-common/expand';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
4
|
export var updateExpandedStateNew = function updateExpandedStateNew(_ref) {
|
|
5
5
|
var tr = _ref.tr,
|
|
6
6
|
node = _ref.node,
|
|
@@ -8,5 +8,4 @@ declare const WIDTHS: {
|
|
|
8
8
|
};
|
|
9
9
|
export { WIDTHS };
|
|
10
10
|
export declare const getResizeContainerWidth: (api: ExtractInjectionAPI<BreakoutPlugin> | undefined) => number;
|
|
11
|
-
export declare const getResizeHardMax: (containerWidth: number) => number;
|
|
12
11
|
export declare const clampWidthToResizeBounds: (proposedWidth: number, containerWidth: number) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-breakout",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.3",
|
|
4
4
|
"description": "Breakout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^57.
|
|
25
|
-
"@atlaskit/editor-plugin-block-controls": "^20.
|
|
24
|
+
"@atlaskit/adf-schema": "^57.6.0",
|
|
25
|
+
"@atlaskit/editor-plugin-block-controls": "^20.1.0",
|
|
26
26
|
"@atlaskit/editor-plugin-editor-disabled": "^19.0.0",
|
|
27
27
|
"@atlaskit/editor-plugin-editor-viewmode": "^21.0.0",
|
|
28
28
|
"@atlaskit/editor-plugin-guideline": "^19.0.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
37
37
|
"@atlaskit/pragmatic-drag-and-drop": "^3.1.0",
|
|
38
38
|
"@atlaskit/theme": "^28.2.0",
|
|
39
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
39
|
+
"@atlaskit/tmp-editor-statsig": "^202.0.0",
|
|
40
40
|
"@atlaskit/tokens": "^18.2.0",
|
|
41
41
|
"@atlaskit/tooltip": "^24.3.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"uuid": "^11.1.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^123.
|
|
49
|
+
"@atlaskit/editor-common": "^123.5.0",
|
|
50
50
|
"react": "^18.2.0 || ^19.2.0",
|
|
51
51
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
52
52
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|