-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |