mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
[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:
committed by
Copybot
co-authored by
Eric Mc Sween
parent
64da16f0d1
commit
4e2ea44b61
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user