123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>wysiwyg-sceditor</title>
- <!-- json editor -->
- <script src="../../dist/jsoneditor.js"></script>
- <!-- jquery -->
- <script src="./../../node_modules/jquery/dist/jquery.min.js"></script>
- <!-- sceditor -->
- <script src="./../../node_modules/sceditor/minified/jquery.sceditor.bbcode.min.js"></script>
- <script src="./../../node_modules/sceditor/minified/jquery.sceditor.xhtml.min.js"></script>
- <link rel="stylesheet" href="./../../node_modules/sceditor/minified/themes/default.min.css">
- </head>
- <body>
- <textarea class="debug" cols="30" rows="10"></textarea>
- <button class='get-value'>Get Value</button>
- <div class='container'></div>
- <script>
- var container = document.querySelector('.container');
- var debug = document.querySelector('.debug');
- var schema = {
- "type": "array",
- "title": "string-sceditor",
- "items": {
- "type": "object",
- "properties": {
- "editor": {
- "type": "string",
- "format": "html",
- "options": {
- "wysiwyg": true
- }
- }
- }
- }
- };
- // sceditor quirk. Styles must be specified in the options at creation
- // if you want to be able to focus on the iframes he creates.
- //JSONEditor.plugins.sceditor.style = '//cdn.jsdelivr.net/sceditor/1.4.3/jquery.sceditor.default.min.css';
- JSONEditor.plugins.sceditor.style = '';
- var editor = new JSONEditor(container, {
- schema: schema
- });
- document.querySelector('.get-value').addEventListener('click', function () {
- debug.value = JSON.stringify(editor.getValue());
- });
- </script>
- </body>
- </html>
|