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

Post editor: Require confirmation before removing Footnotes #52277

Merged
merged 3 commits into from
Jul 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Post editor: Require confirmation before removing Footnotes
Context: #52176
  • Loading branch information
mcsf committed Jul 4, 2023
commit 681f2b3bc682c26e7d5978965f90f04a0e220a7e
15 changes: 14 additions & 1 deletion packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import {
store as editorStore,
} from '@wordpress/editor';
import { useSelect, useDispatch } from '@wordpress/data';
import { BlockBreadcrumb } from '@wordpress/block-editor';
import {
BlockBreadcrumb,
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { Button, ScrollLock, Popover } from '@wordpress/components';
import { useViewportMatch } from '@wordpress/compose';
import { PluginArea } from '@wordpress/plugins';
Expand Down Expand Up @@ -49,6 +52,9 @@ import WelcomeGuide from '../welcome-guide';
import ActionsPanel from './actions-panel';
import StartPageOptions from '../start-page-options';
import { store as editPostStore } from '../../store';
import { unlock } from '../../lock-unlock';

const { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );

const interfaceLabels = {
/* translators: accessibility text for the editor top bar landmark region. */
Expand All @@ -63,6 +69,12 @@ const interfaceLabels = {
footer: __( 'Editor footer' ),
};

const blockRemovalRules = {
'core/footnotes': __(
'The Footnotes block displays all footnotes found in the content.'
),
};

function Layout( { styles } ) {
const isMobileViewport = useViewportMatch( 'medium', '<' );
const isHugeViewport = useViewportMatch( 'huge', '>=' );
Expand Down Expand Up @@ -202,6 +214,7 @@ function Layout( { styles } ) {
<LocalAutosaveMonitor />
<EditPostKeyboardShortcuts />
<EditorKeyboardShortcutsRegister />
<BlockRemovalWarningModal rules={ blockRemovalRules } />
<SettingsSidebar />
<InterfaceSkeleton
isDistractionFree={ isDistractionFree && isLargeViewport }
Expand Down