Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the issue #4660 - shouldn't use a hook like function name for a variable #4693

Merged
merged 8 commits into from
May 23, 2023
1 change: 1 addition & 0 deletions news/4693.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the issue "shouldn't use a hook like function name for a variable" @Kaku-g
7 changes: 4 additions & 3 deletions packages/volto-slate/src/blocks/Text/SlashMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const PersistentSlashMenu = ({ editor }) => {

const [slashMenuSelected, setSlashMenuSelected] = React.useState(0);

const useAllowedBlocks = !isEmpty(allowedBlocks);
const hasAllowedBlocks = !isEmpty(allowedBlocks);
const slashCommand = data.plaintext
?.toLowerCase()
.trim()
Expand All @@ -119,7 +119,7 @@ const PersistentSlashMenu = ({ editor }) => {
const availableBlocks = React.useMemo(
() =>
filter(blocksConfig, (item) =>
useAllowedBlocks
hasAllowedBlocks
? allowedBlocks.includes(item.id)
: typeof item.restricted === 'function'
? !item.restricted({ properties, block: item })
Expand Down Expand Up @@ -150,7 +150,8 @@ const PersistentSlashMenu = ({ editor }) => {
intl,
properties,
slashCommand,
useAllowedBlocks,
hasAllowedBlocks
,
],
);

Expand Down