openpetswithchatandmcp/website/update_editor_linter.py
OpenPets Dev 65ac83849e Add 'website/' from commit '966aea480ffe1c340553aa878def30131d2af827'
git-subtree-dir: website
git-subtree-mainline: 8d3849caea
git-subtree-split: 966aea480f
2026-06-17 20:48:39 +00:00

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')