From 413b18714cc97496c46642ae05bdeb45743ebff4 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 14:01:22 +0530 Subject: [PATCH 1/7] Update @wordpress/editor to the latest version --- projects/js-packages/publicize-components/package.json | 2 +- projects/packages/videopress/package.json | 2 +- projects/plugins/jetpack/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json index 141d9c3cc17c2..51e89656fb4db 100644 --- a/projects/js-packages/publicize-components/package.json +++ b/projects/js-packages/publicize-components/package.json @@ -37,7 +37,7 @@ "@wordpress/dataviews": "4.7.0", "@wordpress/date": "5.11.0", "@wordpress/edit-post": "8.11.0", - "@wordpress/editor": "14.11.0", + "@wordpress/editor": "14.12.0", "@wordpress/element": "6.11.0", "@wordpress/hooks": "4.11.0", "@wordpress/html-entities": "4.11.0", diff --git a/projects/packages/videopress/package.json b/projects/packages/videopress/package.json index 4609e48f0b907..d40cb213c75ff 100644 --- a/projects/packages/videopress/package.json +++ b/projects/packages/videopress/package.json @@ -74,7 +74,7 @@ "@wordpress/data": "10.11.0", "@wordpress/date": "5.11.0", "@wordpress/dom-ready": "4.11.0", - "@wordpress/editor": "14.11.0", + "@wordpress/editor": "14.12.0", "@wordpress/element": "6.11.0", "@wordpress/html-entities": "4.11.0", "@wordpress/i18n": "5.11.0", diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 7f2a0d47e90ba..74d5fe476bd71 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -144,7 +144,7 @@ "@wordpress/components": "28.11.0", "@wordpress/core-data": "7.11.0", "@wordpress/dom-ready": "4.11.0", - "@wordpress/editor": "14.11.0", + "@wordpress/editor": "14.12.0", "@wordpress/escape-html": "3.11.0", "@wordpress/keycodes": "4.11.0", "@wordpress/notices": "5.11.0", From b926d99035ef9b6300c7483da3ff02d70e7d687d Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 14:02:04 +0530 Subject: [PATCH 2/7] Remove @types/wordpress__editor as it's no longer needed --- projects/js-packages/publicize-components/package.json | 1 - projects/plugins/jetpack/package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/projects/js-packages/publicize-components/package.json b/projects/js-packages/publicize-components/package.json index 51e89656fb4db..22ebf063d039f 100644 --- a/projects/js-packages/publicize-components/package.json +++ b/projects/js-packages/publicize-components/package.json @@ -63,7 +63,6 @@ "@testing-library/user-event": "14.5.2", "@types/jest": "29.5.12", "@types/react": "18.3.12", - "@types/wordpress__editor": "13.6.8", "@wordpress/babel-plugin-import-jsx-pragma": "5.11.0", "babel-jest": "29.4.3", "jest": "29.7.0", diff --git a/projects/plugins/jetpack/package.json b/projects/plugins/jetpack/package.json index 74d5fe476bd71..339b51fc5d3b3 100644 --- a/projects/plugins/jetpack/package.json +++ b/projects/plugins/jetpack/package.json @@ -136,7 +136,6 @@ "@types/jest": "29.5.12", "@types/react": "18.3.12", "@types/wordpress__block-editor": "11.5.15", - "@types/wordpress__editor": "13.6.8", "@wordpress/api-fetch": "7.11.0", "@wordpress/babel-plugin-import-jsx-pragma": "5.11.0", "@wordpress/blob": "4.11.0", From 7c48e9107cfcfec916c68e7387fb88da0d3646b1 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 14:02:08 +0530 Subject: [PATCH 3/7] Update pnpm-lock.yaml --- pnpm-lock.yaml | 62 +++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 49 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 027417c51a9a9..4ca7273c48889 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1039,8 +1039,8 @@ importers: specifier: 8.11.0 version: 8.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/editor': - specifier: 14.11.0 - version: 14.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.12.0 + version: 14.12.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/element': specifier: 6.11.0 version: 6.11.0 @@ -1111,9 +1111,6 @@ importers: '@types/react': specifier: 18.3.12 version: 18.3.12 - '@types/wordpress__editor': - specifier: 13.6.8 - version: 13.6.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/babel-plugin-import-jsx-pragma': specifier: 5.11.0 version: 5.11.0(@babel/core@7.26.0) @@ -2897,8 +2894,8 @@ importers: specifier: 4.11.0 version: 4.11.0 '@wordpress/editor': - specifier: 14.11.0 - version: 14.11.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.12.0 + version: 14.12.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/element': specifier: 6.11.0 version: 6.11.0 @@ -4051,9 +4048,6 @@ importers: '@types/wordpress__block-editor': specifier: 11.5.15 version: 11.5.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/wordpress__editor': - specifier: 13.6.8 - version: 13.6.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/api-fetch': specifier: 7.11.0 version: 7.11.0 @@ -4076,8 +4070,8 @@ importers: specifier: 4.11.0 version: 4.11.0 '@wordpress/editor': - specifier: 14.11.0 - version: 14.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: 14.12.0 + version: 14.12.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/escape-html': specifier: 3.11.0 version: 3.11.0 @@ -7457,13 +7451,6 @@ packages: '@types/wordpress__blocks@12.5.14': resolution: {integrity: sha512-eXEnCRKYu+39KEJ/OYpoYxWTATxI+eJHd+meMGZ14hYydFtxA0Y8M7zJT8D8f4klBo8wINLvP7zrO8vYrjWjPQ==} - '@types/wordpress__editor@13.6.8': - resolution: {integrity: sha512-YTOfNUtqzdtXt0e8AMZvcWzXuPQ3vyGyHyo2/VgD8UEaB6cZDWWpYAFSBWvLCYAR8IV38+hvMr9SszoIXPZhpg==} - - '@types/wordpress__media-utils@5.8.0': - resolution: {integrity: sha512-VVT45fQciZz5dPMM4ERy8W0BpmvqoLsEdXglXki1xj8FEr86IjhIN7fwsZRz0hm0onmMCUSUeJFlm/UhUA5hZA==} - deprecated: This is a stub types definition. @wordpress/media-utils provides its own type definitions, so you do not need this installed. - '@types/wordpress__shortcode@2.3.6': resolution: {integrity: sha512-H8BVov7QWyLLoxCaI9QyZVC4zTi1mFkZ+eEKiXBCFlaJ0XV8UVfQk+cAetqD5mWOeWv2d4b8uzzyn0TTQ/ep2g==} @@ -7784,8 +7771,8 @@ packages: react: ^18.0.0 react-dom: ^18.0.0 - '@wordpress/editor@14.11.0': - resolution: {integrity: sha512-XNwBZ54yQrZszum7OW4wAbFFs7lKlwTkj9ILnbc+a6fuCE9Pg6On/vbtDmRJVXi0TrRb+mY2VhNrsXJybdleQQ==} + '@wordpress/editor@14.12.0': + resolution: {integrity: sha512-HZ6iJn7hQ+o2YgjSR0nq6DUm4EcrGuZSu9IW2pT9XGe5oq5qCzen1jSBd5Mh6jk/HWwK8kuz6sKGLlTwuexyHA==} engines: {node: '>=18.12.0', npm: '>=8.19.2'} peerDependencies: react: ^18.0.0 @@ -17441,29 +17428,6 @@ snapshots: - react-dom - supports-color - '@types/wordpress__editor@13.6.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@types/react': 18.3.12 - '@types/wordpress__block-editor': 11.5.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/wordpress__blocks': 12.5.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/wordpress__media-utils': 5.8.0 - '@wordpress/components': 28.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/core-data': 7.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@wordpress/data': 10.11.0(react@18.3.1) - '@wordpress/element': 6.11.0 - transitivePeerDependencies: - - '@emotion/is-prop-valid' - - '@types/react-dom' - - bufferutil - - react - - react-dom - - supports-color - - utf-8-validate - - '@types/wordpress__media-utils@5.8.0': - dependencies: - '@wordpress/media-utils': 5.11.0 - '@types/wordpress__shortcode@2.3.6': {} '@types/yargs-parser@21.0.3': {} @@ -18614,7 +18578,7 @@ snapshots: '@wordpress/data': 10.11.0(react@18.3.1) '@wordpress/deprecated': 4.11.0 '@wordpress/dom': 4.11.0 - '@wordpress/editor': 14.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@wordpress/editor': 14.12.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/element': 6.11.0 '@wordpress/hooks': 4.11.0 '@wordpress/html-entities': 4.11.0 @@ -18658,7 +18622,7 @@ snapshots: '@wordpress/data': 10.11.0(react@18.3.1) '@wordpress/deprecated': 4.11.0 '@wordpress/dom': 4.11.0 - '@wordpress/editor': 14.11.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@wordpress/editor': 14.12.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/element': 6.11.0 '@wordpress/hooks': 4.11.0 '@wordpress/html-entities': 4.11.0 @@ -18686,7 +18650,7 @@ snapshots: - supports-color - utf-8-validate - '@wordpress/editor@14.11.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@wordpress/editor@14.12.0(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.25.7 '@wordpress/a11y': 4.11.0 @@ -18745,7 +18709,7 @@ snapshots: - supports-color - utf-8-validate - '@wordpress/editor@14.11.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@wordpress/editor@14.12.0(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.25.7 '@wordpress/a11y': 4.11.0 @@ -18804,7 +18768,7 @@ snapshots: - supports-color - utf-8-validate - '@wordpress/editor@14.11.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@wordpress/editor@14.12.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.25.7 '@wordpress/a11y': 4.11.0 From 5fb15b527c1a0a9b03d70684a2635adb24e7f9c1 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 14:02:27 +0530 Subject: [PATCH 4/7] Fix TS errors following the update --- .../src/components/form/use-auto-save-and-redirect.ts | 1 - .../src/components/post-publish-share-status/index.tsx | 1 - .../src/components/share-buttons/useShareButtonText.ts | 5 ++--- .../src/components/share-status/retry.tsx | 1 - .../src/components/social-previews/bluesky.tsx | 1 - .../src/hooks/use-post-can-use-sig/index.ts | 4 +--- .../src/hooks/use-post-pre-publish-value/index.ts | 6 +----- .../extensions/blocks/voice-to-content/edit.tsx | 6 ++---- .../components/ai-assistant-plugin-sidebar/index.tsx | 3 +-- .../ai-assistant-plugin/components/feedback/index.tsx | 10 ++-------- .../ai-content-lens/extend/ai-post-excerpt/index.tsx | 9 +++------ .../shared/external-media/media-service/index.ts | 4 ++-- 12 files changed, 14 insertions(+), 37 deletions(-) diff --git a/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts b/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts index dea00097b5244..9fd4daea5e49d 100644 --- a/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts +++ b/projects/js-packages/publicize-components/src/components/form/use-auto-save-and-redirect.ts @@ -9,7 +9,6 @@ import { useCallback } from '@wordpress/element'; * @return {Function} Function to handle autosaving and redirecting. */ export function useAutoSaveAndRedirect(): React.DOMAttributes< HTMLAnchorElement >[ 'onClick' ] { - // @ts-expect-error -- `@wordpress/editor` is a nightmare to work with TypeScript const { isEditedPostDirty } = useSelect( editorStore, [] ); const { autosave } = useDispatch( editorStore ); diff --git a/projects/js-packages/publicize-components/src/components/post-publish-share-status/index.tsx b/projects/js-packages/publicize-components/src/components/post-publish-share-status/index.tsx index 79393b6a547a6..aa55fe1a8486f 100644 --- a/projects/js-packages/publicize-components/src/components/post-publish-share-status/index.tsx +++ b/projects/js-packages/publicize-components/src/components/post-publish-share-status/index.tsx @@ -23,7 +23,6 @@ export function PostPublishShareStatus() { const _editorStore = select( editorStore ); return { - // @ts-expect-error -- `@wordpress/editor` is a nightmare to work with TypeScript isPostPublished: _editorStore.isCurrentPostPublished(), }; }, [] ); diff --git a/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts b/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts index 037d6e2e04502..9f441465f47ac 100644 --- a/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts +++ b/projects/js-packages/publicize-components/src/components/share-buttons/useShareButtonText.ts @@ -1,4 +1,5 @@ import { useSelect } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; import { useCallback } from '@wordpress/element'; import { usePostMeta } from '../../hooks/use-post-meta'; @@ -11,9 +12,7 @@ export function useShareButtonText() { const { shareMessage } = usePostMeta(); const { message, link } = useSelect( select => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const getEditedPostAttribute = ( select( 'core/editor' ) as any ) - .getEditedPostAttribute satisfies ( attribute: string ) => unknown; + const { getEditedPostAttribute } = select( editorStore ); return { link: getEditedPostAttribute( 'link' ), diff --git a/projects/js-packages/publicize-components/src/components/share-status/retry.tsx b/projects/js-packages/publicize-components/src/components/share-status/retry.tsx index 3917ec6aa9992..9e60463af18f1 100644 --- a/projects/js-packages/publicize-components/src/components/share-status/retry.tsx +++ b/projects/js-packages/publicize-components/src/components/share-status/retry.tsx @@ -27,7 +27,6 @@ export type RetryProps = { */ export function Retry( { shareItem }: RetryProps ) { const { recordEvent } = useAnalytics(); - // @ts-expect-error -- `@wordpress/editor` is badly typed, causes issue in CI const postId = useSelect( select => select( editorStore ).getCurrentPostId(), [] ); const connections = useSelect( select => select( socialStore ).getConnections(), [] ); diff --git a/projects/js-packages/publicize-components/src/components/social-previews/bluesky.tsx b/projects/js-packages/publicize-components/src/components/social-previews/bluesky.tsx index 4eba0183c4641..73d25c8545e06 100644 --- a/projects/js-packages/publicize-components/src/components/social-previews/bluesky.tsx +++ b/projects/js-packages/publicize-components/src/components/social-previews/bluesky.tsx @@ -9,7 +9,6 @@ import { store, CONNECTION_SERVICE_BLUESKY } from '../../social-store'; const BlueskyPreview = props => { const { message } = useSocialMediaMessage(); const { content, siteName } = useSelect( select => { - // @ts-expect-error -- `@wordpress/editor` is a nightmare to work with TypeScript const { getEditedPostAttribute } = select( editorStore ); // @ts-expect-error -- It says, "Property 'getUnstableBase' does not exist..." but it does const { getUnstableBase } = select( coreStore ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-post-can-use-sig/index.ts b/projects/js-packages/publicize-components/src/hooks/use-post-can-use-sig/index.ts index 5602ca0709d00..ed306eee48bb3 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-post-can-use-sig/index.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-post-can-use-sig/index.ts @@ -10,9 +10,7 @@ import { features } from '../../utils/constants'; */ export function usePostCanUseSig() { const isJetpackSocialNote = useSelect( select => { - const currentPostType = select( editorStore ) - // @ts-expect-error -- `@wordpress/editor` is a nightmare to work with TypeScript - getCurrentPostType exists on the editor store - .getCurrentPostType(); + const currentPostType = select( editorStore ).getCurrentPostType(); return 'jetpack-social-note' === currentPostType; }, [] ); diff --git a/projects/js-packages/publicize-components/src/hooks/use-post-pre-publish-value/index.ts b/projects/js-packages/publicize-components/src/hooks/use-post-pre-publish-value/index.ts index 8ba9f12d8be38..aaa5c8f12551d 100644 --- a/projects/js-packages/publicize-components/src/hooks/use-post-pre-publish-value/index.ts +++ b/projects/js-packages/publicize-components/src/hooks/use-post-pre-publish-value/index.ts @@ -13,11 +13,7 @@ import { useEffect, useRef, useState } from '@wordpress/element'; * @return {V} The preserved value. */ export function usePostPrePublishValue< V >( value: V ) { - const isPublishing = useSelect( - // @ts-expect-error -- `@wordpress/editor` is a nightmare to work with TypeScript - select => select( editorStore ).isPublishingPost(), - [] - ); + const isPublishing = useSelect( select => select( editorStore ).isPublishingPost(), [] ); const [ currentValue, setCurrentValue ] = useState( value ); diff --git a/projects/plugins/jetpack/extensions/blocks/voice-to-content/edit.tsx b/projects/plugins/jetpack/extensions/blocks/voice-to-content/edit.tsx index 655ffdf83e113..d7939f218596f 100644 --- a/projects/plugins/jetpack/extensions/blocks/voice-to-content/edit.tsx +++ b/projects/plugins/jetpack/extensions/blocks/voice-to-content/edit.tsx @@ -10,6 +10,7 @@ import { ThemeProvider } from '@automattic/jetpack-components'; import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; import { Button, Modal, Icon } from '@wordpress/components'; import { useDispatch, useSelect } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; import { useCallback, useEffect, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { external } from '@wordpress/icons'; @@ -24,7 +25,6 @@ import useTranscriptionInserter from './hooks/use-transcription-inserter'; /** * Types */ -import type { Block } from '@automattic/jetpack-ai-client'; import type { RecordingState, TranscriptionState, @@ -62,9 +62,7 @@ export default function VoiceToContentEdit( { clientId } ) { removeBlock: ( id: string ) => void; }; - const { getBlocks } = useSelect( select => select( 'core/editor' ), [] ) as { - getBlocks: () => Block[]; - }; + const { getBlocks } = useSelect( select => select( editorStore ), [] ); const destroyBlock = useCallback( () => { // Remove the block from the editor diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-assistant-plugin-sidebar/index.tsx b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-assistant-plugin-sidebar/index.tsx index 657e849e86e14..0fe508d9f5172 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-assistant-plugin-sidebar/index.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/ai-assistant-plugin-sidebar/index.tsx @@ -38,7 +38,6 @@ import './style.scss'; * Types */ import type { CoreSelect, JetpackSettingsContentProps } from './types'; -import type * as EditorSelectors from '@wordpress/editor/store/selectors'; const debug = debugFactory( 'jetpack-ai-assistant-plugin:sidebar' ); /** @@ -163,7 +162,7 @@ export default function AiAssistantPluginSidebar() { const { tracks } = useAnalytics(); const isViewable = useSelect( select => { - const postTypeName = ( select( editorStore ) as typeof EditorSelectors ).getCurrentPostType(); + const postTypeName = select( editorStore ).getCurrentPostType(); // The coreStore select type lacks the getPostType method, so we need to cast it to the correct type const postTypeObject = ( select( coreStore ) as unknown as CoreSelect ).getPostType( postTypeName diff --git a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/feedback/index.tsx b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/feedback/index.tsx index d34983b388dee..a904ae4fa4297 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/feedback/index.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-assistant-plugin/components/feedback/index.tsx @@ -5,6 +5,7 @@ import { useAiSuggestions } from '@automattic/jetpack-ai-client'; import { useAnalytics } from '@automattic/jetpack-shared-extension-utils'; import { Button } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; import { useCallback, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import React from 'react'; @@ -14,10 +15,6 @@ import React from 'react'; import usePostContent from '../../hooks/use-post-content'; import AiAssistantModal from '../modal'; import './style.scss'; -/** - * Types - */ -import type * as EditorSelectors from '@wordpress/editor/store/selectors'; export default function Feedback( { disabled = false, @@ -32,10 +29,7 @@ export default function Feedback( { const [ suggestion, setSuggestion ] = useState< Array< React.JSX.Element | null > >( [ null ] ); const { tracks } = useAnalytics(); - const postId = useSelect( - select => ( select( 'core/editor' ) as typeof EditorSelectors ).getCurrentPostId(), - [] - ); + const postId = useSelect( select => select( editorStore ).getCurrentPostId(), [] ); const postContent = usePostContent(); const toggleFeedbackModal = () => { diff --git a/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx b/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx index 0c6758b7b4bb4..f10f65add917a 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx @@ -27,7 +27,6 @@ import { AiExcerptControl } from '../../components/ai-excerpt-control'; import type { LanguageProp } from '../../../../blocks/ai-assistant/components/i18n-dropdown-control'; import type { ToneProp } from '../../../../blocks/ai-assistant/components/tone-dropdown-control'; import type { AiModelTypeProp, PromptProp } from '@automattic/jetpack-ai-client'; -import type * as EditorSelectors from '@wordpress/editor/store/selectors'; import './style.scss'; @@ -45,9 +44,7 @@ type ContentLensMessageContextProps = { function AiPostExcerpt() { const { excerpt, postId } = useSelect( select => { - const { getEditedPostAttribute, getCurrentPostId } = select( - editorStore - ) as typeof EditorSelectors; + const { getEditedPostAttribute, getCurrentPostId } = select( editorStore ); return { excerpt: getEditedPostAttribute( 'excerpt' ) ?? '', @@ -109,7 +106,7 @@ function AiPostExcerpt() { // Pick raw post content const postContent = useSelect( select => { - const content = ( select( editorStore ) as typeof EditorSelectors ).getEditedPostContent(); + const content = select( editorStore ).getEditedPostContent(); if ( ! content ) { return ''; } @@ -298,7 +295,7 @@ ${ postContent } export const PluginDocumentSettingPanelAiExcerpt = () => { const isExcerptUsedAsDescription = useSelect( select => { - const { getCurrentPostType } = select( editorStore ) as typeof EditorSelectors; + const { getCurrentPostType } = select( editorStore ); const postType = getCurrentPostType(); const isTemplateOrTemplatePart = postType === 'wp_template' || postType === 'wp_template_part'; const isPattern = postType === 'wp_block'; diff --git a/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts b/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts index ef699b86172e5..3fa6e162d83dc 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts +++ b/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts @@ -1,6 +1,7 @@ import jetpackAnalytics from '@automattic/jetpack-analytics'; import apiFetch from '@wordpress/api-fetch'; import { dispatch, select } from '@wordpress/data'; +import { store as editorStore } from '@wordpress/editor'; import { __ } from '@wordpress/i18n'; import { addQueryArgs } from '@wordpress/url'; import { waitFor } from '../../wait-for'; @@ -196,8 +197,7 @@ const isMediaSourceConnected = async ( source: MediaSource ) => * @return {boolean} True if the inserter is opened false otherwise. */ const isInserterOpened = (): boolean => { - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - const selectIsInserterOpened = ( select( 'core/editor' ) as any )?.isInserterOpened; + const selectIsInserterOpened = select( editorStore )?.isInserterOpened; const editorIsInserterOpened = selectIsInserterOpened?.(); From 48186392053a30ac2924e3f225a3112d21c270ee Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 14:03:59 +0530 Subject: [PATCH 5/7] Add changelog --- .../publicize-components/changelog/update-wordpress-editor | 4 ++++ .../packages/videopress/changelog/update-wordpress-editor | 4 ++++ projects/plugins/jetpack/changelog/update-wordpress-editor | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 projects/js-packages/publicize-components/changelog/update-wordpress-editor create mode 100644 projects/packages/videopress/changelog/update-wordpress-editor create mode 100644 projects/plugins/jetpack/changelog/update-wordpress-editor diff --git a/projects/js-packages/publicize-components/changelog/update-wordpress-editor b/projects/js-packages/publicize-components/changelog/update-wordpress-editor new file mode 100644 index 0000000000000..783200c3faa3f --- /dev/null +++ b/projects/js-packages/publicize-components/changelog/update-wordpress-editor @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fixed TS errors following @wordpress/editor update diff --git a/projects/packages/videopress/changelog/update-wordpress-editor b/projects/packages/videopress/changelog/update-wordpress-editor new file mode 100644 index 0000000000000..783200c3faa3f --- /dev/null +++ b/projects/packages/videopress/changelog/update-wordpress-editor @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fixed TS errors following @wordpress/editor update diff --git a/projects/plugins/jetpack/changelog/update-wordpress-editor b/projects/plugins/jetpack/changelog/update-wordpress-editor new file mode 100644 index 0000000000000..5877968d4fd9e --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-wordpress-editor @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Fixed TS errors following @wordpress/editor update From da132e05974642747cddd855fba608f12bc50cf5 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 15:04:18 +0530 Subject: [PATCH 6/7] Fix TS error in PluginDocumentSettingPanelAiExcerpt --- .../extend/ai-post-excerpt/index.tsx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx b/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx index f10f65add917a..b3daf8ef0699b 100644 --- a/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx +++ b/projects/plugins/jetpack/extensions/plugins/ai-content-lens/extend/ai-post-excerpt/index.tsx @@ -305,14 +305,18 @@ export const PluginDocumentSettingPanelAiExcerpt = () => { return null; } return ( - - - - - + + + + } + /> ); }; From d15aec4720d3957f0c1927cb5184daadb8d1c527 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Thu, 21 Nov 2024 15:20:14 +0530 Subject: [PATCH 7/7] Restore file --- .../extensions/shared/external-media/media-service/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts b/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts index 3fa6e162d83dc..ef699b86172e5 100644 --- a/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts +++ b/projects/plugins/jetpack/extensions/shared/external-media/media-service/index.ts @@ -1,7 +1,6 @@ import jetpackAnalytics from '@automattic/jetpack-analytics'; import apiFetch from '@wordpress/api-fetch'; import { dispatch, select } from '@wordpress/data'; -import { store as editorStore } from '@wordpress/editor'; import { __ } from '@wordpress/i18n'; import { addQueryArgs } from '@wordpress/url'; import { waitFor } from '../../wait-for'; @@ -197,7 +196,8 @@ const isMediaSourceConnected = async ( source: MediaSource ) => * @return {boolean} True if the inserter is opened false otherwise. */ const isInserterOpened = (): boolean => { - const selectIsInserterOpened = select( editorStore )?.isInserterOpened; + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ + const selectIsInserterOpened = ( select( 'core/editor' ) as any )?.isInserterOpened; const editorIsInserterOpened = selectIsInserterOpened?.();