GUACAMOLE-630: Preserve raw contents of color scheme if manually edited.

This commit is contained in:
Michael Jumper committed 2019-08-08 21:30:44 -07:00
1 parent 588cdcd97a
commit 3ce2adbae6
2 files changed
+4 -6

No files matched your search

@@ -77,14 +77,12 @@ angular.module('form').controller('terminalColorSchemeFieldController', ['$scope
// Keep selected color scheme and custom color scheme in sync with changes
// to model
$scope.$watch('model', function modelChanged(model) {
if (!model)
$scope.selectedColorScheme = '';
else if (_.includes($scope.field.options, model))
$scope.selectedColorScheme = model;
else {
if ($scope.selectedColorScheme === CUSTOM_COLOR_SCHEME || (model && !_.includes($scope.field.options, model))) {
$scope.customColorScheme = ColorScheme.fromString(model);
$scope.selectedColorScheme = CUSTOM_COLOR_SCHEME;
}
else
$scope.selectedColorScheme = model || '';
});
// 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) {
// 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;
// Add background and foreground