123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Presentation editor</title>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
- <link rel="stylesheet" href=
- "https://use.fontawesome.com/releases/v5.6.3/css/all.css"
- integrity=
- "sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
- crossorigin="anonymous">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
- </head>
- <body>
- <div class="container">
- <h1>Presentation editor</h1>
- <div id='editor_holder'></div>
- <button class="btn btn-success" id='submit'>Submit (console.log)</button>
- </div>
- <script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
- <script>
- fetch("/static/slides.schema.json")
- .then(res => res.json())
- .then(schema => {
- console.log(schema);
- fetch("/static/slides.json")
- .then(res => res.json())
- .then(slides => {
- console.log(slides);
- // Initialize the editor with a JSON schema
- var editor = new JSONEditor(
- document.getElementById('editor_holder'), {
- theme: "bootstrap5",
- iconlib: "fontawesome5",
- ajax: true,
- schema: schema,
- startval: slides
- });
- // Hook up the submit button to log to the console
- document.getElementById('submit').addEventListener('click',() => {
- // Get the value from the editor
- console.log(editor.getValue());
- });
- });
- });
- </script>
- </body>
- </html>
|