Method
load_codemirror_theme
(theme: string, url_tpl = appConfig.codeMirrorThemeURL)
Source from the content-addressed store, hash-verified
| 137 | }; |
| 138 | |
| 139 | static load_codemirror_theme(theme: string, url_tpl = appConfig.codeMirrorThemeURL) { |
| 140 | let cssId = 'codemirror_theme_' + theme; // you could encode the css path itself to generate id.. |
| 141 | if (!document.getElementById(cssId)) { |
| 142 | let head = document.getElementsByTagName('head')[0]; |
| 143 | let link = document.createElement('link'); |
| 144 | link.id = cssId; |
| 145 | link.rel = 'stylesheet'; |
| 146 | link.type = 'text/css'; |
| 147 | link.href = url_tpl.replace('%N', theme); |
| 148 | link.media = 'all'; |
| 149 | head.appendChild(link); |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | |
Tested by
no test coverage detected