- posisble fix for auto translation bug in editor component;

This commit is contained in:
Vitalii Kiiko
2025-03-27 11:09:32 +01:00
parent eb126faf87
commit 645f03abb0
2 changed files with 43 additions and 38 deletions

View File

@@ -65,36 +65,39 @@ const Wysiwyg = ({
outlined outlined
onClick={handleCleanValue} onClick={handleCleanValue}
/> : null} /> : null}
<Controller <div translate="no">
name={fieldName} <Controller
control={control} name={fieldName}
defaultValue={defaultValue} control={control}
rules={config} defaultValue={defaultValue}
render={({ field, fieldState }) => ( rules={config}
<Editor render={({ field, fieldState }) => (
ref={editorRef} <Editor
id={field.name} ref={editorRef}
readOnly={disabled} id={field.name}
{...field} readOnly={disabled}
headerTemplate={header} {...field}
modules={{ headerTemplate={header}
clipboard: { modules={{
matchers: [ clipboard: {
[Node.ELEMENT_NODE, function (node, delta) { matchers: [
const ops = delta.ops.map((op) => ({ insert: op.insert })); [Node.ELEMENT_NODE, function (node, delta) {
return new Delta(ops) const ops = delta.ops.map((op) => ({ insert: op.insert }));
}] return new Delta(ops)
] }]
} ]
}} }
placeholder={placeholder} }}
onTextChange={(e) => field.onChange(e.htmlValue)} placeholder={placeholder}
style={{ height: 80 * rows }} onTextChange={(e) => field.onChange(e.htmlValue)}
className={classNames({ 'p-invalid': fieldState.invalid })} style={{ height: 80 * rows }}
/> className={classNames({ 'p-invalid': fieldState.invalid })}
)}/> />
)}/>
</div>
{infoText ? <small>{infoText}</small> : null} {infoText ? <small>{infoText}</small> : null}
</>) </>
)
} }
export default Wysiwyg; export default Wysiwyg;

View File

@@ -470,15 +470,17 @@ const BandoViewBeneficiario = () => {
<h2>{__('Non hai trovato la risposta che cercavi?', 'gepafin')}</h2> <h2>{__('Non hai trovato la risposta che cercavi?', 'gepafin')}</h2>
<div className="appForm__field"> <div className="appForm__field">
<label htmlFor="newQuestion">{__('Fai una domanda', 'gepafin')}</label> <label htmlFor="newQuestion">{__('Fai una domanda', 'gepafin')}</label>
<Editor <div translate="no">
id="newQuestion" <Editor
value={newQuestion} id="newQuestion"
placeholder={__('Digita qui la tua domanda', 'gepafin')} value={newQuestion}
headerTemplate={header} placeholder={__('Digita qui la tua domanda', 'gepafin')}
onTextChange={(e) => setNewQuestion(e.htmlValue)} headerTemplate={header}
style={{ height: 80 * 3 }} onTextChange={(e) => setNewQuestion(e.htmlValue)}
aria-describedby="newQuestion-help" style={{ height: 80 * 3 }}
/> aria-describedby="newQuestion-help"
/>
</div>
<small id="newQuestion-help"> <small id="newQuestion-help">
{__('Riceverai una notifica quando ti risponderemo', 'gepafin')} {__('Riceverai una notifica quando ti risponderemo', 'gepafin')}
</small> </small>