22 lines
927 B
Python
Executable file
22 lines
927 B
Python
Executable file
import re
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/components/LaTeXEditor.tsx', 'r', encoding='utf-8') as f:
|
|
text = f.read()
|
|
|
|
if 'lintLatex' not in text:
|
|
text = text.replace("import { monaco, useMonacoLanguage } from '@/utils/monaco'", "import { monaco, useMonacoLanguage } from '@/utils/monaco'\nimport { lintLatex } from '@/utils/latex-linter'")
|
|
|
|
onChangeReplacement = ''' const handleEditorChange = (nextValue?: string) => {
|
|
onChange(nextValue ?? '')
|
|
if (editorRef.current) {
|
|
const model = editorRef.current.getModel()
|
|
if (model) {
|
|
lintLatex(model)
|
|
}
|
|
}
|
|
}'''
|
|
text = text.replace(' const handleEditorChange = (nextValue?: string) => {\n onChange(nextValue ?? \'\')\n }', onChangeReplacement)
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/components/LaTeXEditor.tsx', 'w', encoding='utf-8') as f:
|
|
f.write(text)
|
|
print('Updated LaTeXEditor.tsx')
|