Fix: textarea auto-height

This commit is contained in:
2024-06-03 01:33:42 +03:00
parent bfb2922a8b
commit b1d72fb313
8 changed files with 99 additions and 117 deletions

View File

@@ -1,10 +1,15 @@
export function parse(text: string): string[] {
import { TranslateData } from '../dto/translate_data.dto';
export function parse(text: string): TranslateData[] {
const replaced_text = text
.replace('/<[kK]{1}>/gm', '\n')
.replace(/(<[^>]*>|\/\/.*)/gm, '')
.replace(/\s*\n\s*/gm, '\n');
return replaced_text
const result = replaced_text
.split('\n')
.map((line) => line.trim())
.filter((line) => line.length > 0);
.filter((line) => line.length > 0)
.map((line) => ({ english_text: line, translated_text: '' }));
console.log(result);
return result;
}