You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monaco-editor/test/manual/2040/iframe.js

23 lines
599 B
JavaScript

const init = () => {
3 years ago
loadEditor(function () {
// create the editor
const target = document.getElementById('container');
const editor = monaco.editor.create(target, { language: 'html' });
3 years ago
// load some sample data
(async () => {
const response = await fetch('https://microsoft.github.io/monaco-editor/');
const html = await response.text();
editor.getModel().setValue(html);
})();
});
};
window.addEventListener('DOMContentLoaded', () => {
3 years ago
if (!window.innerWidth || !window.innerHeight) {
window.addEventListener('resize', init, { once: true });
} else {
init();
}
});