@portabletext/editor 1.50.5 → 1.50.6
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/lib/index.cjs +4 -0
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/internal-utils/slate-utils.ts +8 -0
package/lib/index.cjs
CHANGED
|
@@ -316,6 +316,8 @@ function getPointChild({
|
|
|
316
316
|
function getFirstBlock({
|
|
317
317
|
editor
|
|
318
318
|
}) {
|
|
319
|
+
if (editor.children.length === 0)
|
|
320
|
+
return [void 0, void 0];
|
|
319
321
|
const firstBlockPath = slate.Editor.start(editor, []).path.at(0);
|
|
320
322
|
try {
|
|
321
323
|
return firstBlockPath !== void 0 ? slate.Editor.node(editor, [firstBlockPath]) ?? [void 0, void 0] : [void 0, void 0];
|
|
@@ -326,6 +328,8 @@ function getFirstBlock({
|
|
|
326
328
|
function getLastBlock({
|
|
327
329
|
editor
|
|
328
330
|
}) {
|
|
331
|
+
if (editor.children.length === 0)
|
|
332
|
+
return [void 0, void 0];
|
|
329
333
|
const lastBlockPath = slate.Editor.end(editor, []).path.at(0);
|
|
330
334
|
try {
|
|
331
335
|
return lastBlockPath !== void 0 ? slate.Editor.node(editor, [lastBlockPath]) ?? [void 0, void 0] : [void 0, void 0];
|