codemirror: sync data when closing modal by clicking outside

This commit is contained in:
Keith Grant
2019-03-20 11:01:42 -04:00
parent 2657779eda
commit 86c7fd3b5d

View File

@@ -28,6 +28,13 @@ function atCodeMirrorModalController (
setTimeout(resize, 0); setTimeout(resize, 0);
} }
$scope.close = () => {
$scope.closeFn({
values: $scope.modalVars,
parseType: $scope.modalParseType,
});
};
function init () { function init () {
if ($scope.disabled === 'true') { if ($scope.disabled === 'true') {
$scope.disabled = true; $scope.disabled = true;
@@ -43,7 +50,7 @@ function atCodeMirrorModalController (
readOnly: $scope.disabled readOnly: $scope.disabled
}); });
resize(); resize();
$(CodeMirrorModalID).on('hidden.bs.modal', $scope.closeFn); $(CodeMirrorModalID).on('hidden.bs.modal', $scope.close);
$(`${CodeMirrorModalID} .modal-dialog`).resizable({ $(`${CodeMirrorModalID} .modal-dialog`).resizable({
minHeight: 523, minHeight: 523,
minWidth: 600 minWidth: 600
@@ -53,12 +60,6 @@ function atCodeMirrorModalController (
vm.strings = strings; vm.strings = strings;
vm.toggle = toggle; vm.toggle = toggle;
$scope.close = () => {
$scope.closeFn({
values: $scope.modalVars,
parseType: $scope.modalParseType,
});
};
if ($scope.init) { if ($scope.init) {
$scope.init = init; $scope.init = init;
} }