feat(core): add pdf embed preview feature flag (#9307)
This commit is contained in:
@@ -11,6 +11,7 @@ import type {
|
|||||||
} from '@affine/core/modules/doc-info/types';
|
} from '@affine/core/modules/doc-info/types';
|
||||||
import { EditorService } from '@affine/core/modules/editor';
|
import { EditorService } from '@affine/core/modules/editor';
|
||||||
import { EditorSettingService } from '@affine/core/modules/editor-setting';
|
import { EditorSettingService } from '@affine/core/modules/editor-setting';
|
||||||
|
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||||
import { JournalService } from '@affine/core/modules/journal';
|
import { JournalService } from '@affine/core/modules/journal';
|
||||||
import { toURLSearchParams } from '@affine/core/modules/navigation';
|
import { toURLSearchParams } from '@affine/core/modules/navigation';
|
||||||
import { PeekViewService } from '@affine/core/modules/peek-view/services/peek-view';
|
import { PeekViewService } from '@affine/core/modules/peek-view/services/peek-view';
|
||||||
@@ -97,12 +98,14 @@ const usePatchSpecs = (shared: boolean, mode: DocMode) => {
|
|||||||
docsService,
|
docsService,
|
||||||
editorService,
|
editorService,
|
||||||
workspaceService,
|
workspaceService,
|
||||||
|
featureFlagService,
|
||||||
} = useServices({
|
} = useServices({
|
||||||
PeekViewService,
|
PeekViewService,
|
||||||
DocService,
|
DocService,
|
||||||
DocsService,
|
DocsService,
|
||||||
WorkspaceService,
|
WorkspaceService,
|
||||||
EditorService,
|
EditorService,
|
||||||
|
FeatureFlagService,
|
||||||
});
|
});
|
||||||
const framework = useFramework();
|
const framework = useFramework();
|
||||||
const referenceRenderer: ReferenceReactRenderer = useMemo(() => {
|
const referenceRenderer: ReferenceReactRenderer = useMemo(() => {
|
||||||
@@ -149,7 +152,11 @@ const usePatchSpecs = (shared: boolean, mode: DocMode) => {
|
|||||||
let patched = specs.concat(
|
let patched = specs.concat(
|
||||||
patchReferenceRenderer(reactToLit, referenceRenderer)
|
patchReferenceRenderer(reactToLit, referenceRenderer)
|
||||||
);
|
);
|
||||||
patched = patched.concat(patchForAttachmentEmbedViews(reactToLit));
|
|
||||||
|
if (featureFlagService.flags.enable_pdf_embed_preview.value) {
|
||||||
|
patched = patched.concat(patchForAttachmentEmbedViews(reactToLit));
|
||||||
|
}
|
||||||
|
|
||||||
patched = patched.concat(patchNotificationService(confirmModal));
|
patched = patched.concat(patchNotificationService(confirmModal));
|
||||||
patched = patched.concat(patchPeekViewService(peekViewService));
|
patched = patched.concat(patchPeekViewService(peekViewService));
|
||||||
patched = patched.concat(patchEdgelessClipboard());
|
patched = patched.concat(patchEdgelessClipboard());
|
||||||
@@ -178,6 +185,7 @@ const usePatchSpecs = (shared: boolean, mode: DocMode) => {
|
|||||||
referenceRenderer,
|
referenceRenderer,
|
||||||
shared,
|
shared,
|
||||||
specs,
|
specs,
|
||||||
|
featureFlagService,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -234,7 +234,16 @@ export const AFFINE_FLAGS = {
|
|||||||
configurable: isMobile,
|
configurable: isMobile,
|
||||||
defaultState: false,
|
defaultState: false,
|
||||||
},
|
},
|
||||||
|
enable_pdf_embed_preview: {
|
||||||
|
category: 'affine',
|
||||||
|
displayName:
|
||||||
|
'com.affine.settings.workspace.experimental-features.enable-pdf-embed-preview.name',
|
||||||
|
description:
|
||||||
|
'com.affine.settings.workspace.experimental-features.enable-pdf-embed-preview.description',
|
||||||
|
configurable: !isMobile,
|
||||||
|
defaultState: false,
|
||||||
|
},
|
||||||
} satisfies { [key in string]: FlagInfo };
|
} satisfies { [key in string]: FlagInfo };
|
||||||
|
|
||||||
// eslint-disable-next-line no-redeclare
|
// oxlint-disable-next-line no-redeclare
|
||||||
export type AFFINE_FLAGS = typeof AFFINE_FLAGS;
|
export type AFFINE_FLAGS = typeof AFFINE_FLAGS;
|
||||||
|
|||||||
@@ -1324,6 +1324,8 @@
|
|||||||
"com.affine.settings.workspace.experimental-features.enable-multiple-cloud-servers.description": "Once enabled, users can connect to selfhosted cloud servers.",
|
"com.affine.settings.workspace.experimental-features.enable-multiple-cloud-servers.description": "Once enabled, users can connect to selfhosted cloud servers.",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-mobile-edgeless-editing.name": "Enable Edgeless Editing",
|
"com.affine.settings.workspace.experimental-features.enable-mobile-edgeless-editing.name": "Enable Edgeless Editing",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-mobile-edgeless-editing.description": "Once enabled, users can edit edgeless canvas.",
|
"com.affine.settings.workspace.experimental-features.enable-mobile-edgeless-editing.description": "Once enabled, users can edit edgeless canvas.",
|
||||||
|
"com.affine.settings.workspace.experimental-features.enable-pdf-embed-preview.name": "PDF embed preview",
|
||||||
|
"com.affine.settings.workspace.experimental-features.enable-pdf-embed-preview.description": "Once enabled, you can preview PDF in embed view.",
|
||||||
"com.affine.settings.workspace.not-owner": "Only an owner can edit the workspace avatar and name. Changes will be shown for everyone.",
|
"com.affine.settings.workspace.not-owner": "Only an owner can edit the workspace avatar and name. Changes will be shown for everyone.",
|
||||||
"com.affine.settings.workspace.preferences": "Preference",
|
"com.affine.settings.workspace.preferences": "Preference",
|
||||||
"com.affine.settings.workspace.billing": "Billing",
|
"com.affine.settings.workspace.billing": "Billing",
|
||||||
|
|||||||
Reference in New Issue
Block a user