Untitled
4 years ago in Plain Text
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script src="https://unpkg.com/datocms-plugins-sdk"></script>
<link href="https://unpkg.com/datocms-plugins-sdk/dist/sdk.css" media="all" rel="stylesheet" />
</head>
<body>
<input type="text" />
<script type="text/javascript">
DatoCmsPlugin.init(function(plugin) {
const input = document.querySelector("input");
plugin.startAutoResizer()
input.value = plugin.getFieldValue(plugin.fieldPath);
plugin.addFieldChangeListener(plugin.fieldPath, function(newValue) {
input.value = newValue;
});
input.addEventListener("change", function(e) {
plugin.setFieldValue(plugin.fieldPath, e.target.value);
});
});
</script>
</body>
</html>