Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions demos/gallery/codemirror-v6-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<title>CodeMirror v6 Upgrade Demo</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}

.editor-container {
margin: 20px 0;
border: 1px solid #ddd;
border-radius: 4px;
}

.editor-header {
background: #f5f5f5;
padding: 10px 15px;
border-bottom: 1px solid #ddd;
font-weight: bold;
}

.editor-content {
height: 300px;
}

.cm-editor {
height: 100%;
}

.success {
color: green;
font-weight: bold;
}

.info {
background: #e7f3ff;
border: 1px solid #b3d7ff;
border-radius: 4px;
padding: 15px;
margin: 20px 0;
}
</style>
</head>
<body>
<h1>πŸŽ‰ CodeMirror v6 Upgrade Successful!</h1>

<div class="info">
<strong>Upgrade Summary:</strong><br>
Successfully upgraded from CodeMirror v5.65.19 to v6.0.2<br>
βœ… All editor classes preserved and working<br>
βœ… Modern modular architecture<br>
βœ… Enhanced language support<br>
βœ… API compatibility maintained
</div>

<div class="editor-container">
<div class="editor-header">JSON Editor (CodeMirror v6)</div>
<div id="json-editor" class="editor-content"></div>
</div>

<div class="editor-container">
<div class="editor-header">ECL Editor (CodeMirror v6)</div>
<div id="ecl-editor" class="editor-content"></div>
</div>

<div class="editor-container">
<div class="editor-header">HTML Editor (CodeMirror v6)</div>
<div id="html-editor" class="editor-content"></div>
</div>

<div id="status"></div>

<script type="module">
// Use the UMD build for simpler integration
const script = document.createElement('script');
script.src = '/packages/codemirror/dist/index.umd.cjs';
script.onload = function() {
const codemirror = window['@hpcc-js/codemirror'];
const status = document.getElementById('status');

try {
// Create JSON Editor
const jsonEditor = new codemirror.JSONEditor()
.target("json-editor")
.text('{\n "name": "CodeMirror v6",\n "version": "6.0.2",\n "status": "upgraded",\n "features": [\n "Modern architecture",\n "Better performance",\n "Enhanced accessibility"\n ]\n}')
.render();

// Create ECL Editor
const eclEditor = new codemirror.ECLEditor()
.target("ecl-editor")
.text('// ECL Code with CodeMirror v6\nEXPORT MyDataset := DATASET([\n {\'Name\': \'CodeMirror\', \'Version\': 6},\n {\'Name\': \'HPCC\', \'Version\': 9}\n], {STRING Name; UNSIGNED2 Version});\n\nOUTPUT(MyDataset);')
.render();

// Create HTML Editor
const htmlEditor = new codemirror.HTMLEditor()
.target("html-editor")
.text('<!DOCTYPE html>\n<html>\n<head>\n <title>CodeMirror v6 Demo</title>\n</head>\n<body>\n <h1>Successfully Upgraded!</h1>\n <p>CodeMirror v6 is now running with enhanced features:</p>\n <ul>\n <li>Modern modular architecture</li>\n <li>Better mobile support</li>\n <li>Improved accessibility</li>\n </ul>\n</body>\n</html>')
.render();

status.innerHTML = '<div class="success">βœ… All CodeMirror v6 editors loaded successfully!</div>';

} catch (error) {
status.innerHTML = `<div style="color: red;">❌ Error: ${error.message}</div>`;
console.error('Error:', error);
}
};

script.onerror = function() {
document.getElementById('status').innerHTML = '<div style="color: red;">❌ Failed to load CodeMirror v6</div>';
};

document.head.appendChild(script);
</script>
</body>
</html>
Loading
Loading