Adding CodeMirror to Shadow Dom of Custom Element?

前端 未结 1 1921
轻奢々
轻奢々 2021-01-22 02:18

I\'d like to dynamically create a CodeMirror instance inside a Custom Element and have it live inside the element\'s Shadow DOM. For example:

         


        
1条回答
  •  余生分开走
    2021-01-22 02:34

    Import CodeMirror's stylesheet inside the shadow DOM with @import url:

    constructor() {
        super();
        let shadowRoot = this.attachShadow({ mode: 'open' });
        shadowRoot.innerHTML = `
            `         
    }
    

    0 讨论(0)
提交回复
热议问题