Use color picker component in block list editor configuration (#9056)
* Use color picker component in block list editor configuration * Remove set color property * Allow empty color * Assign color value to properties Co-authored-by: Nathan Woulfe <nathan@nathanw.com.au>
This commit is contained in:
committed by
GitHub
parent
f8cff2722d
commit
2d785af821
@@ -10,13 +10,19 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function BlockConfigurationOverlayController($scope, overlayService, localizationService, editorService, elementTypeResource, eventsService, udiService) {
|
||||
function BlockConfigurationOverlayController($scope, overlayService, localizationService, editorService, elementTypeResource, eventsService, udiService, angularHelper) {
|
||||
|
||||
var unsubscribe = [];
|
||||
|
||||
var vm = this;
|
||||
vm.block = $scope.model.block;
|
||||
|
||||
vm.colorPickerOptions = {
|
||||
type: "color",
|
||||
allowEmpty: true,
|
||||
showAlpha: true
|
||||
};
|
||||
|
||||
loadElementTypes();
|
||||
|
||||
function loadElementTypes() {
|
||||
@@ -285,6 +291,18 @@
|
||||
entry.thumbnail = null;
|
||||
};
|
||||
|
||||
vm.changeIconColor = function (color) {
|
||||
angularHelper.safeApply($scope, function () {
|
||||
vm.block.iconColor = color ? color.toString() : null;
|
||||
});
|
||||
};
|
||||
|
||||
vm.changeBackgroundColor = function (color) {
|
||||
angularHelper.safeApply($scope, function () {
|
||||
vm.block.backgroundColor = color ? color.toString() : null;
|
||||
});
|
||||
};
|
||||
|
||||
vm.submit = function() {
|
||||
if ($scope.model && $scope.model.submit) {
|
||||
$scope.model.submit($scope.model);
|
||||
|
||||
@@ -157,7 +157,11 @@
|
||||
<div class="umb-el-wrap">
|
||||
<label class="control-label" for="backgroundColor"><localize key="blockEditor_labelBackgroundColor">Background Color</localize></label>
|
||||
<div class="controls">
|
||||
<input type="text" name="backgroundColor" ng-model="vm.block.backgroundColor"/>
|
||||
<umb-color-picker
|
||||
ng-model="vm.block.backgroundColor"
|
||||
options="vm.colorPickerOptions"
|
||||
on-change="vm.changeBackgroundColor(color)">
|
||||
</umb-color-picker>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -167,7 +171,11 @@
|
||||
<div class="umb-el-wrap">
|
||||
<label class="control-label" for="iconColor"><localize key="blockEditor_labelIconColor">Icon Color</localize></label>
|
||||
<div class="controls">
|
||||
<input type="text" name="iconColor" ng-model="vm.block.iconColor"/>
|
||||
<umb-color-picker
|
||||
ng-model="vm.block.iconColor"
|
||||
options="vm.colorPickerOptions"
|
||||
on-change="vm.changeIconColor(color)">
|
||||
</umb-color-picker>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user