Skip to content

Commit

Permalink
Forms: update form field and button blocks to support content only mo…
Browse files Browse the repository at this point in the history
…de (#41411)

* Add role:content to field block attributes

* Add role:content for button block

* changelog

* Support updating the label of options in content only mode
  • Loading branch information
talldan authored Feb 4, 2025
1 parent 7fd1989 commit 6c3d061
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Forms: Update fields and button blocks to support contentOnly editing.
14 changes: 14 additions & 0 deletions projects/packages/forms/src/blocks/contact-form/child-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,30 @@ const FieldDefaults = {
label: {
type: 'string',
default: null,
role: 'content',
},
required: {
type: 'boolean',
default: false,
},
requiredText: {
type: 'string',
role: 'content',
},
options: {
type: 'array',
default: [],
role: 'content',
},
defaultValue: {
type: 'string',
default: '',
role: 'content',
},
placeholder: {
type: 'string',
default: '',
role: 'content',
},
id: {
type: 'string',
Expand Down Expand Up @@ -366,6 +371,7 @@ export const childBlocks = [
label: {
type: 'string',
default: 'Text',
role: 'content',
},
},
},
Expand All @@ -388,6 +394,7 @@ export const childBlocks = [
label: {
type: 'string',
default: 'Name',
role: 'content',
},
},
},
Expand All @@ -409,6 +416,7 @@ export const childBlocks = [
label: {
type: 'string',
default: 'Email',
role: 'content',
},
},
},
Expand All @@ -435,6 +443,7 @@ export const childBlocks = [
label: {
type: 'string',
default: __( 'Website', 'jetpack-forms' ),
role: 'content',
},
},
},
Expand Down Expand Up @@ -464,6 +473,7 @@ export const childBlocks = [
label: {
type: 'string',
default: 'Date',
role: 'content',
},
dateFormat: {
type: 'string',
Expand Down Expand Up @@ -493,6 +503,7 @@ export const childBlocks = [
label: {
type: 'string',
default: 'Phone',
role: 'content',
},
},
},
Expand Down Expand Up @@ -542,6 +553,7 @@ export const childBlocks = [
label: {
type: 'string',
default: '',
role: 'content',
},
},
},
Expand Down Expand Up @@ -649,10 +661,12 @@ export const childBlocks = [
toggleLabel: {
type: 'string',
default: null,
role: 'content',
},
options: {
type: 'array',
default: [ '' ],
role: 'content',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
attributes: {
label: {
type: 'string',
role: 'content',
},
fieldType: {
enum: [ 'checkbox', 'radio' ],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Forms: Update field and button blocks to support contentOnly editing.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ export default {
},
text: {
type: 'string',
role: 'content',
},
placeholder: {
type: 'string',
role: 'content',
},
url: {
type: 'string',
role: 'content',
},
textColor: {
type: 'string',
Expand Down

0 comments on commit 6c3d061

Please sign in to comment.