Skip to content

Commit c4d88b7

Browse files
committed
add
1 parent 983a175 commit c4d88b7

File tree

2 files changed

+50
-25
lines changed

2 files changed

+50
-25
lines changed

.idea/workspace.xml

Lines changed: 46 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elastic.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ angular.module('monospaced.elastic', [])
1717

1818
return {
1919
require: 'ngModel',
20-
scope:{
21-
maxHeight:'='
22-
},
2320
restrict: 'A, C',
2421
link: function(scope, element, attrs, ngModel) {
2522

@@ -72,7 +69,7 @@ angular.module('monospaced.elastic', [])
7269
minHeightValue = parseInt(taStyle.getPropertyValue('min-height'), 10),
7370
heightValue = parseInt(taStyle.getPropertyValue('height'), 10),
7471
minHeight = Math.max(minHeightValue, heightValue) - boxOuter.height,
75-
maxHeight = parseInt(taStyle.getPropertyValue('max-height'), 10),
72+
maxHeight = scope.maxHeight?scope.maxHeight:parseInt(taStyle.getPropertyValue('max-height'), 10),
7673
mirrored,
7774
active,
7875
copyStyle = ['font-family',
@@ -192,6 +189,9 @@ angular.module('monospaced.elastic', [])
192189
$win.bind('resize', forceAdjust);
193190

194191
scope.$watch(function() {
192+
if(scope.maxHeight && scope.maxHeight!= maxHeight){
193+
maxHeight = scope.maxHeight
194+
}
195195
return ngModel.$modelValue;
196196
}, function(newValue) {
197197
forceAdjust();
@@ -202,10 +202,6 @@ angular.module('monospaced.elastic', [])
202202
forceAdjust();
203203
});
204204

205-
scope.$watch('maxHeight',function(n,o) {
206-
if(n)maxHeight = n;
207-
});
208-
209205
$timeout(function(){adjust},5000);
210206

211207
/*

0 commit comments

Comments
 (0)