angular-auto-size-input
Version:
Plug and Play directive to automatically scale textareas to their contents. Works while yout type, copy, cut, and paste.
69 lines (57 loc) • 1.44 kB
HTML
<html>
<head>
<title>Playground</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('.playground/index.js').catch(function(err){ console.error(err); });
</script>
<style type="text/css">
* { font-family: sans-serif; }
html, body {
margin: 0;
padding: 0;
background: #fff;
width: 100%;
height: 100%;
}
.h-padding {
padding: 1rem;
}
textarea {
display: block;
width: 100%;
border: 1px solid #ccc;
outline: 0;
padding: 4px;
margin: 0;
background: transparent;
resize: none;
box-sizing: border-box;
}
textarea.as-auto-size-input {
overflow: hidden;
}
.h-flex-row {
display: flex;
flex-direction: row;
}
.h-flex-max {
flex: 1;
}
.h-flex-max:not(:last-child) {
margin-right: 1rem;
}
</style>
</head>
<body>
<app>...</app>
</body>
</html>