Skip to content

Commit fad4886

Browse files
authored
Revert "fix: multi-line formatted correctly for sms (calcom#21779)" (calcom#21979)
This reverts commit 5e2f06c.
1 parent c490f08 commit fad4886

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

packages/ui/components/editor/Editor.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { TextEditorProps } from "./types";
77

88
describe("Editor", () => {
99
const defaultProps: TextEditorProps = {
10-
getText: vi.fn(() => ""),
10+
getText: vi.fn(),
1111
setText: vi.fn(),
1212
variables: ["name", "email"],
1313
height: "200px",

packages/ui/components/editor/plugins/ToolbarPlugin.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ function getSelectedNode(selection: RangeSelection) {
220220
}
221221

222222
export default function ToolbarPlugin(props: TextEditorProps) {
223-
const isInitialized = useRef(false);
224223
const [editor] = useLexicalComposerContext();
225224
const toolbarRef = useRef(null);
226225
const [blockType, setBlockType] = useState("paragraph");
@@ -365,13 +364,11 @@ export default function ToolbarPlugin(props: TextEditorProps) {
365364
}, [props.updateTemplate]);
366365

367366
useEffect(() => {
368-
if (props.setFirstRender && !isInitialized.current) {
369-
isInitialized.current = true;
367+
if (props.setFirstRender) {
370368
props.setFirstRender(false);
371369
editor.update(() => {
372370
const parser = new DOMParser();
373-
const content = props.getText()?.replace(/\n/g, "<br>");
374-
const dom = parser.parseFromString(content, "text/html");
371+
const dom = parser.parseFromString(props.getText(), "text/html");
375372

376373
const nodes = $generateNodesFromDOM(editor, dom);
377374

0 commit comments

Comments
 (0)