@contentful/field-editor-rich-text 2.0.0-next.19 → 2.0.0-next.21
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/dist/field-editor-rich-text.cjs.development.js +1058 -971
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +1060 -973
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +2 -2
- package/dist/plugins/Break/createResetNodePlugin.d.ts +2 -0
- package/dist/plugins/Break/index.d.ts +2 -0
- package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +9 -0
- package/dist/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +5 -0
- package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +9 -0
- package/dist/plugins/Hyperlink/components/styles.d.ts +4 -0
- package/dist/plugins/Hyperlink/createHyperlinkPlugin.d.ts +3 -0
- package/dist/plugins/Hyperlink/index.d.ts +2 -8
- package/dist/plugins/Hyperlink/useEntityInfo.d.ts +16 -0
- package/dist/plugins/Hyperlink/utils.d.ts +2 -0
- package/dist/plugins/List/transforms/deleteBackwardList.d.ts +2 -0
- package/dist/plugins/List/transforms/unwrapList.d.ts +5 -0
- package/dist/plugins/Quote/shouldResetQuote.d.ts +8 -0
- package/dist/plugins/Quote/toggleQuote.d.ts +2 -2
- package/dist/plugins/Quote/withQuote.d.ts +3 -0
- package/dist/types.d.ts +5 -1
- package/package.json +2 -1
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -9
- package/dist/plugins/Hyperlink/truncate.d.ts +0 -1
|
@@ -15,6 +15,7 @@ var deepEquals = _interopDefault(require('fast-deep-equal'));
|
|
|
15
15
|
var noop = _interopDefault(require('lodash/noop'));
|
|
16
16
|
var plateSerializerDocx = require('@udecode/plate-serializer-docx');
|
|
17
17
|
var plateBreak = require('@udecode/plate-break');
|
|
18
|
+
var plateResetNode = require('@udecode/plate-reset-node');
|
|
18
19
|
var isHotkey = _interopDefault(require('is-hotkey'));
|
|
19
20
|
var slate = require('slate');
|
|
20
21
|
var Slate = require('slate-react');
|
|
@@ -27,7 +28,6 @@ var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
|
27
28
|
var find = _interopDefault(require('lodash/find'));
|
|
28
29
|
var flow = _interopDefault(require('lodash/flow'));
|
|
29
30
|
var plateList = require('@udecode/plate-list');
|
|
30
|
-
var plateResetNode = require('@udecode/plate-reset-node');
|
|
31
31
|
var plateBasicMarks = require('@udecode/plate-basic-marks');
|
|
32
32
|
var isPlainObject = _interopDefault(require('is-plain-obj'));
|
|
33
33
|
var plateParagraph = require('@udecode/plate-paragraph');
|
|
@@ -314,6 +314,33 @@ var createExitBreakPlugin = function createExitBreakPlugin() {
|
|
|
314
314
|
});
|
|
315
315
|
};
|
|
316
316
|
|
|
317
|
+
var createResetNodePlugin = function createResetNodePlugin() {
|
|
318
|
+
return plateResetNode.createResetNodePlugin({
|
|
319
|
+
options: {
|
|
320
|
+
rules: []
|
|
321
|
+
},
|
|
322
|
+
then: function then(editor) {
|
|
323
|
+
var rules = editor.plugins.flatMap(function (p) {
|
|
324
|
+
return p.resetNode || [];
|
|
325
|
+
}); // set defaultType to Paragraph if not set
|
|
326
|
+
|
|
327
|
+
for (var _iterator = _createForOfIteratorHelperLoose(rules), _step; !(_step = _iterator()).done;) {
|
|
328
|
+
var rule = _step.value;
|
|
329
|
+
|
|
330
|
+
if (!rule.defaultType) {
|
|
331
|
+
rule.defaultType = Contentful.BLOCKS.PARAGRAPH;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
options: {
|
|
337
|
+
rules: rules
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
|
|
317
344
|
function createDragAndDropPlugin() {
|
|
318
345
|
var DRAGGABLE_TYPES = [Contentful.BLOCKS.EMBEDDED_ENTRY, Contentful.BLOCKS.EMBEDDED_ASSET, Contentful.BLOCKS.HR, Contentful.INLINES.EMBEDDED_ENTRY];
|
|
319
346
|
/**
|
|
@@ -1093,201 +1120,197 @@ function createCommonjsModule(fn, module) {
|
|
|
1093
1120
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1094
1121
|
}
|
|
1095
1122
|
|
|
1096
|
-
var runtime_1 = createCommonjsModule(function (module) {
|
|
1097
|
-
/**
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1123
|
+
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
1124
|
+
/**
|
|
1125
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
1126
|
+
*
|
|
1127
|
+
* This source code is licensed under the MIT license found in the
|
|
1128
|
+
* LICENSE file in the root directory of this source tree.
|
|
1129
|
+
*/
|
|
1130
|
+
var runtime = function (exports) {
|
|
1131
|
+
|
|
1132
|
+
var Op = Object.prototype;
|
|
1133
|
+
var hasOwn = Op.hasOwnProperty;
|
|
1134
|
+
var undefined$1; // More compressible than void 0.
|
|
1135
|
+
|
|
1136
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
1137
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
1138
|
+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
1139
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1140
|
+
|
|
1141
|
+
function define(obj, key, value) {
|
|
1142
|
+
Object.defineProperty(obj, key, {
|
|
1143
|
+
value: value,
|
|
1144
|
+
enumerable: true,
|
|
1145
|
+
configurable: true,
|
|
1146
|
+
writable: true
|
|
1147
|
+
});
|
|
1148
|
+
return obj[key];
|
|
1149
|
+
}
|
|
1103
1150
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1113
|
-
|
|
1114
|
-
function define(obj, key, value) {
|
|
1115
|
-
Object.defineProperty(obj, key, {
|
|
1116
|
-
value: value,
|
|
1117
|
-
enumerable: true,
|
|
1118
|
-
configurable: true,
|
|
1119
|
-
writable: true
|
|
1120
|
-
});
|
|
1121
|
-
return obj[key];
|
|
1122
|
-
}
|
|
1123
|
-
try {
|
|
1124
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
1125
|
-
define({}, "");
|
|
1126
|
-
} catch (err) {
|
|
1127
|
-
define = function(obj, key, value) {
|
|
1128
|
-
return obj[key] = value;
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1151
|
+
try {
|
|
1152
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
1153
|
+
define({}, "");
|
|
1154
|
+
} catch (err) {
|
|
1155
|
+
define = function define(obj, key, value) {
|
|
1156
|
+
return obj[key] = value;
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1131
1159
|
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1160
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1161
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
1162
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
1163
|
+
var generator = Object.create(protoGenerator.prototype);
|
|
1164
|
+
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
1165
|
+
// .throw, and .return methods.
|
|
1137
1166
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1167
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
1168
|
+
return generator;
|
|
1169
|
+
}
|
|
1141
1170
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1171
|
+
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
1172
|
+
// record like context.tryEntries[i].completion. This interface could
|
|
1173
|
+
// have been (and was previously) designed to take a closure to be
|
|
1174
|
+
// invoked without arguments, but in all the cases we care about we
|
|
1175
|
+
// already have an existing method we want to call, so there's no need
|
|
1176
|
+
// to create a new function object. We can even get away with assuming
|
|
1177
|
+
// the method takes exactly one argument, since that happens to be true
|
|
1178
|
+
// in every case, so we don't have to touch the arguments object. The
|
|
1179
|
+
// only additional allocation required is the completion record, which
|
|
1180
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
|
1181
|
+
|
|
1182
|
+
function tryCatch(fn, obj, arg) {
|
|
1183
|
+
try {
|
|
1184
|
+
return {
|
|
1185
|
+
type: "normal",
|
|
1186
|
+
arg: fn.call(obj, arg)
|
|
1187
|
+
};
|
|
1188
|
+
} catch (err) {
|
|
1189
|
+
return {
|
|
1190
|
+
type: "throw",
|
|
1191
|
+
arg: err
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1161
1194
|
}
|
|
1162
|
-
}
|
|
1163
1195
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
// Returning this object from the innerFn has the same effect as
|
|
1170
|
-
// breaking out of the dispatch switch statement.
|
|
1171
|
-
var ContinueSentinel = {};
|
|
1172
|
-
|
|
1173
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
1174
|
-
// .constructor.prototype properties for functions that return Generator
|
|
1175
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
1176
|
-
// minifier not to mangle the names of these two functions.
|
|
1177
|
-
function Generator() {}
|
|
1178
|
-
function GeneratorFunction() {}
|
|
1179
|
-
function GeneratorFunctionPrototype() {}
|
|
1180
|
-
|
|
1181
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
1182
|
-
// don't natively support it.
|
|
1183
|
-
var IteratorPrototype = {};
|
|
1184
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1185
|
-
return this;
|
|
1186
|
-
});
|
|
1196
|
+
var GenStateSuspendedStart = "suspendedStart";
|
|
1197
|
+
var GenStateSuspendedYield = "suspendedYield";
|
|
1198
|
+
var GenStateExecuting = "executing";
|
|
1199
|
+
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
1200
|
+
// breaking out of the dispatch switch statement.
|
|
1187
1201
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
1193
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
1194
|
-
// of the polyfill.
|
|
1195
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
1196
|
-
}
|
|
1202
|
+
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
1203
|
+
// .constructor.prototype properties for functions that return Generator
|
|
1204
|
+
// objects. For full spec compliance, you may wish to configure your
|
|
1205
|
+
// minifier not to mangle the names of these two functions.
|
|
1197
1206
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
// Helper for defining the .next, .throw, and .return methods of the
|
|
1210
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
1211
|
-
function defineIteratorMethods(prototype) {
|
|
1212
|
-
["next", "throw", "return"].forEach(function(method) {
|
|
1213
|
-
define(prototype, method, function(arg) {
|
|
1214
|
-
return this._invoke(method, arg);
|
|
1215
|
-
});
|
|
1207
|
+
function Generator() {}
|
|
1208
|
+
|
|
1209
|
+
function GeneratorFunction() {}
|
|
1210
|
+
|
|
1211
|
+
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
1212
|
+
// don't natively support it.
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
var IteratorPrototype = {};
|
|
1216
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1217
|
+
return this;
|
|
1216
1218
|
});
|
|
1217
|
-
|
|
1219
|
+
var getProto = Object.getPrototypeOf;
|
|
1220
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1218
1221
|
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
// do is to check its .name property.
|
|
1225
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
1226
|
-
: false;
|
|
1227
|
-
};
|
|
1222
|
+
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
1223
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
|
1224
|
+
// of the polyfill.
|
|
1225
|
+
IteratorPrototype = NativeIteratorPrototype;
|
|
1226
|
+
}
|
|
1228
1227
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1228
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1229
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
1230
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
1231
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
1232
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
1233
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
1234
|
+
|
|
1235
|
+
function defineIteratorMethods(prototype) {
|
|
1236
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
1237
|
+
define(prototype, method, function (arg) {
|
|
1238
|
+
return this._invoke(method, arg);
|
|
1239
|
+
});
|
|
1240
|
+
});
|
|
1235
1241
|
}
|
|
1236
|
-
genFun.prototype = Object.create(Gp);
|
|
1237
|
-
return genFun;
|
|
1238
|
-
};
|
|
1239
1242
|
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
};
|
|
1243
|
+
exports.isGeneratorFunction = function (genFun) {
|
|
1244
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
1245
|
+
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
1246
|
+
// do is to check its .name property.
|
|
1247
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
1248
|
+
};
|
|
1247
1249
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
if (record.type === "throw") {
|
|
1252
|
-
reject(record.arg);
|
|
1250
|
+
exports.mark = function (genFun) {
|
|
1251
|
+
if (Object.setPrototypeOf) {
|
|
1252
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
1253
1253
|
} else {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1254
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
1255
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
genFun.prototype = Object.create(Gp);
|
|
1259
|
+
return genFun;
|
|
1260
|
+
}; // Within the body of any async function, `await x` is transformed to
|
|
1261
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
1262
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
1263
|
+
// meant to be awaited.
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
exports.awrap = function (arg) {
|
|
1267
|
+
return {
|
|
1268
|
+
__await: arg
|
|
1269
|
+
};
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
1273
|
+
function invoke(method, arg, resolve, reject) {
|
|
1274
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
1275
|
+
|
|
1276
|
+
if (record.type === "throw") {
|
|
1277
|
+
reject(record.arg);
|
|
1278
|
+
} else {
|
|
1279
|
+
var result = record.arg;
|
|
1280
|
+
var value = result.value;
|
|
1281
|
+
|
|
1282
|
+
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
1283
|
+
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1284
|
+
invoke("next", value, resolve, reject);
|
|
1285
|
+
}, function (err) {
|
|
1286
|
+
invoke("throw", err, resolve, reject);
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1291
|
+
// When a yielded Promise is resolved, its final value becomes
|
|
1292
|
+
// the .value of the Promise<{value,done}> result for the
|
|
1293
|
+
// current iteration.
|
|
1294
|
+
result.value = unwrapped;
|
|
1295
|
+
resolve(result);
|
|
1296
|
+
}, function (error) {
|
|
1297
|
+
// If a rejected Promise was yielded, throw the rejection back
|
|
1298
|
+
// into the async generator function so it can be handled there.
|
|
1299
|
+
return invoke("throw", error, resolve, reject);
|
|
1263
1300
|
});
|
|
1264
1301
|
}
|
|
1265
|
-
|
|
1266
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
1267
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
1268
|
-
// the .value of the Promise<{value,done}> result for the
|
|
1269
|
-
// current iteration.
|
|
1270
|
-
result.value = unwrapped;
|
|
1271
|
-
resolve(result);
|
|
1272
|
-
}, function(error) {
|
|
1273
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
1274
|
-
// into the async generator function so it can be handled there.
|
|
1275
|
-
return invoke("throw", error, resolve, reject);
|
|
1276
|
-
});
|
|
1277
1302
|
}
|
|
1278
|
-
}
|
|
1279
1303
|
|
|
1280
|
-
|
|
1304
|
+
var previousPromise;
|
|
1281
1305
|
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1306
|
+
function enqueue(method, arg) {
|
|
1307
|
+
function callInvokeWithMethodAndArg() {
|
|
1308
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
1309
|
+
invoke(method, arg, resolve, reject);
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1288
1312
|
|
|
1289
|
-
|
|
1290
|
-
// If enqueue has been called before, then we want to wait until
|
|
1313
|
+
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
1291
1314
|
// all previous Promises have been resolved before calling invoke,
|
|
1292
1315
|
// so that results are always delivered in the correct order. If
|
|
1293
1316
|
// enqueue has not been called before, then it is important to
|
|
@@ -1299,554 +1322,527 @@ var runtime = (function (exports) {
|
|
|
1299
1322
|
// execute code before the first await. Since we implement simple
|
|
1300
1323
|
// async functions in terms of async generators, it is especially
|
|
1301
1324
|
// important to get this right, even though it requires care.
|
|
1302
|
-
previousPromise ? previousPromise.then(
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1325
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
1326
|
+
// invocations of the iterator.
|
|
1327
|
+
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1328
|
+
} // Define the unified helper method that is used to implement .next,
|
|
1329
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
this._invoke = enqueue;
|
|
1308
1333
|
}
|
|
1309
1334
|
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1335
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
1336
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1337
|
+
return this;
|
|
1338
|
+
});
|
|
1339
|
+
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
1340
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
|
1341
|
+
// the final result produced by the iterator.
|
|
1342
|
+
|
|
1343
|
+
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1344
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
1345
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1346
|
+
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
1347
|
+
: iter.next().then(function (result) {
|
|
1348
|
+
return result.done ? result.value : iter.next();
|
|
1349
|
+
});
|
|
1350
|
+
};
|
|
1314
1351
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
// Note that simple async functions are implemented on top of
|
|
1322
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
1323
|
-
// the final result produced by the iterator.
|
|
1324
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1325
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
1326
|
-
|
|
1327
|
-
var iter = new AsyncIterator(
|
|
1328
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
1329
|
-
PromiseImpl
|
|
1330
|
-
);
|
|
1331
|
-
|
|
1332
|
-
return exports.isGeneratorFunction(outerFn)
|
|
1333
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
1334
|
-
: iter.next().then(function(result) {
|
|
1335
|
-
return result.done ? result.value : iter.next();
|
|
1336
|
-
});
|
|
1337
|
-
};
|
|
1352
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
1353
|
+
var state = GenStateSuspendedStart;
|
|
1354
|
+
return function invoke(method, arg) {
|
|
1355
|
+
if (state === GenStateExecuting) {
|
|
1356
|
+
throw new Error("Generator is already running");
|
|
1357
|
+
}
|
|
1338
1358
|
|
|
1339
|
-
|
|
1340
|
-
|
|
1359
|
+
if (state === GenStateCompleted) {
|
|
1360
|
+
if (method === "throw") {
|
|
1361
|
+
throw arg;
|
|
1362
|
+
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
1363
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
1341
1364
|
|
|
1342
|
-
return function invoke(method, arg) {
|
|
1343
|
-
if (state === GenStateExecuting) {
|
|
1344
|
-
throw new Error("Generator is already running");
|
|
1345
|
-
}
|
|
1346
1365
|
|
|
1347
|
-
|
|
1348
|
-
if (method === "throw") {
|
|
1349
|
-
throw arg;
|
|
1366
|
+
return doneResult();
|
|
1350
1367
|
}
|
|
1351
1368
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1369
|
+
context.method = method;
|
|
1370
|
+
context.arg = arg;
|
|
1371
|
+
|
|
1372
|
+
while (true) {
|
|
1373
|
+
var delegate = context.delegate;
|
|
1356
1374
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1375
|
+
if (delegate) {
|
|
1376
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1359
1377
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
if (delegateResult) {
|
|
1365
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
1366
|
-
return delegateResult;
|
|
1378
|
+
if (delegateResult) {
|
|
1379
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
1380
|
+
return delegateResult;
|
|
1381
|
+
}
|
|
1367
1382
|
}
|
|
1368
|
-
}
|
|
1369
1383
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1384
|
+
if (context.method === "next") {
|
|
1385
|
+
// Setting context._sent for legacy support of Babel's
|
|
1386
|
+
// function.sent implementation.
|
|
1387
|
+
context.sent = context._sent = context.arg;
|
|
1388
|
+
} else if (context.method === "throw") {
|
|
1389
|
+
if (state === GenStateSuspendedStart) {
|
|
1390
|
+
state = GenStateCompleted;
|
|
1391
|
+
throw context.arg;
|
|
1392
|
+
}
|
|
1374
1393
|
|
|
1375
|
-
|
|
1376
|
-
if (
|
|
1377
|
-
|
|
1378
|
-
throw context.arg;
|
|
1394
|
+
context.dispatchException(context.arg);
|
|
1395
|
+
} else if (context.method === "return") {
|
|
1396
|
+
context.abrupt("return", context.arg);
|
|
1379
1397
|
}
|
|
1380
1398
|
|
|
1381
|
-
|
|
1399
|
+
state = GenStateExecuting;
|
|
1400
|
+
var record = tryCatch(innerFn, self, context);
|
|
1382
1401
|
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1402
|
+
if (record.type === "normal") {
|
|
1403
|
+
// If an exception is thrown from innerFn, we leave state ===
|
|
1404
|
+
// GenStateExecuting and loop back for another invocation.
|
|
1405
|
+
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
1386
1406
|
|
|
1387
|
-
|
|
1407
|
+
if (record.arg === ContinueSentinel) {
|
|
1408
|
+
continue;
|
|
1409
|
+
}
|
|
1388
1410
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1411
|
+
return {
|
|
1412
|
+
value: record.arg,
|
|
1413
|
+
done: context.done
|
|
1414
|
+
};
|
|
1415
|
+
} else if (record.type === "throw") {
|
|
1416
|
+
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
1417
|
+
// context.dispatchException(context.arg) call above.
|
|
1396
1418
|
|
|
1397
|
-
|
|
1398
|
-
|
|
1419
|
+
context.method = "throw";
|
|
1420
|
+
context.arg = record.arg;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
1425
|
+
// result, either by returning a { value, done } result from the
|
|
1426
|
+
// delegate iterator, or by modifying context.method and context.arg,
|
|
1427
|
+
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
1431
|
+
var method = delegate.iterator[context.method];
|
|
1432
|
+
|
|
1433
|
+
if (method === undefined$1) {
|
|
1434
|
+
// A .throw or .return when the delegate iterator has no .throw
|
|
1435
|
+
// method always terminates the yield* loop.
|
|
1436
|
+
context.delegate = null;
|
|
1437
|
+
|
|
1438
|
+
if (context.method === "throw") {
|
|
1439
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
1440
|
+
if (delegate.iterator["return"]) {
|
|
1441
|
+
// If the delegate iterator has a return method, give it a
|
|
1442
|
+
// chance to clean up.
|
|
1443
|
+
context.method = "return";
|
|
1444
|
+
context.arg = undefined$1;
|
|
1445
|
+
maybeInvokeDelegate(delegate, context);
|
|
1446
|
+
|
|
1447
|
+
if (context.method === "throw") {
|
|
1448
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
1449
|
+
// "return" to "throw", let that override the TypeError below.
|
|
1450
|
+
return ContinueSentinel;
|
|
1451
|
+
}
|
|
1399
1452
|
}
|
|
1400
1453
|
|
|
1401
|
-
return {
|
|
1402
|
-
value: record.arg,
|
|
1403
|
-
done: context.done
|
|
1404
|
-
};
|
|
1405
|
-
|
|
1406
|
-
} else if (record.type === "throw") {
|
|
1407
|
-
state = GenStateCompleted;
|
|
1408
|
-
// Dispatch the exception by looping back around to the
|
|
1409
|
-
// context.dispatchException(context.arg) call above.
|
|
1410
1454
|
context.method = "throw";
|
|
1411
|
-
context.arg =
|
|
1455
|
+
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
1412
1456
|
}
|
|
1457
|
+
|
|
1458
|
+
return ContinueSentinel;
|
|
1413
1459
|
}
|
|
1414
|
-
};
|
|
1415
|
-
}
|
|
1416
1460
|
|
|
1417
|
-
|
|
1418
|
-
// result, either by returning a { value, done } result from the
|
|
1419
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
1420
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
1421
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
1422
|
-
var method = delegate.iterator[context.method];
|
|
1423
|
-
if (method === undefined$1) {
|
|
1424
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
1425
|
-
// method always terminates the yield* loop.
|
|
1426
|
-
context.delegate = null;
|
|
1461
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1427
1462
|
|
|
1428
|
-
if (
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
context.arg = undefined$1;
|
|
1435
|
-
maybeInvokeDelegate(delegate, context);
|
|
1463
|
+
if (record.type === "throw") {
|
|
1464
|
+
context.method = "throw";
|
|
1465
|
+
context.arg = record.arg;
|
|
1466
|
+
context.delegate = null;
|
|
1467
|
+
return ContinueSentinel;
|
|
1468
|
+
}
|
|
1436
1469
|
|
|
1437
|
-
|
|
1438
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
1439
|
-
// "return" to "throw", let that override the TypeError below.
|
|
1440
|
-
return ContinueSentinel;
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1470
|
+
var info = record.arg;
|
|
1443
1471
|
|
|
1472
|
+
if (!info) {
|
|
1444
1473
|
context.method = "throw";
|
|
1445
|
-
context.arg = new TypeError(
|
|
1446
|
-
|
|
1474
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
1475
|
+
context.delegate = null;
|
|
1476
|
+
return ContinueSentinel;
|
|
1447
1477
|
}
|
|
1448
1478
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1479
|
+
if (info.done) {
|
|
1480
|
+
// Assign the result of the finished delegate to the temporary
|
|
1481
|
+
// variable specified by delegate.resultName (see delegateYield).
|
|
1482
|
+
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
1451
1483
|
|
|
1452
|
-
|
|
1484
|
+
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
1485
|
+
// exception, let the outer generator proceed normally. If
|
|
1486
|
+
// context.method was "next", forget context.arg since it has been
|
|
1487
|
+
// "consumed" by the delegate iterator. If context.method was
|
|
1488
|
+
// "return", allow the original .return call to continue in the
|
|
1489
|
+
// outer generator.
|
|
1453
1490
|
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1491
|
+
if (context.method !== "return") {
|
|
1492
|
+
context.method = "next";
|
|
1493
|
+
context.arg = undefined$1;
|
|
1494
|
+
}
|
|
1495
|
+
} else {
|
|
1496
|
+
// Re-yield the result returned by the delegate method.
|
|
1497
|
+
return info;
|
|
1498
|
+
} // The delegate iterator is finished, so forget it and continue with
|
|
1499
|
+
// the outer generator.
|
|
1460
1500
|
|
|
1461
|
-
var info = record.arg;
|
|
1462
1501
|
|
|
1463
|
-
if (! info) {
|
|
1464
|
-
context.method = "throw";
|
|
1465
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
1466
1502
|
context.delegate = null;
|
|
1467
1503
|
return ContinueSentinel;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
if (info.done) {
|
|
1471
|
-
// Assign the result of the finished delegate to the temporary
|
|
1472
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
1473
|
-
context[delegate.resultName] = info.value;
|
|
1474
|
-
|
|
1475
|
-
// Resume execution at the desired location (see delegateYield).
|
|
1476
|
-
context.next = delegate.nextLoc;
|
|
1477
|
-
|
|
1478
|
-
// If context.method was "throw" but the delegate handled the
|
|
1479
|
-
// exception, let the outer generator proceed normally. If
|
|
1480
|
-
// context.method was "next", forget context.arg since it has been
|
|
1481
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
1482
|
-
// "return", allow the original .return call to continue in the
|
|
1483
|
-
// outer generator.
|
|
1484
|
-
if (context.method !== "return") {
|
|
1485
|
-
context.method = "next";
|
|
1486
|
-
context.arg = undefined$1;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
} else {
|
|
1490
|
-
// Re-yield the result returned by the delegate method.
|
|
1491
|
-
return info;
|
|
1492
|
-
}
|
|
1504
|
+
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
1505
|
+
// unified ._invoke helper method.
|
|
1493
1506
|
|
|
1494
|
-
// The delegate iterator is finished, so forget it and continue with
|
|
1495
|
-
// the outer generator.
|
|
1496
|
-
context.delegate = null;
|
|
1497
|
-
return ContinueSentinel;
|
|
1498
|
-
}
|
|
1499
1507
|
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1508
|
+
defineIteratorMethods(Gp);
|
|
1509
|
+
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
1510
|
+
// @@iterator function is called on it. Some browsers' implementations of the
|
|
1511
|
+
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
1512
|
+
// object to not be returned from this call. This ensures that doesn't happen.
|
|
1513
|
+
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
1503
1514
|
|
|
1504
|
-
|
|
1515
|
+
define(Gp, iteratorSymbol, function () {
|
|
1516
|
+
return this;
|
|
1517
|
+
});
|
|
1518
|
+
define(Gp, "toString", function () {
|
|
1519
|
+
return "[object Generator]";
|
|
1520
|
+
});
|
|
1505
1521
|
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
1511
|
-
define(Gp, iteratorSymbol, function() {
|
|
1512
|
-
return this;
|
|
1513
|
-
});
|
|
1522
|
+
function pushTryEntry(locs) {
|
|
1523
|
+
var entry = {
|
|
1524
|
+
tryLoc: locs[0]
|
|
1525
|
+
};
|
|
1514
1526
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1527
|
+
if (1 in locs) {
|
|
1528
|
+
entry.catchLoc = locs[1];
|
|
1529
|
+
}
|
|
1518
1530
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1531
|
+
if (2 in locs) {
|
|
1532
|
+
entry.finallyLoc = locs[2];
|
|
1533
|
+
entry.afterLoc = locs[3];
|
|
1534
|
+
}
|
|
1521
1535
|
|
|
1522
|
-
|
|
1523
|
-
entry.catchLoc = locs[1];
|
|
1536
|
+
this.tryEntries.push(entry);
|
|
1524
1537
|
}
|
|
1525
1538
|
|
|
1526
|
-
|
|
1527
|
-
entry.
|
|
1528
|
-
|
|
1539
|
+
function resetTryEntry(entry) {
|
|
1540
|
+
var record = entry.completion || {};
|
|
1541
|
+
record.type = "normal";
|
|
1542
|
+
delete record.arg;
|
|
1543
|
+
entry.completion = record;
|
|
1529
1544
|
}
|
|
1530
1545
|
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
function Context(tryLocsList) {
|
|
1542
|
-
// The root entry object (effectively a try statement without a catch
|
|
1543
|
-
// or a finally block) gives us a place to store values thrown from
|
|
1544
|
-
// locations where there is no enclosing try statement.
|
|
1545
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
1546
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
1547
|
-
this.reset(true);
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
exports.keys = function(object) {
|
|
1551
|
-
var keys = [];
|
|
1552
|
-
for (var key in object) {
|
|
1553
|
-
keys.push(key);
|
|
1546
|
+
function Context(tryLocsList) {
|
|
1547
|
+
// The root entry object (effectively a try statement without a catch
|
|
1548
|
+
// or a finally block) gives us a place to store values thrown from
|
|
1549
|
+
// locations where there is no enclosing try statement.
|
|
1550
|
+
this.tryEntries = [{
|
|
1551
|
+
tryLoc: "root"
|
|
1552
|
+
}];
|
|
1553
|
+
tryLocsList.forEach(pushTryEntry, this);
|
|
1554
|
+
this.reset(true);
|
|
1554
1555
|
}
|
|
1555
|
-
keys.reverse();
|
|
1556
|
-
|
|
1557
|
-
// Rather than returning an object with a next method, we keep
|
|
1558
|
-
// things simple and return the next function itself.
|
|
1559
|
-
return function next() {
|
|
1560
|
-
while (keys.length) {
|
|
1561
|
-
var key = keys.pop();
|
|
1562
|
-
if (key in object) {
|
|
1563
|
-
next.value = key;
|
|
1564
|
-
next.done = false;
|
|
1565
|
-
return next;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
1556
|
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
// also ensures that the minifier will not anonymize the function.
|
|
1572
|
-
next.done = true;
|
|
1573
|
-
return next;
|
|
1574
|
-
};
|
|
1575
|
-
};
|
|
1557
|
+
exports.keys = function (object) {
|
|
1558
|
+
var keys = [];
|
|
1576
1559
|
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
1580
|
-
if (iteratorMethod) {
|
|
1581
|
-
return iteratorMethod.call(iterable);
|
|
1560
|
+
for (var key in object) {
|
|
1561
|
+
keys.push(key);
|
|
1582
1562
|
}
|
|
1583
1563
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
}
|
|
1564
|
+
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
1565
|
+
// things simple and return the next function itself.
|
|
1587
1566
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
if (hasOwn.call(iterable, i)) {
|
|
1592
|
-
next.value = iterable[i];
|
|
1593
|
-
next.done = false;
|
|
1594
|
-
return next;
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1567
|
+
return function next() {
|
|
1568
|
+
while (keys.length) {
|
|
1569
|
+
var key = keys.pop();
|
|
1597
1570
|
|
|
1598
|
-
|
|
1599
|
-
|
|
1571
|
+
if (key in object) {
|
|
1572
|
+
next.value = key;
|
|
1573
|
+
next.done = false;
|
|
1574
|
+
return next;
|
|
1575
|
+
}
|
|
1576
|
+
} // To avoid creating an additional object, we just hang the .value
|
|
1577
|
+
// and .done properties off the next function object itself. This
|
|
1578
|
+
// also ensures that the minifier will not anonymize the function.
|
|
1600
1579
|
|
|
1601
|
-
return next;
|
|
1602
|
-
};
|
|
1603
1580
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1581
|
+
next.done = true;
|
|
1582
|
+
return next;
|
|
1583
|
+
};
|
|
1584
|
+
};
|
|
1607
1585
|
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
exports.values = values;
|
|
1586
|
+
function values(iterable) {
|
|
1587
|
+
if (iterable) {
|
|
1588
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
1612
1589
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1590
|
+
if (iteratorMethod) {
|
|
1591
|
+
return iteratorMethod.call(iterable);
|
|
1592
|
+
}
|
|
1616
1593
|
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
reset: function(skipTempReset) {
|
|
1621
|
-
this.prev = 0;
|
|
1622
|
-
this.next = 0;
|
|
1623
|
-
// Resetting context._sent for legacy support of Babel's
|
|
1624
|
-
// function.sent implementation.
|
|
1625
|
-
this.sent = this._sent = undefined$1;
|
|
1626
|
-
this.done = false;
|
|
1627
|
-
this.delegate = null;
|
|
1628
|
-
|
|
1629
|
-
this.method = "next";
|
|
1630
|
-
this.arg = undefined$1;
|
|
1631
|
-
|
|
1632
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
1633
|
-
|
|
1634
|
-
if (!skipTempReset) {
|
|
1635
|
-
for (var name in this) {
|
|
1636
|
-
// Not sure about the optimal order of these conditions:
|
|
1637
|
-
if (name.charAt(0) === "t" &&
|
|
1638
|
-
hasOwn.call(this, name) &&
|
|
1639
|
-
!isNaN(+name.slice(1))) {
|
|
1640
|
-
this[name] = undefined$1;
|
|
1641
|
-
}
|
|
1594
|
+
if (typeof iterable.next === "function") {
|
|
1595
|
+
return iterable;
|
|
1642
1596
|
}
|
|
1643
|
-
}
|
|
1644
|
-
},
|
|
1645
1597
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1598
|
+
if (!isNaN(iterable.length)) {
|
|
1599
|
+
var i = -1,
|
|
1600
|
+
next = function next() {
|
|
1601
|
+
while (++i < iterable.length) {
|
|
1602
|
+
if (hasOwn.call(iterable, i)) {
|
|
1603
|
+
next.value = iterable[i];
|
|
1604
|
+
next.done = false;
|
|
1605
|
+
return next;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1648
1608
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
}
|
|
1609
|
+
next.value = undefined$1;
|
|
1610
|
+
next.done = true;
|
|
1611
|
+
return next;
|
|
1612
|
+
};
|
|
1654
1613
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1614
|
+
return next.next = next;
|
|
1615
|
+
}
|
|
1616
|
+
} // Return an iterator with no values.
|
|
1657
1617
|
|
|
1658
|
-
dispatchException: function(exception) {
|
|
1659
|
-
if (this.done) {
|
|
1660
|
-
throw exception;
|
|
1661
|
-
}
|
|
1662
1618
|
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
context.next = loc;
|
|
1619
|
+
return {
|
|
1620
|
+
next: doneResult
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1668
1623
|
|
|
1669
|
-
|
|
1670
|
-
// If the dispatched exception was caught by a catch block,
|
|
1671
|
-
// then let that catch block handle the exception normally.
|
|
1672
|
-
context.method = "next";
|
|
1673
|
-
context.arg = undefined$1;
|
|
1674
|
-
}
|
|
1624
|
+
exports.values = values;
|
|
1675
1625
|
|
|
1676
|
-
|
|
1677
|
-
|
|
1626
|
+
function doneResult() {
|
|
1627
|
+
return {
|
|
1628
|
+
value: undefined$1,
|
|
1629
|
+
done: true
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
Context.prototype = {
|
|
1634
|
+
constructor: Context,
|
|
1635
|
+
reset: function reset(skipTempReset) {
|
|
1636
|
+
this.prev = 0;
|
|
1637
|
+
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
1638
|
+
// function.sent implementation.
|
|
1678
1639
|
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1640
|
+
this.sent = this._sent = undefined$1;
|
|
1641
|
+
this.done = false;
|
|
1642
|
+
this.delegate = null;
|
|
1643
|
+
this.method = "next";
|
|
1644
|
+
this.arg = undefined$1;
|
|
1645
|
+
this.tryEntries.forEach(resetTryEntry);
|
|
1682
1646
|
|
|
1683
|
-
if (
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1647
|
+
if (!skipTempReset) {
|
|
1648
|
+
for (var name in this) {
|
|
1649
|
+
// Not sure about the optimal order of these conditions:
|
|
1650
|
+
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
1651
|
+
this[name] = undefined$1;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1688
1654
|
}
|
|
1655
|
+
},
|
|
1656
|
+
stop: function stop() {
|
|
1657
|
+
this.done = true;
|
|
1658
|
+
var rootEntry = this.tryEntries[0];
|
|
1659
|
+
var rootRecord = rootEntry.completion;
|
|
1689
1660
|
|
|
1690
|
-
if (
|
|
1691
|
-
|
|
1692
|
-
|
|
1661
|
+
if (rootRecord.type === "throw") {
|
|
1662
|
+
throw rootRecord.arg;
|
|
1663
|
+
}
|
|
1693
1664
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1665
|
+
return this.rval;
|
|
1666
|
+
},
|
|
1667
|
+
dispatchException: function dispatchException(exception) {
|
|
1668
|
+
if (this.done) {
|
|
1669
|
+
throw exception;
|
|
1670
|
+
}
|
|
1700
1671
|
|
|
1701
|
-
|
|
1702
|
-
if (this.prev < entry.catchLoc) {
|
|
1703
|
-
return handle(entry.catchLoc, true);
|
|
1704
|
-
}
|
|
1672
|
+
var context = this;
|
|
1705
1673
|
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1674
|
+
function handle(loc, caught) {
|
|
1675
|
+
record.type = "throw";
|
|
1676
|
+
record.arg = exception;
|
|
1677
|
+
context.next = loc;
|
|
1710
1678
|
|
|
1711
|
-
|
|
1712
|
-
|
|
1679
|
+
if (caught) {
|
|
1680
|
+
// If the dispatched exception was caught by a catch block,
|
|
1681
|
+
// then let that catch block handle the exception normally.
|
|
1682
|
+
context.method = "next";
|
|
1683
|
+
context.arg = undefined$1;
|
|
1713
1684
|
}
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
},
|
|
1717
1685
|
|
|
1718
|
-
|
|
1719
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1720
|
-
var entry = this.tryEntries[i];
|
|
1721
|
-
if (entry.tryLoc <= this.prev &&
|
|
1722
|
-
hasOwn.call(entry, "finallyLoc") &&
|
|
1723
|
-
this.prev < entry.finallyLoc) {
|
|
1724
|
-
var finallyEntry = entry;
|
|
1725
|
-
break;
|
|
1686
|
+
return !!caught;
|
|
1726
1687
|
}
|
|
1727
|
-
}
|
|
1728
1688
|
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
finallyEntry.tryLoc <= arg &&
|
|
1733
|
-
arg <= finallyEntry.finallyLoc) {
|
|
1734
|
-
// Ignore the finally entry if control is not jumping to a
|
|
1735
|
-
// location outside the try/catch block.
|
|
1736
|
-
finallyEntry = null;
|
|
1737
|
-
}
|
|
1689
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1690
|
+
var entry = this.tryEntries[i];
|
|
1691
|
+
var record = entry.completion;
|
|
1738
1692
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1693
|
+
if (entry.tryLoc === "root") {
|
|
1694
|
+
// Exception thrown outside of any try block that could handle
|
|
1695
|
+
// it, so set the completion value of the entire function to
|
|
1696
|
+
// throw the exception.
|
|
1697
|
+
return handle("end");
|
|
1698
|
+
}
|
|
1742
1699
|
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
return ContinueSentinel;
|
|
1747
|
-
}
|
|
1700
|
+
if (entry.tryLoc <= this.prev) {
|
|
1701
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
1702
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1748
1703
|
|
|
1749
|
-
|
|
1750
|
-
|
|
1704
|
+
if (hasCatch && hasFinally) {
|
|
1705
|
+
if (this.prev < entry.catchLoc) {
|
|
1706
|
+
return handle(entry.catchLoc, true);
|
|
1707
|
+
} else if (this.prev < entry.finallyLoc) {
|
|
1708
|
+
return handle(entry.finallyLoc);
|
|
1709
|
+
}
|
|
1710
|
+
} else if (hasCatch) {
|
|
1711
|
+
if (this.prev < entry.catchLoc) {
|
|
1712
|
+
return handle(entry.catchLoc, true);
|
|
1713
|
+
}
|
|
1714
|
+
} else if (hasFinally) {
|
|
1715
|
+
if (this.prev < entry.finallyLoc) {
|
|
1716
|
+
return handle(entry.finallyLoc);
|
|
1717
|
+
}
|
|
1718
|
+
} else {
|
|
1719
|
+
throw new Error("try statement without catch or finally");
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
abrupt: function abrupt(type, arg) {
|
|
1725
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1726
|
+
var entry = this.tryEntries[i];
|
|
1751
1727
|
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1728
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1729
|
+
var finallyEntry = entry;
|
|
1730
|
+
break;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1756
1733
|
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
this.method = "return";
|
|
1763
|
-
this.next = "end";
|
|
1764
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
1765
|
-
this.next = afterLoc;
|
|
1766
|
-
}
|
|
1734
|
+
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
1735
|
+
// Ignore the finally entry if control is not jumping to a
|
|
1736
|
+
// location outside the try/catch block.
|
|
1737
|
+
finallyEntry = null;
|
|
1738
|
+
}
|
|
1767
1739
|
|
|
1768
|
-
|
|
1769
|
-
|
|
1740
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1741
|
+
record.type = type;
|
|
1742
|
+
record.arg = arg;
|
|
1770
1743
|
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
1775
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
1776
|
-
resetTryEntry(entry);
|
|
1744
|
+
if (finallyEntry) {
|
|
1745
|
+
this.method = "next";
|
|
1746
|
+
this.next = finallyEntry.finallyLoc;
|
|
1777
1747
|
return ContinueSentinel;
|
|
1778
1748
|
}
|
|
1779
|
-
}
|
|
1780
|
-
},
|
|
1781
1749
|
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
if (
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1750
|
+
return this.complete(record);
|
|
1751
|
+
},
|
|
1752
|
+
complete: function complete(record, afterLoc) {
|
|
1753
|
+
if (record.type === "throw") {
|
|
1754
|
+
throw record.arg;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
if (record.type === "break" || record.type === "continue") {
|
|
1758
|
+
this.next = record.arg;
|
|
1759
|
+
} else if (record.type === "return") {
|
|
1760
|
+
this.rval = this.arg = record.arg;
|
|
1761
|
+
this.method = "return";
|
|
1762
|
+
this.next = "end";
|
|
1763
|
+
} else if (record.type === "normal" && afterLoc) {
|
|
1764
|
+
this.next = afterLoc;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
return ContinueSentinel;
|
|
1768
|
+
},
|
|
1769
|
+
finish: function finish(finallyLoc) {
|
|
1770
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1771
|
+
var entry = this.tryEntries[i];
|
|
1772
|
+
|
|
1773
|
+
if (entry.finallyLoc === finallyLoc) {
|
|
1774
|
+
this.complete(entry.completion, entry.afterLoc);
|
|
1789
1775
|
resetTryEntry(entry);
|
|
1776
|
+
return ContinueSentinel;
|
|
1790
1777
|
}
|
|
1791
|
-
return thrown;
|
|
1792
1778
|
}
|
|
1793
|
-
}
|
|
1779
|
+
},
|
|
1780
|
+
"catch": function _catch(tryLoc) {
|
|
1781
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1782
|
+
var entry = this.tryEntries[i];
|
|
1794
1783
|
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
throw new Error("illegal catch attempt");
|
|
1798
|
-
},
|
|
1784
|
+
if (entry.tryLoc === tryLoc) {
|
|
1785
|
+
var record = entry.completion;
|
|
1799
1786
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
nextLoc: nextLoc
|
|
1805
|
-
};
|
|
1787
|
+
if (record.type === "throw") {
|
|
1788
|
+
var thrown = record.arg;
|
|
1789
|
+
resetTryEntry(entry);
|
|
1790
|
+
}
|
|
1806
1791
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
//
|
|
1810
|
-
|
|
1811
|
-
}
|
|
1792
|
+
return thrown;
|
|
1793
|
+
}
|
|
1794
|
+
} // The context.catch method must only be called with a location
|
|
1795
|
+
// argument that corresponds to a known catch block.
|
|
1812
1796
|
|
|
1813
|
-
return ContinueSentinel;
|
|
1814
|
-
}
|
|
1815
|
-
};
|
|
1816
1797
|
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1798
|
+
throw new Error("illegal catch attempt");
|
|
1799
|
+
},
|
|
1800
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1801
|
+
this.delegate = {
|
|
1802
|
+
iterator: values(iterable),
|
|
1803
|
+
resultName: resultName,
|
|
1804
|
+
nextLoc: nextLoc
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
if (this.method === "next") {
|
|
1808
|
+
// Deliberately forget the last sent value so that we don't
|
|
1809
|
+
// accidentally pass it on to the delegate.
|
|
1810
|
+
this.arg = undefined$1;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
return ContinueSentinel;
|
|
1814
|
+
}
|
|
1815
|
+
}; // Regardless of whether this script is executing as a CommonJS module
|
|
1816
|
+
// or not, return the runtime object so that we can declare the variable
|
|
1817
|
+
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1818
|
+
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1822
1819
|
|
|
1823
|
-
|
|
1824
|
-
// If this script is executing as a CommonJS module, use module.exports
|
|
1820
|
+
return exports;
|
|
1821
|
+
}( // If this script is executing as a CommonJS module, use module.exports
|
|
1825
1822
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1826
1823
|
// object. Either way, the resulting object will be used to initialize
|
|
1827
1824
|
// the regeneratorRuntime variable at the top of this file.
|
|
1828
|
-
module.exports
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1825
|
+
module.exports );
|
|
1826
|
+
|
|
1827
|
+
try {
|
|
1828
|
+
regeneratorRuntime = runtime;
|
|
1829
|
+
} catch (accidentalStrictMode) {
|
|
1830
|
+
// This module should not be running in strict mode, so the above
|
|
1831
|
+
// assignment should always work unless something is misconfigured. Just
|
|
1832
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1833
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
1834
|
+
// strict mode using a global Function call. This could conceivably fail
|
|
1835
|
+
// if a Content Security Policy forbids using Function, but in that case
|
|
1836
|
+
// the proper solution is to fix the accidental strict mode problem. If
|
|
1837
|
+
// you've misconfigured your bundler to force strict mode and applied a
|
|
1838
|
+
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1839
|
+
// problems, please detail your unique predicament in a GitHub issue.
|
|
1840
|
+
if (typeof globalThis === "object") {
|
|
1841
|
+
globalThis.regeneratorRuntime = runtime;
|
|
1842
|
+
} else {
|
|
1843
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1844
|
+
}
|
|
1848
1845
|
}
|
|
1849
|
-
}
|
|
1850
1846
|
});
|
|
1851
1847
|
|
|
1852
1848
|
/* eslint-disable you-dont-need-lodash-underscore/find */
|
|
@@ -2281,15 +2277,7 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
2281
2277
|
return /*#__PURE__*/React__default.createElement(f36Components.InlineEntryCard, {
|
|
2282
2278
|
testId: Contentful.INLINES.EMBEDDED_ENTRY,
|
|
2283
2279
|
isSelected: props.isSelected,
|
|
2284
|
-
title:
|
|
2285
|
-
getEntityScheduledActions: loadEntityScheduledActions,
|
|
2286
|
-
entityType: "Entry",
|
|
2287
|
-
entityId: entry.sys.id
|
|
2288
|
-
}, /*#__PURE__*/React__default.createElement(f36Icons.ClockIcon, {
|
|
2289
|
-
className: styles$5.scheduledIcon,
|
|
2290
|
-
variant: "muted",
|
|
2291
|
-
testId: "scheduled-icon"
|
|
2292
|
-
}))),
|
|
2280
|
+
title: contentTypeName + ": " + title,
|
|
2293
2281
|
status: status,
|
|
2294
2282
|
actions: [/*#__PURE__*/React__default.createElement(f36Components.MenuItem, {
|
|
2295
2283
|
key: "edit",
|
|
@@ -2301,7 +2289,15 @@ function FetchingWrappedInlineEntryCard(props) {
|
|
|
2301
2289
|
disabled: props.isDisabled,
|
|
2302
2290
|
testId: "card-action-remove"
|
|
2303
2291
|
}, "Remove")]
|
|
2304
|
-
}
|
|
2292
|
+
}, /*#__PURE__*/React__default.createElement(fieldEditorReference.ScheduledIconWithTooltip, {
|
|
2293
|
+
getEntityScheduledActions: loadEntityScheduledActions,
|
|
2294
|
+
entityType: "Entry",
|
|
2295
|
+
entityId: entry.sys.id
|
|
2296
|
+
}, /*#__PURE__*/React__default.createElement(f36Icons.ClockIcon, {
|
|
2297
|
+
className: styles$5.scheduledIcon,
|
|
2298
|
+
variant: "muted",
|
|
2299
|
+
testId: "scheduled-icon"
|
|
2300
|
+
})), /*#__PURE__*/React__default.createElement(f36Components.Text, null, title));
|
|
2305
2301
|
}
|
|
2306
2302
|
|
|
2307
2303
|
function createInlineEntryNode(id) {
|
|
@@ -2983,159 +2979,6 @@ var createHrPlugin = function createHrPlugin() {
|
|
|
2983
2979
|
};
|
|
2984
2980
|
};
|
|
2985
2981
|
|
|
2986
|
-
function truncate(str, length) {
|
|
2987
|
-
if (typeof str === 'string' && str.length > length) {
|
|
2988
|
-
return str && str.substr(0, length + 1) // +1 to look ahead and be replaced below.
|
|
2989
|
-
// Get rid of orphan letters but not one letter words (I, a, 2).
|
|
2990
|
-
// Try to not have “.” as last character to avoid awkward “....”.
|
|
2991
|
-
.replace(/(\s+\S(?=\S)|\s*)\.?.$/, '…');
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
|
-
return str;
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
function getEntityInfo(_ref) {
|
|
2998
|
-
var entityTitle = _ref.entityTitle,
|
|
2999
|
-
entityStatus = _ref.entityStatus,
|
|
3000
|
-
contentTypeName = _ref.contentTypeName;
|
|
3001
|
-
var title = truncate(entityTitle, 60) || 'Untitled';
|
|
3002
|
-
return (contentTypeName || 'Asset') + " \"" + title + "\", " + entityStatus;
|
|
3003
|
-
}
|
|
3004
|
-
|
|
3005
|
-
function EntryAssetTooltip(_ref2) {
|
|
3006
|
-
var id = _ref2.id,
|
|
3007
|
-
type = _ref2.type,
|
|
3008
|
-
sdk = _ref2.sdk;
|
|
3009
|
-
|
|
3010
|
-
var _React$useState = React.useState(''),
|
|
3011
|
-
entityTitle = _React$useState[0],
|
|
3012
|
-
setEntityTitle = _React$useState[1];
|
|
3013
|
-
|
|
3014
|
-
var _React$useState2 = React.useState(''),
|
|
3015
|
-
entityStatus = _React$useState2[0],
|
|
3016
|
-
setEntityStatus = _React$useState2[1];
|
|
3017
|
-
|
|
3018
|
-
var _React$useState3 = React.useState([]),
|
|
3019
|
-
jobs = _React$useState3[0],
|
|
3020
|
-
setJobs = _React$useState3[1];
|
|
3021
|
-
|
|
3022
|
-
var _React$useState4 = React.useState(true),
|
|
3023
|
-
isLoading = _React$useState4[0],
|
|
3024
|
-
setIsLoading = _React$useState4[1];
|
|
3025
|
-
|
|
3026
|
-
var _React$useState5 = React.useState(false),
|
|
3027
|
-
hasError = _React$useState5[0],
|
|
3028
|
-
setHasError = _React$useState5[1];
|
|
3029
|
-
|
|
3030
|
-
React.useEffect(function () {
|
|
3031
|
-
function loadContent() {
|
|
3032
|
-
return _loadContent.apply(this, arguments);
|
|
3033
|
-
}
|
|
3034
|
-
|
|
3035
|
-
function _loadContent() {
|
|
3036
|
-
_loadContent = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3037
|
-
var actions, contentType, entity, contentTypeId, contentTypes, _entityTitle, _jobs, _entityStatus;
|
|
3038
|
-
|
|
3039
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
3040
|
-
while (1) {
|
|
3041
|
-
switch (_context.prev = _context.next) {
|
|
3042
|
-
case 0:
|
|
3043
|
-
_context.prev = 0;
|
|
3044
|
-
setIsLoading(true);
|
|
3045
|
-
setHasError(false);
|
|
3046
|
-
actions = {
|
|
3047
|
-
Asset: {
|
|
3048
|
-
getEntity: sdk.space.getAsset,
|
|
3049
|
-
getEntityTitle: function getEntityTitle(args) {
|
|
3050
|
-
return fieldEditorShared.entityHelpers.getAssetTitle(_extends({}, args, {
|
|
3051
|
-
asset: args.entity
|
|
3052
|
-
}));
|
|
3053
|
-
}
|
|
3054
|
-
},
|
|
3055
|
-
Entry: {
|
|
3056
|
-
getEntity: sdk.space.getEntry,
|
|
3057
|
-
getEntityTitle: function getEntityTitle(args) {
|
|
3058
|
-
return fieldEditorShared.entityHelpers.getEntryTitle(_extends({}, args, {
|
|
3059
|
-
entry: args.entity
|
|
3060
|
-
}));
|
|
3061
|
-
}
|
|
3062
|
-
}
|
|
3063
|
-
};
|
|
3064
|
-
_context.next = 6;
|
|
3065
|
-
return actions[type].getEntity(id);
|
|
3066
|
-
|
|
3067
|
-
case 6:
|
|
3068
|
-
entity = _context.sent;
|
|
3069
|
-
|
|
3070
|
-
if (entity.sys.contentType) {
|
|
3071
|
-
contentTypeId = entity.sys.contentType.sys.id;
|
|
3072
|
-
contentTypes = sdk.space.getCachedContentTypes();
|
|
3073
|
-
contentType = contentTypes.find(function (ct) {
|
|
3074
|
-
return ct.sys.id === contentTypeId;
|
|
3075
|
-
});
|
|
3076
|
-
}
|
|
3077
|
-
|
|
3078
|
-
_entityTitle = actions[type].getEntityTitle({
|
|
3079
|
-
entity: entity,
|
|
3080
|
-
contentType: contentType,
|
|
3081
|
-
localeCode: sdk.field.locale,
|
|
3082
|
-
defaultLocaleCode: sdk.locales["default"],
|
|
3083
|
-
entityType: type
|
|
3084
|
-
});
|
|
3085
|
-
_context.next = 11;
|
|
3086
|
-
return sdk.space.getEntityScheduledActions(type, id);
|
|
3087
|
-
|
|
3088
|
-
case 11:
|
|
3089
|
-
_jobs = _context.sent;
|
|
3090
|
-
_entityStatus = fieldEditorShared.entityHelpers.getEntryStatus(entity.sys);
|
|
3091
|
-
setEntityTitle(_entityTitle);
|
|
3092
|
-
setEntityStatus(_entityStatus);
|
|
3093
|
-
setJobs(_jobs);
|
|
3094
|
-
_context.next = 22;
|
|
3095
|
-
break;
|
|
3096
|
-
|
|
3097
|
-
case 18:
|
|
3098
|
-
_context.prev = 18;
|
|
3099
|
-
_context.t0 = _context["catch"](0);
|
|
3100
|
-
console.log(_context.t0);
|
|
3101
|
-
setHasError(true);
|
|
3102
|
-
|
|
3103
|
-
case 22:
|
|
3104
|
-
_context.prev = 22;
|
|
3105
|
-
setIsLoading(false);
|
|
3106
|
-
return _context.finish(22);
|
|
3107
|
-
|
|
3108
|
-
case 25:
|
|
3109
|
-
case "end":
|
|
3110
|
-
return _context.stop();
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
}, _callee, null, [[0, 18, 22, 25]]);
|
|
3114
|
-
}));
|
|
3115
|
-
return _loadContent.apply(this, arguments);
|
|
3116
|
-
}
|
|
3117
|
-
|
|
3118
|
-
loadContent();
|
|
3119
|
-
}, [id, type, sdk]);
|
|
3120
|
-
|
|
3121
|
-
if (isLoading) {
|
|
3122
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, "Loading " + type.toLowerCase() + "...");
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
if (hasError) {
|
|
3126
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, type + " missing or inaccessible");
|
|
3127
|
-
}
|
|
3128
|
-
|
|
3129
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, getEntityInfo({
|
|
3130
|
-
entityTitle: entityTitle,
|
|
3131
|
-
contentTypeName: type,
|
|
3132
|
-
entityStatus: entityStatus
|
|
3133
|
-
}), ' ', jobs.length > 0 ? fieldEditorReference.getScheduleTooltipContent({
|
|
3134
|
-
job: jobs[0],
|
|
3135
|
-
jobsCount: jobs.length
|
|
3136
|
-
}) : '');
|
|
3137
|
-
}
|
|
3138
|
-
|
|
3139
2982
|
var _templateObject$3, _SYS_LINK_TYPES, _LINK_TYPE_SELECTION_;
|
|
3140
2983
|
var styles$b = {
|
|
3141
2984
|
removeSelectionLabel: /*#__PURE__*/emotion.css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-left: ", ";\n "])), tokens.spacingS)
|
|
@@ -3447,11 +3290,213 @@ function _addOrEditLink() {
|
|
|
3447
3290
|
return _addOrEditLink.apply(this, arguments);
|
|
3448
3291
|
}
|
|
3449
3292
|
|
|
3293
|
+
function ToolbarHyperlinkButton(props) {
|
|
3294
|
+
var editor = useContentfulEditor();
|
|
3295
|
+
var isActive = !!(editor && isLinkActive(editor));
|
|
3296
|
+
var sdk = useSdkContext();
|
|
3297
|
+
|
|
3298
|
+
function handleClick() {
|
|
3299
|
+
return _handleClick.apply(this, arguments);
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
function _handleClick() {
|
|
3303
|
+
_handleClick = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3304
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
3305
|
+
while (1) {
|
|
3306
|
+
switch (_context.prev = _context.next) {
|
|
3307
|
+
case 0:
|
|
3308
|
+
if (editor) {
|
|
3309
|
+
_context.next = 2;
|
|
3310
|
+
break;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
return _context.abrupt("return");
|
|
3314
|
+
|
|
3315
|
+
case 2:
|
|
3316
|
+
if (isActive) {
|
|
3317
|
+
unwrapLink(editor);
|
|
3318
|
+
editor.tracking.onToolbarAction('unlinkHyperlinks');
|
|
3319
|
+
} else {
|
|
3320
|
+
addOrEditLink(editor, sdk, editor.tracking.onToolbarAction);
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
case 3:
|
|
3324
|
+
case "end":
|
|
3325
|
+
return _context.stop();
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
}, _callee);
|
|
3329
|
+
}));
|
|
3330
|
+
return _handleClick.apply(this, arguments);
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
if (!editor) return null;
|
|
3334
|
+
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
3335
|
+
title: "Hyperlink",
|
|
3336
|
+
testId: "hyperlink-toolbar-button",
|
|
3337
|
+
onClick: handleClick,
|
|
3338
|
+
isActive: isActive,
|
|
3339
|
+
isDisabled: props.isDisabled
|
|
3340
|
+
}, /*#__PURE__*/React.createElement(f36Icons.LinkIcon, null));
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3450
3343
|
var hasText = function hasText(editor, entry) {
|
|
3451
3344
|
var node = entry[0];
|
|
3452
3345
|
return !plateCore.isAncestorEmpty(editor, node) && slate.Node.string(node).trim() !== '';
|
|
3453
3346
|
};
|
|
3454
3347
|
|
|
3348
|
+
function truncate(str, length) {
|
|
3349
|
+
if (typeof str === 'string' && str.length > length) {
|
|
3350
|
+
return str && str.substr(0, length + 1) // +1 to look ahead and be replaced below.
|
|
3351
|
+
// Get rid of orphan letters but not one letter words (I, a, 2).
|
|
3352
|
+
// Try to not have “.” as last character to avoid awkward “....”.
|
|
3353
|
+
.replace(/(\s+\S(?=\S)|\s*)\.?.$/, '…');
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3356
|
+
return str;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
function getEntityInfo(data) {
|
|
3360
|
+
if (!data) {
|
|
3361
|
+
return '';
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
var entityTitle = data.entityTitle,
|
|
3365
|
+
contentTypeName = data.contentTypeName,
|
|
3366
|
+
entityStatus = data.entityStatus,
|
|
3367
|
+
jobs = data.jobs;
|
|
3368
|
+
var title = truncate(entityTitle, 60) || 'Untitled';
|
|
3369
|
+
var scheduledActions = jobs.length > 0 ? fieldEditorReference.getScheduleTooltipContent({
|
|
3370
|
+
job: jobs[0],
|
|
3371
|
+
jobsCount: jobs.length
|
|
3372
|
+
}) : '';
|
|
3373
|
+
return (contentTypeName || 'Asset') + " \"" + title + "\", " + entityStatus + " " + scheduledActions;
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
function fetchAllData(_x) {
|
|
3377
|
+
return _fetchAllData.apply(this, arguments);
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
function _fetchAllData() {
|
|
3381
|
+
_fetchAllData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref) {
|
|
3382
|
+
var sdk, entityId, entityType, localeCode, defaultLocaleCode, contentType, getEntity, entity, contentTypeId, entityTitle, entityDescription, jobs, entityStatus;
|
|
3383
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
3384
|
+
while (1) {
|
|
3385
|
+
switch (_context.prev = _context.next) {
|
|
3386
|
+
case 0:
|
|
3387
|
+
sdk = _ref.sdk, entityId = _ref.entityId, entityType = _ref.entityType, localeCode = _ref.localeCode, defaultLocaleCode = _ref.defaultLocaleCode;
|
|
3388
|
+
getEntity = entityType === 'Entry' ? sdk.space.getEntry : sdk.space.getAsset;
|
|
3389
|
+
_context.next = 4;
|
|
3390
|
+
return getEntity(entityId);
|
|
3391
|
+
|
|
3392
|
+
case 4:
|
|
3393
|
+
entity = _context.sent;
|
|
3394
|
+
|
|
3395
|
+
if (entity.sys.contentType) {
|
|
3396
|
+
contentTypeId = entity.sys.contentType.sys.id;
|
|
3397
|
+
contentType = sdk.space.getCachedContentTypes().find(function (ct) {
|
|
3398
|
+
return ct.sys.id === contentTypeId;
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
entityTitle = entityType === 'Entry' ? fieldEditorShared.entityHelpers.getEntryTitle({
|
|
3403
|
+
entry: entity,
|
|
3404
|
+
contentType: contentType,
|
|
3405
|
+
localeCode: localeCode,
|
|
3406
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
3407
|
+
defaultTitle: 'Untitled'
|
|
3408
|
+
}) : fieldEditorShared.entityHelpers.getAssetTitle({
|
|
3409
|
+
asset: entity,
|
|
3410
|
+
localeCode: localeCode,
|
|
3411
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
3412
|
+
defaultTitle: 'Untitled'
|
|
3413
|
+
});
|
|
3414
|
+
entityDescription = fieldEditorShared.entityHelpers.getEntityDescription({
|
|
3415
|
+
entity: entity,
|
|
3416
|
+
contentType: contentType,
|
|
3417
|
+
localeCode: localeCode,
|
|
3418
|
+
defaultLocaleCode: defaultLocaleCode
|
|
3419
|
+
});
|
|
3420
|
+
_context.next = 10;
|
|
3421
|
+
return sdk.space.getEntityScheduledActions(entityType, entityId);
|
|
3422
|
+
|
|
3423
|
+
case 10:
|
|
3424
|
+
jobs = _context.sent;
|
|
3425
|
+
entityStatus = fieldEditorShared.entityHelpers.getEntryStatus(entity.sys);
|
|
3426
|
+
return _context.abrupt("return", {
|
|
3427
|
+
jobs: jobs,
|
|
3428
|
+
entity: entity,
|
|
3429
|
+
entityTitle: entityTitle,
|
|
3430
|
+
entityDescription: entityDescription,
|
|
3431
|
+
entityStatus: entityStatus,
|
|
3432
|
+
contentTypeName: contentType ? contentType.name : ''
|
|
3433
|
+
});
|
|
3434
|
+
|
|
3435
|
+
case 13:
|
|
3436
|
+
case "end":
|
|
3437
|
+
return _context.stop();
|
|
3438
|
+
}
|
|
3439
|
+
}
|
|
3440
|
+
}, _callee);
|
|
3441
|
+
}));
|
|
3442
|
+
return _fetchAllData.apply(this, arguments);
|
|
3443
|
+
}
|
|
3444
|
+
|
|
3445
|
+
function useRequestStatus(_ref2) {
|
|
3446
|
+
var sdk = _ref2.sdk,
|
|
3447
|
+
target = _ref2.target,
|
|
3448
|
+
onEntityFetchComplete = _ref2.onEntityFetchComplete;
|
|
3449
|
+
|
|
3450
|
+
var _useState = React.useState({
|
|
3451
|
+
type: 'loading'
|
|
3452
|
+
}),
|
|
3453
|
+
requestStatus = _useState[0],
|
|
3454
|
+
setRequestStatus = _useState[1];
|
|
3455
|
+
|
|
3456
|
+
React.useEffect(function () {
|
|
3457
|
+
if (target) {
|
|
3458
|
+
var _target$sys, _target$sys2;
|
|
3459
|
+
|
|
3460
|
+
fetchAllData({
|
|
3461
|
+
sdk: sdk,
|
|
3462
|
+
entityId: target == null ? void 0 : (_target$sys = target.sys) == null ? void 0 : _target$sys.id,
|
|
3463
|
+
entityType: target == null ? void 0 : (_target$sys2 = target.sys) == null ? void 0 : _target$sys2.linkType,
|
|
3464
|
+
localeCode: sdk.field.locale,
|
|
3465
|
+
defaultLocaleCode: sdk.locales["default"]
|
|
3466
|
+
}).then(function (entityInfo) {
|
|
3467
|
+
setRequestStatus({
|
|
3468
|
+
type: 'success',
|
|
3469
|
+
data: entityInfo
|
|
3470
|
+
});
|
|
3471
|
+
})["catch"](function (e) {
|
|
3472
|
+
console.log(e);
|
|
3473
|
+
setRequestStatus({
|
|
3474
|
+
type: 'error',
|
|
3475
|
+
error: e
|
|
3476
|
+
});
|
|
3477
|
+
})["finally"](function () {
|
|
3478
|
+
onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
|
|
3479
|
+
});
|
|
3480
|
+
}
|
|
3481
|
+
}, [sdk, target, onEntityFetchComplete]);
|
|
3482
|
+
return requestStatus;
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
function useEntityInfo(props) {
|
|
3486
|
+
var status = useRequestStatus(props);
|
|
3487
|
+
var linkType = props.target.sys.linkType;
|
|
3488
|
+
|
|
3489
|
+
if (status.type === 'loading') {
|
|
3490
|
+
return "Loading " + linkType.toLowerCase() + "...";
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
if (status.type === 'error') {
|
|
3494
|
+
return linkType + " missing or inaccessible";
|
|
3495
|
+
}
|
|
3496
|
+
|
|
3497
|
+
return getEntityInfo(status.data);
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3455
3500
|
var styles$c = {
|
|
3456
3501
|
hyperlinkWrapper: /*#__PURE__*/emotion.css({
|
|
3457
3502
|
display: 'inline',
|
|
@@ -3469,33 +3514,21 @@ var styles$c = {
|
|
|
3469
3514
|
'&:focus': {
|
|
3470
3515
|
fill: tokens.gray900
|
|
3471
3516
|
}
|
|
3472
|
-
}),
|
|
3473
|
-
hyperlinkIEFallback: /*#__PURE__*/emotion.css({
|
|
3474
|
-
color: '#1683d0',
|
|
3475
|
-
textDecoration: 'underline'
|
|
3476
|
-
}),
|
|
3477
|
-
// TODO: use these styles once we can use the icon
|
|
3478
|
-
hyperlinkIcon: /*#__PURE__*/emotion.css({
|
|
3479
|
-
position: 'relative',
|
|
3480
|
-
top: '4px',
|
|
3481
|
-
height: '14px',
|
|
3482
|
-
margin: '0 -2px 0 -1px',
|
|
3483
|
-
webkitTransition: 'fill 100ms ease-in-out',
|
|
3484
|
-
transition: 'fill 100ms ease-in-out',
|
|
3485
|
-
'&:hover': {
|
|
3486
|
-
fill: tokens.gray900
|
|
3487
|
-
},
|
|
3488
|
-
'&:focus': {
|
|
3489
|
-
fill: tokens.gray900
|
|
3490
|
-
}
|
|
3491
3517
|
})
|
|
3492
3518
|
};
|
|
3493
3519
|
|
|
3494
|
-
function
|
|
3520
|
+
function EntityHyperlink(props) {
|
|
3495
3521
|
var editor = useContentfulEditor();
|
|
3496
3522
|
var isReadOnly = Slate.useReadOnly();
|
|
3497
3523
|
var sdk = useSdkContext();
|
|
3498
|
-
var
|
|
3524
|
+
var target = props.element.data.target;
|
|
3525
|
+
var onEntityFetchComplete = props.onEntityFetchComplete;
|
|
3526
|
+
var tooltipContent = useEntityInfo({
|
|
3527
|
+
target: target,
|
|
3528
|
+
sdk: sdk,
|
|
3529
|
+
onEntityFetchComplete: onEntityFetchComplete
|
|
3530
|
+
});
|
|
3531
|
+
if (!target) return null;
|
|
3499
3532
|
|
|
3500
3533
|
function handleClick(event) {
|
|
3501
3534
|
event.preventDefault();
|
|
@@ -3505,33 +3538,25 @@ function UrlHyperlink(props) {
|
|
|
3505
3538
|
}
|
|
3506
3539
|
|
|
3507
3540
|
return /*#__PURE__*/React.createElement(f36Components.Tooltip, {
|
|
3508
|
-
content:
|
|
3541
|
+
content: tooltipContent,
|
|
3509
3542
|
targetWrapperClassName: styles$c.hyperlinkWrapper,
|
|
3510
3543
|
placement: "bottom",
|
|
3511
3544
|
maxWidth: "auto"
|
|
3512
3545
|
}, /*#__PURE__*/React.createElement(f36Components.TextLink, {
|
|
3513
3546
|
as: "a",
|
|
3514
|
-
href: uri,
|
|
3515
|
-
rel: "noopener noreferrer",
|
|
3516
3547
|
onClick: handleClick,
|
|
3517
3548
|
isDisabled: isReadOnly,
|
|
3518
|
-
className: styles$c.hyperlink
|
|
3549
|
+
className: styles$c.hyperlink,
|
|
3550
|
+
"data-link-type": target.sys.linkType,
|
|
3551
|
+
"data-link-id": target.sys.id
|
|
3519
3552
|
}, props.children));
|
|
3520
3553
|
}
|
|
3521
3554
|
|
|
3522
|
-
function
|
|
3555
|
+
function UrlHyperlink(props) {
|
|
3523
3556
|
var editor = useContentfulEditor();
|
|
3524
3557
|
var isReadOnly = Slate.useReadOnly();
|
|
3525
3558
|
var sdk = useSdkContext();
|
|
3526
|
-
var
|
|
3527
|
-
var onEntityFetchComplete = props.onEntityFetchComplete;
|
|
3528
|
-
React.useEffect(function () {
|
|
3529
|
-
// The real entity loading happens in the tooltip
|
|
3530
|
-
// Since that is deferred the link is considered rendered as soon
|
|
3531
|
-
// the component mounts (link text displayed)
|
|
3532
|
-
onEntityFetchComplete == null ? void 0 : onEntityFetchComplete();
|
|
3533
|
-
}, [onEntityFetchComplete]);
|
|
3534
|
-
if (!target) return null;
|
|
3559
|
+
var uri = props.element.data.uri;
|
|
3535
3560
|
|
|
3536
3561
|
function handleClick(event) {
|
|
3537
3562
|
event.preventDefault();
|
|
@@ -3541,74 +3566,20 @@ function EntityHyperlink(props) {
|
|
|
3541
3566
|
}
|
|
3542
3567
|
|
|
3543
3568
|
return /*#__PURE__*/React.createElement(f36Components.Tooltip, {
|
|
3544
|
-
content:
|
|
3545
|
-
id: target.sys.id,
|
|
3546
|
-
type: target.sys.linkType,
|
|
3547
|
-
sdk: sdk
|
|
3548
|
-
}),
|
|
3569
|
+
content: uri,
|
|
3549
3570
|
targetWrapperClassName: styles$c.hyperlinkWrapper,
|
|
3550
3571
|
placement: "bottom",
|
|
3551
3572
|
maxWidth: "auto"
|
|
3552
3573
|
}, /*#__PURE__*/React.createElement(f36Components.TextLink, {
|
|
3553
3574
|
as: "a",
|
|
3575
|
+
href: uri,
|
|
3576
|
+
rel: "noopener noreferrer",
|
|
3554
3577
|
onClick: handleClick,
|
|
3555
3578
|
isDisabled: isReadOnly,
|
|
3556
|
-
className: styles$c.hyperlink
|
|
3557
|
-
"data-link-type": target.sys.linkType,
|
|
3558
|
-
"data-link-id": target.sys.id
|
|
3579
|
+
className: styles$c.hyperlink
|
|
3559
3580
|
}, props.children));
|
|
3560
3581
|
}
|
|
3561
3582
|
|
|
3562
|
-
function ToolbarHyperlinkButton(props) {
|
|
3563
|
-
var editor = useContentfulEditor();
|
|
3564
|
-
var isActive = !!(editor && isLinkActive(editor));
|
|
3565
|
-
var sdk = useSdkContext();
|
|
3566
|
-
|
|
3567
|
-
function handleClick() {
|
|
3568
|
-
return _handleClick.apply(this, arguments);
|
|
3569
|
-
}
|
|
3570
|
-
|
|
3571
|
-
function _handleClick() {
|
|
3572
|
-
_handleClick = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3573
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
3574
|
-
while (1) {
|
|
3575
|
-
switch (_context.prev = _context.next) {
|
|
3576
|
-
case 0:
|
|
3577
|
-
if (editor) {
|
|
3578
|
-
_context.next = 2;
|
|
3579
|
-
break;
|
|
3580
|
-
}
|
|
3581
|
-
|
|
3582
|
-
return _context.abrupt("return");
|
|
3583
|
-
|
|
3584
|
-
case 2:
|
|
3585
|
-
if (isActive) {
|
|
3586
|
-
unwrapLink(editor);
|
|
3587
|
-
editor.tracking.onToolbarAction('unlinkHyperlinks');
|
|
3588
|
-
} else {
|
|
3589
|
-
addOrEditLink(editor, sdk, editor.tracking.onToolbarAction);
|
|
3590
|
-
}
|
|
3591
|
-
|
|
3592
|
-
case 3:
|
|
3593
|
-
case "end":
|
|
3594
|
-
return _context.stop();
|
|
3595
|
-
}
|
|
3596
|
-
}
|
|
3597
|
-
}, _callee);
|
|
3598
|
-
}));
|
|
3599
|
-
return _handleClick.apply(this, arguments);
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
if (!editor) return null;
|
|
3603
|
-
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
3604
|
-
title: "Hyperlink",
|
|
3605
|
-
testId: "hyperlink-toolbar-button",
|
|
3606
|
-
onClick: handleClick,
|
|
3607
|
-
isActive: isActive,
|
|
3608
|
-
isDisabled: props.isDisabled
|
|
3609
|
-
}, /*#__PURE__*/React.createElement(f36Icons.LinkIcon, null));
|
|
3610
|
-
}
|
|
3611
|
-
|
|
3612
3583
|
var isAnchor = function isAnchor(element) {
|
|
3613
3584
|
return element.nodeName === 'A' && !!element.getAttribute('href') && element.getAttribute('href') !== '#';
|
|
3614
3585
|
};
|
|
@@ -4133,6 +4104,101 @@ var insertListFragment = function insertListFragment(editor) {
|
|
|
4133
4104
|
};
|
|
4134
4105
|
};
|
|
4135
4106
|
|
|
4107
|
+
/**
|
|
4108
|
+
* Credit: Modified version of Plate's list plugin
|
|
4109
|
+
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4110
|
+
*/
|
|
4111
|
+
var listTypes = [Contentful.BLOCKS.UL_LIST, Contentful.BLOCKS.OL_LIST];
|
|
4112
|
+
var unwrapList = function unwrapList(editor, _temp) {
|
|
4113
|
+
var _ref = _temp === void 0 ? {} : _temp,
|
|
4114
|
+
at = _ref.at;
|
|
4115
|
+
|
|
4116
|
+
slate.Editor.withoutNormalizing(editor, function () {
|
|
4117
|
+
do {
|
|
4118
|
+
plateCore.unwrapNodes(editor, {
|
|
4119
|
+
at: at,
|
|
4120
|
+
match: {
|
|
4121
|
+
type: Contentful.BLOCKS.LIST_ITEM
|
|
4122
|
+
},
|
|
4123
|
+
split: true
|
|
4124
|
+
});
|
|
4125
|
+
plateCore.unwrapNodes(editor, {
|
|
4126
|
+
at: at,
|
|
4127
|
+
match: {
|
|
4128
|
+
type: listTypes
|
|
4129
|
+
},
|
|
4130
|
+
split: true
|
|
4131
|
+
});
|
|
4132
|
+
} while (plateCore.getAbove(editor, {
|
|
4133
|
+
match: {
|
|
4134
|
+
type: listTypes,
|
|
4135
|
+
at: at
|
|
4136
|
+
}
|
|
4137
|
+
}));
|
|
4138
|
+
});
|
|
4139
|
+
};
|
|
4140
|
+
|
|
4141
|
+
/**
|
|
4142
|
+
* Credit: Modified version of Plate's list plugin
|
|
4143
|
+
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
4144
|
+
*/
|
|
4145
|
+
var deleteBackwardList = function deleteBackwardList(editor, unit) {
|
|
4146
|
+
var res = plateList.getListItemEntry(editor, {});
|
|
4147
|
+
var moved = false;
|
|
4148
|
+
|
|
4149
|
+
if (res) {
|
|
4150
|
+
var list = res.list,
|
|
4151
|
+
listItem = res.listItem;
|
|
4152
|
+
|
|
4153
|
+
if (plateCore.isSelectionAtBlockStart(editor, {
|
|
4154
|
+
match: function match(node) {
|
|
4155
|
+
return node.type === Contentful.BLOCKS.LIST_ITEM;
|
|
4156
|
+
}
|
|
4157
|
+
})) {
|
|
4158
|
+
slate.Editor.withoutNormalizing(editor, function () {
|
|
4159
|
+
moved = plateList.removeFirstListItem(editor, {
|
|
4160
|
+
list: list,
|
|
4161
|
+
listItem: listItem
|
|
4162
|
+
});
|
|
4163
|
+
if (moved) return;
|
|
4164
|
+
moved = plateList.removeListItem(editor, {
|
|
4165
|
+
list: list,
|
|
4166
|
+
listItem: listItem
|
|
4167
|
+
});
|
|
4168
|
+
if (moved) return;
|
|
4169
|
+
|
|
4170
|
+
if (plateCore.isFirstChild(listItem[1]) && !plateList.isListNested(editor, list[1])) {
|
|
4171
|
+
plateResetNode.onKeyDownResetNode(editor, plateCore.mockPlugin({
|
|
4172
|
+
options: {
|
|
4173
|
+
rules: [{
|
|
4174
|
+
types: [Contentful.BLOCKS.LIST_ITEM],
|
|
4175
|
+
defaultType: Contentful.BLOCKS.PARAGRAPH,
|
|
4176
|
+
hotkey: 'backspace',
|
|
4177
|
+
predicate: function predicate() {
|
|
4178
|
+
return plateCore.isSelectionAtBlockStart(editor);
|
|
4179
|
+
},
|
|
4180
|
+
onReset: function onReset(e) {
|
|
4181
|
+
return unwrapList(e);
|
|
4182
|
+
}
|
|
4183
|
+
}]
|
|
4184
|
+
}
|
|
4185
|
+
}))(plateResetNode.SIMULATE_BACKSPACE);
|
|
4186
|
+
moved = true;
|
|
4187
|
+
return;
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
plateCore.deleteFragment(editor, {
|
|
4191
|
+
unit: unit,
|
|
4192
|
+
reverse: true
|
|
4193
|
+
});
|
|
4194
|
+
moved = true;
|
|
4195
|
+
});
|
|
4196
|
+
}
|
|
4197
|
+
}
|
|
4198
|
+
|
|
4199
|
+
return moved;
|
|
4200
|
+
};
|
|
4201
|
+
|
|
4136
4202
|
/**
|
|
4137
4203
|
* Credit: Modified version of Plate's list plugin
|
|
4138
4204
|
* See: https://github.com/udecode/plate/blob/main/packages/nodes/list
|
|
@@ -4144,7 +4210,7 @@ var withList = function withList(editor) {
|
|
|
4144
4210
|
deleteFragment = editor.deleteFragment;
|
|
4145
4211
|
|
|
4146
4212
|
editor.deleteBackward = function (unit) {
|
|
4147
|
-
if (
|
|
4213
|
+
if (deleteBackwardList(editor, unit)) return;
|
|
4148
4214
|
deleteBackward(unit);
|
|
4149
4215
|
};
|
|
4150
4216
|
|
|
@@ -4210,39 +4276,9 @@ var createListPlugin = function createListPlugin() {
|
|
|
4210
4276
|
});
|
|
4211
4277
|
};
|
|
4212
4278
|
|
|
4213
|
-
var listTypes = [Contentful.BLOCKS.UL_LIST, Contentful.BLOCKS.OL_LIST];
|
|
4214
|
-
|
|
4215
|
-
var
|
|
4216
|
-
var _ref = _temp === void 0 ? {} : _temp,
|
|
4217
|
-
at = _ref.at;
|
|
4218
|
-
|
|
4219
|
-
slate.Editor.withoutNormalizing(editor, function () {
|
|
4220
|
-
do {
|
|
4221
|
-
plateCore.unwrapNodes(editor, {
|
|
4222
|
-
at: at,
|
|
4223
|
-
match: {
|
|
4224
|
-
type: Contentful.BLOCKS.LIST_ITEM
|
|
4225
|
-
},
|
|
4226
|
-
split: true
|
|
4227
|
-
});
|
|
4228
|
-
plateCore.unwrapNodes(editor, {
|
|
4229
|
-
at: at,
|
|
4230
|
-
match: {
|
|
4231
|
-
type: listTypes
|
|
4232
|
-
},
|
|
4233
|
-
split: true
|
|
4234
|
-
});
|
|
4235
|
-
} while (plateCore.getAbove(editor, {
|
|
4236
|
-
match: {
|
|
4237
|
-
type: listTypes,
|
|
4238
|
-
at: at
|
|
4239
|
-
}
|
|
4240
|
-
}));
|
|
4241
|
-
});
|
|
4242
|
-
};
|
|
4243
|
-
|
|
4244
|
-
var toggleList = function toggleList(editor, _ref2) {
|
|
4245
|
-
var type = _ref2.type;
|
|
4279
|
+
var listTypes$1 = [Contentful.BLOCKS.UL_LIST, Contentful.BLOCKS.OL_LIST];
|
|
4280
|
+
var toggleList = function toggleList(editor, _ref) {
|
|
4281
|
+
var type = _ref.type;
|
|
4246
4282
|
return slate.Editor.withoutNormalizing(editor, function () {
|
|
4247
4283
|
if (!editor.selection) {
|
|
4248
4284
|
return;
|
|
@@ -4261,7 +4297,7 @@ var toggleList = function toggleList(editor, _ref2) {
|
|
|
4261
4297
|
}, {
|
|
4262
4298
|
at: editor.selection,
|
|
4263
4299
|
match: function match(n) {
|
|
4264
|
-
return listTypes.includes(n.type);
|
|
4300
|
+
return listTypes$1.includes(n.type);
|
|
4265
4301
|
},
|
|
4266
4302
|
mode: 'lowest'
|
|
4267
4303
|
});
|
|
@@ -4302,19 +4338,19 @@ var toggleList = function toggleList(editor, _ref2) {
|
|
|
4302
4338
|
|
|
4303
4339
|
var commonEntry = slate.Node.common(editor, startPoint.path, endPoint.path);
|
|
4304
4340
|
|
|
4305
|
-
if (listTypes.includes(commonEntry[0].type) || commonEntry[0].type === Contentful.BLOCKS.LIST_ITEM) {
|
|
4341
|
+
if (listTypes$1.includes(commonEntry[0].type) || commonEntry[0].type === Contentful.BLOCKS.LIST_ITEM) {
|
|
4306
4342
|
if (commonEntry[0].type !== type) {
|
|
4307
4343
|
var startList = plateCore.findNode(editor, {
|
|
4308
4344
|
at: slate.Range.start(editor.selection),
|
|
4309
4345
|
match: {
|
|
4310
|
-
type: listTypes
|
|
4346
|
+
type: listTypes$1
|
|
4311
4347
|
},
|
|
4312
4348
|
mode: 'lowest'
|
|
4313
4349
|
});
|
|
4314
4350
|
var endList = plateCore.findNode(editor, {
|
|
4315
4351
|
at: slate.Range.end(editor.selection),
|
|
4316
4352
|
match: {
|
|
4317
|
-
type: listTypes
|
|
4353
|
+
type: listTypes$1
|
|
4318
4354
|
},
|
|
4319
4355
|
mode: 'lowest'
|
|
4320
4356
|
});
|
|
@@ -4329,7 +4365,7 @@ var toggleList = function toggleList(editor, _ref2) {
|
|
|
4329
4365
|
}, {
|
|
4330
4366
|
at: editor.selection,
|
|
4331
4367
|
match: function match(n, path) {
|
|
4332
|
-
return listTypes.includes(n.type) && path.length >= rangeLength;
|
|
4368
|
+
return listTypes$1.includes(n.type) && path.length >= rangeLength;
|
|
4333
4369
|
},
|
|
4334
4370
|
mode: 'all'
|
|
4335
4371
|
});
|
|
@@ -4341,13 +4377,13 @@ var toggleList = function toggleList(editor, _ref2) {
|
|
|
4341
4377
|
|
|
4342
4378
|
var _nodes = Array.from(plateCore.getNodes(editor, {
|
|
4343
4379
|
mode: 'all'
|
|
4344
|
-
})).filter(function (
|
|
4345
|
-
var path =
|
|
4380
|
+
})).filter(function (_ref2) {
|
|
4381
|
+
var path = _ref2[1];
|
|
4346
4382
|
return path.length === rootPathLength + 1;
|
|
4347
4383
|
}).reverse();
|
|
4348
4384
|
|
|
4349
4385
|
_nodes.forEach(function (n) {
|
|
4350
|
-
if (listTypes.includes(n[0].type)) {
|
|
4386
|
+
if (listTypes$1.includes(n[0].type)) {
|
|
4351
4387
|
plateCore.setNodes(editor, {
|
|
4352
4388
|
type: type
|
|
4353
4389
|
}, {
|
|
@@ -5063,10 +5099,51 @@ function Quote(props) {
|
|
|
5063
5099
|
}), props.children);
|
|
5064
5100
|
}
|
|
5065
5101
|
|
|
5102
|
+
/**
|
|
5103
|
+
* Returns true if we are:
|
|
5104
|
+
* 1) Inside a blockquote
|
|
5105
|
+
* 2) With no only one child paragraph/heading and
|
|
5106
|
+
* 3) that child is empty
|
|
5107
|
+
*/
|
|
5108
|
+
|
|
5109
|
+
var shouldResetQuoteOnBackspace = function shouldResetQuoteOnBackspace(editor) {
|
|
5110
|
+
var container = plateCore.getAbove(editor, {
|
|
5111
|
+
match: {
|
|
5112
|
+
type: Contentful.TEXT_CONTAINERS
|
|
5113
|
+
},
|
|
5114
|
+
mode: 'lowest'
|
|
5115
|
+
});
|
|
5116
|
+
|
|
5117
|
+
if (!container) {
|
|
5118
|
+
return false;
|
|
5119
|
+
}
|
|
5120
|
+
|
|
5121
|
+
if (!plateCore.isAncestorEmpty(editor, container[0])) {
|
|
5122
|
+
return false;
|
|
5123
|
+
}
|
|
5124
|
+
|
|
5125
|
+
var quote = plateCore.getBlockAbove(editor, {
|
|
5126
|
+
match: {
|
|
5127
|
+
type: Contentful.BLOCKS.QUOTE
|
|
5128
|
+
},
|
|
5129
|
+
mode: 'lowest'
|
|
5130
|
+
});
|
|
5131
|
+
|
|
5132
|
+
if (!quote) {
|
|
5133
|
+
return false;
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5136
|
+
if (plateCore.hasSingleChild(quote[0]) && plateCore.isLastChild(quote, container[1])) {
|
|
5137
|
+
return true;
|
|
5138
|
+
}
|
|
5139
|
+
|
|
5140
|
+
return false;
|
|
5141
|
+
};
|
|
5142
|
+
|
|
5066
5143
|
function toggleQuote(editor, logAction) {
|
|
5067
5144
|
if (!editor.selection) return;
|
|
5068
5145
|
var isActive = isBlockSelected(editor, Contentful.BLOCKS.QUOTE);
|
|
5069
|
-
logAction(isActive ? 'remove' : 'insert', {
|
|
5146
|
+
logAction == null ? void 0 : logAction(isActive ? 'remove' : 'insert', {
|
|
5070
5147
|
nodeType: Contentful.BLOCKS.QUOTE
|
|
5071
5148
|
});
|
|
5072
5149
|
slate.Editor.withoutNormalizing(editor, function () {
|
|
@@ -5099,6 +5176,54 @@ var onKeyDownToggleQuote = function onKeyDownToggleQuote(editor, plugin) {
|
|
|
5099
5176
|
};
|
|
5100
5177
|
};
|
|
5101
5178
|
|
|
5179
|
+
var withQuote = function withQuote(editor) {
|
|
5180
|
+
var insertFragment = editor.insertFragment;
|
|
5181
|
+
|
|
5182
|
+
editor.insertFragment = function (fragment) {
|
|
5183
|
+
var startingNode = fragment.length && fragment[0];
|
|
5184
|
+
var startsWithBlockquote = slate.Element.isElement(startingNode) && startingNode.type === Contentful.BLOCKS.QUOTE;
|
|
5185
|
+
var containerEntry = plateCore.getAbove(editor, {
|
|
5186
|
+
match: {
|
|
5187
|
+
type: Contentful.TEXT_CONTAINERS
|
|
5188
|
+
}
|
|
5189
|
+
});
|
|
5190
|
+
var containerIsNotEmpty = containerEntry && slate.Node.string(containerEntry[0]) !== '';
|
|
5191
|
+
|
|
5192
|
+
if (startsWithBlockquote && containerIsNotEmpty) {
|
|
5193
|
+
var selection = editor.selection;
|
|
5194
|
+
|
|
5195
|
+
var isContentSelected = function isContentSelected(selection) {
|
|
5196
|
+
return !!selection && slate.Point.compare(selection.anchor, selection.focus) !== 0;
|
|
5197
|
+
}; // if something is selected (highlighted) we replace the selection
|
|
5198
|
+
|
|
5199
|
+
|
|
5200
|
+
if (isContentSelected(selection)) {
|
|
5201
|
+
slate.Transforms["delete"](editor, {
|
|
5202
|
+
at: selection
|
|
5203
|
+
});
|
|
5204
|
+
} // get the cursor entry again, it may be different after deletion
|
|
5205
|
+
|
|
5206
|
+
|
|
5207
|
+
var _containerEntry = plateCore.getAbove(editor, {
|
|
5208
|
+
match: {
|
|
5209
|
+
type: Contentful.TEXT_CONTAINERS
|
|
5210
|
+
}
|
|
5211
|
+
});
|
|
5212
|
+
|
|
5213
|
+
var _containerIsNotEmpty = _containerEntry && slate.Node.string(_containerEntry[0]) !== '';
|
|
5214
|
+
|
|
5215
|
+
if (_containerIsNotEmpty) {
|
|
5216
|
+
slate.Transforms.insertNodes(editor, fragment);
|
|
5217
|
+
return;
|
|
5218
|
+
}
|
|
5219
|
+
}
|
|
5220
|
+
|
|
5221
|
+
insertFragment(fragment);
|
|
5222
|
+
};
|
|
5223
|
+
|
|
5224
|
+
return editor;
|
|
5225
|
+
};
|
|
5226
|
+
|
|
5102
5227
|
function createQuotePlugin() {
|
|
5103
5228
|
var _transform;
|
|
5104
5229
|
|
|
@@ -5118,57 +5243,18 @@ function createQuotePlugin() {
|
|
|
5118
5243
|
validNodeName: 'BLOCKQUOTE'
|
|
5119
5244
|
}]
|
|
5120
5245
|
},
|
|
5246
|
+
resetNode: [{
|
|
5247
|
+
// toggle off blockquote on backspace when it's empty
|
|
5248
|
+
hotkey: 'backspace',
|
|
5249
|
+
types: [Contentful.BLOCKS.QUOTE],
|
|
5250
|
+
predicate: shouldResetQuoteOnBackspace,
|
|
5251
|
+
onReset: toggleQuote
|
|
5252
|
+
}],
|
|
5121
5253
|
normalizer: [{
|
|
5122
5254
|
validChildren: Contentful.CONTAINERS[Contentful.BLOCKS.QUOTE],
|
|
5123
5255
|
transform: (_transform = {}, _transform[Contentful.BLOCKS.QUOTE] = transformUnwrap, _transform["default"] = transformLift, _transform)
|
|
5124
5256
|
}],
|
|
5125
|
-
withOverrides:
|
|
5126
|
-
var insertFragment = editor.insertFragment;
|
|
5127
|
-
|
|
5128
|
-
editor.insertFragment = function (fragment) {
|
|
5129
|
-
var startingNode = fragment.length && fragment[0];
|
|
5130
|
-
var startsWithBlockquote = slate.Element.isElement(startingNode) && startingNode.type === Contentful.BLOCKS.QUOTE;
|
|
5131
|
-
var containerEntry = plateCore.getAbove(editor, {
|
|
5132
|
-
match: {
|
|
5133
|
-
type: Contentful.TEXT_CONTAINERS
|
|
5134
|
-
}
|
|
5135
|
-
});
|
|
5136
|
-
var containerIsNotEmpty = containerEntry && slate.Node.string(containerEntry[0]) !== '';
|
|
5137
|
-
|
|
5138
|
-
if (startsWithBlockquote && containerIsNotEmpty) {
|
|
5139
|
-
var selection = editor.selection;
|
|
5140
|
-
|
|
5141
|
-
var isContentSelected = function isContentSelected(selection) {
|
|
5142
|
-
return !!selection && slate.Point.compare(selection.anchor, selection.focus) !== 0;
|
|
5143
|
-
}; // if something is selected (highlighted) we replace the selection
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
if (isContentSelected(selection)) {
|
|
5147
|
-
slate.Transforms["delete"](editor, {
|
|
5148
|
-
at: selection
|
|
5149
|
-
});
|
|
5150
|
-
} // get the cursor entry again, it may be different after deletion
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
var _containerEntry = plateCore.getAbove(editor, {
|
|
5154
|
-
match: {
|
|
5155
|
-
type: Contentful.TEXT_CONTAINERS
|
|
5156
|
-
}
|
|
5157
|
-
});
|
|
5158
|
-
|
|
5159
|
-
var _containerIsNotEmpty = _containerEntry && slate.Node.string(_containerEntry[0]) !== '';
|
|
5160
|
-
|
|
5161
|
-
if (_containerIsNotEmpty) {
|
|
5162
|
-
slate.Transforms.insertNodes(editor, fragment);
|
|
5163
|
-
return;
|
|
5164
|
-
}
|
|
5165
|
-
}
|
|
5166
|
-
|
|
5167
|
-
insertFragment(fragment);
|
|
5168
|
-
};
|
|
5169
|
-
|
|
5170
|
-
return editor;
|
|
5171
|
-
}
|
|
5257
|
+
withOverrides: withQuote
|
|
5172
5258
|
};
|
|
5173
5259
|
}
|
|
5174
5260
|
|
|
@@ -5843,11 +5929,11 @@ function createTextPlugin() {
|
|
|
5843
5929
|
deleteBackward = editor.deleteBackward;
|
|
5844
5930
|
|
|
5845
5931
|
editor.deleteBackward = function (unit) {
|
|
5846
|
-
|
|
5932
|
+
deleteFirstEmptyParagraph(unit, editor, deleteBackward);
|
|
5847
5933
|
};
|
|
5848
5934
|
|
|
5849
5935
|
editor.deleteForward = function (unit) {
|
|
5850
|
-
|
|
5936
|
+
deleteFirstEmptyParagraph(unit, editor, deleteForward);
|
|
5851
5937
|
};
|
|
5852
5938
|
|
|
5853
5939
|
return editor;
|
|
@@ -5855,7 +5941,7 @@ function createTextPlugin() {
|
|
|
5855
5941
|
};
|
|
5856
5942
|
}
|
|
5857
5943
|
|
|
5858
|
-
function
|
|
5944
|
+
function deleteFirstEmptyParagraph(unit, editor, deleteFunction) {
|
|
5859
5945
|
var entry = plateCore.getAbove(editor, {
|
|
5860
5946
|
match: {
|
|
5861
5947
|
type: Contentful.TEXT_CONTAINERS
|
|
@@ -5868,8 +5954,9 @@ function deleteEmptyParagraph(unit, editor, deleteFunction) {
|
|
|
5868
5954
|
var isTextEmpty = plateCore.isAncestorEmpty(editor, paragraphOrHeading); // We ignore paragraphs/headings that are children of ul, ol, blockquote, tables, etc
|
|
5869
5955
|
|
|
5870
5956
|
var isRootLevel = path.length === 1;
|
|
5957
|
+
var hasSiblings = editor.children.length > 1; // prevent editor from losing focus
|
|
5871
5958
|
|
|
5872
|
-
if (isTextEmpty && isRootLevel) {
|
|
5959
|
+
if (isTextEmpty && isRootLevel && plateCore.isFirstChild(path) && hasSiblings) {
|
|
5873
5960
|
slate.Transforms.removeNodes(editor, {
|
|
5874
5961
|
at: path
|
|
5875
5962
|
});
|
|
@@ -6120,7 +6207,7 @@ var getPlugins = function getPlugins(sdk, onAction) {
|
|
|
6120
6207
|
createTrailingParagraphPlugin(), createTextPlugin(), createVoidsPlugin(), createSelectOnBackspacePlugin(), // Pasting content from other sources
|
|
6121
6208
|
createPasteHTMLPlugin(), // These plugins drive their configurations from the list of plugins
|
|
6122
6209
|
// above. They MUST come last.
|
|
6123
|
-
createSoftBreakPlugin(), createExitBreakPlugin(), createNormalizerPlugin()];
|
|
6210
|
+
createSoftBreakPlugin(), createExitBreakPlugin(), createResetNodePlugin(), createNormalizerPlugin()];
|
|
6124
6211
|
};
|
|
6125
6212
|
var disableCorePlugins = {
|
|
6126
6213
|
// Temporarily until the upstream issue is fixed.
|