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

[pull] trunk from WordPress:trunk #174

Merged
merged 2 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 3 additions & 18 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@ import {
useBlockProps,
useSettings,
useBlockEditingMode,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { useSelect } from '@wordpress/data';
import { getBlockSupport } from '@wordpress/blocks';
import { formatLtr } from '@wordpress/icons';
/**
* Internal dependencies
*/
import { useOnEnter } from './use-enter';
import { unlock } from '../lock-unlock';

function ParagraphRTLControl( { direction, setDirection } ) {
return (
Expand Down Expand Up @@ -111,11 +108,7 @@ function ParagraphBlock( {
isSelected: isSingleSelected,
name,
} ) {
const isZoomOut = useSelect( ( select ) =>
unlock( select( blockEditorStore ) ).isZoomOut()
);

const { align, content, direction, dropCap } = attributes;
const { align, content, direction, dropCap, placeholder } = attributes;
const blockProps = useBlockProps( {
ref: useOnEnter( { clientId, content } ),
className: clsx( {
Expand All @@ -125,12 +118,6 @@ function ParagraphBlock( {
style: { direction },
} );
const blockEditingMode = useBlockEditingMode();
let { placeholder } = attributes;
if ( isZoomOut ) {
placeholder = '';
} else if ( ! placeholder ) {
placeholder = __( 'Type / to choose a block' );
}

return (
<>
Expand Down Expand Up @@ -182,10 +169,8 @@ function ParagraphBlock( {
: __( 'Block: Paragraph' )
}
data-empty={ RichText.isEmpty( content ) }
placeholder={ placeholder }
data-custom-placeholder={
placeholder && ! isZoomOut ? true : undefined
}
placeholder={ placeholder || __( 'Type / to choose a block' ) }
data-custom-placeholder={ placeholder ? true : undefined }
__unstableEmbedURLOnPaste
__unstableAllowPrefixTransformations
/>
Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/paragraph/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@
.block-editor-block-list__block[data-type="core/paragraph"].has-text-align-left[style*="writing-mode: vertical-lr"] {
rotate: 180deg;
}

// Hide the placeholder when the editor is in zoomed out mode.
.is-zoomed-out .block-editor-block-list__block[data-empty="true"] {
[data-rich-text-placeholder] {
opacity: 0;
}
}
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/style-book/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const STYLE_BOOK_ALL_BLOCKS_SUBCATEGORIES: StyleBookCategory[] = [
},
];

// Style book preview categories are organised slightly differently to the editor ones.
// Style book preview categories are organized slightly differently to the editor ones.
export const STYLE_BOOK_PREVIEW_CATEGORIES: StyleBookCategory[] = [
{
slug: 'overview',
Expand Down
Loading