From 3df170fe0aba0b38a22f2dd1f9e11ae788e32eba Mon Sep 17 00:00:00 2001 From: AlekseyManetov Date: Wed, 11 Sep 2024 12:33:33 +0200 Subject: [PATCH] * [RTE]: add `maxLength` prop * [RTE]: fixed serialization of empty lines in HTML, now
html tag is used --- changelog.md | 2 ++ uui-editor/src/SlateEditor.tsx | 4 +++- uui-editor/src/serialization.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index e1629801a7..8e18042998 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,8 @@ * [PickerInput]: fixed issue with clearing disabled (non-checkable) rows using backspace. * [DataTableHeaderCell]: Fixed text selection issue that occurred when clicking on resize, without preventing the event from bubbling. * [useLazyTree]: Fixed an issue where API calls were skipped during very fast scrolling. +* [RTE]: add `maxLength` prop +* [RTE]: fixed serialization of empty lines in HTML, now
html tag is used # 5.9.1 - 28.08.2024 diff --git a/uui-editor/src/SlateEditor.tsx b/uui-editor/src/SlateEditor.tsx index a7bbff57f6..96e9e983c3 100644 --- a/uui-editor/src/SlateEditor.tsx +++ b/uui-editor/src/SlateEditor.tsx @@ -18,11 +18,12 @@ import css from './SlateEditor.module.scss'; import { useFocusEvents } from './plugins/eventEditorPlugin'; import { isEditorValueEmpty } from './helpers'; import { getMigratedPlateValue, isPlateValue } from './migrations'; +import { PlateProps } from '@udecode/plate-core'; export interface PlateEditorProps extends IEditable, IHasCX, - IHasRawProps> { + IHasRawProps>, Pick { plugins: PlatePlugin[]; isReadonly?: boolean; autoFocus?: boolean; @@ -148,6 +149,7 @@ export const SlateEditor = memo(forwardRef((pr plugins={ plugins } onChange={ onChange } editorRef={ editorRef } + maxLength={ props.maxLength } >
{ const editor = createTempEditor(htmlSerializationsWorkingPlugins); return (v: EditorValue) => { const value = initializeEditor(editor, v); - return serializeHtml(editor, { nodes: value }); + return serializeHtml(editor, { nodes: value, convertNewLinesToHtmlBr: true }); }; } else { const editor = createTempEditor(mdSerializationsWorkingPlugins);