Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Automatically resize the inputs.
You can try TextArea or Input examples in your browser.
Note: Autoresize of the <input>
element is not yet implemented.
npm i autoresize
Then in your project require it:
const autoresize = require('autoresize');
Or use ES import:
import autoresize from 'autoresize';
Note: You will have access to the global autoresize
function, that will be added to the window
object.
<script src="https://unpkg.com/autoresize/dist/autoresize.js"></script>
Minified version:
<script src="https://unpkg.com/autoresize/dist/autoresize.min.js"></script>
ES5 version:
<script src="https://unpkg.com/autoresize/dist/autoresize.es5.js"></script>
Minified ES5 version:
<script src="https://unpkg.com/autoresize/dist/autoresize.es5.min.js"></script>
const element = document.querySelector('#textarea');
const options = { maximumRows: 5, assumeRendered: true };
// Enable autoresize by adding specific listeners
const disable = autoresize(element, options);
// Remove all listeners and disable autoresize
disable();
element
An HTML element of types: HTMLTextAreaElement
or HTMLInputElement
.
options
An options object, that is different for each element type.
TextArea
{
minimumRows: 1,
maximumRows: Infinity,
rowHeight: null,
assumeRendered: false
}
Passing the rowHeight
value may be a bit more performant solution, but it will mean that the lineSize
is guarantee to be unchanged in future with JS or CSS (including some @media
queries). Otherwise, rowHeight
will be calculated on the initial step and recalculated on window 'resize'
event.
Passing the assumeRendered
with true
value will skip the check for the presence of the element in the DOM. Otherwise, the render()
function will wait, until the element is rendered and then will apply the event listeners.
Input
{
maxWidth: null,
assumeRendered: false
}
FAQs
Automatically resize the inputs.
The npm package autoresize receives a total of 39 weekly downloads. As such, autoresize popularity was classified as not popular.
We found that autoresize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.