Replace whitespace in JSX text nodes with spaces

master
Vitaliy Filippov 2021-10-12 22:47:59 +03:00
parent 8eb8527f94
commit 4d0fe4874e
2 changed files with 3 additions and 2 deletions

View File

@ -197,7 +197,8 @@ module.exports = function(babel)
let ru = getRegexp(state); let ru = getRegexp(state);
if (ru.exec(path.node.value)) if (ru.exec(path.node.value))
{ {
const [ lwhite, text, rwhite ] = splitWhite(path.node.value); let [ lwhite, text, rwhite ] = splitWhite(path.node.value);
text = text.replace(/\s{2,}|[\n\r\t]/g, ' ');
addImport(path); addImport(path);
addString(path, text); addString(path, text);
const repl = []; const repl = [];

View File

@ -1,6 +1,6 @@
{ {
"name": "babel-plugin-react-translate", "name": "babel-plugin-react-translate",
"version": "1.0.3", "version": "1.0.4",
"description": "Babel-based JS/JSX auto-translator for Russian language", "description": "Babel-based JS/JSX auto-translator for Russian language",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {