mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-28 13:25:43 +00:00
fix(mail(js)): disable autogrow of textarea in popup window
Fixes #4962
This commit is contained in:
1 parent
5e1f487e49
commit
daaad938cb
2 files changed
+11
-8
No files matched your search
@@ -274,13 +274,13 @@
|
|||||||
md-autofocus="::!editor.isNew()"
|
md-autofocus="::!editor.isNew()"
|
||||||
md-no-resize="md-no-resize"
|
md-no-resize="md-no-resize"
|
||||||
md-no-autogrow="md-no-autogrow"
|
md-no-autogrow="md-no-autogrow"
|
||||||
sg-autogrow="sg-autogrow"
|
sg-autogrow="!isPopup"
|
||||||
md-detect-hidden="md-detect-hidden" />
|
md-detect-hidden="md-detect-hidden" />
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</md-dialog-content>
|
</md-dialog-content>
|
||||||
|
|
||||||
<!-- ATTACHMENTS -->
|
<!-- ATTACHMENTS -->
|
||||||
<md-dialog-content class="md-actions sg-mail-editor-attachments"
|
<md-dialog-actions class="sg-mail-editor-attachments"
|
||||||
layout="row" layout-align="space-between start">
|
layout="row" layout-align="space-between start">
|
||||||
<!-- Attachments -->
|
<!-- Attachments -->
|
||||||
<md-chips ng-model="editor.uploader.queue"
|
<md-chips ng-model="editor.uploader.queue"
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
-->
|
-->
|
||||||
<!-- multiple="multiple" -->
|
<!-- multiple="multiple" -->
|
||||||
</div>
|
</div>
|
||||||
</md-dialog-content>
|
</md-dialog-actions>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<sg-ripple class="md-default-theme md-accent md-bg"
|
<sg-ripple class="md-default-theme md-accent md-bg"
|
||||||
|
|||||||
@@ -4,26 +4,30 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sgAutogrow - A directive to automatically grow a textarea depending on its content.
|
* sgAutogrow - A directive to conditionally grow a textarea depending on its content.
|
||||||
* This directive is an alternative to the autogrow feature of the md-input component.
|
* This directive is an alternative to the autogrow feature of the md-input component.
|
||||||
* It fixes the scroll jumping issue described in #3070.
|
* It fixes the scroll jumping issue described in #3070.
|
||||||
*
|
*
|
||||||
* - https://github.com/angular/material/issues/3070
|
* - https://github.com/angular/material/issues/3070
|
||||||
* - https://material.angularjs.org/latest/api/directive/mdInput
|
* - https://material.angularjs.org/latest/api/directive/mdInput
|
||||||
*
|
*
|
||||||
* The drawback of this simple fix is that it won't shrink the textarea but only
|
* The drawback of this directive is that it requires to set md-no-autogrow.
|
||||||
* increase its height. It also requires to set md-no-autogrow.
|
|
||||||
* @memberof SOGo.Common
|
* @memberof SOGo.Common
|
||||||
* @ngInject
|
* @ngInject
|
||||||
* @example:
|
* @example:
|
||||||
|
|
||||||
<textarea rows="9" md-no-autogrow sg-autogrow />
|
<textarea rows="9" md-no-autogrow sg-autogrow="!isPopup" />
|
||||||
*/
|
*/
|
||||||
sgAutogrow.$inject = ['$document', '$timeout'];
|
sgAutogrow.$inject = ['$document', '$timeout'];
|
||||||
function sgAutogrow($document, $timeout) {
|
function sgAutogrow($document, $timeout) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
|
scope: {
|
||||||
|
autogrow: '=sgAutogrow'
|
||||||
|
},
|
||||||
link: function(scope, elem, attr) {
|
link: function(scope, elem, attr) {
|
||||||
|
if (!scope.autogrow) return;
|
||||||
|
|
||||||
var textarea = elem[0];
|
var textarea = elem[0];
|
||||||
var hiddenDiv = $document[0].createElement('div');
|
var hiddenDiv = $document[0].createElement('div');
|
||||||
var content = null;
|
var content = null;
|
||||||
@@ -46,7 +50,6 @@
|
|||||||
hiddenDiv.style.visibility = 'hidden';
|
hiddenDiv.style.visibility = 'hidden';
|
||||||
hiddenDiv.style.display = 'block';
|
hiddenDiv.style.display = 'block';
|
||||||
textarea.style.height = hiddenDiv.offsetHeight + 'px';
|
textarea.style.height = hiddenDiv.offsetHeight + 'px';
|
||||||
console.debug('resize to ' + hiddenDiv.offsetHeight + 'px');
|
|
||||||
hiddenDiv.style.visibility = 'visible';
|
hiddenDiv.style.visibility = 'visible';
|
||||||
hiddenDiv.style.display = 'none';
|
hiddenDiv.style.display = 'none';
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user