@atlaskit/editor-plugin-breakout 6.0.0 → 6.0.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/breakoutPlugin.js +2 -2
  3. package/dist/cjs/editor-commands/set-breakout-width.js +2 -5
  4. package/dist/cjs/pm-plugins/get-guidelines.js +15 -36
  5. package/dist/cjs/pm-plugins/handle-key-down.js +25 -28
  6. package/dist/cjs/pm-plugins/pragmatic-resizer.js +21 -32
  7. package/dist/cjs/pm-plugins/resizer-callbacks.js +50 -69
  8. package/dist/cjs/pm-plugins/resizing-mark-view.js +31 -75
  9. package/dist/cjs/pm-plugins/resizing-plugin.js +4 -4
  10. package/dist/es2019/breakoutPlugin.js +2 -2
  11. package/dist/es2019/editor-commands/set-breakout-width.js +2 -5
  12. package/dist/es2019/pm-plugins/get-guidelines.js +15 -36
  13. package/dist/es2019/pm-plugins/handle-key-down.js +25 -28
  14. package/dist/es2019/pm-plugins/pragmatic-resizer.js +18 -29
  15. package/dist/es2019/pm-plugins/resizer-callbacks.js +49 -68
  16. package/dist/es2019/pm-plugins/resizing-mark-view.js +25 -71
  17. package/dist/es2019/pm-plugins/resizing-plugin.js +4 -4
  18. package/dist/esm/breakoutPlugin.js +2 -2
  19. package/dist/esm/editor-commands/set-breakout-width.js +2 -5
  20. package/dist/esm/pm-plugins/get-guidelines.js +15 -36
  21. package/dist/esm/pm-plugins/handle-key-down.js +25 -28
  22. package/dist/esm/pm-plugins/pragmatic-resizer.js +21 -32
  23. package/dist/esm/pm-plugins/resizer-callbacks.js +50 -69
  24. package/dist/esm/pm-plugins/resizing-mark-view.js +31 -75
  25. package/dist/esm/pm-plugins/resizing-plugin.js +4 -4
  26. package/dist/types/pm-plugins/handle-key-down.d.ts +1 -1
  27. package/dist/types-ts4.5/pm-plugins/handle-key-down.d.ts +1 -1
  28. package/package.json +7 -10
@@ -218,7 +218,7 @@ export var breakoutPlugin = function breakoutPlugin(_ref4) {
218
218
  breakoutNode: undefined
219
219
  };
220
220
  }
221
- if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
221
+ if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true)) {
222
222
  var resizingPluginState = resizingPluginKey.getState(editorState);
223
223
  if (!resizingPluginState) {
224
224
  return {
@@ -244,7 +244,7 @@ export var breakoutPlugin = function breakoutPlugin(_ref4) {
244
244
  if (!editorView) {
245
245
  return null;
246
246
  }
247
- if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
247
+ if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true)) {
248
248
  return /*#__PURE__*/React.createElement(GuidelineLabel, {
249
249
  api: api,
250
250
  editorView: editorView,
@@ -1,6 +1,5 @@
1
1
  import { transferCodeBlockWrappedValue } from '@atlaskit/editor-common/code-block';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import { updateExpandedStateNew } from '../pm-plugins/utils/single-player-expand';
5
4
  export function setBreakoutWidth(width, mode, pos, isLivePage) {
6
5
  return function (state, dispatch) {
@@ -26,12 +25,10 @@ export function setBreakoutWidth(width, mode, pos, isLivePage) {
26
25
  transferCodeBlockWrappedValue(oldNode, newNode);
27
26
  }
28
27
  }
29
- if (fg('platform_editor_breakout_resizing_hello_release')) {
30
- tr.setMeta('scrollIntoView', false);
31
- }
28
+ tr.setMeta('scrollIntoView', false);
32
29
 
33
30
  // keep current selection, necessary to not remove NodeSelection for keyboard resizing
34
- if (state.selection instanceof NodeSelection && state.selection.node.eq(node) && fg('platform_editor_breakout_resizing_hello_release')) {
31
+ if (state.selection instanceof NodeSelection && state.selection.node.eq(node)) {
35
32
  tr.setSelection(NodeSelection.create(tr.doc, pos));
36
33
  }
37
34
  if (dispatch) {
@@ -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 } from '@atlaskit/editor-shared-styles';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
6
5
  var WIDTHS = {
7
6
  MIN: akEditorDefaultLayoutWidth,
@@ -40,45 +39,25 @@ export var getGuidelines = memoizeOne(function (isResizing, newWidth, getEditorW
40
39
  }
41
40
  }
42
41
  var _ref = getEditorWidth() || {},
43
- width = _ref.width,
44
- lineLength = _ref.lineLength;
42
+ width = _ref.width;
45
43
  var padding = width && width <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
46
44
  exposure: true
47
45
  }) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
48
46
  var fullWidth = width ? Math.min(WIDTHS.MAX, width - 2 * padding - akEditorGutterPadding) : undefined;
49
- if (fg('platform_editor_breakout_resizing_hello_release')) {
50
- guidelines.push({
51
- key: GUIDELINE_KEYS.lineLengthLeft,
52
- position: {
53
- x: -roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
54
- },
55
- active: newWidth === WIDTHS.MIN
56
- });
57
- guidelines.push({
58
- key: GUIDELINE_KEYS.lineLengthRight,
59
- position: {
60
- x: roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
61
- },
62
- active: newWidth === WIDTHS.MIN
63
- });
64
- } else {
65
- if (lineLength) {
66
- guidelines.push({
67
- key: GUIDELINE_KEYS.lineLengthLeft,
68
- position: {
69
- x: -roundToNearest(lineLength / 2 + innerPaddingOffset)
70
- },
71
- active: newWidth === lineLength
72
- });
73
- guidelines.push({
74
- key: GUIDELINE_KEYS.lineLengthRight,
75
- position: {
76
- x: roundToNearest(lineLength / 2 + innerPaddingOffset)
77
- },
78
- active: newWidth === lineLength
79
- });
80
- }
81
- }
47
+ guidelines.push({
48
+ key: GUIDELINE_KEYS.lineLengthLeft,
49
+ position: {
50
+ x: -roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
51
+ },
52
+ active: newWidth === WIDTHS.MIN
53
+ });
54
+ guidelines.push({
55
+ key: GUIDELINE_KEYS.lineLengthRight,
56
+ position: {
57
+ x: roundToNearest(WIDTHS.MIN / 2 + innerPaddingOffset)
58
+ },
59
+ active: newWidth === WIDTHS.MIN
60
+ });
82
61
  guidelines.push({
83
62
  key: GUIDELINE_KEYS.wideLeft,
84
63
  position: {
@@ -1,7 +1,6 @@
1
1
  import { browser } from '@atlaskit/editor-common/browser';
2
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
4
  import { setBreakoutWidth } from '../editor-commands/set-breakout-width';
6
5
  var KEYBOARD_RESIZE_STEP = 10;
7
6
  var getAncestorResizableNode = function getAncestorResizableNode(view, breakoutResizableNodes) {
@@ -34,36 +33,34 @@ var getAncestorResizableNode = function getAncestorResizableNode(view, breakoutR
34
33
  };
35
34
  export var handleKeyDown = function handleKeyDown(api) {
36
35
  return function (view, event) {
37
- if (fg('platform_editor_breakout_resizing_hello_release')) {
38
- var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
39
- var isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
40
- if (metaKey && event.altKey && isBracketKey) {
41
- var _view$state$schema$no = view.state.schema.nodes,
42
- expand = _view$state$schema$no.expand,
43
- codeBlock = _view$state$schema$no.codeBlock,
44
- layoutSection = _view$state$schema$no.layoutSection;
45
- var breakoutResizableNodes = new Set([expand, codeBlock, layoutSection]);
46
- var result = getAncestorResizableNode(view, breakoutResizableNodes);
47
- if (result) {
48
- var node = result.node,
49
- pos = result.pos;
50
- var breakoutMark = node === null || node === void 0 ? void 0 : node.marks.find(function (mark) {
51
- return mark.type.name === 'breakout';
52
- });
53
- if (breakoutMark) {
54
- var step = event.code === 'BracketRight' ? KEYBOARD_RESIZE_STEP : -KEYBOARD_RESIZE_STEP;
55
- var newWidth = breakoutMark.attrs.width + step;
56
- if (newWidth < akEditorFullWidthLayoutWidth && newWidth > akEditorDefaultLayoutWidth) {
57
- var _api$editorViewMode;
58
- 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';
59
- setBreakoutWidth(breakoutMark.attrs.width + step, breakoutMark.attrs.mode, pos, isEditMode)(view.state, view.dispatch);
60
- view.focus();
61
- }
62
- return true;
36
+ var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
37
+ var isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
38
+ if (metaKey && event.altKey && isBracketKey) {
39
+ var _view$state$schema$no = view.state.schema.nodes,
40
+ expand = _view$state$schema$no.expand,
41
+ codeBlock = _view$state$schema$no.codeBlock,
42
+ layoutSection = _view$state$schema$no.layoutSection;
43
+ var breakoutResizableNodes = new Set([expand, codeBlock, layoutSection]);
44
+ var result = getAncestorResizableNode(view, breakoutResizableNodes);
45
+ if (result) {
46
+ var node = result.node,
47
+ pos = result.pos;
48
+ var breakoutMark = node === null || node === void 0 ? void 0 : node.marks.find(function (mark) {
49
+ return mark.type.name === 'breakout';
50
+ });
51
+ if (breakoutMark) {
52
+ var step = event.code === 'BracketRight' ? KEYBOARD_RESIZE_STEP : -KEYBOARD_RESIZE_STEP;
53
+ var newWidth = breakoutMark.attrs.width + step;
54
+ if (newWidth < akEditorFullWidthLayoutWidth && newWidth > akEditorDefaultLayoutWidth) {
55
+ var _api$editorViewMode;
56
+ 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';
57
+ setBreakoutWidth(breakoutMark.attrs.width + step, breakoutMark.attrs.mode, pos, isEditMode)(view.state, view.dispatch);
58
+ view.focus();
63
59
  }
60
+ return true;
64
61
  }
65
62
  }
66
- return false;
67
63
  }
64
+ return false;
68
65
  };
69
66
  };
@@ -79,37 +79,26 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref2) {
79
79
  var thumb = document.createElement('div');
80
80
  thumb.classList.add('pm-breakout-resize-handle-thumb');
81
81
  rail.appendChild(thumb);
82
- if (fg('platform_editor_breakout_resizing_hello_release')) {
83
- var tooltipContainer = document.createElement('div');
84
- tooltipContainer.classList.add('pm-breakout-resize-handle-rail-wrapper');
85
- handle.appendChild(tooltipContainer);
86
- handle.appendChild(handleHitBox);
87
- var key = uuid();
88
- nodeViewPortalProviderAPI.render(function () {
89
- return /*#__PURE__*/React.createElement(RailWithTooltip, {
90
- rail: rail,
91
- target: target,
92
- intl: intl
93
- });
94
- }, tooltipContainer, key);
95
- return {
96
- handle: handle,
97
- rail: rail,
98
- handleHitBox: handleHitBox,
99
- destroyTooltip: function destroyTooltip() {
100
- return nodeViewPortalProviderAPI.remove(key);
101
- }
102
- };
103
- } else {
104
- handle.appendChild(rail);
105
- handle.appendChild(handleHitBox);
106
- return {
107
- handle: handle,
82
+ var tooltipContainer = document.createElement('div');
83
+ tooltipContainer.classList.add('pm-breakout-resize-handle-rail-wrapper');
84
+ handle.appendChild(tooltipContainer);
85
+ handle.appendChild(handleHitBox);
86
+ var key = uuid();
87
+ nodeViewPortalProviderAPI.render(function () {
88
+ return /*#__PURE__*/React.createElement(RailWithTooltip, {
108
89
  rail: rail,
109
- handleHitBox: handleHitBox,
110
- destroyTooltip: function destroyTooltip() {}
111
- };
112
- }
90
+ target: target,
91
+ intl: intl
92
+ });
93
+ }, tooltipContainer, key);
94
+ return {
95
+ handle: handle,
96
+ rail: rail,
97
+ handleHitBox: handleHitBox,
98
+ destroyTooltip: function destroyTooltip() {
99
+ return nodeViewPortalProviderAPI.remove(key);
100
+ }
101
+ };
113
102
  };
114
103
  var rightHandle = createHandle('right');
115
104
  var leftHandle = createHandle('left');
@@ -161,7 +150,7 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref2) {
161
150
  })];
162
151
  };
163
152
  var unbindFns = [].concat(_toConsumableArray(registerEvents(target)), _toConsumableArray(registerEvents(rightHandle.handleHitBox)), _toConsumableArray(registerEvents(leftHandle.handleHitBox)), _toConsumableArray(registerEvents(rightHandle.rail)), _toConsumableArray(registerEvents(leftHandle.rail)));
164
- var destroyFns = [registerHandle(rightHandle.handle, 'right'), registerHandle(leftHandle.handle, 'left')].concat(_toConsumableArray(fg('platform_editor_breakout_resizing_hello_release') ? [rightHandle.destroyTooltip, leftHandle.destroyTooltip] : []));
153
+ var destroyFns = [registerHandle(rightHandle.handle, 'right'), registerHandle(leftHandle.handle, 'left'), rightHandle.destroyTooltip, leftHandle.destroyTooltip];
165
154
  return {
166
155
  rightHandle: rightHandle.handle,
167
156
  leftHandle: leftHandle.handle,
@@ -172,7 +161,7 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref2) {
172
161
  unbindFns.forEach(function (unbindFn) {
173
162
  return unbindFn();
174
163
  });
175
- if (isChangeToViewMode && fg('platform_editor_breakout_resizing_hello_release')) {
164
+ if (isChangeToViewMode) {
176
165
  var _rightHandle$handle$p, _leftHandle$handle$pa;
177
166
  (_rightHandle$handle$p = rightHandle.handle.parentElement) === null || _rightHandle$handle$p === void 0 || _rightHandle$handle$p.removeChild(rightHandle.handle);
178
167
  (_leftHandle$handle$pa = leftHandle.handle.parentElement) === null || _leftHandle$handle$pa === void 0 || _leftHandle$handle$pa.removeChild(leftHandle.handle);
@@ -30,13 +30,11 @@ export function getProposedWidth(_ref) {
30
30
 
31
31
  // the node width may be greater than the container width so we resize using the smaller value
32
32
  var proposedWidth = Math.min(initialWidth, containerWidth) + diffX;
33
- if (fg('platform_editor_breakout_resizing_hello_release')) {
34
- var snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.MAX)];
35
- for (var _i = 0, _snapPoints = snapPoints; _i < _snapPoints.length; _i++) {
36
- var snapPoint = _snapPoints[_i];
37
- if (snapPoint - SNAP_GAP < proposedWidth && snapPoint + SNAP_GAP > proposedWidth) {
38
- return snapPoint;
39
- }
33
+ var snapPoints = [WIDTHS.MIN, WIDTHS.WIDE, Math.min(containerWidth, WIDTHS.MAX)];
34
+ for (var _i = 0, _snapPoints = snapPoints; _i < _snapPoints.length; _i++) {
35
+ var snapPoint = _snapPoints[_i];
36
+ if (snapPoint - SNAP_GAP < proposedWidth && snapPoint + SNAP_GAP > proposedWidth) {
37
+ return snapPoint;
40
38
  }
41
39
  }
42
40
  return Math.min(Math.max(WIDTHS.MIN, Math.min(proposedWidth, containerWidth)), WIDTHS.MAX);
@@ -59,9 +57,7 @@ export function createResizerCallbacks(_ref2) {
59
57
  };
60
58
  return {
61
59
  onDragStart: function onDragStart() {
62
- if (fg('platform_editor_breakout_resizing_hello_release')) {
63
- startMeasure();
64
- }
60
+ startMeasure();
65
61
  var pos = view.posAtDOM(dom, 0);
66
62
  node = view.state.doc.nodeAt(pos);
67
63
  api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
@@ -71,27 +67,23 @@ export function createResizerCallbacks(_ref2) {
71
67
  tr: tr
72
68
  });
73
69
  tr.setMeta('is-resizer-resizing', true);
74
- if (fg('platform_editor_breakout_resizing_hello_release')) {
75
- tr.setMeta(resizingPluginKey, {
76
- type: 'UPDATE_BREAKOUT_NODE',
77
- data: {
78
- node: node,
79
- pos: pos,
80
- start: pos,
81
- depth: 0
82
- }
83
- });
84
- }
70
+ tr.setMeta(resizingPluginKey, {
71
+ type: 'UPDATE_BREAKOUT_NODE',
72
+ data: {
73
+ node: node,
74
+ pos: pos,
75
+ start: pos,
76
+ depth: 0
77
+ }
78
+ });
85
79
  return tr;
86
80
  });
87
81
  },
88
82
  onDrag: function onDrag(_ref4) {
89
- var _node, _api$guideline;
83
+ var _node, _api$guideline, _api$breakout$sharedS;
90
84
  var location = _ref4.location,
91
85
  source = _ref4.source;
92
- if (fg('platform_editor_breakout_resizing_hello_release')) {
93
- countFrames();
94
- }
86
+ countFrames();
95
87
  var initialWidth = mark.attrs.width;
96
88
  var newWidth = getProposedWidth({
97
89
  initialWidth: initialWidth,
@@ -103,32 +95,29 @@ export function createResizerCallbacks(_ref2) {
103
95
  api === null || api === void 0 || (_api$guideline = api.guideline) === null || _api$guideline === void 0 || (_api$guideline = _api$guideline.actions) === null || _api$guideline === void 0 || _api$guideline.displayGuideline(view)({
104
96
  guidelines: guidelines
105
97
  });
106
- if (fg('platform_editor_breakout_resizing_hello_release')) {
107
- var _api$breakout$sharedS;
108
- var activeGuideline = guidelines.find(function (guideline) {
109
- return guideline.active && !guideline.key.startsWith('grid');
110
- });
111
- if (activeGuideline) {
112
- api === null || api === void 0 || api.core.actions.execute(function (_ref5) {
113
- var tr = _ref5.tr;
114
- tr.setMeta(resizingPluginKey, {
115
- type: 'UPDATE_ACTIVE_GUIDELINE_KEY',
116
- data: {
117
- activeGuidelineKey: activeGuideline.key
118
- }
119
- });
120
- return tr;
98
+ var activeGuideline = guidelines.find(function (guideline) {
99
+ return guideline.active && !guideline.key.startsWith('grid');
100
+ });
101
+ if (activeGuideline) {
102
+ api === null || api === void 0 || api.core.actions.execute(function (_ref5) {
103
+ var tr = _ref5.tr;
104
+ tr.setMeta(resizingPluginKey, {
105
+ type: 'UPDATE_ACTIVE_GUIDELINE_KEY',
106
+ data: {
107
+ activeGuidelineKey: activeGuideline.key
108
+ }
121
109
  });
122
- }
123
- if (!activeGuideline && api !== null && api !== void 0 && (_api$breakout$sharedS = api.breakout.sharedState.currentState()) !== null && _api$breakout$sharedS !== void 0 && _api$breakout$sharedS.activeGuidelineKey) {
124
- api === null || api === void 0 || api.core.actions.execute(function (_ref6) {
125
- var tr = _ref6.tr;
126
- tr.setMeta(resizingPluginKey, {
127
- type: 'CLEAR_ACTIVE_GUIDELINE_KEY'
128
- });
129
- return tr;
110
+ return tr;
111
+ });
112
+ }
113
+ if (!activeGuideline && api !== null && api !== void 0 && (_api$breakout$sharedS = api.breakout.sharedState.currentState()) !== null && _api$breakout$sharedS !== void 0 && _api$breakout$sharedS.activeGuidelineKey) {
114
+ api === null || api === void 0 || api.core.actions.execute(function (_ref6) {
115
+ var tr = _ref6.tr;
116
+ tr.setMeta(resizingPluginKey, {
117
+ type: 'CLEAR_ACTIVE_GUIDELINE_KEY'
130
118
  });
131
- }
119
+ return tr;
120
+ });
132
121
  }
133
122
  if (fg('platform_editor_breakout_resizing_width_changes')) {
134
123
  // dom is used for width calculations
@@ -138,18 +127,16 @@ export function createResizerCallbacks(_ref2) {
138
127
  }
139
128
  },
140
129
  onDrop: function onDrop(_ref7) {
141
- var _api$guideline2;
130
+ var _api$guideline2, _api$editorViewMode;
142
131
  var location = _ref7.location,
143
132
  source = _ref7.source;
144
133
  var payloads = [];
145
- if (fg('platform_editor_breakout_resizing_hello_release')) {
146
- var frameRateSamples = endMeasure();
147
- payloads = generateResizeFrameRatePayloads({
148
- docSize: view.state.doc.nodeSize,
149
- frameRateSamples: reduceResizeFrameRateSamples(frameRateSamples),
150
- originalNode: node
151
- });
152
- }
134
+ var frameRateSamples = endMeasure();
135
+ payloads = generateResizeFrameRatePayloads({
136
+ docSize: view.state.doc.nodeSize,
137
+ frameRateSamples: reduceResizeFrameRateSamples(frameRateSamples),
138
+ originalNode: node
139
+ });
153
140
  var isResizedToFullWidth = !!guidelines.find(function (guideline) {
154
141
  return guideline.key.startsWith('full_width') && guideline.active;
155
142
  });
@@ -166,18 +153,14 @@ export function createResizerCallbacks(_ref2) {
166
153
  api: api,
167
154
  source: source
168
155
  });
169
- var isEditMode;
170
- if (fg('platform_editor_breakout_resizing_hello_release')) {
171
- var _api$editorViewMode;
172
- 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';
173
- }
156
+ 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
157
  setBreakoutWidth(newWidth, mode, pos, isEditMode)(view.state, view.dispatch);
175
158
  if (fg('platform_editor_breakout_resizing_width_changes')) {
176
159
  dom.style.removeProperty(LOCAL_RESIZE_PROPERTY);
177
160
  } else {
178
161
  contentDOM.style.removeProperty(LOCAL_RESIZE_PROPERTY);
179
162
  }
180
- if (node && fg('platform_editor_breakout_resizing_hello_release')) {
163
+ if (node) {
181
164
  var resizedPayload = generateResizedEventPayload({
182
165
  node: node,
183
166
  prevWidth: initialWidth,
@@ -196,11 +179,9 @@ export function createResizerCallbacks(_ref2) {
196
179
  (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent(payload)(tr);
197
180
  });
198
181
  tr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
199
- if (fg('platform_editor_breakout_resizing_hello_release')) {
200
- tr.setMeta(resizingPluginKey, {
201
- type: 'RESET_STATE'
202
- });
203
- }
182
+ tr.setMeta(resizingPluginKey, {
183
+ type: 'RESET_STATE'
184
+ });
204
185
  return tr;
205
186
  });
206
187
  }
@@ -22,7 +22,9 @@ export var ResizingMarkView = /*#__PURE__*/function () {
22
22
  * ```
23
23
  */
24
24
  function ResizingMarkView(mark, view, api, getIntl, nodeViewPortalProviderAPI) {
25
- var _this = this;
25
+ var _api$editorViewMode,
26
+ _api$editorViewMode2,
27
+ _this = this;
26
28
  _classCallCheck(this, ResizingMarkView);
27
29
  _defineProperty(this, "isResizingInitialised", false);
28
30
  var dom = document.createElement('div');
@@ -67,7 +69,7 @@ export var ResizingMarkView = /*#__PURE__*/function () {
67
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))))");
68
70
  }
69
71
  }
70
- } else if (fg('platform_editor_breakout_resizing_hello_release')) {
72
+ } else {
71
73
  if (mark.attrs.width) {
72
74
  contentDOM.style.width = "min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding)))");
73
75
  } else {
@@ -78,74 +80,31 @@ export var ResizingMarkView = /*#__PURE__*/function () {
78
80
  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))))");
79
81
  }
80
82
  }
81
- } else {
82
- if (mark.attrs.width) {
83
- contentDOM.style.minWidth = "min(var(".concat(LOCAL_RESIZE_PROPERTY, ", ").concat(mark.attrs.width, "px), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding)))");
84
- } else {
85
- if (mark.attrs.mode === 'wide') {
86
- contentDOM.style.minWidth = "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))))");
87
- }
88
- if (mark.attrs.mode === 'full-width') {
89
- contentDOM.style.minWidth = "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))))");
90
- }
91
- }
92
83
  }
93
84
  dom.appendChild(contentDOM);
94
- if (fg('platform_editor_breakout_resizing_hello_release')) {
95
- var _api$editorViewMode;
96
- this.dom = dom;
97
- this.contentDOM = contentDOM;
98
- this.view = view;
99
- this.mark = mark;
100
- this.intl = getIntl();
101
- this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
102
- var isLiveViewMode = (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) === 'view';
103
- if (!isLiveViewMode) {
104
- this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
105
- }
106
- } else {
107
- var callbacks = createResizerCallbacks({
108
- dom: dom,
109
- contentDOM: contentDOM,
110
- view: view,
111
- mark: mark,
112
- api: api
113
- });
114
- this.intl = getIntl();
115
- this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
116
- var _createPragmaticResiz = createPragmaticResizer(_objectSpread(_objectSpread({
117
- target: contentDOM
118
- }, callbacks), {}, {
119
- intl: this.intl,
120
- nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
121
- })),
122
- leftHandle = _createPragmaticResiz.leftHandle,
123
- rightHandle = _createPragmaticResiz.rightHandle,
124
- destroy = _createPragmaticResiz.destroy;
125
- dom.prepend(leftHandle);
126
- dom.appendChild(rightHandle);
127
- this.dom = dom;
128
- this.contentDOM = contentDOM;
129
- this.view = view;
130
- this.mark = mark;
131
- this.destroyFn = destroy;
85
+ this.dom = dom;
86
+ this.contentDOM = contentDOM;
87
+ this.view = view;
88
+ this.mark = mark;
89
+ this.intl = getIntl();
90
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
91
+ var isLiveViewMode = (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) === 'view';
92
+ if (!isLiveViewMode) {
93
+ this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
132
94
  }
133
- if (fg('platform_editor_breakout_resizing_hello_release')) {
134
- var _api$editorViewMode2;
135
- this.unsubscribeToViewModeChange = api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.onChange(function (sharedState) {
136
- var _sharedState$nextShar, _sharedState$prevShar;
137
- if (((_sharedState$nextShar = sharedState.nextSharedState) === null || _sharedState$nextShar === void 0 ? void 0 : _sharedState$nextShar.mode) !== ((_sharedState$prevShar = sharedState.prevSharedState) === null || _sharedState$prevShar === void 0 ? void 0 : _sharedState$prevShar.mode)) {
138
- var _sharedState$nextShar2, _sharedState$nextShar3;
139
- if (((_sharedState$nextShar2 = sharedState.nextSharedState) === null || _sharedState$nextShar2 === void 0 ? void 0 : _sharedState$nextShar2.mode) === 'view' && _this.isResizingInitialised) {
140
- var _this$destroyFn;
141
- (_this$destroyFn = _this.destroyFn) === null || _this$destroyFn === void 0 || _this$destroyFn.call(_this, true);
142
- _this.isResizingInitialised = false;
143
- } else if (((_sharedState$nextShar3 = sharedState.nextSharedState) === null || _sharedState$nextShar3 === void 0 ? void 0 : _sharedState$nextShar3.mode) === 'edit' && !_this.isResizingInitialised) {
144
- _this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
145
- }
95
+ this.unsubscribeToViewModeChange = api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.onChange(function (sharedState) {
96
+ var _sharedState$nextShar, _sharedState$prevShar;
97
+ if (((_sharedState$nextShar = sharedState.nextSharedState) === null || _sharedState$nextShar === void 0 ? void 0 : _sharedState$nextShar.mode) !== ((_sharedState$prevShar = sharedState.prevSharedState) === null || _sharedState$prevShar === void 0 ? void 0 : _sharedState$prevShar.mode)) {
98
+ var _sharedState$nextShar2, _sharedState$nextShar3;
99
+ if (((_sharedState$nextShar2 = sharedState.nextSharedState) === null || _sharedState$nextShar2 === void 0 ? void 0 : _sharedState$nextShar2.mode) === 'view' && _this.isResizingInitialised) {
100
+ var _this$destroyFn;
101
+ (_this$destroyFn = _this.destroyFn) === null || _this$destroyFn === void 0 || _this$destroyFn.call(_this, true);
102
+ _this.isResizingInitialised = false;
103
+ } else if (((_sharedState$nextShar3 = sharedState.nextSharedState) === null || _sharedState$nextShar3 === void 0 ? void 0 : _sharedState$nextShar3.mode) === 'edit' && !_this.isResizingInitialised) {
104
+ _this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
146
105
  }
147
- });
148
- }
106
+ }
107
+ });
149
108
  }
150
109
  return _createClass(ResizingMarkView, [{
151
110
  key: "setupResizerCallbacks",
@@ -157,15 +116,15 @@ export var ResizingMarkView = /*#__PURE__*/function () {
157
116
  mark: mark,
158
117
  api: api
159
118
  });
160
- var _createPragmaticResiz2 = createPragmaticResizer(_objectSpread(_objectSpread({
119
+ var _createPragmaticResiz = createPragmaticResizer(_objectSpread(_objectSpread({
161
120
  target: contentDOM
162
121
  }, callbacks), {}, {
163
122
  intl: this.intl,
164
123
  nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
165
124
  })),
166
- leftHandle = _createPragmaticResiz2.leftHandle,
167
- rightHandle = _createPragmaticResiz2.rightHandle,
168
- destroy = _createPragmaticResiz2.destroy;
125
+ leftHandle = _createPragmaticResiz.leftHandle,
126
+ rightHandle = _createPragmaticResiz.rightHandle,
127
+ destroy = _createPragmaticResiz.destroy;
169
128
  this.dom.prepend(leftHandle);
170
129
  this.dom.appendChild(rightHandle);
171
130
  this.destroyFn = destroy;
@@ -179,12 +138,9 @@ export var ResizingMarkView = /*#__PURE__*/function () {
179
138
  }, {
180
139
  key: "destroy",
181
140
  value: function destroy() {
182
- var _this$destroyFn2;
141
+ var _this$destroyFn2, _this$unsubscribeToVi;
183
142
  (_this$destroyFn2 = this.destroyFn) === null || _this$destroyFn2 === void 0 || _this$destroyFn2.call(this);
184
- if (fg('platform_editor_breakout_resizing_hello_release')) {
185
- var _this$unsubscribeToVi;
186
- (_this$unsubscribeToVi = this.unsubscribeToViewModeChange) === null || _this$unsubscribeToVi === void 0 || _this$unsubscribeToVi.call(this);
187
- }
143
+ (_this$unsubscribeToVi = this.unsubscribeToViewModeChange) === null || _this$unsubscribeToVi === void 0 || _this$unsubscribeToVi.call(this);
188
144
  }
189
145
  }]);
190
146
  }();
@@ -33,7 +33,7 @@ var addBreakoutToResizableNode = function addBreakoutToResizableNode(_ref) {
33
33
  updatedTr = newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
34
34
  width: width
35
35
  })]);
36
- if (isExpand && fg('platform_editor_breakout_resizing_hello_release')) {
36
+ if (isExpand) {
37
37
  updateExpandedStateNew({
38
38
  tr: updatedTr,
39
39
  node: node,
@@ -51,7 +51,7 @@ var addBreakoutToResizableNode = function addBreakoutToResizableNode(_ref) {
51
51
  width: newWidth,
52
52
  mode: mode
53
53
  })]);
54
- if (isExpand && fg('platform_editor_breakout_resizing_hello_release')) {
54
+ if (isExpand) {
55
55
  updateExpandedStateNew({
56
56
  tr: updatedTr,
57
57
  node: node,
@@ -104,7 +104,7 @@ var pluginState = {
104
104
  export var createResizingPlugin = function createResizingPlugin(api, getIntl, nodeViewPortalProviderAPI, options) {
105
105
  return new SafePlugin({
106
106
  key: resizingPluginKey,
107
- state: fg('platform_editor_breakout_resizing_hello_release') ? pluginState : undefined,
107
+ state: pluginState,
108
108
  props: {
109
109
  markViews: {
110
110
  breakout: function breakout(mark, view) {
@@ -122,7 +122,7 @@ export var createResizingPlugin = function createResizingPlugin(api, getIntl, no
122
122
  } else {
123
123
  var _api$editorViewMode2;
124
124
  // if editor is in live-view mode don't send transactions
125
- if ((api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) !== 'edit' && fg('platform_editor_breakout_resizing_hello_release')) {
125
+ if ((api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 || (_api$editorViewMode2 = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.mode) !== 'edit') {
126
126
  return;
127
127
  }
128
128
  }
@@ -1,4 +1,4 @@
1
1
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { BreakoutPlugin } from '../breakoutPluginType';
4
- export declare const handleKeyDown: (api: ExtractInjectionAPI<BreakoutPlugin> | undefined) => (view: EditorView, event: KeyboardEvent) => boolean | undefined;
4
+ export declare const handleKeyDown: (api: ExtractInjectionAPI<BreakoutPlugin> | undefined) => (view: EditorView, event: KeyboardEvent) => boolean;