Spaces:
Running
Running
Download components/pro/monaco_editor/demos/javascript_customize.py from modelscope/modelscope-studio: direct link, hf CLI and curl.
- Browser
- Download file 989 Bytes
-
https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/pro/monaco_editor/demos/javascript_customize.py
- Command line
-
hf download hf://spaces/modelscope/modelscope-studio/components/pro/monaco_editor/demos/javascript_customize.py
-
curl -L -o javascript_customize.py https://huggingface.co/spaces/modelscope/modelscope-studio/resolve/main/components/pro/monaco_editor/demos/javascript_customize.py
989 Bytes
| import gradio as gr | |
| import modelscope_studio.components.antd as antd | |
| import modelscope_studio.components.base as ms | |
| import modelscope_studio.components.pro as pro | |
| with gr.Blocks() as demo, ms.Application(), antd.ConfigProvider(): | |
| pro.MonacoEditor( | |
| value="""import gradio as gr | |
| import modelscope_studio.components.antd as antd | |
| import modelscope_studio.components.base as ms | |
| import modelscope_studio.components.pro as pro | |
| with gr.Blocks() as demo, ms.Application(), antd.ConfigProvider(): | |
| pro.MonacoEditor( | |
| value="Hello World", | |
| height=400, | |
| ) | |
| if __name__ == "__main__": | |
| demo.queue().launch() | |
| """, | |
| language="python", | |
| height=400, | |
| # pass a javascript function string to the after_mount prop | |
| after_mount="""(editor) => { | |
| editor.updateOptions({ | |
| readOnly: true, | |
| minimap: { | |
| enabled: false, | |
| }, | |
| }) | |
| }""") | |
| if __name__ == "__main__": | |
| demo.queue().launch() | |