@atlaskit/editor-plugin-extension 13.5.8 → 13.5.9
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 +8 -0
- package/dist/cjs/editor-actions/actions.js +16 -16
- package/dist/cjs/pm-plugins/macro/actions.js +21 -21
- package/dist/cjs/pm-plugins/main.js +22 -22
- package/dist/cjs/pm-plugins/toolbar.js +15 -13
- package/dist/cjs/pm-plugins/update-edit-button.js +16 -16
- package/dist/cjs/pm-plugins/utils.js +36 -36
- package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +30 -30
- package/dist/cjs/ui/ConfigPanel/Fields/CustomSelect.js +17 -17
- package/dist/cjs/ui/ConfigPanel/Fields/UserSelect.js +20 -20
- package/dist/cjs/ui/ConfigPanel/FormErrorBoundary.js +7 -7
- package/dist/cjs/ui/ConfigPanel/transformers.js +108 -107
- package/dist/cjs/ui/context-panel.js +34 -33
- package/dist/cjs/ui/useConfigPanelPluginHook.js +25 -25
- package/dist/es2019/pm-plugins/toolbar.js +10 -7
- package/dist/esm/editor-actions/actions.js +16 -16
- package/dist/esm/pm-plugins/macro/actions.js +21 -21
- package/dist/esm/pm-plugins/main.js +22 -22
- package/dist/esm/pm-plugins/toolbar.js +15 -13
- package/dist/esm/pm-plugins/update-edit-button.js +16 -16
- package/dist/esm/pm-plugins/utils.js +36 -36
- package/dist/esm/ui/ConfigPanel/ConfigPanel.js +29 -29
- package/dist/esm/ui/ConfigPanel/Fields/CustomSelect.js +16 -16
- package/dist/esm/ui/ConfigPanel/Fields/UserSelect.js +19 -19
- package/dist/esm/ui/ConfigPanel/FormErrorBoundary.js +7 -7
- package/dist/esm/ui/ConfigPanel/transformers.js +108 -107
- package/dist/esm/ui/context-panel.js +34 -33
- package/dist/esm/ui/useConfigPanelPluginHook.js +24 -24
- package/package.json +6 -6
|
@@ -77,7 +77,7 @@ var serialize = exports.serialize = /*#__PURE__*/function () {
|
|
|
77
77
|
parameters,
|
|
78
78
|
hasDuplicateFields,
|
|
79
79
|
_args2 = arguments;
|
|
80
|
-
return _regenerator.default.wrap(function
|
|
80
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
81
81
|
while (1) switch (_context2.prev = _context2.next) {
|
|
82
82
|
case 0:
|
|
83
83
|
options = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : {};
|
|
@@ -87,66 +87,66 @@ var serialize = exports.serialize = /*#__PURE__*/function () {
|
|
|
87
87
|
fillResults = flattenedFields.map( /*#__PURE__*/function () {
|
|
88
88
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(field) {
|
|
89
89
|
var tabGroupData, tabData, expandData, fieldsetData, value;
|
|
90
|
-
return _regenerator.default.wrap(function
|
|
90
|
+
return _regenerator.default.wrap(function (_context) {
|
|
91
91
|
while (1) switch (_context.prev = _context.next) {
|
|
92
92
|
case 0:
|
|
93
93
|
if (!(0, _extensions.isTabGroup)(field)) {
|
|
94
|
-
_context.next =
|
|
94
|
+
_context.next = 2;
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
|
-
_context.next =
|
|
97
|
+
_context.next = 1;
|
|
98
98
|
return serializeTabGroupField(manifest, field, data);
|
|
99
|
-
case
|
|
99
|
+
case 1:
|
|
100
100
|
tabGroupData = _context.sent;
|
|
101
101
|
result.push.apply(result, (0, _toConsumableArray2.default)(tabGroupData));
|
|
102
|
-
_context.next =
|
|
102
|
+
_context.next = 9;
|
|
103
103
|
break;
|
|
104
|
-
case
|
|
104
|
+
case 2:
|
|
105
105
|
if (!(0, _extensions.isTabField)(field)) {
|
|
106
|
-
_context.next =
|
|
106
|
+
_context.next = 4;
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
109
|
-
_context.next =
|
|
109
|
+
_context.next = 3;
|
|
110
110
|
return serializeTabField(manifest, field, data);
|
|
111
|
-
case
|
|
111
|
+
case 3:
|
|
112
112
|
tabData = _context.sent;
|
|
113
113
|
result.push.apply(result, (0, _toConsumableArray2.default)(tabData));
|
|
114
|
-
_context.next =
|
|
114
|
+
_context.next = 9;
|
|
115
115
|
break;
|
|
116
|
-
case
|
|
116
|
+
case 4:
|
|
117
117
|
if (!(0, _extensions.isExpand)(field)) {
|
|
118
|
-
_context.next =
|
|
118
|
+
_context.next = 6;
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
|
-
_context.next =
|
|
121
|
+
_context.next = 5;
|
|
122
122
|
return serializeExpandField(manifest, field, data);
|
|
123
|
-
case
|
|
123
|
+
case 5:
|
|
124
124
|
expandData = _context.sent;
|
|
125
125
|
result.push.apply(result, (0, _toConsumableArray2.default)(expandData));
|
|
126
|
-
_context.next =
|
|
126
|
+
_context.next = 9;
|
|
127
127
|
break;
|
|
128
|
-
case
|
|
128
|
+
case 6:
|
|
129
129
|
if (!((0, _extensions.isFieldset)(field) && depth === 0)) {
|
|
130
|
-
_context.next =
|
|
130
|
+
_context.next = 8;
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
|
-
_context.next =
|
|
133
|
+
_context.next = 7;
|
|
134
134
|
return serializeFieldset(manifest, field, data, depth);
|
|
135
|
-
case
|
|
135
|
+
case 7:
|
|
136
136
|
fieldsetData = _context.sent;
|
|
137
137
|
if (fieldsetData) {
|
|
138
138
|
result.push(fieldsetData);
|
|
139
139
|
}
|
|
140
|
-
_context.next =
|
|
140
|
+
_context.next = 9;
|
|
141
141
|
break;
|
|
142
|
-
case
|
|
142
|
+
case 8:
|
|
143
143
|
value = extract(data[field.name], field, {
|
|
144
144
|
useDefaultValue: true
|
|
145
145
|
}); // ignore undefined values
|
|
146
146
|
if (value !== undefined) {
|
|
147
147
|
result.push((0, _defineProperty2.default)({}, field.name, value));
|
|
148
148
|
}
|
|
149
|
-
case
|
|
149
|
+
case 9:
|
|
150
150
|
case "end":
|
|
151
151
|
return _context.stop();
|
|
152
152
|
}
|
|
@@ -156,9 +156,9 @@ var serialize = exports.serialize = /*#__PURE__*/function () {
|
|
|
156
156
|
return _ref2.apply(this, arguments);
|
|
157
157
|
};
|
|
158
158
|
}());
|
|
159
|
-
_context2.next =
|
|
159
|
+
_context2.next = 1;
|
|
160
160
|
return Promise.all(fillResults);
|
|
161
|
-
case
|
|
161
|
+
case 1:
|
|
162
162
|
// Crunch fields down to parameters
|
|
163
163
|
parameters = result.reduce(function (obj, current) {
|
|
164
164
|
// eslint-disable-next-line guard-for-in
|
|
@@ -171,13 +171,13 @@ var serialize = exports.serialize = /*#__PURE__*/function () {
|
|
|
171
171
|
return field.allowDuplicates;
|
|
172
172
|
});
|
|
173
173
|
if (!hasDuplicateFields) {
|
|
174
|
-
_context2.next =
|
|
174
|
+
_context2.next = 2;
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
177
|
return _context2.abrupt("return", serializeMergeDuplicateFieldData(parameters, data, flattenedFields));
|
|
178
|
-
case
|
|
178
|
+
case 2:
|
|
179
179
|
return _context2.abrupt("return", parameters);
|
|
180
|
-
case
|
|
180
|
+
case 3:
|
|
181
181
|
case "end":
|
|
182
182
|
return _context2.stop();
|
|
183
183
|
}
|
|
@@ -189,46 +189,46 @@ var serialize = exports.serialize = /*#__PURE__*/function () {
|
|
|
189
189
|
}();
|
|
190
190
|
var serializeFieldset = /*#__PURE__*/function () {
|
|
191
191
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(manifest, field, data, depth) {
|
|
192
|
-
var fieldSerializer, fieldsetFields, fieldParams, extracted;
|
|
193
|
-
return _regenerator.default.wrap(function
|
|
192
|
+
var fieldSerializer, fieldsetFields, fieldParams, extracted, _t;
|
|
193
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
194
194
|
while (1) switch (_context3.prev = _context3.next) {
|
|
195
195
|
case 0:
|
|
196
196
|
_context3.prev = 0;
|
|
197
197
|
fieldSerializer = (0, _extensions.getFieldSerializer)(manifest, field.options.transformer);
|
|
198
|
-
_context3.next =
|
|
198
|
+
_context3.next = 2;
|
|
199
199
|
break;
|
|
200
|
-
case
|
|
201
|
-
_context3.prev =
|
|
202
|
-
|
|
200
|
+
case 1:
|
|
201
|
+
_context3.prev = 1;
|
|
202
|
+
_t = _context3["catch"](0);
|
|
203
203
|
if (!(data[field.name] !== undefined)) {
|
|
204
|
-
_context3.next =
|
|
204
|
+
_context3.next = 2;
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
|
-
throw
|
|
208
|
-
case
|
|
207
|
+
throw _t;
|
|
208
|
+
case 2:
|
|
209
209
|
if (fieldSerializer) {
|
|
210
|
-
_context3.next =
|
|
210
|
+
_context3.next = 3;
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
213
|
return _context3.abrupt("return");
|
|
214
|
-
case
|
|
214
|
+
case 3:
|
|
215
215
|
fieldsetFields = field.fields;
|
|
216
216
|
fieldParams = extract(data[field.name], field, {
|
|
217
217
|
useDefaultValue: true
|
|
218
218
|
}) || {};
|
|
219
|
-
_context3.next =
|
|
219
|
+
_context3.next = 4;
|
|
220
220
|
return serialize(manifest, fieldParams, fieldsetFields, {
|
|
221
221
|
depth: depth + 1,
|
|
222
222
|
parentType: 'fieldset'
|
|
223
223
|
});
|
|
224
|
-
case
|
|
224
|
+
case 4:
|
|
225
225
|
extracted = _context3.sent;
|
|
226
226
|
return _context3.abrupt("return", (0, _defineProperty2.default)({}, field.name, fieldSerializer(extracted)));
|
|
227
|
-
case
|
|
227
|
+
case 5:
|
|
228
228
|
case "end":
|
|
229
229
|
return _context3.stop();
|
|
230
230
|
}
|
|
231
|
-
}, _callee3, null, [[0,
|
|
231
|
+
}, _callee3, null, [[0, 1]]);
|
|
232
232
|
}));
|
|
233
233
|
return function serializeFieldset(_x5, _x6, _x7, _x8) {
|
|
234
234
|
return _ref3.apply(this, arguments);
|
|
@@ -237,15 +237,15 @@ var serializeFieldset = /*#__PURE__*/function () {
|
|
|
237
237
|
var serializeExpandField = /*#__PURE__*/function () {
|
|
238
238
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(manifest, field, data) {
|
|
239
239
|
var expandData, value, results, fieldName;
|
|
240
|
-
return _regenerator.default.wrap(function
|
|
240
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
241
241
|
while (1) switch (_context4.prev = _context4.next) {
|
|
242
242
|
case 0:
|
|
243
243
|
expandData = field.hasGroupedValues ? data[field.name] || {} : data;
|
|
244
|
-
_context4.next =
|
|
244
|
+
_context4.next = 1;
|
|
245
245
|
return serialize(manifest, expandData, field.fields, {
|
|
246
246
|
parentType: 'expand'
|
|
247
247
|
});
|
|
248
|
-
case
|
|
248
|
+
case 1:
|
|
249
249
|
value = _context4.sent;
|
|
250
250
|
results = [];
|
|
251
251
|
if (!field.hasGroupedValues) {
|
|
@@ -257,7 +257,7 @@ var serializeExpandField = /*#__PURE__*/function () {
|
|
|
257
257
|
results.push((0, _defineProperty2.default)({}, field.name, value));
|
|
258
258
|
}
|
|
259
259
|
return _context4.abrupt("return", results);
|
|
260
|
-
case
|
|
260
|
+
case 2:
|
|
261
261
|
case "end":
|
|
262
262
|
return _context4.stop();
|
|
263
263
|
}
|
|
@@ -270,17 +270,17 @@ var serializeExpandField = /*#__PURE__*/function () {
|
|
|
270
270
|
var resolveTabValues = /*#__PURE__*/function () {
|
|
271
271
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(manifest, tabField, groupData) {
|
|
272
272
|
var tabFieldParams;
|
|
273
|
-
return _regenerator.default.wrap(function
|
|
273
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
274
274
|
while (1) switch (_context5.prev = _context5.next) {
|
|
275
275
|
case 0:
|
|
276
276
|
tabFieldParams = tabField.hasGroupedValues ? groupData[tabField.name] || {} : groupData;
|
|
277
|
-
_context5.next =
|
|
277
|
+
_context5.next = 1;
|
|
278
278
|
return serialize(manifest, tabFieldParams, tabField.fields, {
|
|
279
279
|
parentType: 'tab'
|
|
280
280
|
});
|
|
281
|
-
case
|
|
281
|
+
case 1:
|
|
282
282
|
return _context5.abrupt("return", _context5.sent);
|
|
283
|
-
case
|
|
283
|
+
case 2:
|
|
284
284
|
case "end":
|
|
285
285
|
return _context5.stop();
|
|
286
286
|
}
|
|
@@ -293,22 +293,22 @@ var resolveTabValues = /*#__PURE__*/function () {
|
|
|
293
293
|
var serializeTabGroupField = /*#__PURE__*/function () {
|
|
294
294
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(manifest, field, data) {
|
|
295
295
|
var tabs, results, value, i, tabField, tabFieldParameters, fieldName, _fieldName;
|
|
296
|
-
return _regenerator.default.wrap(function
|
|
296
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
297
297
|
while (1) switch (_context6.prev = _context6.next) {
|
|
298
298
|
case 0:
|
|
299
299
|
tabs = field.fields;
|
|
300
300
|
results = [];
|
|
301
301
|
value = {};
|
|
302
302
|
i = 0;
|
|
303
|
-
case
|
|
303
|
+
case 1:
|
|
304
304
|
if (!(i < tabs.length)) {
|
|
305
|
-
_context6.next =
|
|
305
|
+
_context6.next = 4;
|
|
306
306
|
break;
|
|
307
307
|
}
|
|
308
308
|
tabField = tabs[i];
|
|
309
|
-
_context6.next =
|
|
309
|
+
_context6.next = 2;
|
|
310
310
|
return resolveTabValues(manifest, tabField, field.hasGroupedValues ? data[field.name] || {} : data);
|
|
311
|
-
case
|
|
311
|
+
case 2:
|
|
312
312
|
tabFieldParameters = _context6.sent;
|
|
313
313
|
if (tabField.hasGroupedValues) {
|
|
314
314
|
// Keep namespaced by tab
|
|
@@ -320,11 +320,11 @@ var serializeTabGroupField = /*#__PURE__*/function () {
|
|
|
320
320
|
value[fieldName] = tabFieldParameters[fieldName];
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
case
|
|
323
|
+
case 3:
|
|
324
324
|
i++;
|
|
325
|
-
_context6.next =
|
|
325
|
+
_context6.next = 1;
|
|
326
326
|
break;
|
|
327
|
-
case
|
|
327
|
+
case 4:
|
|
328
328
|
// Now for tabGroup...
|
|
329
329
|
if (field.hasGroupedValues) {
|
|
330
330
|
results.push((0, _defineProperty2.default)({}, field.name, value));
|
|
@@ -335,7 +335,7 @@ var serializeTabGroupField = /*#__PURE__*/function () {
|
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
return _context6.abrupt("return", results);
|
|
338
|
-
case
|
|
338
|
+
case 5:
|
|
339
339
|
case "end":
|
|
340
340
|
return _context6.stop();
|
|
341
341
|
}
|
|
@@ -348,14 +348,14 @@ var serializeTabGroupField = /*#__PURE__*/function () {
|
|
|
348
348
|
var serializeTabField = /*#__PURE__*/function () {
|
|
349
349
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(manifest, field, data) {
|
|
350
350
|
var results, tabField, tabFieldParameters, fieldName;
|
|
351
|
-
return _regenerator.default.wrap(function
|
|
351
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
352
352
|
while (1) switch (_context7.prev = _context7.next) {
|
|
353
353
|
case 0:
|
|
354
354
|
results = [];
|
|
355
355
|
tabField = field;
|
|
356
|
-
_context7.next =
|
|
356
|
+
_context7.next = 1;
|
|
357
357
|
return resolveTabValues(manifest, tabField, data);
|
|
358
|
-
case
|
|
358
|
+
case 1:
|
|
359
359
|
tabFieldParameters = _context7.sent;
|
|
360
360
|
if (tabField.hasGroupedValues) {
|
|
361
361
|
// Keep namespaced by tab
|
|
@@ -368,7 +368,7 @@ var serializeTabField = /*#__PURE__*/function () {
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
return _context7.abrupt("return", results);
|
|
371
|
-
case
|
|
371
|
+
case 2:
|
|
372
372
|
case "end":
|
|
373
373
|
return _context7.stop();
|
|
374
374
|
}
|
|
@@ -489,8 +489,9 @@ var _deserialize = exports.deserialize = /*#__PURE__*/function () {
|
|
|
489
489
|
_step2,
|
|
490
490
|
_loop2,
|
|
491
491
|
_ret,
|
|
492
|
-
_args9 = arguments
|
|
493
|
-
|
|
492
|
+
_args9 = arguments,
|
|
493
|
+
_t3;
|
|
494
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
494
495
|
while (1) switch (_context9.prev = _context9.next) {
|
|
495
496
|
case 0:
|
|
496
497
|
depth = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : 0;
|
|
@@ -499,10 +500,10 @@ var _deserialize = exports.deserialize = /*#__PURE__*/function () {
|
|
|
499
500
|
errors = [];
|
|
500
501
|
flattenedFields = flattenFields(fields);
|
|
501
502
|
_iterator2 = _createForOfIteratorHelper(dataArray);
|
|
502
|
-
_context9.prev =
|
|
503
|
+
_context9.prev = 1;
|
|
503
504
|
_loop2 = /*#__PURE__*/_regenerator.default.mark(function _loop2() {
|
|
504
|
-
var item, _Object$entries$, name, originalValue, field, value, fieldDeserializer;
|
|
505
|
-
return _regenerator.default.wrap(function
|
|
505
|
+
var item, _Object$entries$, name, originalValue, field, value, fieldDeserializer, _t2;
|
|
506
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
506
507
|
while (1) switch (_context8.prev = _context8.next) {
|
|
507
508
|
case 0:
|
|
508
509
|
item = _step2.value;
|
|
@@ -511,88 +512,88 @@ var _deserialize = exports.deserialize = /*#__PURE__*/function () {
|
|
|
511
512
|
return field.name === (0, _utils.getNameFromDuplicateField)(name);
|
|
512
513
|
});
|
|
513
514
|
if (!(field === undefined)) {
|
|
514
|
-
_context8.next =
|
|
515
|
+
_context8.next = 1;
|
|
515
516
|
break;
|
|
516
517
|
}
|
|
517
518
|
return _context8.abrupt("return", 0);
|
|
518
|
-
case
|
|
519
|
+
case 1:
|
|
519
520
|
value = extract(originalValue, field);
|
|
520
521
|
if (!(value === undefined)) {
|
|
521
|
-
_context8.next =
|
|
522
|
+
_context8.next = 2;
|
|
522
523
|
break;
|
|
523
524
|
}
|
|
524
525
|
return _context8.abrupt("return", 0);
|
|
525
|
-
case
|
|
526
|
+
case 2:
|
|
526
527
|
if (!((0, _extensions.isFieldset)(field) && depth === 0)) {
|
|
527
|
-
_context8.next =
|
|
528
|
+
_context8.next = 7;
|
|
528
529
|
break;
|
|
529
530
|
}
|
|
530
531
|
fieldDeserializer = (0, _extensions.getFieldDeserializer)(manifest, field.options.transformer);
|
|
531
532
|
if (!fieldDeserializer) {
|
|
532
|
-
_context8.next =
|
|
533
|
+
_context8.next = 7;
|
|
533
534
|
break;
|
|
534
535
|
}
|
|
535
|
-
_context8.prev =
|
|
536
|
+
_context8.prev = 3;
|
|
536
537
|
value = fieldDeserializer(value);
|
|
537
|
-
_context8.next =
|
|
538
|
+
_context8.next = 5;
|
|
538
539
|
break;
|
|
539
|
-
case
|
|
540
|
-
_context8.prev =
|
|
541
|
-
|
|
542
|
-
errors.push((0, _defineProperty2.default)({}, name,
|
|
540
|
+
case 4:
|
|
541
|
+
_context8.prev = 4;
|
|
542
|
+
_t2 = _context8["catch"](3);
|
|
543
|
+
errors.push((0, _defineProperty2.default)({}, name, _t2 instanceof Error ? _t2.message : String(_t2)));
|
|
543
544
|
return _context8.abrupt("return", 0);
|
|
544
|
-
case
|
|
545
|
-
_context8.next =
|
|
545
|
+
case 5:
|
|
546
|
+
_context8.next = 6;
|
|
546
547
|
return _deserialize(manifest, value, field.fields, depth + 1);
|
|
547
|
-
case
|
|
548
|
+
case 6:
|
|
548
549
|
value = _context8.sent;
|
|
549
|
-
case
|
|
550
|
+
case 7:
|
|
550
551
|
result.push((0, _defineProperty2.default)({}, name, value));
|
|
551
|
-
case
|
|
552
|
+
case 8:
|
|
552
553
|
case "end":
|
|
553
554
|
return _context8.stop();
|
|
554
555
|
}
|
|
555
|
-
}, _loop2, null, [[
|
|
556
|
+
}, _loop2, null, [[3, 4]]);
|
|
556
557
|
});
|
|
557
558
|
_iterator2.s();
|
|
558
|
-
case
|
|
559
|
+
case 2:
|
|
559
560
|
if ((_step2 = _iterator2.n()).done) {
|
|
560
|
-
_context9.next =
|
|
561
|
+
_context9.next = 5;
|
|
561
562
|
break;
|
|
562
563
|
}
|
|
563
|
-
return _context9.delegateYield(_loop2(), "t0",
|
|
564
|
-
case
|
|
564
|
+
return _context9.delegateYield(_loop2(), "t0", 3);
|
|
565
|
+
case 3:
|
|
565
566
|
_ret = _context9.t0;
|
|
566
567
|
if (!(_ret === 0)) {
|
|
567
|
-
_context9.next =
|
|
568
|
+
_context9.next = 4;
|
|
568
569
|
break;
|
|
569
570
|
}
|
|
570
|
-
return _context9.abrupt("continue",
|
|
571
|
-
case
|
|
572
|
-
_context9.next =
|
|
571
|
+
return _context9.abrupt("continue", 4);
|
|
572
|
+
case 4:
|
|
573
|
+
_context9.next = 2;
|
|
573
574
|
break;
|
|
574
|
-
case
|
|
575
|
-
_context9.next =
|
|
575
|
+
case 5:
|
|
576
|
+
_context9.next = 7;
|
|
576
577
|
break;
|
|
577
|
-
case
|
|
578
|
-
_context9.prev =
|
|
579
|
-
|
|
580
|
-
_iterator2.e(
|
|
581
|
-
case
|
|
582
|
-
_context9.prev =
|
|
578
|
+
case 6:
|
|
579
|
+
_context9.prev = 6;
|
|
580
|
+
_t3 = _context9["catch"](1);
|
|
581
|
+
_iterator2.e(_t3);
|
|
582
|
+
case 7:
|
|
583
|
+
_context9.prev = 7;
|
|
583
584
|
_iterator2.f();
|
|
584
|
-
return _context9.finish(
|
|
585
|
-
case
|
|
585
|
+
return _context9.finish(7);
|
|
586
|
+
case 8:
|
|
586
587
|
result = convertToParametersObject(result);
|
|
587
588
|
if (errors.length > 0) {
|
|
588
589
|
result.errors = convertToParametersObject(errors);
|
|
589
590
|
}
|
|
590
591
|
return _context9.abrupt("return", injectDefaultValues(result, flattenedFields));
|
|
591
|
-
case
|
|
592
|
+
case 9:
|
|
592
593
|
case "end":
|
|
593
594
|
return _context9.stop();
|
|
594
595
|
}
|
|
595
|
-
}, _callee8, null, [[
|
|
596
|
+
}, _callee8, null, [[1, 6, 7, 8]]);
|
|
596
597
|
}));
|
|
597
598
|
return function deserialize(_x19, _x20, _x21) {
|
|
598
599
|
return _ref9.apply(this, arguments);
|
|
@@ -99,17 +99,17 @@ var getContextPanel = exports.getContextPanel = function getContextPanel(getEdit
|
|
|
99
99
|
,
|
|
100
100
|
onChange: ( /*#__PURE__*/function () {
|
|
101
101
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(updatedParameters) {
|
|
102
|
-
return _regenerator.default.wrap(function
|
|
102
|
+
return _regenerator.default.wrap(function (_context) {
|
|
103
103
|
while (1) switch (_context.prev = _context.next) {
|
|
104
104
|
case 0:
|
|
105
|
-
_context.next =
|
|
105
|
+
_context.next = 1;
|
|
106
106
|
return onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
|
|
107
|
-
case
|
|
107
|
+
case 1:
|
|
108
108
|
onSaveEnded();
|
|
109
109
|
if (autoSaveResolve) {
|
|
110
110
|
autoSaveResolve();
|
|
111
111
|
}
|
|
112
|
-
case
|
|
112
|
+
case 2:
|
|
113
113
|
case "end":
|
|
114
114
|
return _context.stop();
|
|
115
115
|
}
|
|
@@ -122,30 +122,31 @@ var getContextPanel = exports.getContextPanel = function getContextPanel(getEdit
|
|
|
122
122
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
123
123
|
,
|
|
124
124
|
onCancel: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
125
|
-
|
|
125
|
+
var _t;
|
|
126
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
126
127
|
while (1) switch (_context2.prev = _context2.next) {
|
|
127
128
|
case 0:
|
|
128
129
|
_context2.prev = 0;
|
|
129
|
-
_context2.next =
|
|
130
|
+
_context2.next = 1;
|
|
130
131
|
return new Promise(function (resolve, reject) {
|
|
131
132
|
(0, _commands.forceAutoSave)(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
132
133
|
});
|
|
133
|
-
case
|
|
134
|
-
_context2.next =
|
|
134
|
+
case 1:
|
|
135
|
+
_context2.next = 3;
|
|
135
136
|
break;
|
|
136
|
-
case
|
|
137
|
-
_context2.prev =
|
|
138
|
-
|
|
137
|
+
case 2:
|
|
138
|
+
_context2.prev = 2;
|
|
139
|
+
_t = _context2["catch"](0);
|
|
139
140
|
// Even if the save failed, we should proceed with closing the panel
|
|
140
141
|
// eslint-disable-next-line no-console
|
|
141
|
-
console.error("Autosave failed with error",
|
|
142
|
-
case
|
|
142
|
+
console.error("Autosave failed with error", _t);
|
|
143
|
+
case 3:
|
|
143
144
|
(0, _commands.clearEditingContext)(applyChange)(editorView.state, editorView.dispatch);
|
|
144
|
-
case
|
|
145
|
+
case 4:
|
|
145
146
|
case "end":
|
|
146
147
|
return _context2.stop();
|
|
147
148
|
}
|
|
148
|
-
}, _callee2, null, [[0,
|
|
149
|
+
}, _callee2, null, [[0, 2]]);
|
|
149
150
|
})),
|
|
150
151
|
featureFlags: featureFlags
|
|
151
152
|
});
|
|
@@ -183,7 +184,7 @@ function _onChangeAction() {
|
|
|
183
184
|
selection,
|
|
184
185
|
positionsLess,
|
|
185
186
|
_args3 = arguments;
|
|
186
|
-
return _regenerator.default.wrap(function
|
|
187
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
187
188
|
while (1) switch (_context3.prev = _context3.next) {
|
|
188
189
|
case 0:
|
|
189
190
|
updatedParameters = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
@@ -193,55 +194,55 @@ function _onChangeAction() {
|
|
|
193
194
|
// WARNING: editorView.state stales quickly, do not unpack
|
|
194
195
|
_ref4 = (0, _pluginFactory.getPluginState)(editorView.state), processParametersAfter = _ref4.processParametersAfter, processParametersBefore = _ref4.processParametersBefore;
|
|
195
196
|
if (processParametersAfter) {
|
|
196
|
-
_context3.next =
|
|
197
|
+
_context3.next = 1;
|
|
197
198
|
break;
|
|
198
199
|
}
|
|
199
200
|
return _context3.abrupt("return");
|
|
200
|
-
case
|
|
201
|
+
case 1:
|
|
201
202
|
unwrappedOldParameters = processParametersBefore ? processParametersBefore(oldParameters) : oldParameters;
|
|
202
203
|
if (!areParametersEqual(unwrappedOldParameters, updatedParameters)) {
|
|
203
|
-
_context3.next =
|
|
204
|
+
_context3.next = 2;
|
|
204
205
|
break;
|
|
205
206
|
}
|
|
206
207
|
return _context3.abrupt("return");
|
|
207
|
-
case
|
|
208
|
+
case 2:
|
|
208
209
|
if (onSaving) {
|
|
209
210
|
onSaving();
|
|
210
211
|
}
|
|
211
212
|
key = Date.now();
|
|
212
213
|
_ref5 = (0, _pluginFactory.getPluginState)(editorView.state), previousPositions = _ref5.positions;
|
|
213
|
-
_context3.next =
|
|
214
|
+
_context3.next = 3;
|
|
214
215
|
return (0, _commands.updateState)({
|
|
215
216
|
positions: _objectSpread(_objectSpread({}, previousPositions), {}, (0, _defineProperty2.default)({}, key, nodeWithPos.pos))
|
|
216
217
|
})(editorView.state, editorView.dispatch);
|
|
217
|
-
case
|
|
218
|
-
_context3.next =
|
|
218
|
+
case 3:
|
|
219
|
+
_context3.next = 4;
|
|
219
220
|
return processParametersAfter(updatedParameters);
|
|
220
|
-
case
|
|
221
|
+
case 4:
|
|
221
222
|
newParameters = _context3.sent;
|
|
222
223
|
_ref6 = (0, _pluginFactory.getPluginState)(editorView.state), positions = _ref6.positions;
|
|
223
224
|
if (positions) {
|
|
224
|
-
_context3.next =
|
|
225
|
+
_context3.next = 5;
|
|
225
226
|
break;
|
|
226
227
|
}
|
|
227
228
|
return _context3.abrupt("return");
|
|
228
|
-
case
|
|
229
|
+
case 5:
|
|
229
230
|
if (key in positions) {
|
|
230
|
-
_context3.next =
|
|
231
|
+
_context3.next = 6;
|
|
231
232
|
break;
|
|
232
233
|
}
|
|
233
234
|
return _context3.abrupt("return");
|
|
234
|
-
case
|
|
235
|
+
case 6:
|
|
235
236
|
node = nodeWithPos.node;
|
|
236
237
|
newNode = (0, _actions.buildExtensionNode)(nodeWithPos.node.toJSON().type, editorView.state.schema, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
237
238
|
parameters: _objectSpread(_objectSpread({}, oldParameters), newParameters)
|
|
238
239
|
}), node.content, node.marks);
|
|
239
240
|
if (newNode) {
|
|
240
|
-
_context3.next =
|
|
241
|
+
_context3.next = 7;
|
|
241
242
|
break;
|
|
242
243
|
}
|
|
243
244
|
return _context3.abrupt("return");
|
|
244
|
-
case
|
|
245
|
+
case 7:
|
|
245
246
|
positionUpdated = positions[key];
|
|
246
247
|
transaction = editorView.state.tr.replaceWith(positionUpdated, positionUpdated + newNode.nodeSize, newNode); // Ensure we preserve the selection, tr.replaceWith causes it to be lost in some cases
|
|
247
248
|
// when replacing the node
|
|
@@ -254,13 +255,13 @@ function _onChangeAction() {
|
|
|
254
255
|
}
|
|
255
256
|
positionsLess = _objectSpread({}, (0, _pluginFactory.getPluginState)(editorView.state).positions);
|
|
256
257
|
delete positionsLess[key];
|
|
257
|
-
_context3.next =
|
|
258
|
+
_context3.next = 8;
|
|
258
259
|
return (0, _commands.updateState)({
|
|
259
260
|
positions: positionsLess
|
|
260
261
|
})(editorView.state, editorView.dispatch);
|
|
261
|
-
case
|
|
262
|
+
case 8:
|
|
262
263
|
editorView.dispatch(transaction);
|
|
263
|
-
case
|
|
264
|
+
case 9:
|
|
264
265
|
case "end":
|
|
265
266
|
return _context3.stop();
|
|
266
267
|
}
|