Browse Source

Sample editor added.

pull/362/head
Sebastian Stehle 7 years ago
parent
commit
b2a7546e7d
  1. 40
      src/Squidex/wwwroot/scripts/combined-editor.html
  2. 28
      src/Squidex/wwwroot/scripts/context-editor.html

40
src/Squidex/wwwroot/scripts/combined-editor.html

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Load the editor sdk from the local folder or https://cloud.squidex.io/scripts/editor-sdk.js -->
<script src="editor-sdk.js"></script>
</head>
<body>
<textarea style="width: 100%; box-sizing: border-box; height: 40px;" name="content" id="editor"></textarea>
<script>
var element = document.getElementById('editor');
// When the field is instantiated it notified the UI that it has been loaded.
var field = new SquidexFormField();
// Handle the value change event and set the text to the editor.
field.onValueChanged(function (value) {
element.value = value || '';
});
// Disable the editor when it should be disabled.
field.onDisabled(function (disabled) {
element.disabled = disabled;
});
field.onFormValueChanged(function (value) {
if (value.a && value.a.iv && value.b && value.b.iv) {
element.value = value.a.iv + value.b.iv;
field.valueChanged(element.value);
}
})
</script>
</body>
</html>

28
src/Squidex/wwwroot/scripts/context-editor.html

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Load the editor sdk from the local folder or https://cloud.squidex.io/scripts/editor-sdk.js -->
<script src="editor-sdk.js"></script>
</head>
<body>
<textarea style="width: 100%; box-sizing: border-box; height: 100px;" name="content" id="editor"></textarea>
<script>
var element = document.getElementById('editor');
// When the field is instantiated it notified the UI that it has been loaded.
var field = new SquidexFormField();
field.onInit(function (context) {
if (context) {
element.innerHTML = JSON.stringify(context, null, 2);
}
});
</script>
</body>
</html>
Loading…
Cancel
Save