diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-compile-button.tsx b/services/web/frontend/js/features/pdf-preview/components/pdf-compile-button.tsx index 6140219070..50ac9ed9d1 100644 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-compile-button.tsx +++ b/services/web/frontend/js/features/pdf-preview/components/pdf-compile-button.tsx @@ -50,6 +50,7 @@ function PdfCompileButton() { recompileFromScratch, smoothPdfTransition, setSmoothPdfTransition, + isLatexProject, } = useCompileContext() const { enableStopOnFirstError, disableStopOnFirstError } = useStopOnFirstError({ eventSource: 'dropdown' }) @@ -171,26 +172,30 @@ function PdfCompileButton() { {t('off')} - - {t('compile_mode')} -
  • - sendEventAndSet(false, setDraft, 'compile-mode')} - trailingIcon={!draft ? 'check' : null} - > - {t('normal')} - -
  • -
  • - sendEventAndSet(true, setDraft, 'compile-mode')} - trailingIcon={draft ? 'check' : null} - > - {t('fast')} [draft] - -
  • + {isLatexProject && ( + <> + + {t('compile_mode')} +
  • + sendEventAndSet(false, setDraft, 'compile-mode')} + trailingIcon={!draft ? 'check' : null} + > + {t('normal')} + +
  • +
  • + sendEventAndSet(true, setDraft, 'compile-mode')} + trailingIcon={draft ? 'check' : null} + > + {t('fast')} [draft] + +
  • + + )} {t('syntax_checks')}
  • @@ -215,26 +220,30 @@ function PdfCompileButton() { {t('ignore_validation_errors')}
  • - - {t('compile_error_handling')} -
  • - - {t('stop_on_first_error')} - -
  • -
  • - - {t('try_to_compile_despite_errors')} - -
  • + {isLatexProject && ( + <> + + {t('compile_error_handling')} +
  • + + {t('stop_on_first_error')} + +
  • +
  • + + {t('try_to_compile_despite_errors')} + +
  • + + )} {t('smooth_pdf_transition')}
  • diff --git a/services/web/frontend/js/shared/context/detach-compile-context.tsx b/services/web/frontend/js/shared/context/detach-compile-context.tsx index f192d0e219..aa6fcaa769 100644 --- a/services/web/frontend/js/shared/context/detach-compile-context.tsx +++ b/services/web/frontend/js/shared/context/detach-compile-context.tsx @@ -76,6 +76,7 @@ export const DetachCompileProvider: FC = ({ activeOverallTheme: _activeOverallTheme, smoothPdfTransition: _smoothPdfTransition, setSmoothPdfTransition: _setSmoothPdfTransition, + isLatexProject: _isLatexProject, } = localCompileContext const [animateCompileDropdownArrow] = useDetachStateWatcher( @@ -152,6 +153,12 @@ export const DetachCompileProvider: FC = ({ 'detacher', 'detached' ) + const [isLatexProject] = useDetachStateWatcher( + 'isLatexProject', + _isLatexProject, + 'detacher', + 'detached' + ) const [lastCompileOptions] = useDetachStateWatcher( 'lastCompileOptions', _lastCompileOptions, @@ -474,6 +481,7 @@ export const DetachCompileProvider: FC = ({ activeOverallTheme, smoothPdfTransition, setSmoothPdfTransition, + isLatexProject, }), [ animateCompileDropdownArrow, @@ -532,6 +540,7 @@ export const DetachCompileProvider: FC = ({ activeOverallTheme, smoothPdfTransition, setSmoothPdfTransition, + isLatexProject, ] ) diff --git a/services/web/frontend/js/shared/context/local-compile-context.tsx b/services/web/frontend/js/shared/context/local-compile-context.tsx index 7d2af27589..f1ebed03e2 100644 --- a/services/web/frontend/js/shared/context/local-compile-context.tsx +++ b/services/web/frontend/js/shared/context/local-compile-context.tsx @@ -132,6 +132,7 @@ export type CompileContext = { darkModePdf: boolean | undefined setDarkModePdf: (value: boolean) => void activeOverallTheme: ActiveOverallTheme + isLatexProject: boolean } export const LocalCompileContext = createContext( @@ -302,6 +303,8 @@ export const LocalCompileProvider: FC = ({ { listen: true } ) const [isTypstProject, setIsTypstProject] = useState(false) + const [isQuartoProject, setIsQuartoProject] = useState(false) + const isLatexProject = !isTypstProject && !isQuartoProject const smoothPdfTransition = isTypstProject ? smoothTransitionTypst : smoothTransitionLatex @@ -380,8 +383,10 @@ export const LocalCompileProvider: FC = ({ // distinguish "no stored preference" from an explicit user choice. useEffect(() => { const { rootResourcePath } = getRootDocInfo() - const isTypst = rootResourcePath.endsWith('.typ') + const isTypst = /\.typ$/i.test(rootResourcePath) + const isQuarto = /\.(qmd|md|rmd)$/i.test(rootResourcePath) setIsTypstProject(isTypst) + setIsQuartoProject(isQuarto) if (!isTypst) return // Default auto-compile ON for Typst — only if user has never set a pref. if (window.localStorage.getItem(`autocompile_enabled:${projectId}`) === null) { @@ -873,6 +878,7 @@ export const LocalCompileProvider: FC = ({ activeOverallTheme, smoothPdfTransition, setSmoothPdfTransition, + isLatexProject, }), [ animateCompileDropdownArrow, @@ -930,6 +936,7 @@ export const LocalCompileProvider: FC = ({ activeOverallTheme, smoothPdfTransition, setSmoothPdfTransition, + isLatexProject, ] ) diff --git a/services/web/locales/de.json b/services/web/locales/de.json index b65979d4e5..a99f4c4e92 100644 --- a/services/web/locales/de.json +++ b/services/web/locales/de.json @@ -1396,6 +1396,7 @@ "state": "Status", "status_checks": "Statusüberprüfungen", "still_have_questions": "Hast du noch Fragen?", + "smooth_pdf_transition": "Weicher PDF-Übergang", "stop_compile": "Kompiliervorgang stoppen", "stop_on_first_error": "Beim ersten Fehler anhalten", "stop_on_first_error_enabled_description": "<0>„Anhalten beim ersten Fehler“ ist aktiviert. Durch Deaktivieren kann der Compiler möglicherweise eine PDF-Datei erstellen (Das Projekt wird aber weiterhin Fehler enthalten).", diff --git a/services/web/locales/es.json b/services/web/locales/es.json index 0b76f61b51..72eb3d446b 100644 --- a/services/web/locales/es.json +++ b/services/web/locales/es.json @@ -541,6 +541,7 @@ "share_project": "Compartir proyecto", "shared_with_you": "Compartidos contigo", "single_sign_on_sso": "Single Sign-On (SSO)", + "smooth_pdf_transition": "Transición suave del PDF", "something_went_wrong_rendering_pdf": "Algo ha fallado al renderizar este PDF.", "somthing_went_wrong_compiling": "Disculpa, algo anduvo mal y tu proyecto no se pudo compilar. Por favor, intenta de nuevo en unos minutos más.", "source": "Fuente", diff --git a/services/web/locales/fr.json b/services/web/locales/fr.json index 2dfae18fa2..e631f3327c 100644 --- a/services/web/locales/fr.json +++ b/services/web/locales/fr.json @@ -1031,6 +1031,7 @@ "state": "État", "status_checks": "Vérifications d’état", "still_have_questions": "Vous avez d’autres questions ?", + "smooth_pdf_transition": "Transition PDF fluide", "stop_compile": "Arrêter la compilation", "stop_on_first_error": "Arrêter à la première erreur", "stop_on_validation_error": "Vérifier la syntaxe avant la compilation",