textarea replace editor

This commit is contained in:
hamid zarghami
2025-08-02 15:09:58 +03:30
parent 0b79f870ee
commit 2b19dc5a71
4 changed files with 23 additions and 18 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
"react-loading-skeleton": "^3.5.0", "react-loading-skeleton": "^3.5.0",
"react-multi-date-picker": "^4.5.2", "react-multi-date-picker": "^4.5.2",
"react-quill": "^2.0.0", "react-quill": "^2.0.0",
"react-quill-new": "^3.4.6", "react-quill-new": "^3.6.0",
"react-router-dom": "^7.5.2", "react-router-dom": "^7.5.2",
"react-spinners": "^0.17.0", "react-spinners": "^0.17.0",
"swiper": "^11.2.6", "swiper": "^11.2.6",
+5 -5
View File
@@ -99,8 +99,8 @@ importers:
specifier: ^2.0.0 specifier: ^2.0.0
version: 2.0.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0) version: 2.0.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
react-quill-new: react-quill-new:
specifier: ^3.4.6 specifier: ^3.6.0
version: 3.4.6(quill-delta@5.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) version: 3.6.0(quill-delta@5.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
react-router-dom: react-router-dom:
specifier: ^7.5.2 specifier: ^7.5.2
version: 7.6.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) version: 7.6.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -2640,8 +2640,8 @@ packages:
react: '>=16.8.0' react: '>=16.8.0'
react-dom: '>=16.8.0' react-dom: '>=16.8.0'
react-quill-new@3.4.6: react-quill-new@3.6.0:
resolution: {integrity: sha512-S2kEAwoKRo+xUIAEpb94fwiPe2QU3FmwIfQ+7Lkchf+izPa2nRu1mr4i4QxyVYg8TjHDryDUiOEYZuFEV45QFA==} resolution: {integrity: sha512-weU6YfB2+7Cujw5Hjgmi0aN/qJd3B6ADWrxgUJMp2MO3tEvKX5kfB0sg3P0UdOVfU0z8icsKFzlnEIpeW1mLhw==}
peerDependencies: peerDependencies:
quill-delta: ^5.1.0 quill-delta: ^5.1.0
react: ^16 || ^17 || ^18 || ^19 react: ^16 || ^17 || ^18 || ^19
@@ -5895,7 +5895,7 @@ snapshots:
react-dom: 19.1.0(react@19.1.0) react-dom: 19.1.0(react@19.1.0)
react-element-popper: 2.1.7(react-dom@19.1.0(react@19.1.0))(react@19.1.0) react-element-popper: 2.1.7(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
react-quill-new@3.4.6(quill-delta@5.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0): react-quill-new@3.6.0(quill-delta@5.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0):
dependencies: dependencies:
lodash-es: 4.17.21 lodash-es: 4.17.21
quill: 2.0.3 quill: 2.0.3
+5 -2
View File
@@ -3,24 +3,27 @@ import Error from './Error'
import { clx } from '../helpers/utils' import { clx } from '../helpers/utils'
type Props = { type Props = {
label: string, label?: string,
error_text?: string error_text?: string
} & InputHTMLAttributes<HTMLTextAreaElement> } & InputHTMLAttributes<HTMLTextAreaElement>
const Textarea: FC<Props> = (props: Props) => { const Textarea: FC<Props> = (props: Props) => {
return ( return (
<div className='w-full relative'> <div className='w-full relative'>
{
props.label &&
<label className='text-sm'> <label className='text-sm'>
{props.label} {props.label}
</label> </label>
}
<textarea <textarea
{...props}
className={clx( className={clx(
'border border-border leading-7 w-full rounded-xl px-4 py-3 min-h-[100px] mt-1 text-xs', 'border border-border leading-7 w-full rounded-xl px-4 py-3 min-h-[100px] mt-1 text-xs',
props.readOnly && 'bg-gray-100 border-0 text-description' props.readOnly && 'bg-gray-100 border-0 text-description'
)} )}
{...props}
> >
</textarea> </textarea>
@@ -2,10 +2,10 @@ import Button from '@/components/Button';
import { Add, AlignBottom, AlignHorizontally, AlignLeft, AlignRight, AlignTop, AlignVertically, Edit, Trash } from 'iconsax-react'; import { Add, AlignBottom, AlignHorizontally, AlignLeft, AlignRight, AlignTop, AlignVertically, Edit, Trash } from 'iconsax-react';
import { FC, useState, useEffect } from 'react' import { FC, useState, useEffect } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import ReactQuill from 'react-quill-new';
import { usePersonalityStore } from '../store/Store'; import { usePersonalityStore } from '../store/Store';
import ColorPicker from '@/components/ColorPicker'; import ColorPicker from '@/components/ColorPicker';
import { HorizontalAlignment, VerticalAlignment, ElementType } from '../types/Types'; import { HorizontalAlignment, VerticalAlignment, ElementType } from '../types/Types';
import Textarea from '@/components/Textarea';
const TextSidebar: FC = () => { const TextSidebar: FC = () => {
@@ -66,10 +66,6 @@ const TextSidebar: FC = () => {
} }
}, [selectedElement, isEditMode, data]); }, [selectedElement, isEditMode, data]);
const handleChange = (value: string) => {
setValue(value);
}
const handleAddText = () => { const handleAddText = () => {
if (value.trim()) { if (value.trim()) {
addTextToActiveItem({ addTextToActiveItem({
@@ -136,7 +132,7 @@ const TextSidebar: FC = () => {
</div> </div>
<div className='mt-8'> <div className='mt-8'>
<ReactQuill {/* <ReactQuill
modules={{ modules={{
toolbar: [ toolbar: [
[{ header: '1' }, { header: '2' }, { font: [] }], [{ header: '1' }, { header: '2' }, { font: [] }],
@@ -152,6 +148,12 @@ const TextSidebar: FC = () => {
onChange={handleChange} onChange={handleChange}
style={{ minHeight: '120px' }} style={{ minHeight: '120px' }}
className='text-sm' className='text-sm'
/> */}
<Textarea
placeholder={t('setting.text')}
value={value}
onChange={(e) => setValue(e.target.value)}
className='text-sm border border-border'
/> />
</div> </div>