Merge pull request #230 from taigaio/bug/1859/detect-scroll-movement
Bug #1859: Detect scroll movement on codeblocks of the wikistable
commit
5b6a1d5c10
|
@ -276,6 +276,12 @@ EditableWikiContentDirective = ($window, $document, $repo, $confirm, $loading, $
|
|||
promise.finally ->
|
||||
$loading.finish($el.find('.save-container'))
|
||||
|
||||
$el.on "mousedown", ".view-wiki-content", (event) ->
|
||||
# Prepare the scroll movement detection
|
||||
target = angular.element(event.target)
|
||||
if target.is('pre')
|
||||
target.data("scroll-pos", target[0].scrollLeft)
|
||||
|
||||
$el.on "mouseup", ".view-wiki-content", (event) ->
|
||||
# We want to dettect the a inside the div so we use the target and
|
||||
# not the currentTarget
|
||||
|
@ -283,6 +289,12 @@ EditableWikiContentDirective = ($window, $document, $repo, $confirm, $loading, $
|
|||
return if not isEditable()
|
||||
return if target.is('a')
|
||||
return if getSelectedText()
|
||||
if target.is('pre')
|
||||
prevPos = target.data("scroll-pos")
|
||||
target.data("scroll-pos", null)
|
||||
if prevPos != target[0].scrollLeft
|
||||
return
|
||||
|
||||
switchToEditMode()
|
||||
|
||||
$el.on "click", ".save", debounce 2000, ->
|
||||
|
|
Loading…
Reference in New Issue