Skip to content

Commit

Permalink
feat: only open editor if cursor didn't move
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfran committed Feb 14, 2024
1 parent 5e43bc8 commit 0a9ae1c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/modules/components/wysiwyg/wysiwyg.directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,20 @@ Wysiwyg = ($translate, $confirm, $storage, wysiwygService, animationFrame, tgLoa


linksEvents = () ->
initialPos = null

$el.on 'mousedown', '.js-wysiwyg-html', (e) =>
initialPos = {x: e.clientX, y: e.clientY}

$el.on 'click', '.js-wysiwyg-html', (e) =>
diffX = Math.abs(e.clientX - initialPos.x)
diffY = Math.abs(e.clientY - initialPos.y)

initialPos = null

if diffX > 10 || diffY > 10
return

if e.target.tagName != 'A' && e.target.parentElement.tagName != 'A'
$scope.$applyAsync () => $scope.setEditMode(true)

Expand Down

0 comments on commit 0a9ae1c

Please sign in to comment.