Skip to content

Commit

Permalink
fix: handle break in texteditorwidget
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Nov 28, 2023
1 parent 6b6d118 commit 1a59a08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ const TextEditorWidget = (props) => {
onChangeBlock(block, {
...data,
...retVal,
// TODO: also add html serialized value
});
}}
selected={selected}
Expand Down
65 changes: 0 additions & 65 deletions src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx

This file was deleted.

14 changes: 12 additions & 2 deletions src/config/Slate/handlers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Node } from 'slate';
import { Node, Editor } from 'slate';
import {
goDown,
goUp,
Expand Down Expand Up @@ -175,7 +175,17 @@ const handleBreak = (props) => {
if (!showToolbar) {
return breakInSimpleTextEditor(props);
} else {
return softBreak(props);
let ret = softBreak(props);
if (!ret) {
props.event.preventDefault();
props.event.stopPropagation();
Editor.insertNode(props.editor, {
type: 'paragraph',
children: [{ text: '' }],
});
ret = true;
}
return ret;
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/config/Widgets/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import CharCounterTextareaWidget from 'design-comuni-plone-theme/components/ItaliaTheme/manage/Widgets/CharCounterTextareaWidget';
import CharCounterTextWidget from 'design-comuni-plone-theme/components/ItaliaTheme/manage/Widgets/CharCounterTextWidget';
import { DatetimeWidget } from '@plone/volto/config/Widgets';
import { ArrayWidget, WysiwygWidget } from '@plone/volto/components';
import { ArrayWidget } from '@plone/volto/components';
import { MultilingualWidget } from 'volto-multilingual-widget';
import IconWidget from 'design-comuni-plone-theme/components/ItaliaTheme/manage/Widgets/IconWidget';
import SubsiteSocialLinksWidget from 'design-comuni-plone-theme/components/ItaliaTheme/manage/Widgets/SubsiteSocialLinksWidget';
Expand Down

0 comments on commit 1a59a08

Please sign in to comment.