mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
java frontend (#5097)
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Reece <[email protected]> Co-authored-by: Reece Browne <[email protected]>
This commit is contained in:
co-authored by
Reece
Reece Browne
parent
c3456adc2b
commit
c2a63cf425
@@ -1,7 +1,24 @@
|
||||
|
||||
// Base path from Vite config - build-time constant, normalized (no trailing slash)
|
||||
// When no subpath, use empty string instead of '.' to avoid relative path issues
|
||||
export const BASE_PATH = (import.meta.env.BASE_URL || '/').replace(/\/$/, '').replace(/^\.$/, '');
|
||||
// Base path - read from <base> tag at runtime to support dynamic subpaths
|
||||
// Falls back to Vite's BASE_URL for build-time subpaths
|
||||
// Normalized: no trailing slash, empty string instead of '.' or '/'
|
||||
function getBasePath(): string {
|
||||
// Try to read from <base> tag first (runtime subpath support)
|
||||
if (typeof document !== 'undefined') {
|
||||
const baseElement = document.querySelector('base');
|
||||
if (baseElement) {
|
||||
const href = baseElement.getAttribute('href');
|
||||
if (href && href !== '%BASE_URL%') {
|
||||
return href.replace(/\/$/, '').replace(/^\.$/, '').replace(/^\/$/, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to Vite's BASE_URL (build-time subpath)
|
||||
return (import.meta.env.BASE_URL || '/').replace(/\/$/, '').replace(/^\.$/, '').replace(/^\/$/, '');
|
||||
}
|
||||
|
||||
export const BASE_PATH = getBasePath();
|
||||
|
||||
// EmbedPDF needs time to remove annotations internally before a recreation runs.
|
||||
// Without the buffer we occasionally end up with duplicate annotations or stale image data.
|
||||
|
||||
@@ -110,7 +110,7 @@ export const TourOrchestrationProvider: React.FC<{ children: React.ReactNode }>
|
||||
|
||||
const loadSampleFile = useCallback(async () => {
|
||||
try {
|
||||
const response = await fetch('/samples/Sample.pdf');
|
||||
const response = await fetch('samples/Sample.pdf');
|
||||
const blob = await response.blob();
|
||||
const file = new File([blob], 'Sample.pdf', { type: 'application/pdf' });
|
||||
|
||||
|
||||
+2
-2
@@ -335,7 +335,7 @@ export default function AdminGeneralSection() {
|
||||
label: (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem', padding: '0.25rem 0' }}>
|
||||
<img
|
||||
src="/classic-logo/favicon.ico"
|
||||
src="classic-logo/favicon.ico"
|
||||
alt={t('admin.settings.general.logoStyle.classicAlt', 'Classic logo')}
|
||||
style={{ width: '24px', height: '24px' }}
|
||||
/>
|
||||
@@ -348,7 +348,7 @@ export default function AdminGeneralSection() {
|
||||
label: (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem', padding: '0.25rem 0' }}>
|
||||
<img
|
||||
src="/modern-logo/StirlingPDFLogoNoTextLight.svg"
|
||||
src="modern-logo/StirlingPDFLogoNoTextLight.svg"
|
||||
alt={t('admin.settings.general.logoStyle.modernAlt', 'Modern logo')}
|
||||
style={{ width: '24px', height: '24px' }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user