File: wysiwyg.html

package info (click to toggle)
json-editor.js 1.3.2%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,700 kB
  • sloc: javascript: 10,168; perl: 39; makefile: 5
file content (50 lines) | stat: -rw-r--r-- 1,789 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>JSON Editor WYSIWYG Example</title>
    <script src="../../../javascript/json-editor/jsoneditor.min.js"></script>
    <script type="text/javascript" src="../../../javascript/jquery/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="../../../javascript/jquery-migrate-1.4.1.js"></script>
    <script src="//cdn.jsdelivr.net/sceditor/1.4.3/jquery.sceditor.bbcode.min.js"></script>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/sceditor/1.4.3/jquery.sceditor.default.min.css">
    <script src="//cdn.jsdelivr.net/sceditor/1.4.3/jquery.sceditor.xhtml.min.js"></script>
    <link rel="stylesheet" href="//cdn.jsdelivr.net/sceditor/1.4.3/themes/default.min.css">
  </head>
  <body>
    <h1>JSON Editor WYSIWYG Example</h1>
    
    <p style='margin-bottom:20px;'>This example demonstrates JSONEditor's integration with SCEditor</p>
    
    <div id='editor_holder'></div>
    <button id='submit'>Submit (console.log)</button>
    
    <script>
      // Initialize the editor with a JSON schema
      var editor = new JSONEditor(document.getElementById('editor_holder'),{
        schema: {
          type: "object",
          title: "Blog Post",
          properties: {
            title: {
              type: "string"
            },
            body: {
              type: "string",
              format: "html",
              options: {
                wysiwyg: true
              }
            }
          }
        }
      });
      
      // Hook up the submit button to log to the console
      document.getElementById('submit').addEventListener('click',function() {
        // Get the value from the editor
        console.log(editor.getValue());
      });
    </script>
  </body>
</html>