Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.2 KiB

<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>
<style>
.editor {
border: 1px solid #eee;
border-radius: 4px;
height: 500px;
width: 100%;
}
</style>
</head>
<body style="margin: 0px; padding: 0px;">
<textarea name="content" class="editor" id="editor"></textarea>
<script>
var element = document.getElementById('editor');
// When the field is instantiated it notifies the UI that it has been loaded.
//
// Furthermore it sends the current size to the parent.
var field = new SquidexFormField();
field.onValueChanged(function (value) {
if (value) {
element.value = JSON.stringify(value);
} else {
element.value = '';
}
});
field.onDisabled(function (disabled) {
element.disabled = disabled;
});
element.addEventListener('change', function () {
var value = element.value;
if (value) {
field.valueChanged(JSON.parse(value));
} else {
field.valueChanged(undefined);
}
});
</script>
</body>
</html>