File tree Expand file tree Collapse file tree
src/core/components/forms/textAreaRichText Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,15 +97,23 @@ export const TextAreaRichText: React.FC<ITextAreaRichTextProps> = (props) => {
9797 return ;
9898 }
9999
100- const handlers : Record < ValueFormat , ( ) => string > = {
100+ const handlers : Record < ValueFormat , ( ) => string | undefined > = {
101101 html : ( ) => editor . getHTML ( ) ,
102- markdown : ( ) => ( editor . storage . markdown as MarkdownStorage ) ?. getMarkdown ( ) ?? editor . getHTML ( ) ,
103102 text : ( ) => editor . getText ( ) ,
103+ markdown : ( ) => {
104+ const markdownStorage = editor . storage . markdown as MarkdownStorage | undefined ;
105+
106+ if ( markdownStorage ) {
107+ return markdownStorage . getMarkdown ( ) ;
108+ }
109+
110+ return editor . getHTML ( ) ;
111+ } ,
104112 } ;
105113
106- const getValue = handlers [ valueFormat ] ?? handlers . html ;
114+ const value = handlers [ valueFormat ] ( ) ?? editor . getHTML ( ) ;
107115
108- onChange ?.( getValue ( ) ) ;
116+ onChange ?.( value ) ;
109117 } ,
110118 } ) ;
111119
You can’t perform that action at this time.
0 commit comments