goobs-frontend 0.9.12 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "goobs-frontend",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "type": "module",
5
5
  "description": "A comprehensive React-based libary that extends the functionality of Material-UI",
6
6
  "license": "MIT",
@@ -56,7 +56,6 @@
56
56
  "@storybook/nextjs": "^8",
57
57
  "@storybook/react": "^8",
58
58
  "@storybook/test": "^8",
59
- "@types/node": "^22",
60
59
  "@types/react": "^19",
61
60
  "@types/react-dom": "^19",
62
61
  "@typescript-eslint/eslint-plugin": "^8",
@@ -1,11 +1,7 @@
1
1
  // File: src/components/RichTextEditor/MarkdownEditor/index.tsx
2
2
 
3
3
  import React, { useEffect, useState } from 'react'
4
- import {
5
- handleSwitchToRichText,
6
- handleBoldClick,
7
- handleItalicClick,
8
- } from '../utils/useMarkdownEditor'
4
+ import { handleBoldClick, handleItalicClick } from '../utils/useMarkdownEditor'
9
5
  import Toolbar from '../Toolbars/Editor'
10
6
  import { Box, Divider, TextField } from '@mui/material'
11
7
  import { RichTextEditorTypes } from '../utils/useRichtextEditor'
@@ -23,7 +19,6 @@ const MarkdownEditor: React.FC<MarkdownEditorProps> = ({
23
19
  setMarkdown,
24
20
  markdownMode,
25
21
  setMarkdownMode,
26
- setNewSlateValue,
27
22
  }) => {
28
23
  const [markdownValue, setMarkdownValue] = useState(markdown)
29
24
  const [selectedText, setSelectedText] = useState('')
@@ -48,16 +43,6 @@ const MarkdownEditor: React.FC<MarkdownEditorProps> = ({
48
43
  setMarkdown(newValue)
49
44
  }
50
45
 
51
- const handleSwitchMode = () => {
52
- // Mark the returned Promise as intentionally ignored:
53
- void handleSwitchToRichText(
54
- markdown,
55
- setNewSlateValue,
56
- setNewSlateValue,
57
- setMarkdownMode
58
- )
59
- }
60
-
61
46
  const handleSelect = (event: React.SyntheticEvent<HTMLDivElement>) => {
62
47
  const target = event.target as HTMLTextAreaElement
63
48
  setSelectedText(
@@ -59,9 +59,6 @@ const ComplexToolbar: React.FC<ComplexToolbarProps> = ({
59
59
  setMarkdown,
60
60
  markdownMode,
61
61
  setMarkdownMode,
62
- handleBoldClick,
63
- handleItalicClick,
64
- handleLinkClick,
65
62
  error,
66
63
  helperText,
67
64
  required,
@@ -3,6 +3,7 @@ import React, { useState, useCallback, useEffect } from 'react'
3
3
  import { Box } from '@mui/material'
4
4
  import { Descendant } from 'slate'
5
5
  import ComplexToolbar, { EditorMode } from './Toolbars/Complex'
6
+ import SimpleEditor from './SimpleEditor'
6
7
 
7
8
  export interface ComplexTextEditorProps {
8
9
  // For backward compatibility
@@ -108,6 +109,25 @@ const ComplexTextEditor: React.FC<ComplexTextEditorProps> = ({
108
109
  ...style,
109
110
  }
110
111
 
112
+ // If editorType is explicitly set to 'simple', only render the SimpleEditor without toolbar
113
+ if (editorType === 'simple') {
114
+ return (
115
+ <Box sx={combinedStyles}>
116
+ <SimpleEditor
117
+ value={simpleValue}
118
+ setValue={handleSimpleValueChange}
119
+ minRows={minRows}
120
+ label={label}
121
+ error={error}
122
+ helperText={helperText}
123
+ required={required}
124
+ style={style}
125
+ />
126
+ </Box>
127
+ )
128
+ }
129
+
130
+ // Otherwise, render the ComplexToolbar with mode toggling options
111
131
  return (
112
132
  <Box sx={combinedStyles}>
113
133
  <ComplexToolbar