squash: feat: Create fillable PDF forms
This commit is contained in:
34
src/js/utils/full-width.ts
Normal file
34
src/js/utils/full-width.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
// Full-width mode utility
|
||||
// This script applies the full-width preference from localStorage to page uploaders
|
||||
|
||||
export function initFullWidthMode() {
|
||||
const savedFullWidth = localStorage.getItem('fullWidthMode') === 'true';
|
||||
|
||||
if (savedFullWidth) {
|
||||
applyFullWidthMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
export function applyFullWidthMode(enabled: boolean) {
|
||||
// Apply to all page uploaders
|
||||
const pageUploaders = document.querySelectorAll('#tool-uploader');
|
||||
pageUploaders.forEach((uploader) => {
|
||||
if (enabled) {
|
||||
uploader.classList.remove('max-w-2xl', 'max-w-5xl');
|
||||
} else {
|
||||
// Restore original max-width if not already present
|
||||
if (!uploader.classList.contains('max-w-2xl') && !uploader.classList.contains('max-w-5xl')) {
|
||||
uploader.classList.add('max-w-2xl');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-initialize on DOM load
|
||||
if (typeof document !== 'undefined') {
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', initFullWidthMode);
|
||||
} else {
|
||||
initFullWidthMode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user