Cancel with confirmation in wysiwyg editor

stable
Daniel García 2018-08-20 12:55:48 +02:00 committed by Alex Hermida
parent 079a89fbba
commit 0e35acf9ff
4 changed files with 8 additions and 4 deletions

View File

@ -58,6 +58,10 @@ class StoryHeaderController
canEdit: _.includes(@.project.my_permissions, @.requiredPerm) canEdit: _.includes(@.project.my_permissions, @.requiredPerm)
} }
cancelEdit: () ->
@.editMode = false
@.item.subject = @.originalSubject
editSubject: (value) -> editSubject: (value) ->
selection = @window.getSelection() selection = @window.getSelection()
if selection.type != "Range" if selection.type != "Range"

View File

@ -42,7 +42,7 @@
svg-icon="icon-save" svg-icon="icon-save"
) )
button.edit-title-button.cancel-title-button.e2e-cancel-title-button( button.edit-title-button.cancel-title-button.e2e-cancel-title-button(
ng-click="vm.editSubject(false)" ng-click="vm.cancelEdit(false)"
) )
tg-svg(svg-icon="icon-close") tg-svg(svg-icon="icon-close")

View File

@ -352,7 +352,7 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
discardLocalStorage = () -> discardLocalStorage = () ->
$storage.remove($scope.storageKey) $storage.remove($scope.storageKey)
cancelWithConfirmation = () -> $scope.cancelWithConfirmation = () ->
if $scope.content == $scope.markdown if $scope.content == $scope.markdown
$scope.cancel() $scope.cancel()
@ -509,7 +509,7 @@ Medium = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoad
if $scope.editMode && code == 27 if $scope.editMode && code == 27
e.stopPropagation() e.stopPropagation()
$scope.$applyAsync(cancelWithConfirmation) $scope.$applyAsync($scope.cancelWithConfirmation)
else if code == 27 else if code == 27
editorMedium.blur() editorMedium.blur()

View File

@ -44,7 +44,7 @@
tg-svg(svg-icon="icon-save") tg-svg(svg-icon="icon-save")
a.e2e-cancel-editor( a.e2e-cancel-editor(
href="#", href="#",
ng-click="cancel($event)" ng-click="cancelWithConfirmation($event)"
title="{{ 'COMMON.CANCEL' | translate }}" title="{{ 'COMMON.CANCEL' | translate }}"
) )
tg-svg(svg-icon="icon-close") tg-svg(svg-icon="icon-close")