Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8" /> |
| 5 |
<title>JSON Editor signature drawing</title> |
| 6 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/signature_pad.min.js"></script> |
| 7 |
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor/dist/jsoneditor.min.js"></script> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<h1>JSON Editor: signature editor</h1> |
| 11 |
|
| 12 |
<div>Using this editor a signature (or any other simple drawing) can be made using the mouse or touchpad. The result is saved in base64 format. The editor will span the full width of the container, so no columns/grids are possible. With big thank you to <a href='https://github.com/szimek'>Szimek</a> for creating SignaturePad. <a href='https://github.com/szimek/signature_pad'>SignaturePad</a> must be included before the json-editor to load the signature editor properly. Set the type of the property to 'string' and the format to 'signature' to use the editor. The canvas is set to a default height of 300px, but this can be easily overriden by adding for example 'canvas_height': 500 in the properties.</div> |
| 13 |
|
| 14 |
<div id='editor_holder'></div> |
| 15 |
<button id='submit'>Submit (console.log)</button> |
| 16 |
|
| 17 |
<script> |
| 18 |
// Initialize the editor with a JSON schema |
| 19 |
var editor = new JSONEditor(document.getElementById('editor_holder'),{ |
| 20 |
"schema": { |
| 21 |
"type": "object", |
| 22 |
"title": "Document", |
| 23 |
"properties": { |
| 24 |
"signature": { |
| 25 |
"type": "signature", |
| 26 |
"title": "Signature", |
| 27 |
"options": { |
| 28 |
"canvas_height": 500 |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
}); |
| 34 |
|
| 35 |
// Hook up the submit button to log to the console |
| 36 |
document.getElementById('submit').addEventListener('click',function() { |
| 37 |
// Get the value from the editor |
| 38 |
console.log(editor.getValue()); |
| 39 |
}); |
| 40 |
</script> |
| 41 |
</body> |
| 42 |
</html> |