editor: preserve all whitespaces while setting content (#1978)

Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
This commit is contained in:
Muhammad Ali
2023-02-23 16:34:46 +05:00
committed by GitHub
parent 648eac5555
commit 87c7eccee4
3 changed files with 6 additions and 3 deletions

View File

@@ -115,7 +115,9 @@ export function useEditorController(update: () => void): EditorController {
htmlContentRef.current = value;
if (!editor) break;
const { from, to } = editor.state.selection;
editor?.commands.setContent(htmlContentRef.current, false);
editor?.commands.setContent(htmlContentRef.current, false, {
preserveWhitespace: "full"
});
editor.commands.setTextSelection({
from,
to