diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 3c4f5a7d73..2fd75184ca 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -48,7 +48,14 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s if (configuredStylesheets) { angular.forEach(configuredStylesheets, function (val, key) { - stylesheets.push(Umbraco.Sys.ServerVariables.umbracoSettings.cssPath + "/" + val + ".css"); + if (val.indexOf(Umbraco.Sys.ServerVariables.umbracoSettings.cssPath + "/") === 0) { + // current format (full path to stylesheet) + stylesheets.push(val); + } + else { + // legacy format (stylesheet name only) - must prefix with stylesheet folder and postfix with ".css" + stylesheets.push(Umbraco.Sys.ServerVariables.umbracoSettings.cssPath + "/" + val + ".css"); + } promises.push(stylesheetResource.getRulesByName(val).then(function (rules) { angular.forEach(rules, function (rule) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.controller.js index 59e0429678..1b489d6283 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.controller.js @@ -40,14 +40,17 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.RteController", $scope.stylesheets = stylesheets; }); - $scope.selected = function(cmd, alias, lookup){ - if (lookup && angular.isArray(lookup)) { - cmd.selected = lookup.indexOf(alias) >= 0; - return cmd.selected; - } - return false; + $scope.commandSelected = function(cmd) { + cmd.selected = $scope.model.value.toolbar.indexOf(cmd.alias) >= 0; + return cmd.selected; }; + $scope.cssSelected = function (css) { + // support both current format (full stylesheet path) and legacy format (stylesheet name only) + css.selected = $scope.model.value.stylesheets.indexOf(css.path) >= 0 ||$scope.model.value.stylesheets.indexOf(css.name) >= 0; + return css.selected; + } + $scope.selectCommand = function(command){ var index = $scope.model.value.toolbar.indexOf(command.alias); @@ -60,11 +63,16 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.RteController", $scope.selectStylesheet = function (css) { - var index = $scope.model.value.stylesheets.indexOf(css.name); + // find out if the stylesheet is already selected; first look for the full stylesheet path (current format) + var index = $scope.model.value.stylesheets.indexOf(css.path); + if (index === -1) { + // ... then look for the stylesheet name (legacy format) + index = $scope.model.value.stylesheets.indexOf(css.name); + } - if(css.selected && index === -1){ - $scope.model.value.stylesheets.push(css.name); - }else if(index >= 0){ + if(index === -1){ + $scope.model.value.stylesheets.push(css.path); + }else{ $scope.model.value.stylesheets.splice(index, 1); } }; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.html index 13515ca7a9..463b1a03e0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.prevalues.html @@ -4,7 +4,7 @@