From 9d5d3a92f41100b76730837c39fece9a210e463e Mon Sep 17 00:00:00 2001 From: Hamza Date: Mon, 6 Oct 2025 11:54:05 +0200 Subject: [PATCH] fix(text-block): preserve line breaks on plain text Signed-off-by: Hamza --- src/ckeditor/smartpicker/InsertItemCommand.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ckeditor/smartpicker/InsertItemCommand.js b/src/ckeditor/smartpicker/InsertItemCommand.js index 34b3bf2e86..8051cf2bb6 100644 --- a/src/ckeditor/smartpicker/InsertItemCommand.js +++ b/src/ckeditor/smartpicker/InsertItemCommand.js @@ -46,9 +46,11 @@ export default class InsertItemCommand extends Command { const modelFragment = editor.data.toModel(viewFragment) editor.model.insertContent(modelFragment) } else { - const itemElement = writer.createElement('paragraph') - writer.insertText(item.content, itemElement) - editor.model.insertContent(itemElement) + const lines = item.content.split('\n') + const htmlContent = lines.map(line => `

${line}

`).join('') + const viewFragment = editor.data.processor.toView(htmlContent) + const modelFragment = editor.data.toModel(viewFragment) + editor.model.insertContent(modelFragment) } } else { const itemElement = writer.createElement('paragraph')