Skip to content

Commit

Permalink
Merge branch 'main' into blocks-layout-navigator
Browse files Browse the repository at this point in the history
* main:
  Fix link in pop-up RelationsMatrix.jsx (#6085)
  Fix deselecting lists. (#6080)
  • Loading branch information
sneridagh committed Jun 12, 2024
2 parents f7a387c + c08e7a3 commit 13dea0c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/volto-slate/news/6080.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix removal of slate formatting applied to text when toggling the list buttons @robgietema
17 changes: 16 additions & 1 deletion packages/volto-slate/src/utils/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export const toggleBlock = (editor, format, allowedChildren) => {
} else if (!isListItem && !wantsList) {
toggleFormat(editor, format, allowedChildren);
} else if (isListItem && wantsList && isActive) {
clearFormatting(editor);
clearList(editor);
} else {
console.warn('toggleBlock case not covered, please examine:', {
wantsList,
Expand Down Expand Up @@ -298,6 +298,21 @@ export const switchListType = (editor, format) => {
Transforms.wrapNodes(editor, block);
};

/*
* Clear list by exploding the block
*/
export const clearList = (editor) => {
const { slate } = config.settings;
Transforms.unwrapNodes(editor, {
match: (n) => slate.listTypes.includes(n.type),
split: true,
});
Transforms.setNodes(editor, {
type: 'p',
});
Editor.normalize(editor);
};

export const changeBlockToList = (editor, format) => {
const { slate } = config.settings;
const [match] = Editor.nodes(editor, {
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/6085.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix link in pop-up in `RelationsMatrix.jsx`. @stevepiercy
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ const RelationsMatrix = (props) => {
<Popup
trigger={
<a
href="https://6.docs.plone.org/volto/recipes/widget.html#restricting-potential-targets"
href="https://6.docs.plone.org/volto/development/widget.html#widget-relation-field-label"
target="_blank"
rel="noopener noreferrer"
>
Expand Down

0 comments on commit 13dea0c

Please sign in to comment.