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