mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
🐛 Fix bug with multi line texts on Edit Image Node
This commit is contained in:
parent
aaaa804f36
commit
b81d175145
|
@ -721,16 +721,19 @@ export class EditImage implements INodeType {
|
||||||
// Split the text in multiple lines
|
// Split the text in multiple lines
|
||||||
const lines: string[] = [];
|
const lines: string[] = [];
|
||||||
let currentLine = '';
|
let currentLine = '';
|
||||||
(text as string).split(' ').forEach((textPart: string) => {
|
(text as string).split('\n').forEach((textLine: string) => {
|
||||||
if (currentLine.length + textPart.length + 1 > lineLength) {
|
textLine.split(' ').forEach((textPart: string) => {
|
||||||
|
if ((currentLine.length + textPart.length + 1) > lineLength) {
|
||||||
lines.push(currentLine.trim());
|
lines.push(currentLine.trim());
|
||||||
currentLine = `${textPart} `;
|
currentLine = `${textPart} `;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentLine += `${textPart} `;
|
currentLine += `${textPart} `;
|
||||||
});
|
});
|
||||||
// Add the last line
|
|
||||||
lines.push(currentLine.trim());
|
lines.push(currentLine.trim());
|
||||||
|
currentLine = '';
|
||||||
|
});
|
||||||
|
|
||||||
// Combine the lines to a single string
|
// Combine the lines to a single string
|
||||||
const renderText = lines.join('\n');
|
const renderText = lines.join('\n');
|
||||||
|
|
Loading…
Reference in a new issue