-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Simple Payments block registration
- Loading branch information
1 parent
3bb0b6b
commit 0adf412
Showing
5 changed files
with
56 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 35 additions & 3 deletions
38
projects/plugins/jetpack/extensions/blocks/simple-payments/editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,36 @@ | ||
import registerJetpackBlock from '../../shared/register-jetpack-block'; | ||
import { name, settings } from '.'; | ||
import { registerJetpackBlockFromMetadata } from '../../shared/register-jetpack-block'; | ||
import metadata from './block.json'; | ||
import deprecatedV1 from './deprecated/v1'; | ||
import deprecatedV2 from './deprecated/v2'; | ||
import edit from './edit'; | ||
import save from './save'; | ||
import './editor.scss'; | ||
|
||
registerJetpackBlock( name, settings ); | ||
registerJetpackBlockFromMetadata( metadata, { | ||
edit, | ||
save, | ||
transforms: { | ||
from: [ | ||
{ | ||
type: 'shortcode', | ||
tag: 'simple-payment', | ||
attributes: { | ||
productId: { | ||
type: 'number', | ||
shortcode: ( { named: { id } } ) => { | ||
if ( ! id ) { | ||
return; | ||
} | ||
|
||
const result = parseInt( id, 10 ); | ||
if ( result ) { | ||
return result; | ||
} | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
deprecated: [ deprecatedV1, deprecatedV2 ], | ||
} ); |
186 changes: 0 additions & 186 deletions
186
projects/plugins/jetpack/extensions/blocks/simple-payments/index.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters