feat: add content preview (remove future flag)

This commit is contained in:
Rémi de Juvigny 2024-12-04 09:36:19 +01:00
parent 2dcec09530
commit 81b62a508e
6 changed files with 2 additions and 26 deletions

View File

@ -1,5 +1 @@
module.exports = ({ env }) => ({ module.exports = ({ env }) => ({});
future: {
preview: env.bool('STRAPI_FUTURE_PREVIEW', false),
},
});

View File

@ -1 +0,0 @@
export const FEATURE_ID = 'preview';

View File

@ -1,18 +1,12 @@
/* eslint-disable check-file/no-index */ /* eslint-disable check-file/no-index */
import { PreviewSidePanel } from './components/PreviewSidePanel'; import { PreviewSidePanel } from './components/PreviewSidePanel';
import { FEATURE_ID } from './constants';
import type { ContentManagerPlugin } from '../content-manager'; import type { ContentManagerPlugin } from '../content-manager';
import type { PluginDefinition } from '@strapi/admin/strapi-admin'; import type { PluginDefinition } from '@strapi/admin/strapi-admin';
const previewAdmin = { const previewAdmin = {
bootstrap(app) { bootstrap(app) {
// TODO: Add license registry check when it's available
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
return;
}
const contentManagerPluginApis = app.getPlugin('content-manager') const contentManagerPluginApis = app.getPlugin('content-manager')
.apis as ContentManagerPlugin['config']['apis']; .apis as ContentManagerPlugin['config']['apis'];

View File

@ -1 +0,0 @@
export const FEATURE_ID = 'preview';

View File

@ -1,6 +1,5 @@
import type { Plugin } from '@strapi/types'; import type { Plugin } from '@strapi/types';
import { FEATURE_ID } from './constants';
import { routes } from './routes'; import { routes } from './routes';
import { controllers } from './controllers'; import { controllers } from './controllers';
import { services } from './services'; import { services } from './services';
@ -11,15 +10,6 @@ import { getService } from './utils';
* so that we can assume it is enabled in the other files. * so that we can assume it is enabled in the other files.
*/ */
const getFeature = (): Partial<Plugin.LoadedPlugin> => { const getFeature = (): Partial<Plugin.LoadedPlugin> => {
if (!strapi.features.future.isEnabled(FEATURE_ID)) {
return {};
}
// TODO: Add license registry check when it's available
// if (!strapi.ee.features.isEnabled('cms-content-preview')) {
// return {};
// }
return { return {
register() { register() {
const config = getService(strapi, 'preview-config'); const config = getService(strapi, 'preview-config');

View File

@ -1,7 +1,5 @@
export interface FeaturesConfig { export interface FeaturesConfig {
future?: { future?: object;
preview?: boolean;
};
} }
export interface FeaturesService { export interface FeaturesService {