Browse Source

Feature/sidebar plugin (#582)

* Another sidebar plugin.
pull/584/head 4.7.0
Sebastian Stehle 5 years ago
committed by GitHub
parent
commit
f9c9ee7bb9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 49
      backend/src/Squidex/wwwroot/scripts/sidebar-content.html

49
backend/src/Squidex/wwwroot/scripts/sidebar-content.html

@ -0,0 +1,49 @@
<!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>
<style>
textarea {
box-sizing: border-box;
border: 0;
border-radius: 0;
resize: none;
overflow: hidden;
width: 100%;
}
</style>
</head>
<body>
<script>
function grow(element) {
element.style.height = "5px";
element.style.height = (element.scrollHeight)+"px";
}
</script>
<textarea oninput="grow(this)" name="content" id="editor"></textarea>
<script>
var element = document.getElementById('editor');
// When the plugin is instantiated it notifies the UI that it has been loaded.
//
// Furthermore it sends the current size to the parent.
var plugin = new SquidexPlugin();
// The content is only available when it is used as a sidebar plugin for single content items.
plugin.onContentChanged(function (content) {
element.innerHTML = JSON.stringify(content, null, 2);
grow(element);
});
</script>
</body>
</html>
Loading…
Cancel
Save