diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-stylesheet.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-stylesheet.less index ec34bdd34c..31824590e8 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-stylesheet.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-stylesheet.less @@ -1,5 +1,5 @@ .umb-stylesheet-rules { - width: 600px; + max-width: 600px; } .umb-stylesheet-rules__listitem { @@ -7,17 +7,17 @@ padding: 6px; margin: 10px 0 !important; background: @gray-10; - cursor: move; + cursor: pointer; } .umb-stylesheet-rules__listitem i { display: flex; align-items: center; - margin-right: 5px + margin-right: 5px; + cursor: move; } .umb-stylesheet-rules__listitem a { - cursor: pointer; margin-left: auto; } @@ -26,29 +26,9 @@ } .umb-stylesheet-rules__left { - display: block; + display: flex; flex: 1 1 auto; overflow: hidden; - - .control-group { - margin: 5px auto; - - .control-label { - text-align: left; - float: none; - } - - .controls { - margin-left: 0; - display: inline; - - textarea { - width: 295px; - height: 80px; - resize: none; - } - } - } } .umb-stylesheet-rules__right { @@ -56,3 +36,11 @@ flex: 0 0 auto; align-items: center; } + +.umb-stylesheet-rule-overlay { + textarea { + width: 300px; + height: 120px; + resize: none; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js index dc14c6181a..2705294d54 100644 --- a/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js @@ -4,7 +4,6 @@ function StyleSheetsEditController($scope, $routeParams, $timeout, $http, appState, editorState, navigationService, assetsService, codefileResource, contentEditingHelper, notificationsService, localizationService, templateHelper, angularHelper, umbRequestHelper) { var vm = this; - var currentPosition = null; vm.page = {}; vm.page.loading = true; diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.controller.js b/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.controller.js index 91b5f28ff8..28d1724b64 100644 --- a/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.controller.js @@ -1,10 +1,11 @@ angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.RulesController", - function ($scope, angularHelper) { + function ($scope, localizationService) { $scope.sortableOptions = { axis: 'y', containment: 'parent', cursor: 'move', items: 'div.umb-stylesheet-rules__listitem', + handle: '.handle', tolerance: 'pointer', update: function (e, ui) { setDirty(); @@ -14,8 +15,21 @@ angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.RulesControlle $scope.add = function (evt) { evt.preventDefault(); - $scope.model.stylesheet.rules.push({}); - setDirty(); + openOverlay({}, $scope.labels.addRule, (newRule) => { + $scope.model.stylesheet.rules.push(newRule); + setDirty(); + }); + } + + $scope.edit = function(rule, evt) { + evt.preventDefault(); + + openOverlay(rule, $scope.labels.editRule, (newRule) => { + rule.name = newRule.name; + rule.selector = newRule.selector; + rule.styles = newRule.styles; + setDirty(); + }); } $scope.remove = function (rule, evt) { @@ -25,7 +39,32 @@ angular.module("umbraco").controller("Umbraco.Editors.StyleSheets.RulesControlle setDirty(); } + function openOverlay(rule, title, onSubmit) { + $scope.model.overlay = { + title: title, + submit: function (model) { + onSubmit(model.rule); + $scope.model.overlay = null; + }, + close: function (oldModel) { + $scope.model.overlay = null; + }, + rule: _.clone(rule) + }; + } + function setDirty() { $scope.model.setDirty(); } + + function init() { + localizationService.localizeMany(["stylesheet_overlayTitleAddRule", "stylesheet_overlayTitleEditRule"]).then(function (data) { + $scope.labels = { + addRule: data[0], + editRule: data[1] + } + }); + } + + init(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.html b/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.html index 77c344057c..17b52f064e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.html +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/views/rules/rules.html @@ -1,47 +1,41 @@ -
Rich text editor styles
- Define the styles that should be available in the rich text editor for this stylesheet -
-
-
- -
-
- -
- +
+
+
Rich text editor styles
+ Define the styles that should be available in the rich text editor for this stylesheet +
+
+
+
+
+ +
+ {{rule.name}}
-
-
- -
- -
-
-
- -
- +
+ Remove
-
- Remove +
+
-
- -
+ + + + + + + + + + + + + diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml index 4f627313d4..7646851cd7 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml @@ -1041,11 +1041,14 @@ Mange hilsner fra Umbraco robotten Teksteditor-styles Definér de styles, der skal være tilgængelige i teksteditoren for dette stylesheet Selector - Bruger CSS-syntaks f.eks. h1, .redheader, .blueTex + Bruger CSS-syntaks, f.eks. "h1" eller ".redheader" Rediger stylesheet Rediger CSS-egenskab + Tilføj style + Redigér style Det navn der vises i teksteditoren Styles + Den CSS der skal anvendes i teksteditoren, f.eks. "color:red;" Kode Editor diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index edf973476b..11a32a9703 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -1323,9 +1323,12 @@ To manage your website, simply open the Umbraco back office and start adding con Edit stylesheet Edit stylesheet property The name displayed in the editor style selector + Add style + Edit style Selector - Uses CSS syntax ex: h1, .redHeader, .blueTex + Uses CSS syntax, e.g. "h1" or ".redHeader" Styles + The CSS that should be applied in the rich text editor, e.g. "color:red;" Code Editor diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 0a250cc980..d5e6c6fa0c 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -1344,9 +1344,12 @@ To manage your website, simply open the Umbraco back office and start adding con Edit stylesheet Edit stylesheet property The name displayed in the editor style selector + Add style + Edit style Selector - Uses CSS syntax ex: h1, .redHeader, .blueTex + Uses CSS syntax, e.g. "h1" or ".redHeader" Styles + The CSS that should be applied in the rich text editor, e.g. "color:red;" Code Editor