Also make sure the embed rte plugin only shows resize options if provider supports it
This commit is contained in:
@@ -5,23 +5,43 @@
|
||||
$scope.constrain = true;
|
||||
$scope.preview = "";
|
||||
$scope.success = false;
|
||||
|
||||
$scope.info = "";
|
||||
$scope.supportsDimensions = false;
|
||||
|
||||
var origWidth = 500;
|
||||
var origHeight = 300;
|
||||
|
||||
$scope.showPreview = function(){
|
||||
|
||||
if ($scope.url != "") {
|
||||
|
||||
$scope.preview = "<div class=\"umb-loader\">";
|
||||
$scope.info = "";
|
||||
$scope.success = false;
|
||||
|
||||
$http({ method: 'GET', url: '/umbraco/UmbracoApi/RteEmbed/GetEmbed', params: { url: $scope.url, width: $scope.width, height: $scope.height } })
|
||||
.success(function(data) {
|
||||
$scope.preview = data.Markup;
|
||||
$scope.success = true;
|
||||
.success(function (data) {
|
||||
|
||||
$scope.preview = "";
|
||||
|
||||
switch (data.Status) {
|
||||
case 0:
|
||||
//not supported
|
||||
$scope.info = "Not Supported";
|
||||
break;
|
||||
case 1:
|
||||
//error
|
||||
$scope.info = "Computer says no";
|
||||
break;
|
||||
case 2:
|
||||
$scope.preview = data.Markup;
|
||||
$scope.supportsDimensions = data.SupportsDimensions;
|
||||
break;
|
||||
}
|
||||
})
|
||||
.error(function() {
|
||||
$scope.preview = "";
|
||||
$scope.info = "Computer says no";
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -14,12 +14,15 @@
|
||||
|
||||
<label for="url">Url</label>
|
||||
<input id="url" type="text" ng-model="url" ng-change="showPreview()"/>
|
||||
|
||||
<div ng-show="supportsDimensions">
|
||||
<label>Size:</label>
|
||||
<input type="text" ng-model="width" on-blur="changeSize('width')"/> x <input type="text" ng-model="height" on-blur="changeSize('height')"/>
|
||||
<label for="constrain">Constrain:</label>
|
||||
<input id="constrain" type="checkbox" ng-model="constrain"/>
|
||||
</div>
|
||||
|
||||
<label>Size:</label>
|
||||
<input type="text" ng-model="width" on-blur="changeSize('width')"/> x <input type="text" ng-model="height" on-blur="changeSize('height')"/>
|
||||
<label for="constrain">Constrain:</label>
|
||||
<input id="constrain" type="checkbox" ng-model="constrain"/>
|
||||
|
||||
<p ng-bind="info"></p>
|
||||
<div ng-bind-html-unsafe="preview">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user