45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
(function(wp) {
|
|
const { registerBlockVariation } = wp.blocks;
|
|
|
|
wp.domReady(function() {
|
|
// Register variations for the Maple Code Block
|
|
registerBlockVariation('maple-code-blocks/code-block', {
|
|
name: 'maple-github',
|
|
title: 'Maple: GitHub Code',
|
|
description: 'Display code from GitHub',
|
|
icon: 'editor-code',
|
|
attributes: {
|
|
repository: 'facebook/react',
|
|
theme: 'dark'
|
|
},
|
|
scope: ['inserter']
|
|
});
|
|
|
|
registerBlockVariation('maple-code-blocks/code-block', {
|
|
name: 'maple-gitlab',
|
|
title: 'Maple: GitLab Code',
|
|
description: 'Display code from GitLab',
|
|
icon: 'editor-code',
|
|
attributes: {
|
|
repository: 'gitlab:gitlab-org/gitlab',
|
|
theme: 'dark'
|
|
},
|
|
scope: ['inserter']
|
|
});
|
|
|
|
registerBlockVariation('maple-code-blocks/code-block', {
|
|
name: 'maple-documentation',
|
|
title: 'Maple: Documentation',
|
|
description: 'Display README or docs',
|
|
icon: 'media-document',
|
|
attributes: {
|
|
repository: '',
|
|
theme: 'light',
|
|
height: '400px'
|
|
},
|
|
scope: ['inserter']
|
|
});
|
|
|
|
console.log('Maple Code Blocks: Variations registered');
|
|
});
|
|
})(window.wp);
|