<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<style>
#editor-container {
height: 375px;
}
</style>
</head>
<body>
<h1>Editor</h1>
<div id="editor-container">
</div>
<h1>Result</h1>
<div id="editor-presentor"></div>
<script>
const container = new Quill('#editor-container', {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block']
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
});
const presentor = new Quill('#editor-presentor', {
readOnly: true,
theme: 'bubble'
});
container.on('editor-change', () => {
presentor.setContents(container.getContents())
})
</script>
</body>
</html>