string-sceditor.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>wysiwyg-sceditor</title>
  6. <!-- json editor -->
  7. <script src="../../dist/jsoneditor.js"></script>
  8. <!-- jquery -->
  9. <script src="./../../node_modules/jquery/dist/jquery.min.js"></script>
  10. <!-- sceditor -->
  11. <script src="./../../node_modules/sceditor/minified/jquery.sceditor.bbcode.min.js"></script>
  12. <script src="./../../node_modules/sceditor/minified/jquery.sceditor.xhtml.min.js"></script>
  13. <link rel="stylesheet" href="./../../node_modules/sceditor/minified/themes/default.min.css">
  14. </head>
  15. <body>
  16. <textarea class="debug" cols="30" rows="10"></textarea>
  17. <button class='get-value'>Get Value</button>
  18. <div class='container'></div>
  19. <script>
  20. var container = document.querySelector('.container');
  21. var debug = document.querySelector('.debug');
  22. var schema = {
  23. "type": "array",
  24. "title": "string-sceditor",
  25. "items": {
  26. "type": "object",
  27. "properties": {
  28. "editor": {
  29. "type": "string",
  30. "format": "html",
  31. "options": {
  32. "wysiwyg": true
  33. }
  34. }
  35. }
  36. }
  37. };
  38. // sceditor quirk. Styles must be specified in the options at creation
  39. // if you want to be able to focus on the iframes he creates.
  40. //JSONEditor.plugins.sceditor.style = '//cdn.jsdelivr.net/sceditor/1.4.3/jquery.sceditor.default.min.css';
  41. JSONEditor.plugins.sceditor.style = '';
  42. var editor = new JSONEditor(container, {
  43. schema: schema
  44. });
  45. document.querySelector('.get-value').addEventListener('click', function () {
  46. debug.value = JSON.stringify(editor.getValue());
  47. });
  48. </script>
  49. </body>
  50. </html>