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)
}
cancelEdit: () ->
@.editMode = false
@.item.subject = @.originalSubject
editSubject: (value) ->
selection = @window.getSelection()
if selection.type != "Range"

View File

@ -42,7 +42,7 @@
svg-icon="icon-save"
)
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")

View File

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

View File

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