Skip to content

Commit

Permalink
* [RTE]: add maxLength prop
Browse files Browse the repository at this point in the history
* [RTE]: fixed serialization of empty lines in HTML, now </br> html tag is used
  • Loading branch information
AlekseyManetov committed Sep 11, 2024
1 parent 1a7515b commit 3df170f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 </br> html tag is used


# 5.9.1 - 28.08.2024
Expand Down
4 changes: 3 additions & 1 deletion uui-editor/src/SlateEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<EditorValue>,
IHasCX,
IHasRawProps<React.HTMLAttributes<HTMLDivElement>> {
IHasRawProps<React.HTMLAttributes<HTMLDivElement>>, Pick<PlateProps, 'maxLength'> {
plugins: PlatePlugin[];
isReadonly?: boolean;
autoFocus?: boolean;
Expand Down Expand Up @@ -148,6 +149,7 @@ export const SlateEditor = memo(forwardRef<HTMLDivElement, PlateEditorProps>((pr
plugins={ plugins }
onChange={ onChange }
editorRef={ editorRef }
maxLength={ props.maxLength }
>
<div
ref={ composedRef }
Expand Down
2 changes: 1 addition & 1 deletion uui-editor/src/serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const createSerializer = (type: SerializerType = 'html') => {
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);
Expand Down

0 comments on commit 3df170f

Please sign in to comment.