Skip to content

Commit

Permalink
fix the richTextEditor output in case on no data save
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish8689 committed Jan 22, 2025
1 parent 51bdaac commit ff1be5c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export const ModalWithMarkdownEditor: FunctionComponent<ModalWithMarkdownEditorP
if (markdownRef.current) {
setIsLoading(true);
try {
const content =
markdownRef.current?.getEditorContent?.()?.trim() ?? '';
const content = markdownRef.current?.getEditorContent?.()?.trim();
await onSave?.(content);
} catch (error) {
showErrorToast(error as AxiosError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ export interface RichTextEditorProp extends HTMLAttributes<HTMLDivElement> {
}

export interface EditorContentRef {
getEditorContent: () => string;
getEditorContent: () => string | undefined;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const RichTextEditor = forwardRef<EditorContentRef, RichTextEditorProp>(
const htmlContent = editorRef.current?.editor?.getHTML() ?? '';
const backendFormat = formatContent(htmlContent, 'server');

return backendFormat;
return backendFormat === '<p></p>' ? undefined : backendFormat;
},
}));

Expand Down

0 comments on commit ff1be5c

Please sign in to comment.