yuanqing / autosize-input Goto Github PK
View Code? Open in Web Editor NEW:balloon: Effortless, dynamic-width text boxes in vanilla JavaScript
Home Page: https://codepen.io/lyuanqing/pen/xYpmKj
License: MIT License
:balloon: Effortless, dynamic-width text boxes in vanilla JavaScript
Home Page: https://codepen.io/lyuanqing/pen/xYpmKj
License: MIT License
Is it possible to destroy the instance - or a way to reinit it?
Right now the set
function is closured inside the autosizeInput
function and bound to 'input'
but sometimes the value of an input can change via input.value = 'something'
and the listener won't fire in that case. It would be nice to be able to call resize manually too.
Hi,
I just found out, that Internet Explorer (11) behaves different calculating the width of the input.
using
61: var width = window.getComputedStyle(ghostElement).width
there are different results between IE11 and Chrome for example.
Suggestion: use
var width = ghostElement.offsetWidth, then it works everywhere.
When I try to use this package with TypeScript/Webpack/Angular 2 I receive this error during my build: TS2307: Cannot find module 'autosize-input'.
Imported like so:
import * as autosizeInput from 'autosize-input';
It is worth mentioning is that the application does run, it just doesn't compile correctly.
Webpack: 2.2.1
TypeScript: 2.0.3
Angular: 2.4.10
Would it be possible to include a built version (bundle.js) of the library like there used to be in version 0.4.0? That would be useful for those of us who just want to include the file directly and don't have a build system.
When the library first loads, it creates a ghost div that is appended to the dom. This makes the library incompatible with Turbolinks which reloads the dom on each request.
Would it be possible to initialize the ghost div inside the autosizeInput
function or create some sort of initializer that can be called to create the ghost div?
Thanks for this very useful plugin! Would it be possible to create a 0.2.1 release so it can be added to https://rails-assets.org/#/components/yuanqing--autosize-input
At least not on my machine. It appears the wzrd.in service isn't resolving autosize-input.
However, codepen itself recomments importing npm packages via cdn.skypack.net; and even provides UI to help you find and import npm packages such as autosize-input.
The following variant of your pen works on my machine: https://codepen.io/emn13/pen/gOeNNQJ
All I did was remove the JS dependency referring to wzrd.in, and added the skypack alternative, which is effectively no more than adding import autosizeInput from "https://cdn.skypack.dev/[email protected]";
to the top of the JS code.
Problem: Autosize doesn’t calculate width properly when using a font-weight
other than 400
or a font-style
other than normal
.
Reproduction: http://jsfiddle.net/drewpowers/98k622ah/46/
Suggestion: Added a pull request with suggested changes here: #4
I have functionality that updated the input value in other way that typing into the input field (e.g. click a button and update the input to 'test value').
$('#search').val('test-value')
I need to trigger an event to update the width of the input field. I tried using jquery trigger with 'keydown', 'change' and 'input' events, but nothing happened:
$('#search').trigger('input')
Is there a maxWidth option?
It would be nice to keep defined style:
<input type="text" id="baz" placeholder="Matter" style="max-width: 200px">
Resize is nice, but don't resize too much though :p
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.