Skip to content

Commit 4e9f9ae

Browse files
committed
fix failing test
1 parent 3be3924 commit 4e9f9ae

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

packages/lexical-markdown/src/MarkdownImport.ts

-10
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
$getRoot,
2525
$getSelection,
2626
$isParagraphNode,
27-
$isTextNode,
2827
ElementNode,
2928
} from 'lexical';
3029

@@ -248,15 +247,6 @@ function $importBlocks(
248247
textMatchTransformers,
249248
);
250249

251-
// Go through every text node in the element node and handle escape characters
252-
for (const child of elementNode.getChildren()) {
253-
if ($isTextNode(child)) {
254-
const textContent = child.getTextContent();
255-
const escapedText = textContent.replace(/\\([*_`~])/g, '$1');
256-
child.setTextContent(escapedText);
257-
}
258-
}
259-
260250
// If no transformer found and we left with original paragraph node
261251
// can check if its content can be appended to the previous node
262252
// if it's a paragraph, quote or list

packages/lexical-markdown/src/importTextTransformers.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export function importTextTransformers(
9696
textMatchTransformers,
9797
);
9898
}
99-
return;
10099
} else if (foundTextMatch) {
101100
const result = importFoundTextMatchTransformer(
102101
textNode,
@@ -130,9 +129,10 @@ export function importTextTransformers(
130129
textMatchTransformers,
131130
);
132131
}
133-
return;
134-
} else {
135-
// Done!
136-
return;
137132
}
133+
134+
// Handle escape characters
135+
const textContent = textNode.getTextContent();
136+
const escapedText = textContent.replace(/\\([*_`~])/g, '$1');
137+
textNode.setTextContent(escapedText);
138138
}

0 commit comments

Comments
 (0)