From 2a89d0429ca23420a44dca4eb5b1afd48246f01f Mon Sep 17 00:00:00 2001 From: Simon Gaudreau Date: Tue, 26 Mar 2019 10:24:11 -0400 Subject: [PATCH 1/3] Make sure the code support custom post type without excerpt --- src/PostSelector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PostSelector.js b/src/PostSelector.js index ee40db5..147bd33 100644 --- a/src/PostSelector.js +++ b/src/PostSelector.js @@ -202,11 +202,11 @@ class PostSelector extends Component { apiFetch({ path: `/wp/v2/${restBase}/${post.id}` }).then(response => { - // console.log( response ); + const excerpt = response.excerpt ? response.excerpt.rendered : ''; const fullpost = { title: decodeEntities(response.title.rendered), id: response.id, - excerpt: decodeEntities(response.excerpt.rendered), + excerpt: decodeEntities(excerpt), url: response.link, date: response.date, type: response.type, From f412518dad5b502bcf634bce9b38bae7e1498eb0 Mon Sep 17 00:00:00 2001 From: Orlando Wenzinger Date: Tue, 11 Jun 2019 18:06:50 +0200 Subject: [PATCH 2/3] [Bugfix]: Fix missleading docs --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3366def..4260ad5 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ registerBlockType('vermilion/post-selector', { { - attributes.posts.push(post); - setAttributes({ posts: [...attributes.posts] }); + const updatedPosts = [...attributes.posts, post]; + setAttributes({ posts: updatedPosts }); }} posts={attributes.posts} onChange={newValue => { From 5477c957d19d56e82312bf04e3079f5bf32cbcf0 Mon Sep 17 00:00:00 2001 From: Matt Dickey Date: Tue, 20 Aug 2019 09:06:35 -0600 Subject: [PATCH 3/3] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4260ad5..9ed52a6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +## \*\*\*\*_This repo is no longer being maintained_\*\*\*\* +_Vermilion Design has shifted the way that we develop for Gutenberg which means that this repo will no longer be relevant for our workflow. Additionally, there is a fundamental flaw with getting posts the way that this component does it. Data will not change when the source posts are updated. In order to circumvent this, you should use Server Side Rendering views, which are much easier to write and maintain. However, if you would like to still use this component, you should check out one of the forks._ + # Gutenberg PostSelector REQUIRES WordPress 5.0+