1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

[file edit] fixed codeMirror selection bug

This commit is contained in:
llj
2013-02-07 12:17:42 +08:00
parent 9494cc68c1
commit 67fdc67619

View File

@@ -154,8 +154,8 @@ switch($('#lang-context').data('lang')) {
$(window).scroll(function() {
var offset = $('#edit-hd').offset();
if ($(window).scrollTop() > offset.top + $('#edit-hd').height()) {
$('#edit-hd').css('margin-bottom', $('#path-op').outerHeight(true));
$('#path-op').addClass('fixed-path-op').css({'left':0, 'top':0, 'padding-left':offset.left, 'padding-right':offset.left});
$('#edit-hd').css('margin-bottom', $('#path-op').outerHeight());
} else {
$('#path-op').removeClass('fixed-path-op').removeAttr('style');
$('#edit-hd').css('margin-bottom', 0);
@@ -185,7 +185,7 @@ var editor = CodeMirror.fromTextArea($('#docu-view')[0], {
$(window).scrollTop($(window).scrollTop() + parseInt($('#file-edit').css('padding-bottom')));
}
// keep the cursor visible when path-op fixed and moving the cursor upward
if (cursor.y - $(window).scrollTop() < $('#path-op').outerHeight()) {
if (cursor.y - $(window).scrollTop() < $('#path-op').outerHeight() && !editor.somethingSelected()) {
$(window).scrollTop(cursor.y - $('#path-op').outerHeight());
}
},