Code:
<!DOCTYPE html>
<html>
<head>
<script src="https://uicdn.toast.com/editor/latest/toastui-editor-all.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.48.4/codemirror.min.css" />
<link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />
</head>
<body>
<div id="editor"></div>
<script>
const editor = new toastui.Editor({
el: document.querySelector('#editor'),
height: '600px',
initialEditType: 'markdown',
previewStyle: 'vertical'
});
</script>
</body>
</html>
Errors:
Uncaught TypeError: Cannot read property 'appendChild' of null
Uncaught TypeError: toastui.Editor is not a constructor
OS: Windows 10
Browser: Chrome (latest version)
Seems to work in JSFiddle though.
if I move everything to the body it works
Closing this issue, as even though the docs don't work, no response, and I found a solution
FWIW, same issue and above note was very helpful https://jsfiddle.net/rrjanbiah/9ytodkbx/
The cdn script should be placen inside your body tag, better at the end of your page and problem solved
Most helpful comment
FWIW, same issue and above note was very helpful https://jsfiddle.net/rrjanbiah/9ytodkbx/