diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md
index e61bddfbbf2de0..78e90241d1869a 100644
--- a/packages/block-library/CHANGELOG.md
+++ b/packages/block-library/CHANGELOG.md
@@ -1,5 +1,10 @@
## Master (unreleased)
+### Enhancements
+
+- Heading block uses `has-text-align-*` class names rather than inline style for text alignment.
+- Verse block uses `has-text-align-*` class names rather than inline style for text alignment.
+
### Bug Fixes
- Fixed insertion of columns in the table block, which now inserts columns for all table sections ([#16410](https://github.com/WordPress/gutenberg/pull/16410))
diff --git a/packages/block-library/src/style.scss b/packages/block-library/src/style.scss
index f9a2909ff360a8..540fd4cd99ec51 100644
--- a/packages/block-library/src/style.scss
+++ b/packages/block-library/src/style.scss
@@ -153,10 +153,12 @@
}
.has-text-align-left {
+ /*rtl:ignore*/
text-align: left;
}
.has-text-align-right {
+ /*rtl:ignore*/
text-align: right;
}
diff --git a/packages/block-library/src/verse/deprecated.js b/packages/block-library/src/verse/deprecated.js
new file mode 100644
index 00000000000000..f26ac103c226b6
--- /dev/null
+++ b/packages/block-library/src/verse/deprecated.js
@@ -0,0 +1,35 @@
+/**
+ * WordPress dependencies
+ */
+import { RichText } from '@wordpress/block-editor';
+
+const blockAttributes = {
+ content: {
+ type: 'string',
+ source: 'html',
+ selector: 'pre',
+ default: '',
+ },
+ textAlign: {
+ type: 'string',
+ },
+};
+
+const deprecated = [
+ {
+ attributes: blockAttributes,
+ save( { attributes } ) {
+ const { textAlign, content } = attributes;
+
+ return (
+
A verse…+ diff --git a/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.json b/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.json new file mode 100644 index 00000000000000..002e26a7da88b9 --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.json @@ -0,0 +1,13 @@ +[ + { + "clientId": "_clientId_0", + "name": "core/verse", + "isValid": true, + "attributes": { + "content": "A verse…
And more!
A verse…" + } +] diff --git a/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.parsed.json b/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.parsed.json new file mode 100644 index 00000000000000..2e703ee0d855ea --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.parsed.json @@ -0,0 +1,22 @@ +[ + { + "blockName": "core/verse", + "attrs": { + "textAlign": "left" + }, + "innerBlocks": [], + "innerHTML": "\n
And more!
A verse…\n", + "innerContent": [ + "\n
And more!
A verse…\n" + ] + }, + { + "blockName": null, + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n", + "innerContent": [ + "\n" + ] + } +] diff --git a/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.serialized.html b/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.serialized.html new file mode 100644 index 00000000000000..a1075252bbc83c --- /dev/null +++ b/packages/e2e-tests/fixtures/blocks/core__verse__deprecated.serialized.html @@ -0,0 +1,3 @@ + +
And more!
A verse…+
And more!