testomatio-editor-blocks 0.4.28 → 0.4.29
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.
|
@@ -120,10 +120,12 @@ export function addStepsBlock(editor) {
|
|
|
120
120
|
let lastIndex = stepsHeadingIndex;
|
|
121
121
|
for (let i = stepsHeadingIndex + 1; i < allBlocks.length; i++) {
|
|
122
122
|
const b = allBlocks[i];
|
|
123
|
-
if (b.type === "testStep" || b.type === "snippet"
|
|
123
|
+
if (b.type === "testStep" || b.type === "snippet") {
|
|
124
124
|
lastIndex = i;
|
|
125
125
|
continue;
|
|
126
126
|
}
|
|
127
|
+
if (isEmptyParagraph(b))
|
|
128
|
+
continue;
|
|
127
129
|
break;
|
|
128
130
|
}
|
|
129
131
|
const inserted = editor.insertBlocks([emptyStep], allBlocks[lastIndex].id, "after");
|
|
@@ -300,6 +302,12 @@ export const stepBlock = createReactBlockSpec({
|
|
|
300
302
|
});
|
|
301
303
|
}, [editor, block.id, expectedResult]);
|
|
302
304
|
const handleInsertNextStep = useCallback(() => {
|
|
305
|
+
const allBlocks = editor.document;
|
|
306
|
+
const idx = allBlocks.findIndex((b) => b.id === block.id);
|
|
307
|
+
const next = idx >= 0 ? allBlocks[idx + 1] : null;
|
|
308
|
+
if (next && isEmptyParagraph(next)) {
|
|
309
|
+
editor.removeBlocks([next.id]);
|
|
310
|
+
}
|
|
303
311
|
editor.insertBlocks([
|
|
304
312
|
{
|
|
305
313
|
type: "testStep",
|
package/package.json
CHANGED
|
@@ -134,10 +134,11 @@ export function addStepsBlock(editor: {
|
|
|
134
134
|
let lastIndex = stepsHeadingIndex;
|
|
135
135
|
for (let i = stepsHeadingIndex + 1; i < allBlocks.length; i++) {
|
|
136
136
|
const b = allBlocks[i];
|
|
137
|
-
if (b.type === "testStep" || b.type === "snippet"
|
|
137
|
+
if (b.type === "testStep" || b.type === "snippet") {
|
|
138
138
|
lastIndex = i;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
|
+
if (isEmptyParagraph(b)) continue;
|
|
141
142
|
break;
|
|
142
143
|
}
|
|
143
144
|
const inserted = editor.insertBlocks([emptyStep], allBlocks[lastIndex].id, "after");
|
|
@@ -346,6 +347,12 @@ export const stepBlock = createReactBlockSpec(
|
|
|
346
347
|
);
|
|
347
348
|
|
|
348
349
|
const handleInsertNextStep = useCallback(() => {
|
|
350
|
+
const allBlocks = editor.document;
|
|
351
|
+
const idx = allBlocks.findIndex((b: any) => b.id === block.id);
|
|
352
|
+
const next = idx >= 0 ? allBlocks[idx + 1] : null;
|
|
353
|
+
if (next && isEmptyParagraph(next)) {
|
|
354
|
+
editor.removeBlocks([next.id]);
|
|
355
|
+
}
|
|
349
356
|
editor.insertBlocks(
|
|
350
357
|
[
|
|
351
358
|
{
|