From 7ad7e45d07a2f96ad939fe9e9c2d73668c7bfb43 Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Fri, 22 Nov 2024 14:11:33 +0100 Subject: [PATCH] Remove root unlock from email editor [MAILPOET-6319] --- packages/js/email-editor/src/lock-unlock.js | 10 ---------- .../js/email-editor/src/private-apis/index.ts | 16 +++++++++------- 2 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 packages/js/email-editor/src/lock-unlock.js diff --git a/packages/js/email-editor/src/lock-unlock.js b/packages/js/email-editor/src/lock-unlock.js deleted file mode 100644 index 20bb58e012..0000000000 --- a/packages/js/email-editor/src/lock-unlock.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * WordPress dependencies - */ -import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; - -export const { lock, unlock } = - __dangerousOptInToUnstableAPIsOnlyForCoreModules( - 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', - '@wordpress/edit-post' // The module name must be in the list of allowed, so for now I used the package name of the post editor - ); diff --git a/packages/js/email-editor/src/private-apis/index.ts b/packages/js/email-editor/src/private-apis/index.ts index 10b1a782a1..6169cce68b 100644 --- a/packages/js/email-editor/src/private-apis/index.ts +++ b/packages/js/email-editor/src/private-apis/index.ts @@ -1,22 +1,24 @@ /** * WordPress dependencies */ +import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; import { + // @ts-expect-error No types for privateApis. privateApis as blockEditorPrivateApi, - // @ts-expect-error No types for this exist yet. + // @ts-expect-error No types for privateApis. privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { privateApis as componentsPrivateApis } from '@wordpress/components'; import { store as coreStore } from '@wordpress/core-data'; -/** - * Internal dependencies - */ -import { unlock } from './lock-unlock'; +const { unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules( + 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', + '@wordpress/edit-post' // The module name must be in the list of allowed, so for now I used the package name of the post editor +); /** * We use the experimental block canvas to render the block editor's canvas. - * Currently this is needed because we use contentRef property which is not available in the stable BlockCanvas + * Currently, this is needed because we use contentRef property which is not available in the stable BlockCanvas * The property is used for handling clicks for selecting block to edit and to display modal for switching between email and template. */ const { ExperimentalBlockCanvas: BlockCanvas } = unlock( @@ -25,7 +27,7 @@ const { ExperimentalBlockCanvas: BlockCanvas } = unlock( /** * Tabs are used in the right sidebar header to switch between Email and Block settings. - * Tabs should be close to stablization https://github.com/WordPress/gutenberg/pull/61072 + * Tabs should be close to stabilization https://github.com/WordPress/gutenberg/pull/61072 */ const { Tabs } = unlock( componentsPrivateApis );