Skip to content

Commit

Permalink
fix(webapps): fix copy variable value not type string (#4220)
Browse files Browse the repository at this point in the history
related to #4190
  • Loading branch information
tasso94 authored Mar 25, 2024
1 parent ef827ef commit 7d3b21f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
ng-if="!isEditable('value', info) && !hasEditDialog(variable.type)"
class="read-only value-wrapper">
<span ng-if="variable.type !== 'Bytes' && variable.type !== 'Date'"
cam-widget-clipboard="variable.value">{{ variable.value }}</span>
cam-widget-clipboard="asString(variable.value)">{{ variable.value }}</span>
<span ng-if="variable.type === 'Bytes'">{{ variable.value }}</span>
<span ng-if="variable.type === 'Date'"
cam-widget-clipboard="variable.value">{{ variable.value | camDate }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ module.exports = [
},

link: function($scope) {
/**
* Starting with clipboard.js 2.0.9 creating a
* fake textarea for values not of type string is broken.
* Cf. https://github.com/camunda/camunda-bpm-platform/issues/4190
* @param value the value that is not a string.
* @returns {string} a string value.
*/
$scope.asString = value => value + '';

if ($scope.validatable) {
const onHideValidationPopover = e => {
const modalWindow = angular.element('.modal');
Expand Down Expand Up @@ -289,9 +298,11 @@ module.exports = [
info.valid = true;

var varPath = 'variables[' + i + '].variable';

function wrapedValidate() {
validate(info, i);
}

$scope.$watch(varPath + '.value', wrapedValidate);
$scope.$watch(varPath + '.name', wrapedValidate);
$scope.$watch(varPath + '.type', wrapedValidate);
Expand Down

0 comments on commit 7d3b21f

Please sign in to comment.