Open SkiBum326 opened 2 years ago
I used regular expressions to replace the problematic'/
' with '<br/>'
for line breaks.
Froalaeditor.RegisterCommand("codeBlock", {
title: "codeBlock",
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function () {
this.html.set(
this.html.get().replace(/ /g, "<br/> "),
);
},
});
when you select pasted vs code, and click codeBlock buttton, then it replace well like below image.
Expected behavior. If I copy code from a code editor (VS Code for example), I'm expecting the formatting (spacing, indentation, newlines) to be preserved.
Actual behavior. Pasting the code into Froala loses the newlines. In particular, it appears that a newline is replaced with a  .
Sample pasted code viewed in Froala HTML:
include#include
Steps to reproduce the problem. Copy a multi-line code snippet from VS Code or another code editor Paste into Froala Editor version. 4.0.10 for Angular / Typescript