Get started with constrained-editor-plugin CDN

MIT licensed

Plugin: Software component restricting input formats in text editors for data consistency, security.

Tags:
  • monaco-editor
  • restrictions-in-editor
  • edit-area-restriction

Stable version

Copied!

How to start using constrained-editor-plugin CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with constrained-editor-plugin CDN - cdnhub.io</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/constrain-image-ratio/1.1.0/constrain.min.css">
    <script src="https://cdn.cdnhub.io/constrained-editor-plugin/1.3.0/constrainedEditorPlugin.min.js"></script>
</head>
<body>
    <div id="editor-container">
        <img id="image" src="path/to/your/image.jpg" alt="Image to be edited">
        <textarea id="caption"></textarea>
    </div>

    <script>
        const editorContainer = document.getElementById('editor-container');
        const image = editorContainer.querySelector('#image');
        const caption = editorContainer.querySelector('#caption');

        const editor = new ConstrainedEditorPlugin(image, {
            aspectRatio: 16 / 9,
            minWidth: 300,
            minHeight: 180,
            maxWidth: 800,
            maxHeight: 600,
            onCaptionChange: (captionText) => {
                console.log('Caption changed:', captionText);
            }
        });

        editor.on('fileUploaded', (file) => {
            console.log('File uploaded:', file.name);
        });

        editor.init();
    </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions