Fix bug in chrome caused by a nonsense reason

stable
Xavier Julián 2015-02-17 14:35:26 +01:00
parent 3239b8757b
commit c83cc76be8
2 changed files with 12 additions and 16 deletions

View File

@ -235,24 +235,15 @@ EditableWikiContentDirective = ($window, $document, $repo, $confirm, $loading, $
$loading.finish($el.find('.save-container')) $loading.finish($el.find('.save-container'))
$el.on "mousedown", ".view-wiki-content", (event) -> $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
target = angular.element(event.target) target = angular.element(event.target)
return if not isEditable() return if not isEditable()
return if target.is('a', '.codehilite', 'pre')
return if getSelectedText()
return if event.button == 2 return if event.button == 2
if target.is('pre')
prevPos = target.data("scroll-pos") $el.on "mouseup", ".view-wiki-content", (event) ->
target.data("scroll-pos", null) target = angular.element(event.target)
if prevPos != target[0].scrollLeft return if getSelectedText()
return return if target.is('a')
return if target.is('pre')
switchToEditMode() switchToEditMode()

View File

@ -48,13 +48,18 @@
line-height: 1.4rem; line-height: 1.4rem;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.codehilite {
overflow: auto;
}
pre, pre,
code { code {
@extend %small; @extend %small;
background: $whitish; background: lighten($grayer, 10%);
color: $whitish;
direction: ltr; direction: ltr;
font-family: 'courier new', 'monospace'; font-family: 'courier new', 'monospace';
margin-bottom: 1rem; margin-bottom: 1rem;
overflow: auto;
unicode-bidi: embed; unicode-bidi: embed;
white-space: pre; white-space: pre;
} }