@atlaskit/editor-plugin-expand 1.3.2 → 1.3.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#90914](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90914) [`a4a9d317e5b8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a4a9d317e5b8) - [ux] [ED-23013] Fix bug in single player expand where backspace in the title would delete entire expand even if the title had content.
8
+
3
9
  ## 1.3.2
4
10
 
5
11
  ### Patch Changes
@@ -134,6 +134,15 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
134
134
  (0, _defineProperty2.default)(this, "deleteEmptyExpand", function () {
135
135
  var state = _this.view.state;
136
136
  var expandNode = _this.node;
137
+ if (!_this.input) {
138
+ return;
139
+ }
140
+ var _this$input = _this.input,
141
+ selectionStart = _this$input.selectionStart,
142
+ selectionEnd = _this$input.selectionEnd;
143
+ if (selectionStart !== selectionEnd || selectionStart !== 0) {
144
+ return;
145
+ }
137
146
  if (expandNode && (0, _utils.isEmptyNode)(state.schema)(expandNode)) {
138
147
  var _this$api;
139
148
  (0, _commands.deleteExpand)((_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.analytics) === null || _this$api === void 0 ? void 0 : _this$api.actions)(state, _this.view.dispatch);
@@ -179,10 +188,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
179
188
  if (typeof pos !== 'number') {
180
189
  return;
181
190
  }
182
- var _this$input = _this.input,
183
- value = _this$input.value,
184
- selectionStart = _this$input.selectionStart,
185
- selectionEnd = _this$input.selectionEnd;
191
+ var _this$input2 = _this.input,
192
+ value = _this$input2.value,
193
+ selectionStart = _this$input2.selectionStart,
194
+ selectionEnd = _this$input2.selectionEnd;
186
195
  if (selectionStart === selectionEnd && selectionStart === value.length) {
187
196
  var _this$view4 = _this.view,
188
197
  state = _this$view4.state,
@@ -200,9 +209,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
200
209
  if (typeof pos !== 'number') {
201
210
  return;
202
211
  }
203
- var _this$input2 = _this.input,
204
- selectionStart = _this$input2.selectionStart,
205
- selectionEnd = _this$input2.selectionEnd;
212
+ var _this$input3 = _this.input,
213
+ selectionStart = _this$input3.selectionStart,
214
+ selectionEnd = _this$input3.selectionEnd;
206
215
  if (selectionStart === selectionEnd && selectionStart === 0) {
207
216
  event.preventDefault();
208
217
  var _this$view5 = _this.view,
@@ -220,10 +229,10 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
220
229
  if (typeof pos !== 'number') {
221
230
  return;
222
231
  }
223
- var _this$input3 = _this.input,
224
- value = _this$input3.value,
225
- selectionStart = _this$input3.selectionStart,
226
- selectionEnd = _this$input3.selectionEnd;
232
+ var _this$input4 = _this.input,
233
+ value = _this$input4.value,
234
+ selectionStart = _this$input4.selectionStart,
235
+ selectionEnd = _this$input4.selectionEnd;
227
236
  if (selectionStart === selectionEnd && selectionStart === value.length) {
228
237
  event.preventDefault();
229
238
  var _this$view6 = _this.view,
@@ -247,9 +256,9 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
247
256
  if (typeof pos !== 'number') {
248
257
  return;
249
258
  }
250
- var _this$input4 = _this.input,
251
- selectionStart = _this$input4.selectionStart,
252
- selectionEnd = _this$input4.selectionEnd;
259
+ var _this$input5 = _this.input,
260
+ selectionStart = _this$input5.selectionStart,
261
+ selectionEnd = _this$input5.selectionEnd;
253
262
  if (selectionStart === selectionEnd && selectionStart === 0) {
254
263
  var _this$api2;
255
264
  event.preventDefault();
@@ -124,6 +124,16 @@ export class ExpandNodeView {
124
124
  state
125
125
  } = this.view;
126
126
  const expandNode = this.node;
127
+ if (!this.input) {
128
+ return;
129
+ }
130
+ const {
131
+ selectionStart,
132
+ selectionEnd
133
+ } = this.input;
134
+ if (selectionStart !== selectionEnd || selectionStart !== 0) {
135
+ return;
136
+ }
127
137
  if (expandNode && isEmptyNode(state.schema)(expandNode)) {
128
138
  var _this$api, _this$api$analytics;
129
139
  deleteExpand((_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$analytics = _this$api.analytics) === null || _this$api$analytics === void 0 ? void 0 : _this$api$analytics.actions)(state, this.view.dispatch);
@@ -126,6 +126,15 @@ export var ExpandNodeView = /*#__PURE__*/function () {
126
126
  _defineProperty(this, "deleteEmptyExpand", function () {
127
127
  var state = _this.view.state;
128
128
  var expandNode = _this.node;
129
+ if (!_this.input) {
130
+ return;
131
+ }
132
+ var _this$input = _this.input,
133
+ selectionStart = _this$input.selectionStart,
134
+ selectionEnd = _this$input.selectionEnd;
135
+ if (selectionStart !== selectionEnd || selectionStart !== 0) {
136
+ return;
137
+ }
129
138
  if (expandNode && isEmptyNode(state.schema)(expandNode)) {
130
139
  var _this$api;
131
140
  deleteExpand((_this$api = _this.api) === null || _this$api === void 0 || (_this$api = _this$api.analytics) === null || _this$api === void 0 ? void 0 : _this$api.actions)(state, _this.view.dispatch);
@@ -171,10 +180,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
171
180
  if (typeof pos !== 'number') {
172
181
  return;
173
182
  }
174
- var _this$input = _this.input,
175
- value = _this$input.value,
176
- selectionStart = _this$input.selectionStart,
177
- selectionEnd = _this$input.selectionEnd;
183
+ var _this$input2 = _this.input,
184
+ value = _this$input2.value,
185
+ selectionStart = _this$input2.selectionStart,
186
+ selectionEnd = _this$input2.selectionEnd;
178
187
  if (selectionStart === selectionEnd && selectionStart === value.length) {
179
188
  var _this$view4 = _this.view,
180
189
  state = _this$view4.state,
@@ -192,9 +201,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
192
201
  if (typeof pos !== 'number') {
193
202
  return;
194
203
  }
195
- var _this$input2 = _this.input,
196
- selectionStart = _this$input2.selectionStart,
197
- selectionEnd = _this$input2.selectionEnd;
204
+ var _this$input3 = _this.input,
205
+ selectionStart = _this$input3.selectionStart,
206
+ selectionEnd = _this$input3.selectionEnd;
198
207
  if (selectionStart === selectionEnd && selectionStart === 0) {
199
208
  event.preventDefault();
200
209
  var _this$view5 = _this.view,
@@ -212,10 +221,10 @@ export var ExpandNodeView = /*#__PURE__*/function () {
212
221
  if (typeof pos !== 'number') {
213
222
  return;
214
223
  }
215
- var _this$input3 = _this.input,
216
- value = _this$input3.value,
217
- selectionStart = _this$input3.selectionStart,
218
- selectionEnd = _this$input3.selectionEnd;
224
+ var _this$input4 = _this.input,
225
+ value = _this$input4.value,
226
+ selectionStart = _this$input4.selectionStart,
227
+ selectionEnd = _this$input4.selectionEnd;
219
228
  if (selectionStart === selectionEnd && selectionStart === value.length) {
220
229
  event.preventDefault();
221
230
  var _this$view6 = _this.view,
@@ -239,9 +248,9 @@ export var ExpandNodeView = /*#__PURE__*/function () {
239
248
  if (typeof pos !== 'number') {
240
249
  return;
241
250
  }
242
- var _this$input4 = _this.input,
243
- selectionStart = _this$input4.selectionStart,
244
- selectionEnd = _this$input4.selectionEnd;
251
+ var _this$input5 = _this.input,
252
+ selectionStart = _this$input5.selectionStart,
253
+ selectionEnd = _this$input5.selectionEnd;
245
254
  if (selectionStart === selectionEnd && selectionStart === 0) {
246
255
  var _this$api2;
247
256
  event.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",