summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2019-05-22 01:01:36 -0400
committerYury German <blueknight@gentoo.org>2019-05-22 01:01:36 -0400
commit0914c92da22824025992c368c745546e41fbeb84 (patch)
tree965f6adf3b725e56d559fe4a93eff02281499dcc /plugins/jetpack/extensions/blocks/seo/panel.js
parentDeleting plugins for update (diff)
downloadblogs-gentoo-0914c92da22824025992c368c745546e41fbeb84.tar.gz
blogs-gentoo-0914c92da22824025992c368c745546e41fbeb84.tar.bz2
blogs-gentoo-0914c92da22824025992c368c745546e41fbeb84.zip
Adding Plugins
Updating the following akismet.4.1.2, google-authenticator.0.52, jetpack.7.3.1 Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'plugins/jetpack/extensions/blocks/seo/panel.js')
-rw-r--r--plugins/jetpack/extensions/blocks/seo/panel.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/jetpack/extensions/blocks/seo/panel.js b/plugins/jetpack/extensions/blocks/seo/panel.js
new file mode 100644
index 00000000..38496052
--- /dev/null
+++ b/plugins/jetpack/extensions/blocks/seo/panel.js
@@ -0,0 +1,54 @@
+/**
+ * External dependencies
+ */
+import { __, _n, sprintf } from '@wordpress/i18n';
+import { Component } from '@wordpress/element';
+import { compose } from '@wordpress/compose';
+import { get } from 'lodash';
+import { withDispatch, withSelect } from '@wordpress/data';
+
+class SeoPanel extends Component {
+ onMessageChange = event => {
+ this.props.updateSeoDescription( event.target.value );
+ };
+
+ render() {
+ const { seoDescription } = this.props;
+
+ return (
+ <div className="jetpack-seo-message-box">
+ <textarea
+ value={ seoDescription }
+ onChange={ this.onMessageChange }
+ placeholder={ __( 'Write a description…', 'jetpack' ) }
+ rows={ 4 }
+ />
+ <div className="jetpack-seo-character-count">
+ { sprintf(
+ _n( '%d character', '%d characters', seoDescription.length, 'jetpack' ),
+ seoDescription.length
+ ) }
+ </div>
+ </div>
+ );
+ }
+}
+
+export default compose( [
+ withSelect( select => ( {
+ seoDescription: get(
+ select( 'core/editor' ).getEditedPostAttribute( 'meta' ),
+ [ 'advanced_seo_description' ],
+ ''
+ ),
+ } ) ),
+ withDispatch( dispatch => ( {
+ updateSeoDescription( seoDescription ) {
+ dispatch( 'core/editor' ).editPost( {
+ meta: {
+ advanced_seo_description: seoDescription,
+ },
+ } );
+ },
+ } ) ),
+] )( SeoPanel );