π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: prevent command crash
Nevo David0165d73ce979
diff --git a/apps/frontend/src/components/new-launch/bold.text.tsx b/apps/frontend/src/components/new-launch/bold.text.tsxindex 5f0f76626..d0478a819 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 (<divdiff --git a/apps/frontend/src/components/new-launch/bullets.component.tsx b/apps/frontend/src/components/new-launch/bullets.component.tsxindex 7dfcf2837..454162e19 100644--- a/apps/frontend/src/components/new-launch/bullets.component.tsx+++ b/apps/frontend/src/components/new-launch/bullets.component.tsx@@ -7,7 +7,7 @@ export const Bullets: FC<{currentValue: string;}> = ({ editor }) => {const bullet = () => {- editor.commands.toggleBulletList();+ editor?.commands?.toggleBulletList();};return (<divdiff --git a/apps/frontend/src/components/new-launch/editor.tsx b/apps/frontend/src/components/new-launch/editor.tsxindex 017d7b4cc..818012d25 100644--- a/apps/frontend/src/components/new-launch/editor.tsx+++ b/apps/frontend/src/components/new-launch/editor.tsx@@ -64,8 +64,8 @@ const InterceptBoldShortcut = Extension.create({return {'Mod-b': () => {// 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.tsxindex f8338f346..ed117943f 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.tsxindex 7c6d2a17e..3c0315a0a 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 (<divdiff --git a/apps/frontend/src/components/signature.tsx b/apps/frontend/src/components/signature.tsxindex bb78de8e6..1148ec1fd 100644--- a/apps/frontend/src/components/signature.tsx+++ b/apps/frontend/src/components/signature.tsx@@ -10,8 +10,8 @@ export const SignatureBox: FC<{setShowModal(true);}, [showModal]);const appendValue = (val: string) => {- editor?.commands.insertContent("\n\n" + val);- editor?.commands.focus();+ editor?.commands?.insertContent("\n\n" + val);+ editor?.commands?.focus();setShowModal(false);};return (