mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-630: Preserve raw contents of color scheme if manually edited.
This commit is contained in:
@@ -77,14 +77,12 @@ angular.module('form').controller('terminalColorSchemeFieldController', ['$scope
|
|||||||
// Keep selected color scheme and custom color scheme in sync with changes
|
// Keep selected color scheme and custom color scheme in sync with changes
|
||||||
// to model
|
// to model
|
||||||
$scope.$watch('model', function modelChanged(model) {
|
$scope.$watch('model', function modelChanged(model) {
|
||||||
if (!model)
|
if ($scope.selectedColorScheme === CUSTOM_COLOR_SCHEME || (model && !_.includes($scope.field.options, model))) {
|
||||||
$scope.selectedColorScheme = '';
|
|
||||||
else if (_.includes($scope.field.options, model))
|
|
||||||
$scope.selectedColorScheme = model;
|
|
||||||
else {
|
|
||||||
$scope.customColorScheme = ColorScheme.fromString(model);
|
$scope.customColorScheme = ColorScheme.fromString(model);
|
||||||
$scope.selectedColorScheme = CUSTOM_COLOR_SCHEME;
|
$scope.selectedColorScheme = CUSTOM_COLOR_SCHEME;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$scope.selectedColorScheme = model || '';
|
||||||
});
|
});
|
||||||
|
|
||||||
// Keep model in sync with changes to selected color scheme
|
// Keep model in sync with changes to selected color scheme
|
||||||
|
@@ -242,7 +242,7 @@ angular.module('form').factory('ColorScheme', [function defineColorScheme() {
|
|||||||
ColorScheme.toString = function toString(scheme) {
|
ColorScheme.toString = function toString(scheme) {
|
||||||
|
|
||||||
// Use originally-provided string if it equates to the exact same color scheme
|
// Use originally-provided string if it equates to the exact same color scheme
|
||||||
if (scheme._originalString && ColorScheme.equals(scheme, ColorScheme.fromString(scheme._originalString)))
|
if (!_.isUndefined(scheme._originalString) && ColorScheme.equals(scheme, ColorScheme.fromString(scheme._originalString)))
|
||||||
return scheme._originalString;
|
return scheme._originalString;
|
||||||
|
|
||||||
// Add background and foreground
|
// Add background and foreground
|
||||||
|
Reference in New Issue
Block a user