diff --git a/apps/frontend/src/components/new-launch/bold.text.tsx b/apps/frontend/src/components/new-launch/bold.text.tsx index 5f0f7662..d0478a81 100644 --- a/apps/frontend/src/components/new-launch/bold.text.tsx +++ b/apps/frontend/src/components/new-launch/bold.text.tsx @@ -75,9 +75,9 @@ export const BoldText: FC<{ currentValue: string; }> = ({ editor }) => { const mark = () => { - editor.commands.unsetUnderline(); - editor.commands.toggleBold(); - editor.commands.focus(); + editor?.commands?.unsetUnderline(); + editor?.commands?.toggleBold(); + editor?.commands?.focus(); }; return (
= ({ editor }) => { const bullet = () => { - editor.commands.toggleBulletList(); + editor?.commands?.toggleBulletList(); }; return (
{ // For example, toggle bold while removing underline - this.editor.commands.unsetUnderline(); - return this.editor.commands.toggleBold(); + this?.editor?.commands?.unsetUnderline(); + return this?.editor?.commands?.toggleBold(); }, }; }, @@ -78,8 +78,8 @@ const InterceptUnderlineShortcut = Extension.create({ return { 'Mod-u': () => { // For example, toggle bold while removing underline - this.editor.commands.unsetBold(); - return this.editor.commands.toggleUnderline(); + this?.editor?.commands?.unsetBold(); + return this?.editor?.commands?.toggleUnderline(); }, }; }, @@ -505,8 +505,8 @@ export const Editor: FC<{ const addText = useCallback( (emoji: string) => { - editorRef?.current?.editor.commands.insertContent(emoji); - editorRef?.current?.editor.commands.focus(); + editorRef?.current?.editor?.commands?.insertContent(emoji); + editorRef?.current?.editor?.commands?.focus(); }, [props.value, id] ); diff --git a/apps/frontend/src/components/new-launch/heading.component.tsx b/apps/frontend/src/components/new-launch/heading.component.tsx index f8338f34..ed117943 100644 --- a/apps/frontend/src/components/new-launch/heading.component.tsx +++ b/apps/frontend/src/components/new-launch/heading.component.tsx @@ -7,7 +7,7 @@ export const HeadingComponent: FC<{ currentValue: string; }> = ({ editor }) => { const setHeading = (level: number) => () => { - editor.commands.toggleHeading({ level }) + editor?.commands?.toggleHeading({ level }) }; return ( diff --git a/apps/frontend/src/components/new-launch/u.text.tsx b/apps/frontend/src/components/new-launch/u.text.tsx index 7c6d2a17..3c0315a0 100644 --- a/apps/frontend/src/components/new-launch/u.text.tsx +++ b/apps/frontend/src/components/new-launch/u.text.tsx @@ -75,9 +75,9 @@ export const UText: FC<{ currentValue: string; }> = ({ editor }) => { const mark = () => { - editor.commands.unsetBold(); - editor.commands.toggleUnderline(); - editor.commands.focus(); + editor?.commands?.unsetBold(); + editor?.commands?.toggleUnderline(); + editor?.commands?.focus(); }; return (
{ - editor?.commands.insertContent("\n\n" + val); - editor?.commands.focus(); + editor?.commands?.insertContent("\n\n" + val); + editor?.commands?.focus(); setShowModal(false); }; return (