Revert "fix: multi-line formatted correctly for sms (#21779)" (#21979)

This reverts commit 5e2f06cdea.
This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2025-06-23 16:00:43 +00:00
1 parent c490f084dc
commit fad488623f
2 files changed
+3 -6

No files matched your search

@@ -7,7 +7,7 @@ import type { TextEditorProps } from "./types";
describe("Editor", () => {
const defaultProps: TextEditorProps = {
getText: vi.fn(() => ""),
getText: vi.fn(),
setText: vi.fn(),
variables: ["name", "email"],
height: "200px",
@@ -220,7 +220,6 @@ function getSelectedNode(selection: RangeSelection) {
}
export default function ToolbarPlugin(props: TextEditorProps) {
const isInitialized = useRef(false);
const [editor] = useLexicalComposerContext();
const toolbarRef = useRef(null);
const [blockType, setBlockType] = useState("paragraph");
@@ -365,13 +364,11 @@ export default function ToolbarPlugin(props: TextEditorProps) {
}, [props.updateTemplate]);
useEffect(() => {
if (props.setFirstRender && !isInitialized.current) {
isInitialized.current = true;
if (props.setFirstRender) {
props.setFirstRender(false);
editor.update(() => {
const parser = new DOMParser();
const content = props.getText()?.replace(/\n/g, "<br>");
const dom = parser.parseFromString(content, "text/html");
const dom = parser.parseFromString(props.getText(), "text/html");
const nodes = $generateNodesFromDOM(editor, dom);