25 lines
1.3 KiB
Python
Executable file
25 lines
1.3 KiB
Python
Executable file
import re
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/EditorSimplified.tsx', 'r', encoding='utf-8') as f:
|
|
text = f.read()
|
|
|
|
# Add a check for zenMode
|
|
if 'zenMode' not in text:
|
|
text = text.replace('import { useEditorStore } from ''../stores/editorStore''', 'import { useEditorStore } from ''../stores/editorStore''\n')
|
|
|
|
# find out how variables are accessed
|
|
text = text.replace('const content = useEditorStore((state) => state.content)', 'const content = useEditorStore((state) => state.content)\n const zenMode = useEditorStore((state) => state.zenMode)\n const toggleZenMode = useEditorStore((state) => state.toggleZenMode)')
|
|
|
|
# Make zen mode override panels
|
|
|
|
text = re.sub(r'const visibleExplorer = isExplorerVisible(.*\n.*)', r'const visibleExplorer = !zenMode && isExplorerVisible\1', text)
|
|
text = re.sub(r'const visiblePreview = isPreviewVisible(.*\n.*);?', r'const visiblePreview = !zenMode && isPreviewVisible\1;', text)
|
|
|
|
# find where to add toggle button (maybe in header?)
|
|
# there is an EditorToolbar component
|
|
|
|
with open('c:/ScriptoriumAI/scriptoriumai-ui/src/pages/EditorSimplified.tsx', 'w', encoding='utf-8') as f:
|
|
f.write(text)
|
|
|
|
print('Added zenMode wiring to EditorSimplified.tsx')
|
|
|