@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.js
CHANGED
|
@@ -345,6 +345,8 @@ function getPointChild({
|
|
|
345
345
|
function getFirstBlock({
|
|
346
346
|
editor
|
|
347
347
|
}) {
|
|
348
|
+
if (editor.children.length === 0)
|
|
349
|
+
return [void 0, void 0];
|
|
348
350
|
const firstBlockPath = Editor.start(editor, []).path.at(0);
|
|
349
351
|
try {
|
|
350
352
|
return firstBlockPath !== void 0 ? Editor.node(editor, [firstBlockPath]) ?? [void 0, void 0] : [void 0, void 0];
|
|
@@ -355,6 +357,8 @@ function getFirstBlock({
|
|
|
355
357
|
function getLastBlock({
|
|
356
358
|
editor
|
|
357
359
|
}) {
|
|
360
|
+
if (editor.children.length === 0)
|
|
361
|
+
return [void 0, void 0];
|
|
358
362
|
const lastBlockPath = Editor.end(editor, []).path.at(0);
|
|
359
363
|
try {
|
|
360
364
|
return lastBlockPath !== void 0 ? Editor.node(editor, [lastBlockPath]) ?? [void 0, void 0] : [void 0, void 0];
|