We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c0836c7 + e535588 commit d5658fcCopy full SHA for d5658fc
packages/mdx/src/smooth-code/splitter.tsx
@@ -89,9 +89,17 @@ export function splitByFocus(
89
>
90
): FocusedCode {
91
const { lines, ...mergedCodeRest } = mergedCode
92
- const focusByLineNumber = map(focus, focus =>
93
- mapFocusToLineNumbers(focus, lines)
94
- )
+
+ const focusByLineNumber = map(focus, (focus, key) => {
+ // we need to filter the lines that don't belong to the step
95
+ // for the case where focus == ""
96
+ const stepLines =
97
+ key === "prev"
98
+ ? lines.filter(l => l.move !== "enter")
99
+ : lines.filter(l => l.move !== "exit")
100
101
+ return mapFocusToLineNumbers(focus, stepLines)
102
+ })
103
104
const splittedLines = lines.map(line => {
105
const { tokens, ...rest } = line
0 commit comments