Get started with wysihtml5 CDN

MIT licensed

WysiHTML5: library converting text areas into advanced HTML editors in browsers.

Tags:
  • html5
  • wysiwyg
  • textarea
  • editor

Stable version

Copied!

How to start using wysihtml5 CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with wysihtml5 CDN - cdnhub.io</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
    <script src="https://cdn.cdnhub.io/wysihtml5/0.3.0/wysihtml5.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container mt-5">
        <textarea id="editor" class="form-control" rows="10">
            <p>Hello, this is some <strong>rich text</strong> with <a href="https://www.example.com">links</a>.</p>
        </textarea>
        <button class="btn btn-primary mt-3" id="save">Save</button>
    </div>

    <script>
        const editor = new wysihtml5.Editor('editor', {
            stylesheets: ['https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css'],
            toolbar: {
                "bold": true,
                "italic": true,
                "strikethrough": true,
                "underline": true,
                "link": true,
                "image": false,
                "list": true,
                "code": false,
                "html": false
            }
        });

        document.getElementById('save').addEventListener('click', () => {
            console.log(editor.value());
        });
    </script>
</body>
</html>
Copied!

All versions