Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/main/resources/META-INF/resources/primefaces/forms/forms.js
- ===================================================================
- --- src/main/resources/META-INF/resources/primefaces/forms/forms.js (revision 7443)
- +++ src/main/resources/META-INF/resources/primefaces/forms/forms.js (working copy)
- @@ -58,6 +58,12 @@
- },
- setupAutoResize: function() {
- + var suffix = "_reference", referenceContainerId = this.jqId + suffix;
- + this.referenceContainer = $(referenceContainerId);
- + if (this.referenceContainer.length != 1) {
- + this.referenceContainer = $(document.createElement('div')).attr('id', this.id + suffix).addClass("ui-inputfield ui-inputtextarea ui-inputtextarea-resizable-reference").appendTo($(document.body));
- + }
- +
- var _self = this;
- this.jq.keyup(function() {
- @@ -70,16 +76,10 @@
- },
- resize: function() {
- - var linesCount = 0,
- - lines = this.jq.val().split('\n');
- -
- - for(var i = lines.length-1; i >= 0 ; --i) {
- - linesCount += Math.floor((lines[i].length / this.cfg.colsDefault) + 1);
- - }
- -
- - var newRows = (linesCount >= this.cfg.rowsDefault) ? (linesCount + 1) : this.cfg.rowsDefault;
- -
- - this.jq.attr('rows', newRows);
- + //Update reference container and resize text area
- + this.referenceContainer.width(this.jq.width());
- + this.referenceContainer.text(this.jq.val());
- + this.jq.height(this.referenceContainer.innerHeight());
- },
- applyMaxlength: function() {
- @@ -1799,4 +1799,4 @@
- this._super(cfg);
- }
- -});
- \ No newline at end of file
- +});
- Index: src/main/resources/META-INF/resources/primefaces/forms/forms.css
- ===================================================================
- --- src/main/resources/META-INF/resources/primefaces/forms/forms.css (revision 7443)
- +++ src/main/resources/META-INF/resources/primefaces/forms/forms.css (working copy)
- @@ -15,6 +15,15 @@
- resize:none;
- }
- +.ui-inputtextarea-resizable-reference {
- + position: absolute;
- + bottom: 0;
- + right: 0;
- + white-space: pre-wrap;
- + word-wrap: break-word;
- + visibility: hidden;
- +}
- +
- .ui-selectonelistbox, .ui-selectmanymenu {
- width:100px;
- overflow:auto;
- @@ -367,4 +376,4 @@
- .ui-password-panel-overlay {
- position: absolute;
- -}
- \ No newline at end of file
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement