From 64fb7fb8b0a51deae4ecec074bfa854695ee3f09 Mon Sep 17 00:00:00 2001 From: Ella Date: Sat, 8 Jul 2023 08:39:48 +0200 Subject: [PATCH 1/2] Footnotes: show in inserter and placehold --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/footnotes/block.json | 1 - packages/block-library/src/footnotes/edit.js | 14 +++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index a4e307c94df87e..44561fdecfcf70 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -275,7 +275,7 @@ Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenb - **Name:** core/footnotes - **Category:** text -- **Supports:** ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ +- **Supports:** ~~html~~, ~~multiple~~, ~~reusable~~ - **Attributes:** ## Classic diff --git a/packages/block-library/src/footnotes/block.json b/packages/block-library/src/footnotes/block.json index 0ab992009d123f..e021e9c5225dab 100644 --- a/packages/block-library/src/footnotes/block.json +++ b/packages/block-library/src/footnotes/block.json @@ -11,7 +11,6 @@ "supports": { "html": false, "multiple": false, - "inserter": false, "reusable": false }, "style": "wp-block-footnotes" diff --git a/packages/block-library/src/footnotes/edit.js b/packages/block-library/src/footnotes/edit.js index e90a7f82be94a9..2c37588a1ce293 100644 --- a/packages/block-library/src/footnotes/edit.js +++ b/packages/block-library/src/footnotes/edit.js @@ -3,6 +3,8 @@ */ import { RichText, useBlockProps } from '@wordpress/block-editor'; import { useEntityProp } from '@wordpress/core-data'; +import { __ } from '@wordpress/i18n'; +import { Placeholder } from '@wordpress/components'; export default function FootnotesEdit( { context: { postType, postId } } ) { const [ meta, updateMeta ] = useEntityProp( @@ -12,8 +14,18 @@ export default function FootnotesEdit( { context: { postType, postId } } ) { postId ); const footnotes = meta?.footnotes ? JSON.parse( meta.footnotes ) : []; + const blockProps = useBlockProps(); + + if ( ! footnotes.length ) { + return ( + + { __( 'No footnotes yet.' ) } + + ); + } + return ( -
    +
      { footnotes.map( ( { id, content } ) => (
    1. Date: Mon, 10 Jul 2023 14:44:05 +0100 Subject: [PATCH 2/2] Fix placeholder block membrane; fix copy; add icon, label --- packages/block-library/src/footnotes/edit.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/block-library/src/footnotes/edit.js b/packages/block-library/src/footnotes/edit.js index 2c37588a1ce293..fdfe7a94039af9 100644 --- a/packages/block-library/src/footnotes/edit.js +++ b/packages/block-library/src/footnotes/edit.js @@ -1,10 +1,11 @@ /** * WordPress dependencies */ -import { RichText, useBlockProps } from '@wordpress/block-editor'; +import { BlockIcon, RichText, useBlockProps } from '@wordpress/block-editor'; import { useEntityProp } from '@wordpress/core-data'; import { __ } from '@wordpress/i18n'; import { Placeholder } from '@wordpress/components'; +import { formatListNumbered as icon } from '@wordpress/icons'; export default function FootnotesEdit( { context: { postType, postId } } ) { const [ meta, updateMeta ] = useEntityProp( @@ -18,9 +19,15 @@ export default function FootnotesEdit( { context: { postType, postId } } ) { if ( ! footnotes.length ) { return ( - - { __( 'No footnotes yet.' ) } - +
      + } + label={ __( 'Footnotes' ) } + instructions={ __( + 'Footnotes found in blocks within this document will be displayed here.' + ) } + /> +
      ); }