Skip to content

Commit

Permalink
default to previous language
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBatdorf committed Aug 27, 2022
1 parent 8177535 commit 8923d8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/editor/components/BlockFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import blockConfig from '../../block.json';
import { blockIcon } from '../../icons';
import { useLanguageStore } from '../../state/language';
import { getMainAlias } from '../../util/languages';

export const BlockFilter = (
Expand All @@ -18,6 +19,7 @@ export const BlockFilter = (
) => {
// eslint-disable-next-line
const { attributes, clientId } = props;
const { previousLanguage } = useLanguageStore();
const showMenu = useSelect(
(select) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down Expand Up @@ -45,7 +47,7 @@ export const BlockFilter = (
// eslint-disable-next-line
code: attributes?.content ? decode(attributes.content) : undefined,
// eslint-disable-next-line
language: getMainAlias(attributes?.language) ?? 'javascript',
language: getMainAlias(attributes?.language) ?? previousLanguage,
});
replaceBlock(clientId, [blockData]);
};
Expand Down

0 comments on commit 8923d8c

Please sign in to comment.