Skip to content

Commit

Permalink
Feature/sidebar plugin (#582)
Browse files Browse the repository at this point in the history
* Another sidebar plugin.
  • Loading branch information
SebastianStehle authored Sep 27, 2020
1 parent 542fca6 commit f9c9ee7
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions backend/src/Squidex/wwwroot/scripts/sidebar-content.html
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit f9c9ee7

Please sign in to comment.