From 8df21ef2459968960cf4356f0fc8d372b59bee86 Mon Sep 17 00:00:00 2001 From: Nikita Date: Mon, 9 Dec 2024 14:29:44 +0300 Subject: [PATCH] fixed JS error when inserting response to editor --- .eslintrc.js | 3 ++ src/editor/components/editor-styles/index.js | 30 +++++--------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5f6d1da..358d418 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,6 @@ module.exports = { extends: ['plugin:@wordpress/eslint-plugin/recommended'], + settings: { + 'import/core-modules': ['jquery', 'lodash'], + }, }; diff --git a/src/editor/components/editor-styles/index.js b/src/editor/components/editor-styles/index.js index b8d9239..db72e7f 100644 --- a/src/editor/components/editor-styles/index.js +++ b/src/editor/components/editor-styles/index.js @@ -1,15 +1,7 @@ -/** - * WordPress dependencies - */ -// eslint-disable-next-line import/no-extraneous-dependencies import { compact, map } from 'lodash'; -import { createPortal, useContext, useMemo } from '@wordpress/element'; -import { transformStyles, BlockList } from '@wordpress/block-editor'; -const { elementContext: __stableElementContext, __unstableElementContext } = - BlockList; - -const elementContext = __stableElementContext || __unstableElementContext; +import { transformStyles } from '@wordpress/block-editor'; +import { useMemo } from '@wordpress/element'; const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper'; @@ -35,19 +27,11 @@ export default function EditorStyles(props) { return resultStyles; }, [styles]); - const element = useContext(elementContext); - return ( - renderStyles && - element && - createPortal( -