Skip to content

Commit

Permalink
Merge pull request plone#3682 from plone/unwrapp-list
Browse files Browse the repository at this point in the history
Remove wrapping ul or ol when deselecting list
  • Loading branch information
robgietema authored Sep 26, 2022
2 parents 24ee4ec + c27931e commit 5bf00a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugfix

- Remove wrapping ul or ol when deselecting list style @robgietema

### Internal

### Documentation
Expand Down
3 changes: 1 addition & 2 deletions packages/volto-slate/src/utils/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export const toggleBlock = (editor, format, allowedChildren) => {
const isListItem = isBlockActive(editor, slate.listItemType);
const isActive = isBlockActive(editor, format);
const wantsList = listTypes.includes(format);
// console.log({ isListItem, isActive, wantsList, format });

if (isListItem && !wantsList) {
toggleFormatAsListItem(editor, format);
Expand All @@ -223,7 +222,7 @@ export const toggleBlock = (editor, format, allowedChildren) => {
} else if (!isListItem && !wantsList) {
toggleFormat(editor, format, allowedChildren);
} else if (isListItem && wantsList && isActive) {
toggleFormatAsListItem(editor, slate.defaultBlockType);
clearFormatting(editor);
} else {
console.warn('toggleBlock case not covered, please examine:', {
wantsList,
Expand Down

0 comments on commit 5bf00a6

Please sign in to comment.