feat: allows soft breaks in rich text
This commit is contained in:
@@ -118,7 +118,13 @@ const RichText: React.FC<Props> = (props) => {
|
||||
].filter(Boolean).join(' ');
|
||||
|
||||
const editor = useMemo(() => {
|
||||
let CreatedEditor = withHTML(withHistory(withReact(createEditor())));
|
||||
let CreatedEditor = withHTML(
|
||||
withHistory(
|
||||
withReact(
|
||||
createEditor(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
CreatedEditor = enablePlugins(CreatedEditor, elements);
|
||||
CreatedEditor = enablePlugins(CreatedEditor, leaves);
|
||||
@@ -228,6 +234,11 @@ const RichText: React.FC<Props> = (props) => {
|
||||
readOnly={readOnly}
|
||||
onBlur={onBlur}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'Enter' && event.shiftKey) {
|
||||
event.preventDefault();
|
||||
editor.insertText('\n');
|
||||
}
|
||||
|
||||
Object.keys(hotkeys).forEach((hotkey) => {
|
||||
if (isHotkey(hotkey, event as any)) {
|
||||
event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user