1
- var bob = null
2
1
angular . module ( "umbraco" )
3
2
. controller ( "DM.MetaMomentum" ,
4
3
function ( $scope , $filter , editorState , contentEditingHelper , editorService , mediaHelper , entityResource , $interval ) {
4
+ var shareImgUpdateInterval ;
5
+
5
6
$scope . sharePreviewType = null ;
6
7
$scope . showEditSearch = false ;
7
8
$scope . showEditSocial = false ;
8
9
10
+
11
+
12
+ $scope . $on ( '$destroy' , function iVeBeenDismissed ( ) {
13
+ // say goodbye to your controller here
14
+ // release resources, cancel request...
15
+ if ( angular . isDefined ( shareImgUpdateInterval ) ) {
16
+ //Stop interval function from updating share image
17
+ $interval . cancel ( shareImgUpdateInterval ) ;
18
+ shareImgUpdateInterval = undefined ;
19
+
20
+ }
21
+
22
+ } )
23
+
9
24
10
25
if ( $scope . model . config . showSocialPreviewFacebook == 1 ) {
11
26
$scope . sharePreviewType = "facebook" ;
@@ -93,7 +108,7 @@ angular.module("umbraco")
93
108
}
94
109
95
110
//Todo: Need to find a better way of checking if a fallback property has changed. Works for text but not images
96
- $interval ( $scope . updateShareImage , 3000 ) ;
111
+ shareImgUpdateInterval = $interval ( $scope . updateShareImage , 3000 ) ;
97
112
}
98
113
99
114
function getPositionInString ( string , subString , index ) {
@@ -114,7 +129,7 @@ angular.module("umbraco")
114
129
if ( typeof properties [ p ] !== "undefined" && properties [ p ] . alias === fallbackTitles [ i ] ) {
115
130
if ( typeof properties [ p ] . value !== "undefined" && properties [ p ] . value !== "" && properties [ p ] . value !== null )
116
131
//Found a fallback property value
117
- $scope . model . value . title = properties [ p ] . value ;
132
+ $scope . model . value . title = $filter ( 'momentumStripHtml' ) ( properties [ p ] . value , true ) ;
118
133
}
119
134
}
120
135
}
@@ -149,7 +164,7 @@ angular.module("umbraco")
149
164
if ( typeof properties [ p ] !== "undefined" && properties [ p ] . alias === fallbackDescriptions [ i ] ) {
150
165
if ( typeof properties [ p ] . value !== "undefined" && properties [ p ] . value !== "" && properties [ p ] . value !== null )
151
166
//Found a fallback property value
152
- $scope . model . value . description = properties [ p ] . value ;
167
+ $scope . model . value . description = $filter ( 'momentumStripHtml' ) ( properties [ p ] . value , true ) ;
153
168
}
154
169
}
155
170
}
@@ -317,7 +332,7 @@ angular.module("umbraco")
317
332
multiPicker : false ,
318
333
submit : function ( imgmodel ) {
319
334
editorService . close ( ) ;
320
- console . log ( imgmodel . selection [ 0 ] )
335
+
321
336
$scope . model . value . share . image = imgmodel . selection [ 0 ] ;
322
337
$scope . model . value . share . imageUrl = imgmodel . selection [ 0 ] . image ;
323
338
@@ -353,5 +368,23 @@ angular.module("umbraco")
353
368
} ) ;
354
369
}
355
370
371
+ $scope . openSocialPreview = function ( ) {
372
+ $scope . showEditSocial = true ;
373
+ document . querySelector ( '#SocialPreview' ) . scrollIntoView ( {
374
+ behavior : 'smooth'
375
+ } ) ;
376
+ }
377
+
378
+ $scope . toggleAllowSearchEngines = function ( e ) {
379
+ console . log ( e )
380
+ e . preventDefault ( ) ;
381
+ $scope . model . value . noIndex = ! $scope . model . value . noIndex ;
382
+ console . log ( $scope . model . value . noIndex )
383
+ }
384
+
385
+ $scope . test = function ( evt ) {
386
+ console . log ( evt )
387
+ }
388
+
356
389
init ( ) ;
357
390
} ) ;
0 commit comments