[web] add BibTeX visual editor module (#30726)

* [web] add BibTeX visual editor module

* Make the visual editor hook open to extension

Instead of looking specifically for the bibtex visual editor, allow any
extension to provide a visual editor.

* Fix stylelint error

---------

Co-authored-by: Eric Mc Sween <5454374+emcsween@users.noreply.github.com>
GitOrigin-RevId: c85c27a2b119c826e3d00cbd475a2a21f1508091
This commit is contained in:
Domagoj Kriskovic
2026-01-15 09:05:13 +00:00
committed by Copybot
co-authored by Eric Mc Sween
parent 64da16f0d1
commit 4e2ea44b61
6 changed files with 50 additions and 4 deletions
@@ -0,0 +1,29 @@
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
import { isValidTeXFile } from '../../../main/is-valid-tex-file'
const visualEditorProviders = importOverleafModules('visualEditorProviders')
export function isVisualEditorAvailable(filename: string): boolean {
// Core LaTeX visual editor
if (isValidTeXFile(filename)) {
return true
}
// Visual editors provided by modules
for (const provider of visualEditorProviders) {
if (provider.import.isVisualEditorAvailable(filename)) {
return true
}
}
return false
}
export function getVisualEditorComponent(filename: string) {
for (const provider of visualEditorProviders) {
const component = provider.import.getVisualEditorComponent(filename)
if (component != null) {
return component
}
}
return null
}