feat: add support for disabling specific features in the PDF Editor

This commit is contained in:
alam00000
2026-03-29 23:02:58 +05:30
parent 245b48464b
commit a617279c2d
6 changed files with 66 additions and 1 deletions
+10
View File
@@ -2,6 +2,7 @@ import type { AppConfig } from '@/types';
const disabledToolsSet = new Set<string>(__DISABLED_TOOLS__);
let runtimeConfigLoaded = false;
let editorDisabledCategories: string[] = [];
export async function loadRuntimeConfig(): Promise<void> {
if (runtimeConfigLoaded) return;
@@ -21,6 +22,11 @@ export async function loadRuntimeConfig(): Promise<void> {
}
}
}
if (Array.isArray(config.editorDisabledCategories)) {
editorDisabledCategories = config.editorDisabledCategories.filter(
(c): c is string => typeof c === 'string'
);
}
} catch {}
}
@@ -36,6 +42,10 @@ export function getToolIdFromPath(): string | null {
return withoutExt?.[1] ?? null;
}
export function getEditorDisabledCategories(): string[] {
return editorDisabledCategories;
}
export function isCurrentPageDisabled(): boolean {
const toolId = getToolIdFromPath();
if (!toolId) return false;