Fixed share json (#23607)

This commit is contained in:
Torkel Ödegaard
2020-04-16 09:31:40 +02:00
committed by GitHub
parent 5fc255bd89
commit 7fc9921be3
2 changed files with 21 additions and 0 deletions

View File

@@ -2,3 +2,4 @@ import './invited_ctrl';
import './signup_ctrl'; import './signup_ctrl';
import './reset_password_ctrl'; import './reset_password_ctrl';
import './error_ctrl'; import './error_ctrl';
import './json_editor_ctrl';

View File

@@ -0,0 +1,20 @@
import angular from 'angular';
import coreModule from '../core_module';
export class JsonEditorCtrl {
/** @ngInject */
constructor($scope: any) {
$scope.json = angular.toJson($scope.model.object, true);
$scope.canUpdate = $scope.model.updateHandler !== void 0 && $scope.model.canUpdate;
$scope.canCopy = $scope.model.enableCopy;
$scope.update = () => {
const newObject = angular.fromJson($scope.json);
$scope.model.updateHandler(newObject, $scope.model.object);
};
$scope.getContentForClipboard = () => $scope.json;
}
}
coreModule.controller('JsonEditorCtrl', JsonEditorCtrl);