Bug #1859: Detect scroll movement on codeblocks of the wiki
parent
a21ed91888
commit
0f6a7dadb9
|
@ -276,6 +276,12 @@ EditableWikiContentDirective = ($window, $document, $repo, $confirm, $loading, $
|
||||||
promise.finally ->
|
promise.finally ->
|
||||||
$loading.finish($el.find('.save-container'))
|
$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) ->
|
$el.on "mouseup", ".view-wiki-content", (event) ->
|
||||||
# We want to dettect the a inside the div so we use the target and
|
# We want to dettect the a inside the div so we use the target and
|
||||||
# not the currentTarget
|
# not the currentTarget
|
||||||
|
@ -283,6 +289,12 @@ EditableWikiContentDirective = ($window, $document, $repo, $confirm, $loading, $
|
||||||
return if not isEditable()
|
return if not isEditable()
|
||||||
return if target.is('a')
|
return if target.is('a')
|
||||||
return if getSelectedText()
|
return if getSelectedText()
|
||||||
|
if target.is('pre')
|
||||||
|
prevPos = target.data("scroll-pos")
|
||||||
|
target.data("scroll-pos", null)
|
||||||
|
if prevPos != target[0].scrollLeft
|
||||||
|
return
|
||||||
|
|
||||||
switchToEditMode()
|
switchToEditMode()
|
||||||
|
|
||||||
$el.on "click", ".save", debounce 2000, ->
|
$el.on "click", ".save", debounce 2000, ->
|
||||||
|
|
Loading…
Reference in New Issue