Don't try to access model.value when model.value might be empty. Fixes broken prevalue editor for RTE.

This commit is contained in:
Sebastiaan Janssen
2014-03-19 11:19:34 +01:00
parent 6ac2cc9f8b
commit 76eb06784d

View File

@@ -2,14 +2,6 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.RteController",
function ($scope, $timeout, $log, tinyMceService, stylesheetResource) {
var cfg = tinyMceService.defaultPrevalues();
if (!$scope.model.value.stylesheets) {
$scope.model.value.stylesheets = [];
}
if (!$scope.model.value.toolbar) {
$scope.model.value.toolbar = [];
}
if($scope.model.value){
if(angular.isString($scope.model.value)){
$scope.model.value = cfg;
@@ -18,11 +10,18 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.RteController",
$scope.model.value = cfg;
}
if (!$scope.model.value.stylesheets) {
$scope.model.value.stylesheets = [];
}
if (!$scope.model.value.toolbar) {
$scope.model.value.toolbar = [];
}
tinyMceService.configuration().then(function(config){
$scope.tinyMceConfig = config;
});
stylesheetResource.getAll().then(function(stylesheets){
$scope.stylesheets = stylesheets;
});