Skip to content

Commit ccec39a

Browse files
committed
Update add-preview.js
1 parent 89274be commit ccec39a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tasks/add-preview.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ const getFullTaskList = (options) => {
123123
}
124124
},
125125
task: async () => {
126+
let thisPreviewPosition = ctx.previewPosition;
127+
126128
if (ctx.previewPositionType === 'percentage') {
127129
const childrenLength = updatedLexical.root.children.length;
128130
const percentageAsDecimal = ctx.previewPosition / 100;
129-
ctx.previewPosition = Math.floor(childrenLength * percentageAsDecimal) + 1;
131+
thisPreviewPosition = Math.floor(childrenLength * percentageAsDecimal) + 1;
130132
}
131133

132-
updatedLexical.root.children.splice(ctx.previewPosition, 0, {type: 'paywall', version: 1});
134+
updatedLexical.root.children.splice(thisPreviewPosition, 0, {type: 'paywall', version: 1});
133135

134136
updatedLexical = JSON.stringify(updatedLexical, null, 2);
135137

0 commit comments

Comments
 (0)