|
1 |
| -( function() { |
2 |
| - var registerBlockType = wp.blocks.registerBlockType; |
3 |
| - var RichText = wp.blockEditor.RichText; |
4 |
| - var el = wp.element.createElement; |
| 1 | +( function () { |
| 2 | + const registerBlockType = wp.blocks.registerBlockType; |
| 3 | + const RichText = wp.blockEditor.RichText; |
| 4 | + const el = wp.element.createElement; |
5 | 5 |
|
6 | 6 | registerBlockType( 'core/deprecated-children-matcher', {
|
7 | 7 | title: 'Deprecated Children Matcher',
|
|
13 | 13 | },
|
14 | 14 | },
|
15 | 15 | category: 'text',
|
16 |
| - edit: function( { attributes, setAttributes } ) { |
| 16 | + edit( { attributes, setAttributes } ) { |
17 | 17 | return el( RichText, {
|
18 | 18 | tagName: 'p',
|
19 | 19 | value: attributes.value,
|
20 |
| - onChange: function( nextValue ) { |
| 20 | + onChange( nextValue ) { |
21 | 21 | setAttributes( { value: nextValue } );
|
22 | 22 | },
|
23 | 23 | } );
|
24 | 24 | },
|
25 |
| - save: function( { attributes } ) { |
| 25 | + save( { attributes } ) { |
26 | 26 | return el( RichText.Content, {
|
27 | 27 | tagName: 'p',
|
28 | 28 | value: attributes.value,
|
|
31 | 31 | } );
|
32 | 32 |
|
33 | 33 | function toRichTextValue( value ) {
|
34 |
| - return _.map( value, function( subValue ) { |
| 34 | + // eslint-disable-next-line no-undef |
| 35 | + return _.map( value, function ( subValue ) { |
35 | 36 | return subValue.children;
|
36 | 37 | } );
|
37 | 38 | }
|
38 | 39 |
|
39 | 40 | function fromRichTextValue( value ) {
|
40 |
| - return _.map( value, function( subValue ) { |
| 41 | + // eslint-disable-next-line no-undef |
| 42 | + return _.map( value, function ( subValue ) { |
41 | 43 | return {
|
42 | 44 | children: subValue,
|
43 | 45 | };
|
|
59 | 61 | },
|
60 | 62 | },
|
61 | 63 | category: 'text',
|
62 |
| - edit: function( { attributes, setAttributes } ) { |
| 64 | + edit( { attributes, setAttributes } ) { |
63 | 65 | return el(
|
64 | 66 | 'blockquote',
|
65 | 67 | {},
|
66 | 68 | el( RichText, {
|
67 | 69 | multiline: 'p',
|
68 | 70 | value: toRichTextValue( attributes.value ),
|
69 |
| - onChange: function( nextValue ) { |
| 71 | + onChange( nextValue ) { |
70 | 72 | setAttributes( {
|
71 | 73 | value: fromRichTextValue( nextValue ),
|
72 | 74 | } );
|
73 | 75 | },
|
74 | 76 | } )
|
75 | 77 | );
|
76 | 78 | },
|
77 |
| - save: function( { attributes } ) { |
| 79 | + save( { attributes } ) { |
78 | 80 | return el(
|
79 | 81 | 'blockquote',
|
80 | 82 | {},
|
|
0 commit comments