Skip to content

Commit

Permalink
refactor: adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Dec 28, 2023
1 parent 2edcc82 commit ee4df6f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/conversion/find_and_replace_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,9 @@ export default function findAndReplaceText(
const replaceWith = censor.replace;
if (toReplace.match(/^\/.+\/[gimy]*$/)) {
const regex = createRegexFromText(toReplace, censor.flags);
if (!censor.inCodeBlocks)
text = replaceText(text, regex, replaceWith, settings);
else
text = text.replace(regex, replaceWith);
text = censor.inCodeBlocks ? text.replace(regex, replaceWith) : replaceText(text, regex, replaceWith, settings);
} else {
if (!censor.inCodeBlocks)
text = replaceText(text, toReplace, replaceWith, settings);
else
text = text.replace(toReplace, replaceWith);
text = censor.inCodeBlocks ? text.replace(toReplace, replaceWith) : replaceText(text, toReplace, replaceWith, settings);
}
}
}
Expand Down

0 comments on commit ee4df6f

Please sign in to comment.