You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.
<html><head><metacharset="utf-8"><metaname="viewport" content="width=device-width, initial-scale=1.0"><title>paper_autogrow_textarea_test</title><linkrel="import" href="packages/paper_elements/paper_autogrow_textarea.html"><linkrel="import" href="packages/paper_elements/paper_input_decorator.html"></head><bodyunresolved><paper-input-decoratorlabel="with autogrowing text area"><paper-autogrow-textareaid="simple_autogrow_textarea"><textareaid="simple_textarea"></textarea></paper-autogrow-textarea></paper-input-decorator><scripttype="application/dart">import'package:polymer/polymer.dart';import'package:paper_elements/paper_input_decorator.dart';import'package:paper_elements/paper_autogrow_textarea.dart';import'dart:html';main(){initPolymer().run((){Polymer.onReady.then((_){(querySelector('#simple_textarea')asTextAreaElement).value="Some\nmulti-line\ntext";(querySelector('#simple_autogrow_textarea')asPaperAutogrowTextarea).update();});});}</script></body></html>
Is there any workaround? The issue is that in a form where I want to allow updating a multiline text, the initial text is never display correctly in the textarea (only the first line is displayed - yes I can play with the rows attribute but in this case if I put too many rows, it does not shrink properly neither)
The text was updated successfully, but these errors were encountered:
It looks like you have to pass the textarea element to the update() function, so the comment needs to be updated. Also our wrappers either didn't pick up the argument or it wasn't properly commented in the previous version so you will have to use js-interop directly for now, this can be done by changing your code inside onReady to the following:
var t = (querySelector('#simple_textarea') as TextAreaElement);
t.value = "Some\nmulti-line\ntext";
(querySelector('#simple_autogrow_textarea') as PaperAutogrowTextarea).jsElement.callMethod('update', [t]);
It shouldn't be necessary for you to pass this argument at all, I am going to work on a pull request to clean this up on the js side as there are a few wonky things I see (such as an unused target published attribute which would be useful here).
Thanks for the workaround which works great (and indeed I looked at the js code which does require an input parameter for the update method while the documentation states it does not)
Jake - it seems like the signature of our element is missing the argument. I wonder if we should update the autogenerated class in the meantime while we wait for your change to get merged.
According to Polymer documentation (https://www.polymer-project.org/docs/elements/paper-elements.html#paper-autogrow-textarea), doing the following code should resize the text-area
I made a simple example and the textarea does not grow when update() is called, it only grows when I start typing in the area. I created a sample project here: https://github.com/alextekartik/dart-test/tree/master/paper_autogrow_textarea_test
with the following html file that shows the issue:
Is there any workaround? The issue is that in a form where I want to allow updating a multiline text, the initial text is never display correctly in the textarea (only the first line is displayed - yes I can play with the rows attribute but in this case if I put too many rows, it does not shrink properly neither)
The text was updated successfully, but these errors were encountered: