@@ -18,6 +18,7 @@ import {
18
18
TextControl ,
19
19
ToggleControl ,
20
20
} from '@wordpress/components' ;
21
+ import { RichText } from '@wordpress/block-editor' ;
21
22
22
23
class Edit extends Component {
23
24
constructor ( props ) {
@@ -141,7 +142,8 @@ class Edit extends Component {
141
142
}
142
143
143
144
renderUntieredForm ( ) {
144
- const { className } = this . props ;
145
+ const { attributes, className, setAttributes } = this . props ;
146
+ const { buttonText } = attributes ;
145
147
const { uid } = this . state ;
146
148
const { currencySymbol, customDonationAmounts, selectedFrequency } = this . blockData ( ) ;
147
149
@@ -196,15 +198,21 @@ class Edit extends Component {
196
198
{ __ ( 'Your contribution is appreciated.' , 'newspack-blocks' ) }
197
199
</ p >
198
200
< button type = "submit" onClick = { evt => evt . preventDefault ( ) } >
199
- { __ ( 'Donate now!' , 'newspack-blocks' ) }
201
+ < RichText
202
+ onChange = { value => setAttributes ( { buttonText : value } ) }
203
+ placeholder = { __ ( 'Button text…' , 'newspack-blocks' ) }
204
+ value = { buttonText }
205
+ tagName = "span"
206
+ />
200
207
</ button >
201
208
</ form >
202
209
</ div >
203
210
) ;
204
211
}
205
212
206
213
renderTieredForm ( ) {
207
- const { className } = this . props ;
214
+ const { attributes, className, setAttributes } = this . props ;
215
+ const { buttonText } = attributes ;
208
216
const { uid } = this . state ;
209
217
const {
210
218
activeTier,
@@ -301,7 +309,12 @@ class Edit extends Component {
301
309
{ __ ( 'Your contribution is appreciated.' , 'newspack-blocks' ) }
302
310
</ p >
303
311
< button type = "submit" onClick = { evt => evt . preventDefault ( ) } >
304
- { __ ( 'Donate now!' , 'newspack-blocks' ) }
312
+ < RichText
313
+ onChange = { value => setAttributes ( { buttonText : value } ) }
314
+ placeholder = { __ ( 'Button text…' , 'newspack-blocks' ) }
315
+ value = { buttonText }
316
+ tagName = "span"
317
+ />
305
318
</ button >
306
319
</ form >
307
320
</ div >
0 commit comments