Skip to content
Snippets Groups Projects
Commit 48c4d56c authored by Erick Hitter's avatar Erick Hitter
Browse files

Scaffold sidebar panel

parent ed90a2db
No related branches found
No related tags found
1 merge request!14Add native block-editor support
module.exports = function( grunt ) {
module.exports = function ( grunt ) {
'use strict';
// Project configuration
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
addtextdomain: {
......@@ -13,17 +11,24 @@ module.exports = function( grunt ) {
},
update_all_domains: {
options: {
updateDomains: true
updateDomains: true,
},
src: [ '*.php', '**/*.php', '!\.git/**/*', '!bin/**/*', '!node_modules/**/*', '!tests/**/*' ]
}
src: [
'*.php',
'**/*.php',
'!.git/**/*',
'!bin/**/*',
'!node_modules/**/*',
'!tests/**/*',
],
},
},
wp_readme_to_markdown: {
your_target: {
files: {
'README.md': 'readme.txt'
}
'README.md': 'readme.txt',
},
},
options: {
screenshot_url:
......@@ -35,26 +40,25 @@ module.exports = function( grunt ) {
target: {
options: {
domainPath: '/languages',
exclude: [ '\.git/*', 'bin/*', 'node_modules/*', 'tests/*' ],
exclude: [ '.git/*', 'bin/*', 'node_modules/*', 'tests/*' ],
mainFile: 'external-permalinks-redux.php',
potFilename: 'external-permalinks-redux.pot',
potHeaders: {
poedit: true,
'x-poedit-keywordslist': true
'x-poedit-keywordslist': true,
},
type: 'wp-plugin',
updateTimestamp: true
}
}
updateTimestamp: true,
},
},
},
} );
grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' );
grunt.registerTask( 'default', [ 'i18n','readme' ] );
grunt.registerTask( 'i18n', ['addtextdomain', 'makepot'] );
grunt.registerTask( 'readme', ['wp_readme_to_markdown'] );
grunt.registerTask( 'default', [ 'i18n', 'readme' ] );
grunt.registerTask( 'i18n', [ 'addtextdomain', 'makepot' ] );
grunt.registerTask( 'readme', [ 'wp_readme_to_markdown' ] );
grunt.util.linefeed = '\n';
};
/* global externalPermalinksReduxConfig */
import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
import { link } from '@wordpress/icons';
import { registerPlugin } from '@wordpress/plugins';
const { postTypes } = externalPermalinksReduxConfig;
const slug = 'external-permalinks-redux';
const View = ( { postType } ) => {
if ( ! postType ) {
return null;
}
return (
<PluginDocumentSettingPanel
name={ slug }
title={ postTypes[ postType ] }
className={ slug }
>
Hi
</PluginDocumentSettingPanel>
);
};
const Panel = compose( [
withSelect( ( select ) => {
const { type: postType } = select( 'core/editor' ).getCurrentPost();
return {
postType,
};
} ),
] )( View );
registerPlugin( slug, {
icon: link,
render: Panel,
} );
......@@ -80,7 +80,7 @@ class External_Permalinks_Redux_Block_Editor {
'post',
external_permalinks_redux::get_instance()->meta_key_type,
array(
// Matches fallback in `external_permalinks_redux::get_redirect_data()`
// Matches fallback in `external_permalinks_redux::get_redirect_data()`.
'default' => 302,
'description' => __(
'Redirect status code',
......
This diff is collapsed.
{
"name": "external-permalinks-redux",
"version": "0.1.0",
"description": "Allows you to point WordPress objects (posts, pages, custom post types) to a URL of your choosing.",
"main": "Gruntfile.js",
"author": "Erick Hitter",
"devDependencies": {
"@wordpress/scripts": "^23.2.0",
"grunt": "^1.5.3",
"grunt-wp-i18n": "^1.0.3",
"grunt-wp-readme-to-markdown": "^2.1.0"
},
"scripts": {
"build": "wp-scripts build",
"check-engines": "wp-scripts check-engines",
"check-licenses": "wp-scripts check-licenses",
"format": "wp-scripts format",
"grunt": "grunt",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"lint:md:docs": "wp-scripts lint-md-docs",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"packages-update": "wp-scripts packages-update",
"start": "wp-scripts start",
"test:e2e": "wp-scripts test-e2e",
"test:unit": "wp-scripts test-unit-js"
}
"name": "external-permalinks-redux",
"version": "0.1.0",
"description": "Allows you to point WordPress objects (posts, pages, custom post types) to a URL of your choosing.",
"main": "Gruntfile.js",
"author": "Erick Hitter",
"devDependencies": {
"@wordpress/icons": "^9.1.0",
"@wordpress/scripts": "^23.2.0",
"grunt": "^1.5.3",
"grunt-wp-i18n": "^1.0.3",
"grunt-wp-readme-to-markdown": "^2.1.0",
"prettier": "npm:wp-prettier@^2.6.2"
},
"scripts": {
"build": "wp-scripts build",
"check-engines": "wp-scripts check-engines",
"check-licenses": "wp-scripts check-licenses",
"format": "wp-scripts format",
"grunt": "grunt",
"lint:css": "wp-scripts lint-style",
"lint:js": "wp-scripts lint-js",
"lint:md:docs": "wp-scripts lint-md-docs",
"lint:pkg-json": "wp-scripts lint-pkg-json",
"packages-update": "wp-scripts packages-update",
"start": "wp-scripts start",
"test:e2e": "wp-scripts test-e2e",
"test:unit": "wp-scripts test-unit-js"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment