@atlaskit/editor-plugin-extension 13.5.7 → 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 +14 -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 +7 -7
|
@@ -70,7 +70,7 @@ export var serialize = /*#__PURE__*/function () {
|
|
|
70
70
|
parameters,
|
|
71
71
|
hasDuplicateFields,
|
|
72
72
|
_args2 = arguments;
|
|
73
|
-
return _regeneratorRuntime.wrap(function
|
|
73
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
74
74
|
while (1) switch (_context2.prev = _context2.next) {
|
|
75
75
|
case 0:
|
|
76
76
|
options = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : {};
|
|
@@ -80,66 +80,66 @@ export var serialize = /*#__PURE__*/function () {
|
|
|
80
80
|
fillResults = flattenedFields.map( /*#__PURE__*/function () {
|
|
81
81
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(field) {
|
|
82
82
|
var tabGroupData, tabData, expandData, fieldsetData, value;
|
|
83
|
-
return _regeneratorRuntime.wrap(function
|
|
83
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
84
84
|
while (1) switch (_context.prev = _context.next) {
|
|
85
85
|
case 0:
|
|
86
86
|
if (!isTabGroup(field)) {
|
|
87
|
-
_context.next =
|
|
87
|
+
_context.next = 2;
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
|
-
_context.next =
|
|
90
|
+
_context.next = 1;
|
|
91
91
|
return serializeTabGroupField(manifest, field, data);
|
|
92
|
-
case
|
|
92
|
+
case 1:
|
|
93
93
|
tabGroupData = _context.sent;
|
|
94
94
|
result.push.apply(result, _toConsumableArray(tabGroupData));
|
|
95
|
-
_context.next =
|
|
95
|
+
_context.next = 9;
|
|
96
96
|
break;
|
|
97
|
-
case
|
|
97
|
+
case 2:
|
|
98
98
|
if (!isTabField(field)) {
|
|
99
|
-
_context.next =
|
|
99
|
+
_context.next = 4;
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
|
-
_context.next =
|
|
102
|
+
_context.next = 3;
|
|
103
103
|
return serializeTabField(manifest, field, data);
|
|
104
|
-
case
|
|
104
|
+
case 3:
|
|
105
105
|
tabData = _context.sent;
|
|
106
106
|
result.push.apply(result, _toConsumableArray(tabData));
|
|
107
|
-
_context.next =
|
|
107
|
+
_context.next = 9;
|
|
108
108
|
break;
|
|
109
|
-
case
|
|
109
|
+
case 4:
|
|
110
110
|
if (!isExpand(field)) {
|
|
111
|
-
_context.next =
|
|
111
|
+
_context.next = 6;
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
-
_context.next =
|
|
114
|
+
_context.next = 5;
|
|
115
115
|
return serializeExpandField(manifest, field, data);
|
|
116
|
-
case
|
|
116
|
+
case 5:
|
|
117
117
|
expandData = _context.sent;
|
|
118
118
|
result.push.apply(result, _toConsumableArray(expandData));
|
|
119
|
-
_context.next =
|
|
119
|
+
_context.next = 9;
|
|
120
120
|
break;
|
|
121
|
-
case
|
|
121
|
+
case 6:
|
|
122
122
|
if (!(isFieldset(field) && depth === 0)) {
|
|
123
|
-
_context.next =
|
|
123
|
+
_context.next = 8;
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
|
-
_context.next =
|
|
126
|
+
_context.next = 7;
|
|
127
127
|
return serializeFieldset(manifest, field, data, depth);
|
|
128
|
-
case
|
|
128
|
+
case 7:
|
|
129
129
|
fieldsetData = _context.sent;
|
|
130
130
|
if (fieldsetData) {
|
|
131
131
|
result.push(fieldsetData);
|
|
132
132
|
}
|
|
133
|
-
_context.next =
|
|
133
|
+
_context.next = 9;
|
|
134
134
|
break;
|
|
135
|
-
case
|
|
135
|
+
case 8:
|
|
136
136
|
value = extract(data[field.name], field, {
|
|
137
137
|
useDefaultValue: true
|
|
138
138
|
}); // ignore undefined values
|
|
139
139
|
if (value !== undefined) {
|
|
140
140
|
result.push(_defineProperty({}, field.name, value));
|
|
141
141
|
}
|
|
142
|
-
case
|
|
142
|
+
case 9:
|
|
143
143
|
case "end":
|
|
144
144
|
return _context.stop();
|
|
145
145
|
}
|
|
@@ -149,9 +149,9 @@ export var serialize = /*#__PURE__*/function () {
|
|
|
149
149
|
return _ref2.apply(this, arguments);
|
|
150
150
|
};
|
|
151
151
|
}());
|
|
152
|
-
_context2.next =
|
|
152
|
+
_context2.next = 1;
|
|
153
153
|
return Promise.all(fillResults);
|
|
154
|
-
case
|
|
154
|
+
case 1:
|
|
155
155
|
// Crunch fields down to parameters
|
|
156
156
|
parameters = result.reduce(function (obj, current) {
|
|
157
157
|
// eslint-disable-next-line guard-for-in
|
|
@@ -164,13 +164,13 @@ export var serialize = /*#__PURE__*/function () {
|
|
|
164
164
|
return field.allowDuplicates;
|
|
165
165
|
});
|
|
166
166
|
if (!hasDuplicateFields) {
|
|
167
|
-
_context2.next =
|
|
167
|
+
_context2.next = 2;
|
|
168
168
|
break;
|
|
169
169
|
}
|
|
170
170
|
return _context2.abrupt("return", serializeMergeDuplicateFieldData(parameters, data, flattenedFields));
|
|
171
|
-
case
|
|
171
|
+
case 2:
|
|
172
172
|
return _context2.abrupt("return", parameters);
|
|
173
|
-
case
|
|
173
|
+
case 3:
|
|
174
174
|
case "end":
|
|
175
175
|
return _context2.stop();
|
|
176
176
|
}
|
|
@@ -182,46 +182,46 @@ export var serialize = /*#__PURE__*/function () {
|
|
|
182
182
|
}();
|
|
183
183
|
var serializeFieldset = /*#__PURE__*/function () {
|
|
184
184
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(manifest, field, data, depth) {
|
|
185
|
-
var fieldSerializer, fieldsetFields, fieldParams, extracted;
|
|
186
|
-
return _regeneratorRuntime.wrap(function
|
|
185
|
+
var fieldSerializer, fieldsetFields, fieldParams, extracted, _t;
|
|
186
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
187
187
|
while (1) switch (_context3.prev = _context3.next) {
|
|
188
188
|
case 0:
|
|
189
189
|
_context3.prev = 0;
|
|
190
190
|
fieldSerializer = getFieldSerializer(manifest, field.options.transformer);
|
|
191
|
-
_context3.next =
|
|
191
|
+
_context3.next = 2;
|
|
192
192
|
break;
|
|
193
|
-
case
|
|
194
|
-
_context3.prev =
|
|
195
|
-
|
|
193
|
+
case 1:
|
|
194
|
+
_context3.prev = 1;
|
|
195
|
+
_t = _context3["catch"](0);
|
|
196
196
|
if (!(data[field.name] !== undefined)) {
|
|
197
|
-
_context3.next =
|
|
197
|
+
_context3.next = 2;
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
200
|
-
throw
|
|
201
|
-
case
|
|
200
|
+
throw _t;
|
|
201
|
+
case 2:
|
|
202
202
|
if (fieldSerializer) {
|
|
203
|
-
_context3.next =
|
|
203
|
+
_context3.next = 3;
|
|
204
204
|
break;
|
|
205
205
|
}
|
|
206
206
|
return _context3.abrupt("return");
|
|
207
|
-
case
|
|
207
|
+
case 3:
|
|
208
208
|
fieldsetFields = field.fields;
|
|
209
209
|
fieldParams = extract(data[field.name], field, {
|
|
210
210
|
useDefaultValue: true
|
|
211
211
|
}) || {};
|
|
212
|
-
_context3.next =
|
|
212
|
+
_context3.next = 4;
|
|
213
213
|
return serialize(manifest, fieldParams, fieldsetFields, {
|
|
214
214
|
depth: depth + 1,
|
|
215
215
|
parentType: 'fieldset'
|
|
216
216
|
});
|
|
217
|
-
case
|
|
217
|
+
case 4:
|
|
218
218
|
extracted = _context3.sent;
|
|
219
219
|
return _context3.abrupt("return", _defineProperty({}, field.name, fieldSerializer(extracted)));
|
|
220
|
-
case
|
|
220
|
+
case 5:
|
|
221
221
|
case "end":
|
|
222
222
|
return _context3.stop();
|
|
223
223
|
}
|
|
224
|
-
}, _callee3, null, [[0,
|
|
224
|
+
}, _callee3, null, [[0, 1]]);
|
|
225
225
|
}));
|
|
226
226
|
return function serializeFieldset(_x5, _x6, _x7, _x8) {
|
|
227
227
|
return _ref3.apply(this, arguments);
|
|
@@ -230,15 +230,15 @@ var serializeFieldset = /*#__PURE__*/function () {
|
|
|
230
230
|
var serializeExpandField = /*#__PURE__*/function () {
|
|
231
231
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(manifest, field, data) {
|
|
232
232
|
var expandData, value, results, fieldName;
|
|
233
|
-
return _regeneratorRuntime.wrap(function
|
|
233
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
234
234
|
while (1) switch (_context4.prev = _context4.next) {
|
|
235
235
|
case 0:
|
|
236
236
|
expandData = field.hasGroupedValues ? data[field.name] || {} : data;
|
|
237
|
-
_context4.next =
|
|
237
|
+
_context4.next = 1;
|
|
238
238
|
return serialize(manifest, expandData, field.fields, {
|
|
239
239
|
parentType: 'expand'
|
|
240
240
|
});
|
|
241
|
-
case
|
|
241
|
+
case 1:
|
|
242
242
|
value = _context4.sent;
|
|
243
243
|
results = [];
|
|
244
244
|
if (!field.hasGroupedValues) {
|
|
@@ -250,7 +250,7 @@ var serializeExpandField = /*#__PURE__*/function () {
|
|
|
250
250
|
results.push(_defineProperty({}, field.name, value));
|
|
251
251
|
}
|
|
252
252
|
return _context4.abrupt("return", results);
|
|
253
|
-
case
|
|
253
|
+
case 2:
|
|
254
254
|
case "end":
|
|
255
255
|
return _context4.stop();
|
|
256
256
|
}
|
|
@@ -263,17 +263,17 @@ var serializeExpandField = /*#__PURE__*/function () {
|
|
|
263
263
|
var resolveTabValues = /*#__PURE__*/function () {
|
|
264
264
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(manifest, tabField, groupData) {
|
|
265
265
|
var tabFieldParams;
|
|
266
|
-
return _regeneratorRuntime.wrap(function
|
|
266
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
267
267
|
while (1) switch (_context5.prev = _context5.next) {
|
|
268
268
|
case 0:
|
|
269
269
|
tabFieldParams = tabField.hasGroupedValues ? groupData[tabField.name] || {} : groupData;
|
|
270
|
-
_context5.next =
|
|
270
|
+
_context5.next = 1;
|
|
271
271
|
return serialize(manifest, tabFieldParams, tabField.fields, {
|
|
272
272
|
parentType: 'tab'
|
|
273
273
|
});
|
|
274
|
-
case
|
|
274
|
+
case 1:
|
|
275
275
|
return _context5.abrupt("return", _context5.sent);
|
|
276
|
-
case
|
|
276
|
+
case 2:
|
|
277
277
|
case "end":
|
|
278
278
|
return _context5.stop();
|
|
279
279
|
}
|
|
@@ -286,22 +286,22 @@ var resolveTabValues = /*#__PURE__*/function () {
|
|
|
286
286
|
var serializeTabGroupField = /*#__PURE__*/function () {
|
|
287
287
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(manifest, field, data) {
|
|
288
288
|
var tabs, results, value, i, tabField, tabFieldParameters, fieldName, _fieldName;
|
|
289
|
-
return _regeneratorRuntime.wrap(function
|
|
289
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
290
290
|
while (1) switch (_context6.prev = _context6.next) {
|
|
291
291
|
case 0:
|
|
292
292
|
tabs = field.fields;
|
|
293
293
|
results = [];
|
|
294
294
|
value = {};
|
|
295
295
|
i = 0;
|
|
296
|
-
case
|
|
296
|
+
case 1:
|
|
297
297
|
if (!(i < tabs.length)) {
|
|
298
|
-
_context6.next =
|
|
298
|
+
_context6.next = 4;
|
|
299
299
|
break;
|
|
300
300
|
}
|
|
301
301
|
tabField = tabs[i];
|
|
302
|
-
_context6.next =
|
|
302
|
+
_context6.next = 2;
|
|
303
303
|
return resolveTabValues(manifest, tabField, field.hasGroupedValues ? data[field.name] || {} : data);
|
|
304
|
-
case
|
|
304
|
+
case 2:
|
|
305
305
|
tabFieldParameters = _context6.sent;
|
|
306
306
|
if (tabField.hasGroupedValues) {
|
|
307
307
|
// Keep namespaced by tab
|
|
@@ -313,11 +313,11 @@ var serializeTabGroupField = /*#__PURE__*/function () {
|
|
|
313
313
|
value[fieldName] = tabFieldParameters[fieldName];
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
case
|
|
316
|
+
case 3:
|
|
317
317
|
i++;
|
|
318
|
-
_context6.next =
|
|
318
|
+
_context6.next = 1;
|
|
319
319
|
break;
|
|
320
|
-
case
|
|
320
|
+
case 4:
|
|
321
321
|
// Now for tabGroup...
|
|
322
322
|
if (field.hasGroupedValues) {
|
|
323
323
|
results.push(_defineProperty({}, field.name, value));
|
|
@@ -328,7 +328,7 @@ var serializeTabGroupField = /*#__PURE__*/function () {
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
return _context6.abrupt("return", results);
|
|
331
|
-
case
|
|
331
|
+
case 5:
|
|
332
332
|
case "end":
|
|
333
333
|
return _context6.stop();
|
|
334
334
|
}
|
|
@@ -341,14 +341,14 @@ var serializeTabGroupField = /*#__PURE__*/function () {
|
|
|
341
341
|
var serializeTabField = /*#__PURE__*/function () {
|
|
342
342
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(manifest, field, data) {
|
|
343
343
|
var results, tabField, tabFieldParameters, fieldName;
|
|
344
|
-
return _regeneratorRuntime.wrap(function
|
|
344
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
345
345
|
while (1) switch (_context7.prev = _context7.next) {
|
|
346
346
|
case 0:
|
|
347
347
|
results = [];
|
|
348
348
|
tabField = field;
|
|
349
|
-
_context7.next =
|
|
349
|
+
_context7.next = 1;
|
|
350
350
|
return resolveTabValues(manifest, tabField, data);
|
|
351
|
-
case
|
|
351
|
+
case 1:
|
|
352
352
|
tabFieldParameters = _context7.sent;
|
|
353
353
|
if (tabField.hasGroupedValues) {
|
|
354
354
|
// Keep namespaced by tab
|
|
@@ -361,7 +361,7 @@ var serializeTabField = /*#__PURE__*/function () {
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
return _context7.abrupt("return", results);
|
|
364
|
-
case
|
|
364
|
+
case 2:
|
|
365
365
|
case "end":
|
|
366
366
|
return _context7.stop();
|
|
367
367
|
}
|
|
@@ -482,8 +482,9 @@ var _deserialize = /*#__PURE__*/function () {
|
|
|
482
482
|
_step2,
|
|
483
483
|
_loop2,
|
|
484
484
|
_ret,
|
|
485
|
-
_args9 = arguments
|
|
486
|
-
|
|
485
|
+
_args9 = arguments,
|
|
486
|
+
_t3;
|
|
487
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
487
488
|
while (1) switch (_context9.prev = _context9.next) {
|
|
488
489
|
case 0:
|
|
489
490
|
depth = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : 0;
|
|
@@ -492,10 +493,10 @@ var _deserialize = /*#__PURE__*/function () {
|
|
|
492
493
|
errors = [];
|
|
493
494
|
flattenedFields = flattenFields(fields);
|
|
494
495
|
_iterator2 = _createForOfIteratorHelper(dataArray);
|
|
495
|
-
_context9.prev =
|
|
496
|
+
_context9.prev = 1;
|
|
496
497
|
_loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
|
|
497
|
-
var item, _Object$entries$, name, originalValue, field, value, fieldDeserializer;
|
|
498
|
-
return _regeneratorRuntime.wrap(function
|
|
498
|
+
var item, _Object$entries$, name, originalValue, field, value, fieldDeserializer, _t2;
|
|
499
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
499
500
|
while (1) switch (_context8.prev = _context8.next) {
|
|
500
501
|
case 0:
|
|
501
502
|
item = _step2.value;
|
|
@@ -504,88 +505,88 @@ var _deserialize = /*#__PURE__*/function () {
|
|
|
504
505
|
return field.name === getNameFromDuplicateField(name);
|
|
505
506
|
});
|
|
506
507
|
if (!(field === undefined)) {
|
|
507
|
-
_context8.next =
|
|
508
|
+
_context8.next = 1;
|
|
508
509
|
break;
|
|
509
510
|
}
|
|
510
511
|
return _context8.abrupt("return", 0);
|
|
511
|
-
case
|
|
512
|
+
case 1:
|
|
512
513
|
value = extract(originalValue, field);
|
|
513
514
|
if (!(value === undefined)) {
|
|
514
|
-
_context8.next =
|
|
515
|
+
_context8.next = 2;
|
|
515
516
|
break;
|
|
516
517
|
}
|
|
517
518
|
return _context8.abrupt("return", 0);
|
|
518
|
-
case
|
|
519
|
+
case 2:
|
|
519
520
|
if (!(isFieldset(field) && depth === 0)) {
|
|
520
|
-
_context8.next =
|
|
521
|
+
_context8.next = 7;
|
|
521
522
|
break;
|
|
522
523
|
}
|
|
523
524
|
fieldDeserializer = getFieldDeserializer(manifest, field.options.transformer);
|
|
524
525
|
if (!fieldDeserializer) {
|
|
525
|
-
_context8.next =
|
|
526
|
+
_context8.next = 7;
|
|
526
527
|
break;
|
|
527
528
|
}
|
|
528
|
-
_context8.prev =
|
|
529
|
+
_context8.prev = 3;
|
|
529
530
|
value = fieldDeserializer(value);
|
|
530
|
-
_context8.next =
|
|
531
|
+
_context8.next = 5;
|
|
531
532
|
break;
|
|
532
|
-
case
|
|
533
|
-
_context8.prev =
|
|
534
|
-
|
|
535
|
-
errors.push(_defineProperty({}, name,
|
|
533
|
+
case 4:
|
|
534
|
+
_context8.prev = 4;
|
|
535
|
+
_t2 = _context8["catch"](3);
|
|
536
|
+
errors.push(_defineProperty({}, name, _t2 instanceof Error ? _t2.message : String(_t2)));
|
|
536
537
|
return _context8.abrupt("return", 0);
|
|
537
|
-
case
|
|
538
|
-
_context8.next =
|
|
538
|
+
case 5:
|
|
539
|
+
_context8.next = 6;
|
|
539
540
|
return _deserialize(manifest, value, field.fields, depth + 1);
|
|
540
|
-
case
|
|
541
|
+
case 6:
|
|
541
542
|
value = _context8.sent;
|
|
542
|
-
case
|
|
543
|
+
case 7:
|
|
543
544
|
result.push(_defineProperty({}, name, value));
|
|
544
|
-
case
|
|
545
|
+
case 8:
|
|
545
546
|
case "end":
|
|
546
547
|
return _context8.stop();
|
|
547
548
|
}
|
|
548
|
-
}, _loop2, null, [[
|
|
549
|
+
}, _loop2, null, [[3, 4]]);
|
|
549
550
|
});
|
|
550
551
|
_iterator2.s();
|
|
551
|
-
case
|
|
552
|
+
case 2:
|
|
552
553
|
if ((_step2 = _iterator2.n()).done) {
|
|
553
|
-
_context9.next =
|
|
554
|
+
_context9.next = 5;
|
|
554
555
|
break;
|
|
555
556
|
}
|
|
556
|
-
return _context9.delegateYield(_loop2(), "t0",
|
|
557
|
-
case
|
|
557
|
+
return _context9.delegateYield(_loop2(), "t0", 3);
|
|
558
|
+
case 3:
|
|
558
559
|
_ret = _context9.t0;
|
|
559
560
|
if (!(_ret === 0)) {
|
|
560
|
-
_context9.next =
|
|
561
|
+
_context9.next = 4;
|
|
561
562
|
break;
|
|
562
563
|
}
|
|
563
|
-
return _context9.abrupt("continue",
|
|
564
|
-
case
|
|
565
|
-
_context9.next =
|
|
564
|
+
return _context9.abrupt("continue", 4);
|
|
565
|
+
case 4:
|
|
566
|
+
_context9.next = 2;
|
|
566
567
|
break;
|
|
567
|
-
case
|
|
568
|
-
_context9.next =
|
|
568
|
+
case 5:
|
|
569
|
+
_context9.next = 7;
|
|
569
570
|
break;
|
|
570
|
-
case
|
|
571
|
-
_context9.prev =
|
|
572
|
-
|
|
573
|
-
_iterator2.e(
|
|
574
|
-
case
|
|
575
|
-
_context9.prev =
|
|
571
|
+
case 6:
|
|
572
|
+
_context9.prev = 6;
|
|
573
|
+
_t3 = _context9["catch"](1);
|
|
574
|
+
_iterator2.e(_t3);
|
|
575
|
+
case 7:
|
|
576
|
+
_context9.prev = 7;
|
|
576
577
|
_iterator2.f();
|
|
577
|
-
return _context9.finish(
|
|
578
|
-
case
|
|
578
|
+
return _context9.finish(7);
|
|
579
|
+
case 8:
|
|
579
580
|
result = convertToParametersObject(result);
|
|
580
581
|
if (errors.length > 0) {
|
|
581
582
|
result.errors = convertToParametersObject(errors);
|
|
582
583
|
}
|
|
583
584
|
return _context9.abrupt("return", injectDefaultValues(result, flattenedFields));
|
|
584
|
-
case
|
|
585
|
+
case 9:
|
|
585
586
|
case "end":
|
|
586
587
|
return _context9.stop();
|
|
587
588
|
}
|
|
588
|
-
}, _callee8, null, [[
|
|
589
|
+
}, _callee8, null, [[1, 6, 7, 8]]);
|
|
589
590
|
}));
|
|
590
591
|
return function deserialize(_x19, _x20, _x21) {
|
|
591
592
|
return _ref9.apply(this, arguments);
|
|
@@ -91,17 +91,17 @@ export var getContextPanel = function getContextPanel(getEditorView) {
|
|
|
91
91
|
,
|
|
92
92
|
onChange: ( /*#__PURE__*/function () {
|
|
93
93
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(updatedParameters) {
|
|
94
|
-
return _regeneratorRuntime.wrap(function
|
|
94
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
95
95
|
while (1) switch (_context.prev = _context.next) {
|
|
96
96
|
case 0:
|
|
97
|
-
_context.next =
|
|
97
|
+
_context.next = 1;
|
|
98
98
|
return onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
|
|
99
|
-
case
|
|
99
|
+
case 1:
|
|
100
100
|
onSaveEnded();
|
|
101
101
|
if (autoSaveResolve) {
|
|
102
102
|
autoSaveResolve();
|
|
103
103
|
}
|
|
104
|
-
case
|
|
104
|
+
case 2:
|
|
105
105
|
case "end":
|
|
106
106
|
return _context.stop();
|
|
107
107
|
}
|
|
@@ -114,30 +114,31 @@ export var getContextPanel = function getContextPanel(getEditorView) {
|
|
|
114
114
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
115
115
|
,
|
|
116
116
|
onCancel: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
117
|
-
|
|
117
|
+
var _t;
|
|
118
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
118
119
|
while (1) switch (_context2.prev = _context2.next) {
|
|
119
120
|
case 0:
|
|
120
121
|
_context2.prev = 0;
|
|
121
|
-
_context2.next =
|
|
122
|
+
_context2.next = 1;
|
|
122
123
|
return new Promise(function (resolve, reject) {
|
|
123
124
|
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
124
125
|
});
|
|
125
|
-
case
|
|
126
|
-
_context2.next =
|
|
126
|
+
case 1:
|
|
127
|
+
_context2.next = 3;
|
|
127
128
|
break;
|
|
128
|
-
case
|
|
129
|
-
_context2.prev =
|
|
130
|
-
|
|
129
|
+
case 2:
|
|
130
|
+
_context2.prev = 2;
|
|
131
|
+
_t = _context2["catch"](0);
|
|
131
132
|
// Even if the save failed, we should proceed with closing the panel
|
|
132
133
|
// eslint-disable-next-line no-console
|
|
133
|
-
console.error("Autosave failed with error",
|
|
134
|
-
case
|
|
134
|
+
console.error("Autosave failed with error", _t);
|
|
135
|
+
case 3:
|
|
135
136
|
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
136
|
-
case
|
|
137
|
+
case 4:
|
|
137
138
|
case "end":
|
|
138
139
|
return _context2.stop();
|
|
139
140
|
}
|
|
140
|
-
}, _callee2, null, [[0,
|
|
141
|
+
}, _callee2, null, [[0, 2]]);
|
|
141
142
|
})),
|
|
142
143
|
featureFlags: featureFlags
|
|
143
144
|
});
|
|
@@ -176,7 +177,7 @@ function _onChangeAction() {
|
|
|
176
177
|
selection,
|
|
177
178
|
positionsLess,
|
|
178
179
|
_args3 = arguments;
|
|
179
|
-
return _regeneratorRuntime.wrap(function
|
|
180
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
180
181
|
while (1) switch (_context3.prev = _context3.next) {
|
|
181
182
|
case 0:
|
|
182
183
|
updatedParameters = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
@@ -186,55 +187,55 @@ function _onChangeAction() {
|
|
|
186
187
|
// WARNING: editorView.state stales quickly, do not unpack
|
|
187
188
|
_ref4 = getPluginState(editorView.state), processParametersAfter = _ref4.processParametersAfter, processParametersBefore = _ref4.processParametersBefore;
|
|
188
189
|
if (processParametersAfter) {
|
|
189
|
-
_context3.next =
|
|
190
|
+
_context3.next = 1;
|
|
190
191
|
break;
|
|
191
192
|
}
|
|
192
193
|
return _context3.abrupt("return");
|
|
193
|
-
case
|
|
194
|
+
case 1:
|
|
194
195
|
unwrappedOldParameters = processParametersBefore ? processParametersBefore(oldParameters) : oldParameters;
|
|
195
196
|
if (!areParametersEqual(unwrappedOldParameters, updatedParameters)) {
|
|
196
|
-
_context3.next =
|
|
197
|
+
_context3.next = 2;
|
|
197
198
|
break;
|
|
198
199
|
}
|
|
199
200
|
return _context3.abrupt("return");
|
|
200
|
-
case
|
|
201
|
+
case 2:
|
|
201
202
|
if (onSaving) {
|
|
202
203
|
onSaving();
|
|
203
204
|
}
|
|
204
205
|
key = Date.now();
|
|
205
206
|
_ref5 = getPluginState(editorView.state), previousPositions = _ref5.positions;
|
|
206
|
-
_context3.next =
|
|
207
|
+
_context3.next = 3;
|
|
207
208
|
return updateState({
|
|
208
209
|
positions: _objectSpread(_objectSpread({}, previousPositions), {}, _defineProperty({}, key, nodeWithPos.pos))
|
|
209
210
|
})(editorView.state, editorView.dispatch);
|
|
210
|
-
case
|
|
211
|
-
_context3.next =
|
|
211
|
+
case 3:
|
|
212
|
+
_context3.next = 4;
|
|
212
213
|
return processParametersAfter(updatedParameters);
|
|
213
|
-
case
|
|
214
|
+
case 4:
|
|
214
215
|
newParameters = _context3.sent;
|
|
215
216
|
_ref6 = getPluginState(editorView.state), positions = _ref6.positions;
|
|
216
217
|
if (positions) {
|
|
217
|
-
_context3.next =
|
|
218
|
+
_context3.next = 5;
|
|
218
219
|
break;
|
|
219
220
|
}
|
|
220
221
|
return _context3.abrupt("return");
|
|
221
|
-
case
|
|
222
|
+
case 5:
|
|
222
223
|
if (key in positions) {
|
|
223
|
-
_context3.next =
|
|
224
|
+
_context3.next = 6;
|
|
224
225
|
break;
|
|
225
226
|
}
|
|
226
227
|
return _context3.abrupt("return");
|
|
227
|
-
case
|
|
228
|
+
case 6:
|
|
228
229
|
node = nodeWithPos.node;
|
|
229
230
|
newNode = buildExtensionNode(nodeWithPos.node.toJSON().type, editorView.state.schema, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
230
231
|
parameters: _objectSpread(_objectSpread({}, oldParameters), newParameters)
|
|
231
232
|
}), node.content, node.marks);
|
|
232
233
|
if (newNode) {
|
|
233
|
-
_context3.next =
|
|
234
|
+
_context3.next = 7;
|
|
234
235
|
break;
|
|
235
236
|
}
|
|
236
237
|
return _context3.abrupt("return");
|
|
237
|
-
case
|
|
238
|
+
case 7:
|
|
238
239
|
positionUpdated = positions[key];
|
|
239
240
|
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
|
|
240
241
|
// when replacing the node
|
|
@@ -247,13 +248,13 @@ function _onChangeAction() {
|
|
|
247
248
|
}
|
|
248
249
|
positionsLess = _objectSpread({}, getPluginState(editorView.state).positions);
|
|
249
250
|
delete positionsLess[key];
|
|
250
|
-
_context3.next =
|
|
251
|
+
_context3.next = 8;
|
|
251
252
|
return updateState({
|
|
252
253
|
positions: positionsLess
|
|
253
254
|
})(editorView.state, editorView.dispatch);
|
|
254
|
-
case
|
|
255
|
+
case 8:
|
|
255
256
|
editorView.dispatch(transaction);
|
|
256
|
-
case
|
|
257
|
+
case 9:
|
|
257
258
|
case "end":
|
|
258
259
|
return _context3.stop();
|
|
259
260
|
}
|