Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0
This commit is contained in:
@@ -5,27 +5,70 @@
|
||||
$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.preview = "<div class=\"umb-loader\" style=\"height: 10px; margin: 10px 0px;\"></div>";
|
||||
$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;
|
||||
$scope.success = true;
|
||||
break;
|
||||
}
|
||||
})
|
||||
.error(function() {
|
||||
$scope.preview = "";
|
||||
$scope.info = "Computer says no";
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.changeSize = function (type) {
|
||||
var width, height;
|
||||
|
||||
if ($scope.constrain) {
|
||||
width = parseInt($scope.width, 10);
|
||||
height = parseInt($scope.height, 10);
|
||||
if (type == 'width') {
|
||||
origHeight = Math.round((width / origWidth) * height);
|
||||
$scope.height = origHeight;
|
||||
} else {
|
||||
origWidth = Math.round((height / origHeight) * width);
|
||||
$scope.width = origWidth;
|
||||
}
|
||||
}
|
||||
if ($scope.url != "") {
|
||||
$scope.showPreview();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$scope.insert = function(){
|
||||
$scope.submit($scope.preview);
|
||||
};
|
||||
|
||||
@@ -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"/> x <input type="text" ng-model="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