You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

editor.html 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Presentation editor</title>
  7. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
  8. <link rel="stylesheet" href=
  9. "https://use.fontawesome.com/releases/v5.6.3/css/all.css"
  10. integrity=
  11. "sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
  12. crossorigin="anonymous">
  13. <link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
  14. </head>
  15. <body>
  16. <div class="container">
  17. <h1>Presentation editor</h1>
  18. <div id='editor_holder'></div>
  19. <button class="btn btn-success" id='submit'>Submit (console.log)</button>
  20. </div>
  21. <script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
  22. <script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
  23. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
  24. <script>
  25. fetch("/static/slides.schema.json")
  26. .then(res => res.json())
  27. .then(schema => {
  28. console.log(schema);
  29. fetch("/static/slides.json")
  30. .then(res => res.json())
  31. .then(slides => {
  32. console.log(slides);
  33. // Initialize the editor with a JSON schema
  34. var editor = new JSONEditor(
  35. document.getElementById('editor_holder'), {
  36. theme: "bootstrap5",
  37. iconlib: "fontawesome5",
  38. ajax: true,
  39. schema: schema,
  40. startval: slides
  41. });
  42. // Hook up the submit button to log to the console
  43. document.getElementById('submit').addEventListener('click',() => {
  44. // Get the value from the editor
  45. console.log(editor.getValue());
  46. });
  47. });
  48. });
  49. </script>
  50. </body>
  51. </html>