I have an editor from ToastUI (source code :
<html>
<head>
<title>TOAST UI</title>
<script src="https://uicdn.toast.com/tui-editor/latest/tui-editor-Editor-full.js"></script>
<script src="https://code.jquery.com/jquery-1.12.3.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" />
</script>
</head>
<body>
<div id="editorSection">
</div>
<button id = "but">Hello</button>
<script>
var editor = new tui.Editor({
el: document.querySelector('#editorSection'),
previewStyle: 'vertical',
height: '300px',
initialEditType: 'markdown'
});
document.querySelector("#but").addEventListener("click", function() {
//I want such html to make the markdown text, but this doesn't work.
console.log(document.querySelector('#editorSection').textContent)
})
</script>
</body>
</html>
and it works, but I want to save the markdown text to a database on a click of a button. How to do this?