Skip to content

Commit 20e0fec

Browse files
committed
feat(strapi): add preview button
1 parent 9011272 commit 20e0fec

5 files changed

Lines changed: 45 additions & 48 deletions

File tree

apps/strapi/config/plugins.ts

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@ export default ({ env }: { env: Env }) => ({
129129
'entity-notes': {
130130
enabled: true,
131131
},
132-
// scheduler: {
133-
// enabled: true,
134-
// // pathToPlugin: '../../../node_modules/strapi-plugin-scheduler',
135-
// config: {
136-
// model: 'scheduler',
137-
// },
138-
// },
139132
seo: {
140133
// pathToPlugin: '../../../node_modules/@strapi/plugin-seo',
141134
enabled: true,
@@ -188,7 +181,7 @@ export default ({ env }: { env: Env }) => ({
188181
},
189182
},
190183
publisher: {
191-
enabled: true,
184+
enabled: false,
192185
},
193186
navigation: {
194187
enabled: false,
@@ -201,6 +194,11 @@ export default ({ env }: { env: Env }) => ({
201194
config: {
202195
host: env('MEILISEARCH_URL'),
203196
apiKey: env('MEILISEARCH_API_KEY'),
197+
'blog-post': {
198+
settings: {
199+
filterableAttributes: ['blog_tags', 'category', 'blog_authors', 'team_members'],
200+
},
201+
},
204202
},
205203
},
206204
graphql: {
@@ -209,4 +207,37 @@ export default ({ env }: { env: Env }) => ({
209207
'strapi-blurhash': {
210208
enabled: true,
211209
},
210+
'preview-button': {
211+
config: {
212+
openTarget: '_blank',
213+
contentTypes: [
214+
{
215+
uid: 'api::blog-post.blog-post',
216+
draft: {
217+
url: 'https://blog.trialanderror.org/api/draft',
218+
query: {
219+
secret: env('DRAFT_SECRET'),
220+
slug: '{slug}',
221+
},
222+
},
223+
published: {
224+
url: 'https://blog.trialanderror.org/{slug}',
225+
},
226+
},
227+
{
228+
uid: 'api::page.page',
229+
draft: {
230+
url: 'https://trialanderror.org/api/draft',
231+
query: {
232+
secret: env('DRAFT_SECRET'),
233+
slug: '{slug}',
234+
},
235+
},
236+
published: {
237+
url: 'https://trialanderror.org/{slug}',
238+
},
239+
},
240+
],
241+
},
242+
},
212243
})

apps/strapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"strapi-plugin-navigation": "^2.2.4",
3232
"strapi-plugin-notes": "^1.0.1",
3333
"strapi-plugin-plausible": "^1.0.5",
34-
"strapi-plugin-preview-button": "^1.1.2",
34+
"strapi-plugin-preview-button": "^1.1.3",
3535
"strapi-plugin-publisher": "^1.2.0",
3636
"strapi-plugin-rest-cache": "^4.2.6",
3737
"strapi-plugin-sitemap": "^2.0.9",

apps/strapi/src/extensions/documentation/documentation/1.0.0/full_documentation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"name": "Apache 2.0",
1515
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
1616
},
17-
"x-generation-date": "2023-05-11T12:23:59.818Z"
17+
"x-generation-date": "2023-05-16T13:10:15.926Z"
1818
},
1919
"x-strapi-config": {
2020
"path": "/documentation",

apps/strapi/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11532,10 +11532,10 @@ strapi-plugin-plausible@^1.0.5:
1153211532
resolved "https://registry.yarnpkg.com/strapi-plugin-plausible/-/strapi-plugin-plausible-1.0.5.tgz#871f83fada0c4074f515275d2f037ff9eda9f90a"
1153311533
integrity sha512-cIx6cBxz9EjdKbxMq+/8ruRuWAPRR1LVbxGffgdRC0s0SkQ05rNBVQ78zbC7W2eypmIjkf/RRNmd8ML27upwhw==
1153411534

11535-
strapi-plugin-preview-button@^1.1.2:
11536-
version "1.1.2"
11537-
resolved "https://registry.yarnpkg.com/strapi-plugin-preview-button/-/strapi-plugin-preview-button-1.1.2.tgz#453a5b91a2e53ff3a930917e74aceb57460a0121"
11538-
integrity sha512-YnNTLxa9YFK9H6Vk4/tFQlWAfGSLuX2IKZMxVOiqww5yt78rn0AiKU+pk/ZqYUFB2msO8uCGWeJxsBvFHDhl2g==
11535+
strapi-plugin-preview-button@^1.1.3:
11536+
version "1.1.3"
11537+
resolved "https://registry.yarnpkg.com/strapi-plugin-preview-button/-/strapi-plugin-preview-button-1.1.3.tgz#c1d30dd741d637e70ef55e55b633a8851e67840b"
11538+
integrity sha512-j+32xYeA0ZRm1yrVBJASHDln1NCCWgWICM5BI/dxV7614Rg2CzAUAe3q0NnMMrocjuvRBbhuxnigOhh0QEjDgQ==
1153911539
dependencies:
1154011540
immer "^9.0.12"
1154111541
prop-types "^15.8.1"

libs/types/src/lib/schemas.d.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -437,39 +437,6 @@ export interface PluginSlugifySlug extends CollectionTypeSchema {
437437
}
438438
}
439439

440-
export interface PluginPublisherAction extends CollectionTypeSchema {
441-
info: {
442-
singularName: 'action'
443-
pluralName: 'actions'
444-
displayName: 'actions'
445-
}
446-
options: {
447-
draftAndPublish: false
448-
comment: ''
449-
}
450-
pluginOptions: {
451-
'content-manager': {
452-
visible: false
453-
}
454-
'content-type-builder': {
455-
visible: false
456-
}
457-
}
458-
attributes: {
459-
executeAt: DateTimeAttribute
460-
mode: StringAttribute
461-
entityId: IntegerAttribute
462-
entitySlug: StringAttribute
463-
createdAt: DateTimeAttribute
464-
updatedAt: DateTimeAttribute
465-
createdBy: RelationAttribute<'plugin::publisher.action', 'oneToOne', 'admin::user'> &
466-
PrivateAttribute
467-
updatedBy: RelationAttribute<'plugin::publisher.action', 'oneToOne', 'admin::user'> &
468-
PrivateAttribute
469-
sitemap_exclude: BooleanAttribute & PrivateAttribute & DefaultTo<false>
470-
}
471-
}
472-
473440
export interface PluginMenusMenu extends CollectionTypeSchema {
474441
info: {
475442
displayName: 'Menu'
@@ -2208,7 +2175,6 @@ declare global {
22082175
'plugin::email-designer.email-template': PluginEmailDesignerEmailTemplate
22092176
'plugin::entity-notes.note': PluginEntityNotesNote
22102177
'plugin::slugify.slug': PluginSlugifySlug
2211-
'plugin::publisher.action': PluginPublisherAction
22122178
'plugin::menus.menu': PluginMenusMenu
22132179
'plugin::menus.menu-item': PluginMenusMenuItem
22142180
'plugin::i18n.locale': PluginI18NLocale

0 commit comments

Comments
 (0)