uiwjs / react-monacoeditor

Monaco Editor component for React.

Home Page:https://uiwjs.github.io/react-monacoeditor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When there are two editors on a page, changing one theme will affect the other

zeroHW opened this issue · comments

When I use react-monacoeditor I get this bug. There are two react-monacoeditor in my page, a loaded one is vs-light and a unloaded one is vs-dark. After the unloaded one is loaded, the loaded one will become vs-dark. I think they should not influence each other.

@zeroHW Can give an example?

@jaywcjlove 我遇到的情况是这样的,同一页面上有两个编辑器,1号已加载的主题是vs-light,2号预加载的主题是vs-dark,正常状态应该是1号和2号的主题互不影响,但实际状态是2号加载以后,1号的主题会变为vs-dark。

example:

            <Container fluid>
              <Row>
                {/* <Col>
                  <h6>Values</h6>
                </Col> */}
                <Col>
                  <h6>Selected File</h6>
                  <MonacoEditor
                    language="html"
                    value="<h1>I ♥ react-monacoeditor</h1>"
                    options={{
                      theme: 'vs-light',
                    }}
                  />
                </Col>
                <Col>
                  <h6>Render Output</h6>
                  <MonacoEditor
                    language="yaml"
                    value="<h1>I ♥ react-monacoeditor</h1>"
                    options={{
                      theme: 'vs-dark',
                      readOnly: true,
                    }}
                  />
                </Col>
              </Row>
            </Container>