@atlaskit/editor-plugin-breakout 2.7.3 → 2.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-breakout
2
2
 
3
+ ## 2.7.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#170955](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/170955)
8
+ [`de48855e17dbe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de48855e17dbe) -
9
+ [ux] ED-28260 disable resize handles in live page view mode
10
+ - Updated dependencies
11
+
12
+ ## 2.7.4
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 2.7.3
4
19
 
5
20
  ### Patch Changes
@@ -171,13 +171,18 @@ var createPragmaticResizer = exports.createPragmaticResizer = function createPra
171
171
  return {
172
172
  rightHandle: rightHandle.handle,
173
173
  leftHandle: leftHandle.handle,
174
- destroy: function destroy() {
174
+ destroy: function destroy(isChangeToViewMode) {
175
175
  destroyFns.forEach(function (destroyFn) {
176
176
  return destroyFn();
177
177
  });
178
178
  unbindFns.forEach(function (unbindFn) {
179
179
  return unbindFn();
180
180
  });
181
+ if (isChangeToViewMode && (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
182
+ var _rightHandle$handle$p, _leftHandle$handle$pa;
183
+ (_rightHandle$handle$p = rightHandle.handle.parentElement) === null || _rightHandle$handle$p === void 0 || _rightHandle$handle$p.removeChild(rightHandle.handle);
184
+ (_leftHandle$handle$pa = leftHandle.handle.parentElement) === null || _leftHandle$handle$pa === void 0 || _leftHandle$handle$pa.removeChild(leftHandle.handle);
185
+ }
181
186
  }
182
187
  };
183
188
  };
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.ResizingMarkView = exports.LOCAL_RESIZE_PROPERTY = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _styles = require("@atlaskit/editor-common/styles");
12
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
13
  var _pragmaticResizer = require("./pragmatic-resizer");
@@ -28,7 +28,9 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
28
28
  * ```
29
29
  */
30
30
  function ResizingMarkView(mark, view, api, getIntl, nodeViewPortalProviderAPI) {
31
+ var _this = this;
31
32
  (0, _classCallCheck2.default)(this, ResizingMarkView);
33
+ (0, _defineProperty2.default)(this, "isResizingInitialised", false);
32
34
  var dom = document.createElement('div');
33
35
  var contentDOM = document.createElement('div');
34
36
  contentDOM.className = _styles.BreakoutCssClassName.BREAKOUT_MARK_DOM;
@@ -69,33 +71,87 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
69
71
  }
70
72
  }
71
73
  dom.appendChild(contentDOM);
72
- var callbacks = (0, _resizerCallbacks.createResizerCallbacks)({
73
- dom: dom,
74
- contentDOM: contentDOM,
75
- view: view,
76
- mark: mark,
77
- api: api
78
- });
79
- this.intl = getIntl();
80
- this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
81
- var _createPragmaticResiz = (0, _pragmaticResizer.createPragmaticResizer)(_objectSpread(_objectSpread({
82
- target: contentDOM
83
- }, callbacks), {}, {
84
- intl: this.intl,
85
- nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
86
- })),
87
- leftHandle = _createPragmaticResiz.leftHandle,
88
- rightHandle = _createPragmaticResiz.rightHandle,
89
- destroy = _createPragmaticResiz.destroy;
90
- dom.prepend(leftHandle);
91
- dom.appendChild(rightHandle);
92
- this.dom = dom;
93
- this.contentDOM = contentDOM;
94
- this.view = view;
95
- this.mark = mark;
96
- this.destroyFn = destroy;
74
+ if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
75
+ var _api$editorViewMode;
76
+ this.dom = dom;
77
+ this.contentDOM = contentDOM;
78
+ this.view = view;
79
+ this.mark = mark;
80
+ this.intl = getIntl();
81
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
82
+ 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';
83
+ if (!isLiveViewMode) {
84
+ this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
85
+ }
86
+ } else {
87
+ var callbacks = (0, _resizerCallbacks.createResizerCallbacks)({
88
+ dom: dom,
89
+ contentDOM: contentDOM,
90
+ view: view,
91
+ mark: mark,
92
+ api: api
93
+ });
94
+ this.intl = getIntl();
95
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
96
+ var _createPragmaticResiz = (0, _pragmaticResizer.createPragmaticResizer)(_objectSpread(_objectSpread({
97
+ target: contentDOM
98
+ }, callbacks), {}, {
99
+ intl: this.intl,
100
+ nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
101
+ })),
102
+ leftHandle = _createPragmaticResiz.leftHandle,
103
+ rightHandle = _createPragmaticResiz.rightHandle,
104
+ destroy = _createPragmaticResiz.destroy;
105
+ dom.prepend(leftHandle);
106
+ dom.appendChild(rightHandle);
107
+ this.dom = dom;
108
+ this.contentDOM = contentDOM;
109
+ this.view = view;
110
+ this.mark = mark;
111
+ this.destroyFn = destroy;
112
+ }
113
+ if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
114
+ var _api$editorViewMode2;
115
+ this.unsubscribeToViewModeChange = api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.onChange(function (sharedState) {
116
+ var _sharedState$nextShar, _sharedState$prevShar;
117
+ 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)) {
118
+ var _sharedState$nextShar2, _sharedState$nextShar3;
119
+ if (((_sharedState$nextShar2 = sharedState.nextSharedState) === null || _sharedState$nextShar2 === void 0 ? void 0 : _sharedState$nextShar2.mode) === 'view' && _this.isResizingInitialised) {
120
+ var _this$destroyFn;
121
+ (_this$destroyFn = _this.destroyFn) === null || _this$destroyFn === void 0 || _this$destroyFn.call(_this, true);
122
+ _this.isResizingInitialised = false;
123
+ } else if (((_sharedState$nextShar3 = sharedState.nextSharedState) === null || _sharedState$nextShar3 === void 0 ? void 0 : _sharedState$nextShar3.mode) === 'edit' && !_this.isResizingInitialised) {
124
+ _this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
125
+ }
126
+ }
127
+ });
128
+ }
97
129
  }
98
130
  return (0, _createClass2.default)(ResizingMarkView, [{
131
+ key: "setupResizerCallbacks",
132
+ value: function setupResizerCallbacks(dom, contentDOM, view, mark, api) {
133
+ var callbacks = (0, _resizerCallbacks.createResizerCallbacks)({
134
+ dom: dom,
135
+ contentDOM: contentDOM,
136
+ view: view,
137
+ mark: mark,
138
+ api: api
139
+ });
140
+ var _createPragmaticResiz2 = (0, _pragmaticResizer.createPragmaticResizer)(_objectSpread(_objectSpread({
141
+ target: contentDOM
142
+ }, callbacks), {}, {
143
+ intl: this.intl,
144
+ nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
145
+ })),
146
+ leftHandle = _createPragmaticResiz2.leftHandle,
147
+ rightHandle = _createPragmaticResiz2.rightHandle,
148
+ destroy = _createPragmaticResiz2.destroy;
149
+ this.dom.prepend(leftHandle);
150
+ this.dom.appendChild(rightHandle);
151
+ this.destroyFn = destroy;
152
+ this.isResizingInitialised = true;
153
+ }
154
+ }, {
99
155
  key: "ignoreMutation",
100
156
  value: function ignoreMutation() {
101
157
  return true;
@@ -103,7 +159,12 @@ var ResizingMarkView = exports.ResizingMarkView = /*#__PURE__*/function () {
103
159
  }, {
104
160
  key: "destroy",
105
161
  value: function destroy() {
106
- this.destroyFn();
162
+ var _this$destroyFn2;
163
+ (_this$destroyFn2 = this.destroyFn) === null || _this$destroyFn2 === void 0 || _this$destroyFn2.call(this);
164
+ if ((0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
165
+ var _this$unsubscribeToVi;
166
+ (_this$unsubscribeToVi = this.unsubscribeToViewModeChange) === null || _this$unsubscribeToVi === void 0 || _this$unsubscribeToVi.call(this);
167
+ }
107
168
  }
108
169
  }]);
109
170
  }();
@@ -154,9 +154,14 @@ export const createPragmaticResizer = ({
154
154
  return {
155
155
  rightHandle: rightHandle.handle,
156
156
  leftHandle: leftHandle.handle,
157
- destroy: () => {
157
+ destroy: isChangeToViewMode => {
158
158
  destroyFns.forEach(destroyFn => destroyFn());
159
159
  unbindFns.forEach(unbindFn => unbindFn());
160
+ if (isChangeToViewMode && fg('platform_editor_breakout_resizing_hello_release')) {
161
+ var _rightHandle$handle$p, _leftHandle$handle$pa;
162
+ (_rightHandle$handle$p = rightHandle.handle.parentElement) === null || _rightHandle$handle$p === void 0 ? void 0 : _rightHandle$handle$p.removeChild(rightHandle.handle);
163
+ (_leftHandle$handle$pa = leftHandle.handle.parentElement) === null || _leftHandle$handle$pa === void 0 ? void 0 : _leftHandle$handle$pa.removeChild(leftHandle.handle);
164
+ }
160
165
  }
161
166
  };
162
167
  };
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
2
3
  import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { createPragmaticResizer } from './pragmatic-resizer';
@@ -16,6 +17,7 @@ export class ResizingMarkView {
16
17
  * ```
17
18
  */
18
19
  constructor(mark, view, api, getIntl, nodeViewPortalProviderAPI) {
20
+ _defineProperty(this, "isResizingInitialised", false);
19
21
  const dom = document.createElement('div');
20
22
  const contentDOM = document.createElement('div');
21
23
  contentDOM.className = BreakoutCssClassName.BREAKOUT_MARK_DOM;
@@ -56,6 +58,64 @@ export class ResizingMarkView {
56
58
  }
57
59
  }
58
60
  dom.appendChild(contentDOM);
61
+ if (fg('platform_editor_breakout_resizing_hello_release')) {
62
+ var _api$editorViewMode, _api$editorViewMode$s;
63
+ this.dom = dom;
64
+ this.contentDOM = contentDOM;
65
+ this.view = view;
66
+ this.mark = mark;
67
+ this.intl = getIntl();
68
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
69
+ const isLiveViewMode = (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) === 'view';
70
+ if (!isLiveViewMode) {
71
+ this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
72
+ }
73
+ } else {
74
+ const callbacks = createResizerCallbacks({
75
+ dom,
76
+ contentDOM,
77
+ view,
78
+ mark,
79
+ api
80
+ });
81
+ this.intl = getIntl();
82
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
83
+ const {
84
+ leftHandle,
85
+ rightHandle,
86
+ destroy
87
+ } = createPragmaticResizer({
88
+ target: contentDOM,
89
+ ...callbacks,
90
+ intl: this.intl,
91
+ nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
92
+ });
93
+ dom.prepend(leftHandle);
94
+ dom.appendChild(rightHandle);
95
+ this.dom = dom;
96
+ this.contentDOM = contentDOM;
97
+ this.view = view;
98
+ this.mark = mark;
99
+ this.destroyFn = destroy;
100
+ }
101
+ if (fg('platform_editor_breakout_resizing_hello_release')) {
102
+ var _api$editorViewMode2;
103
+ this.unsubscribeToViewModeChange = api === null || api === void 0 ? void 0 : (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.onChange(sharedState => {
104
+ var _sharedState$nextShar, _sharedState$prevShar;
105
+ 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)) {
106
+ var _sharedState$nextShar2, _sharedState$nextShar3;
107
+ if (((_sharedState$nextShar2 = sharedState.nextSharedState) === null || _sharedState$nextShar2 === void 0 ? void 0 : _sharedState$nextShar2.mode) === 'view' && this.isResizingInitialised) {
108
+ var _this$destroyFn;
109
+ (_this$destroyFn = this.destroyFn) === null || _this$destroyFn === void 0 ? void 0 : _this$destroyFn.call(this, true);
110
+ this.isResizingInitialised = false;
111
+ } else if (((_sharedState$nextShar3 = sharedState.nextSharedState) === null || _sharedState$nextShar3 === void 0 ? void 0 : _sharedState$nextShar3.mode) === 'edit' && !this.isResizingInitialised) {
112
+ this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
113
+ }
114
+ }
115
+ });
116
+ }
117
+ }
118
+ setupResizerCallbacks(dom, contentDOM, view, mark, api) {
59
119
  const callbacks = createResizerCallbacks({
60
120
  dom,
61
121
  contentDOM,
@@ -63,8 +123,6 @@ export class ResizingMarkView {
63
123
  mark,
64
124
  api
65
125
  });
66
- this.intl = getIntl();
67
- this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
68
126
  const {
69
127
  leftHandle,
70
128
  rightHandle,
@@ -75,18 +133,20 @@ export class ResizingMarkView {
75
133
  intl: this.intl,
76
134
  nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
77
135
  });
78
- dom.prepend(leftHandle);
79
- dom.appendChild(rightHandle);
80
- this.dom = dom;
81
- this.contentDOM = contentDOM;
82
- this.view = view;
83
- this.mark = mark;
136
+ this.dom.prepend(leftHandle);
137
+ this.dom.appendChild(rightHandle);
84
138
  this.destroyFn = destroy;
139
+ this.isResizingInitialised = true;
85
140
  }
86
141
  ignoreMutation() {
87
142
  return true;
88
143
  }
89
144
  destroy() {
90
- this.destroyFn();
145
+ var _this$destroyFn2;
146
+ (_this$destroyFn2 = this.destroyFn) === null || _this$destroyFn2 === void 0 ? void 0 : _this$destroyFn2.call(this);
147
+ if (fg('platform_editor_breakout_resizing_hello_release')) {
148
+ var _this$unsubscribeToVi;
149
+ (_this$unsubscribeToVi = this.unsubscribeToViewModeChange) === null || _this$unsubscribeToVi === void 0 ? void 0 : _this$unsubscribeToVi.call(this);
150
+ }
91
151
  }
92
152
  }
@@ -162,13 +162,18 @@ export var createPragmaticResizer = function createPragmaticResizer(_ref2) {
162
162
  return {
163
163
  rightHandle: rightHandle.handle,
164
164
  leftHandle: leftHandle.handle,
165
- destroy: function destroy() {
165
+ destroy: function destroy(isChangeToViewMode) {
166
166
  destroyFns.forEach(function (destroyFn) {
167
167
  return destroyFn();
168
168
  });
169
169
  unbindFns.forEach(function (unbindFn) {
170
170
  return unbindFn();
171
171
  });
172
+ if (isChangeToViewMode && fg('platform_editor_breakout_resizing_hello_release')) {
173
+ var _rightHandle$handle$p, _leftHandle$handle$pa;
174
+ (_rightHandle$handle$p = rightHandle.handle.parentElement) === null || _rightHandle$handle$p === void 0 || _rightHandle$handle$p.removeChild(rightHandle.handle);
175
+ (_leftHandle$handle$pa = leftHandle.handle.parentElement) === null || _leftHandle$handle$pa === void 0 || _leftHandle$handle$pa.removeChild(leftHandle.handle);
176
+ }
172
177
  }
173
178
  };
174
179
  };
@@ -1,6 +1,6 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
+ 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';
@@ -21,7 +21,9 @@ export var ResizingMarkView = /*#__PURE__*/function () {
21
21
  * ```
22
22
  */
23
23
  function ResizingMarkView(mark, view, api, getIntl, nodeViewPortalProviderAPI) {
24
+ var _this = this;
24
25
  _classCallCheck(this, ResizingMarkView);
26
+ _defineProperty(this, "isResizingInitialised", false);
25
27
  var dom = document.createElement('div');
26
28
  var contentDOM = document.createElement('div');
27
29
  contentDOM.className = BreakoutCssClassName.BREAKOUT_MARK_DOM;
@@ -62,33 +64,87 @@ export var ResizingMarkView = /*#__PURE__*/function () {
62
64
  }
63
65
  }
64
66
  dom.appendChild(contentDOM);
65
- var callbacks = createResizerCallbacks({
66
- dom: dom,
67
- contentDOM: contentDOM,
68
- view: view,
69
- mark: mark,
70
- api: api
71
- });
72
- this.intl = getIntl();
73
- this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
74
- var _createPragmaticResiz = createPragmaticResizer(_objectSpread(_objectSpread({
75
- target: contentDOM
76
- }, callbacks), {}, {
77
- intl: this.intl,
78
- nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
79
- })),
80
- leftHandle = _createPragmaticResiz.leftHandle,
81
- rightHandle = _createPragmaticResiz.rightHandle,
82
- destroy = _createPragmaticResiz.destroy;
83
- dom.prepend(leftHandle);
84
- dom.appendChild(rightHandle);
85
- this.dom = dom;
86
- this.contentDOM = contentDOM;
87
- this.view = view;
88
- this.mark = mark;
89
- this.destroyFn = destroy;
67
+ if (fg('platform_editor_breakout_resizing_hello_release')) {
68
+ var _api$editorViewMode;
69
+ this.dom = dom;
70
+ this.contentDOM = contentDOM;
71
+ this.view = view;
72
+ this.mark = mark;
73
+ this.intl = getIntl();
74
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
75
+ 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';
76
+ if (!isLiveViewMode) {
77
+ this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
78
+ }
79
+ } else {
80
+ var callbacks = createResizerCallbacks({
81
+ dom: dom,
82
+ contentDOM: contentDOM,
83
+ view: view,
84
+ mark: mark,
85
+ api: api
86
+ });
87
+ this.intl = getIntl();
88
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
89
+ var _createPragmaticResiz = createPragmaticResizer(_objectSpread(_objectSpread({
90
+ target: contentDOM
91
+ }, callbacks), {}, {
92
+ intl: this.intl,
93
+ nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
94
+ })),
95
+ leftHandle = _createPragmaticResiz.leftHandle,
96
+ rightHandle = _createPragmaticResiz.rightHandle,
97
+ destroy = _createPragmaticResiz.destroy;
98
+ dom.prepend(leftHandle);
99
+ dom.appendChild(rightHandle);
100
+ this.dom = dom;
101
+ this.contentDOM = contentDOM;
102
+ this.view = view;
103
+ this.mark = mark;
104
+ this.destroyFn = destroy;
105
+ }
106
+ if (fg('platform_editor_breakout_resizing_hello_release')) {
107
+ var _api$editorViewMode2;
108
+ this.unsubscribeToViewModeChange = api === null || api === void 0 || (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : _api$editorViewMode2.sharedState.onChange(function (sharedState) {
109
+ var _sharedState$nextShar, _sharedState$prevShar;
110
+ 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)) {
111
+ var _sharedState$nextShar2, _sharedState$nextShar3;
112
+ if (((_sharedState$nextShar2 = sharedState.nextSharedState) === null || _sharedState$nextShar2 === void 0 ? void 0 : _sharedState$nextShar2.mode) === 'view' && _this.isResizingInitialised) {
113
+ var _this$destroyFn;
114
+ (_this$destroyFn = _this.destroyFn) === null || _this$destroyFn === void 0 || _this$destroyFn.call(_this, true);
115
+ _this.isResizingInitialised = false;
116
+ } else if (((_sharedState$nextShar3 = sharedState.nextSharedState) === null || _sharedState$nextShar3 === void 0 ? void 0 : _sharedState$nextShar3.mode) === 'edit' && !_this.isResizingInitialised) {
117
+ _this.setupResizerCallbacks(dom, contentDOM, view, mark, api);
118
+ }
119
+ }
120
+ });
121
+ }
90
122
  }
91
123
  return _createClass(ResizingMarkView, [{
124
+ key: "setupResizerCallbacks",
125
+ value: function setupResizerCallbacks(dom, contentDOM, view, mark, api) {
126
+ var callbacks = createResizerCallbacks({
127
+ dom: dom,
128
+ contentDOM: contentDOM,
129
+ view: view,
130
+ mark: mark,
131
+ api: api
132
+ });
133
+ var _createPragmaticResiz2 = createPragmaticResizer(_objectSpread(_objectSpread({
134
+ target: contentDOM
135
+ }, callbacks), {}, {
136
+ intl: this.intl,
137
+ nodeViewPortalProviderAPI: this.nodeViewPortalProviderAPI
138
+ })),
139
+ leftHandle = _createPragmaticResiz2.leftHandle,
140
+ rightHandle = _createPragmaticResiz2.rightHandle,
141
+ destroy = _createPragmaticResiz2.destroy;
142
+ this.dom.prepend(leftHandle);
143
+ this.dom.appendChild(rightHandle);
144
+ this.destroyFn = destroy;
145
+ this.isResizingInitialised = true;
146
+ }
147
+ }, {
92
148
  key: "ignoreMutation",
93
149
  value: function ignoreMutation() {
94
150
  return true;
@@ -96,7 +152,12 @@ export var ResizingMarkView = /*#__PURE__*/function () {
96
152
  }, {
97
153
  key: "destroy",
98
154
  value: function destroy() {
99
- this.destroyFn();
155
+ var _this$destroyFn2;
156
+ (_this$destroyFn2 = this.destroyFn) === null || _this$destroyFn2 === void 0 || _this$destroyFn2.call(this);
157
+ if (fg('platform_editor_breakout_resizing_hello_release')) {
158
+ var _this$unsubscribeToVi;
159
+ (_this$unsubscribeToVi = this.unsubscribeToViewModeChange) === null || _this$unsubscribeToVi === void 0 || _this$unsubscribeToVi.call(this);
160
+ }
100
161
  }
101
162
  }]);
102
163
  }();
@@ -1,14 +1,14 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import { type BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
4
- import { type EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
3
+ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
4
+ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
- import { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
6
+ import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
7
7
  import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
8
8
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
9
9
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
10
10
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
11
- import { ActiveGuidelineKey } from './pm-plugins/resizing-plugin';
11
+ import type { ActiveGuidelineKey } from './pm-plugins/resizing-plugin';
12
12
  export interface BreakoutPluginState {
13
13
  breakoutNode: ContentNodeWithPos | undefined;
14
14
  activeGuidelineKey: ActiveGuidelineKey | undefined;
@@ -1,5 +1,5 @@
1
- import { GuidelineConfig } from '@atlaskit/editor-common/guideline';
2
- import { EditorContainerWidth } from '@atlaskit/editor-common/types';
1
+ import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
2
+ import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
3
3
  import { NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  export declare const GUIDELINE_KEYS: {
5
5
  readonly lineLengthLeft: "grid_left";
@@ -12,5 +12,5 @@ export declare const createPragmaticResizer: ({ target, onDragStart, onDrag, onD
12
12
  }) => {
13
13
  rightHandle: HTMLDivElement;
14
14
  leftHandle: HTMLDivElement;
15
- destroy: () => void;
15
+ destroy: (isChangeToViewMode?: boolean) => void;
16
16
  };
@@ -1,9 +1,9 @@
1
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
2
  import { Mark } from '@atlaskit/editor-prosemirror/model';
3
3
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
5
- import { BaseEventPayload, DragLocationHistory, ElementDragType } from '@atlaskit/pragmatic-drag-and-drop/types';
6
- import { BreakoutPlugin } from '../breakoutPluginType';
4
+ import type { ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
5
+ import type { BaseEventPayload, DragLocationHistory, ElementDragType } from '@atlaskit/pragmatic-drag-and-drop/types';
6
+ import type { BreakoutPlugin } from '../breakoutPluginType';
7
7
  export declare function getProposedWidth({ initialWidth, location, api, source, }: {
8
8
  initialWidth: number;
9
9
  location: DragLocationHistory;
@@ -3,16 +3,18 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { Mark } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
- import { BreakoutPlugin } from '../breakoutPluginType';
6
+ import type { BreakoutPlugin } from '../breakoutPluginType';
7
7
  export declare const LOCAL_RESIZE_PROPERTY = "--local-resizing-width";
8
8
  export declare class ResizingMarkView implements NodeView {
9
9
  dom: HTMLElement;
10
10
  contentDOM: HTMLElement;
11
11
  view: EditorView;
12
12
  mark: Mark;
13
- destroyFn: () => void;
13
+ destroyFn: ((isChangeToViewMode?: boolean) => void) | undefined;
14
14
  intl: IntlShape;
15
15
  nodeViewPortalProviderAPI: PortalProviderAPI;
16
+ unsubscribeToViewModeChange: (() => void) | undefined;
17
+ isResizingInitialised: boolean;
16
18
  /**
17
19
  * Wrap node view in a resizing mark view
18
20
  * @param {Mark} mark - The breakout mark to resize
@@ -25,6 +27,7 @@ export declare class ResizingMarkView implements NodeView {
25
27
  * ```
26
28
  */
27
29
  constructor(mark: Mark, view: EditorView, api: ExtractInjectionAPI<BreakoutPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI);
30
+ setupResizerCallbacks(dom: HTMLElement, contentDOM: HTMLElement, view: EditorView, mark: Mark, api?: ExtractInjectionAPI<BreakoutPlugin>): void;
28
31
  ignoreMutation(): boolean;
29
32
  destroy(): void;
30
33
  }
@@ -1,10 +1,9 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
- import { BreakoutPlugin } from '../breakoutPluginType';
7
- import type { BreakoutPluginOptions, BreakoutPluginState } from '../breakoutPluginType';
6
+ import type { BreakoutPlugin, BreakoutPluginOptions, BreakoutPluginState } from '../breakoutPluginType';
8
7
  import { GUIDELINE_KEYS } from './get-guidelines';
9
8
  export declare const resizingPluginKey: PluginKey<BreakoutPluginState>;
10
9
  export type ActiveGuidelineKey = Exclude<(typeof GUIDELINE_KEYS)[keyof typeof GUIDELINE_KEYS], 'grid_left' | 'grid_right'>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { BreakoutPlugin } from '../breakoutPluginType';
4
+ import type { BreakoutPlugin } from '../breakoutPluginType';
5
5
  type GuidelineLabelProps = {
6
6
  api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
7
7
  editorView: EditorView;
@@ -1,14 +1,14 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import { type BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
4
- import { type EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
3
+ import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
4
+ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
6
- import { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
6
+ import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
7
7
  import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
8
8
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
9
9
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
10
10
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
11
- import { ActiveGuidelineKey } from './pm-plugins/resizing-plugin';
11
+ import type { ActiveGuidelineKey } from './pm-plugins/resizing-plugin';
12
12
  export interface BreakoutPluginState {
13
13
  breakoutNode: ContentNodeWithPos | undefined;
14
14
  activeGuidelineKey: ActiveGuidelineKey | undefined;
@@ -1,5 +1,5 @@
1
- import { GuidelineConfig } from '@atlaskit/editor-common/guideline';
2
- import { EditorContainerWidth } from '@atlaskit/editor-common/types';
1
+ import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
2
+ import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
3
3
  import { NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  export declare const GUIDELINE_KEYS: {
5
5
  readonly lineLengthLeft: "grid_left";
@@ -12,5 +12,5 @@ export declare const createPragmaticResizer: ({ target, onDragStart, onDrag, onD
12
12
  }) => {
13
13
  rightHandle: HTMLDivElement;
14
14
  leftHandle: HTMLDivElement;
15
- destroy: () => void;
15
+ destroy: (isChangeToViewMode?: boolean) => void;
16
16
  };
@@ -1,9 +1,9 @@
1
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
2
  import { Mark } from '@atlaskit/editor-prosemirror/model';
3
3
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
5
- import { BaseEventPayload, DragLocationHistory, ElementDragType } from '@atlaskit/pragmatic-drag-and-drop/types';
6
- import { BreakoutPlugin } from '../breakoutPluginType';
4
+ import type { ElementDragPayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
5
+ import type { BaseEventPayload, DragLocationHistory, ElementDragType } from '@atlaskit/pragmatic-drag-and-drop/types';
6
+ import type { BreakoutPlugin } from '../breakoutPluginType';
7
7
  export declare function getProposedWidth({ initialWidth, location, api, source, }: {
8
8
  initialWidth: number;
9
9
  location: DragLocationHistory;
@@ -3,16 +3,18 @@ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { Mark } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
6
- import { BreakoutPlugin } from '../breakoutPluginType';
6
+ import type { BreakoutPlugin } from '../breakoutPluginType';
7
7
  export declare const LOCAL_RESIZE_PROPERTY = "--local-resizing-width";
8
8
  export declare class ResizingMarkView implements NodeView {
9
9
  dom: HTMLElement;
10
10
  contentDOM: HTMLElement;
11
11
  view: EditorView;
12
12
  mark: Mark;
13
- destroyFn: () => void;
13
+ destroyFn: ((isChangeToViewMode?: boolean) => void) | undefined;
14
14
  intl: IntlShape;
15
15
  nodeViewPortalProviderAPI: PortalProviderAPI;
16
+ unsubscribeToViewModeChange: (() => void) | undefined;
17
+ isResizingInitialised: boolean;
16
18
  /**
17
19
  * Wrap node view in a resizing mark view
18
20
  * @param {Mark} mark - The breakout mark to resize
@@ -25,6 +27,7 @@ export declare class ResizingMarkView implements NodeView {
25
27
  * ```
26
28
  */
27
29
  constructor(mark: Mark, view: EditorView, api: ExtractInjectionAPI<BreakoutPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI);
30
+ setupResizerCallbacks(dom: HTMLElement, contentDOM: HTMLElement, view: EditorView, mark: Mark, api?: ExtractInjectionAPI<BreakoutPlugin>): void;
28
31
  ignoreMutation(): boolean;
29
32
  destroy(): void;
30
33
  }
@@ -1,10 +1,9 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
- import { BreakoutPlugin } from '../breakoutPluginType';
7
- import type { BreakoutPluginOptions, BreakoutPluginState } from '../breakoutPluginType';
6
+ import type { BreakoutPlugin, BreakoutPluginOptions, BreakoutPluginState } from '../breakoutPluginType';
8
7
  import { GUIDELINE_KEYS } from './get-guidelines';
9
8
  export declare const resizingPluginKey: PluginKey<BreakoutPluginState>;
10
9
  export type ActiveGuidelineKey = Exclude<(typeof GUIDELINE_KEYS)[keyof typeof GUIDELINE_KEYS], 'grid_left' | 'grid_right'>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { BreakoutPlugin } from '../breakoutPluginType';
4
+ import type { BreakoutPlugin } from '../breakoutPluginType';
5
5
  type GuidelineLabelProps = {
6
6
  api: ExtractInjectionAPI<BreakoutPlugin> | undefined;
7
7
  editorView: EditorView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-breakout",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "description": "Breakout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,8 +34,8 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
- "@atlaskit/editor-common": "^106.6.0",
38
- "@atlaskit/editor-plugin-block-controls": "^3.17.0",
37
+ "@atlaskit/editor-common": "^106.9.0",
38
+ "@atlaskit/editor-plugin-block-controls": "^3.19.0",
39
39
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
40
40
  "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
41
41
  "@atlaskit/editor-plugin-guideline": "^2.0.0",
@@ -48,8 +48,8 @@
48
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
49
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
50
50
  "@atlaskit/theme": "^18.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^6.2.0",
52
- "@atlaskit/tokens": "^5.1.0",
51
+ "@atlaskit/tmp-editor-statsig": "^7.0.0",
52
+ "@atlaskit/tokens": "^5.2.0",
53
53
  "@atlaskit/tooltip": "^20.3.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1",