@@ -23,10 +23,19 @@ const isHtmlContent = (content) => {
2323}
2424
2525// define your extension array
26- const extensions = ( availableNodesForVariable , availableState , acceptNodeOutputAsVariable , nodes , nodeData , isNodeInsideInteration ) => [
26+ const extensions = (
27+ availableNodesForVariable ,
28+ availableState ,
29+ acceptNodeOutputAsVariable ,
30+ nodes ,
31+ nodeData ,
32+ isNodeInsideInteration ,
33+ useMarkdown
34+ ) => [
2735 Markdown ,
2836 StarterKit . configure ( {
29- codeBlock : false
37+ codeBlock : false ,
38+ ...( ! useMarkdown && { link : false } )
3039 } ) ,
3140 CustomMention . configure ( {
3241 HTMLAttributes : {
@@ -103,6 +112,7 @@ const StyledEditorContent = styled(EditorContent)(({ theme, rows, disabled, isDa
103112} ) )
104113
105114export const RichInput = ( { inputParam, value, nodes, edges, nodeId, onChange, disabled = false } ) => {
115+ const useMarkdown = ! ! inputParam ?. rows
106116 const customization = useSelector ( ( state ) => state . customization )
107117 const isDarkMode = customization . isDarkMode
108118 const [ availableNodesForVariable , setAvailableNodesForVariable ] = useState ( [ ] )
@@ -135,15 +145,20 @@ export const RichInput = ({ inputParam, value, nodes, edges, nodeId, onChange, d
135145 inputParam ?. acceptNodeOutputAsVariable ,
136146 nodes ,
137147 nodeData ,
138- isNodeInsideInteration
148+ isNodeInsideInteration ,
149+ useMarkdown
139150 ) ,
140151 Placeholder . configure ( { placeholder : inputParam ?. placeholder } )
141152 ] ,
142153 content : '' ,
143154 onUpdate : ( { editor } ) => {
144- try {
145- onChange ( editor . getMarkdown ( ) )
146- } catch {
155+ if ( useMarkdown ) {
156+ try {
157+ onChange ( editor . getMarkdown ( ) )
158+ } catch {
159+ onChange ( editor . getHTML ( ) )
160+ }
161+ } else {
147162 onChange ( editor . getHTML ( ) )
148163 }
149164 } ,
@@ -155,7 +170,7 @@ export const RichInput = ({ inputParam, value, nodes, edges, nodeId, onChange, d
155170 // Load initial content after editor is ready, detecting HTML vs markdown
156171 useEffect ( ( ) => {
157172 if ( editor && value ) {
158- if ( isHtmlContent ( value ) ) {
173+ if ( ! useMarkdown || isHtmlContent ( value ) ) {
159174 editor . commands . setContent ( value )
160175 } else {
161176 editor . commands . setContent ( value , { contentType : 'markdown' } )
0 commit comments