mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-08 00:50:59 +01:00
feat: add support for disabling specific features in the PDF Editor
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user