From 81b20c4de67bad271f848eb2dd492c9da0b43678 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 5 Feb 2010 03:50:24 +0100 Subject: fixed linenumber height if first line in source has a margin --- etherpad/src/static/js/ace.js | 2 +- infrastructure/ace/www/ace2_inner.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etherpad/src/static/js/ace.js b/etherpad/src/static/js/ace.js index 6976945..96b103d 100644 --- a/etherpad/src/static/js/ace.js +++ b/etherpad/src/static/js/ace.js @@ -20,7 +20,7 @@ var L=function(Q){return'\''"];T.push(("('\\n\'');T.push('\' \''); var X='editorId = "'+A.id+'"; editorInfo = parent.'+K+'.registry[editorId]; window.onload = function() { window.onload = null; setTimeout(function() { var iframe = document.createElement("IFRAME"); iframe.scrolling = "no"; var outerdocbody = document.getElementById("outerdocbody"); iframe.frameBorder = 0; iframe.allowTransparency = true; outerdocbody.insertBefore(iframe, outerdocbody.firstChild); iframe.ace_outerWin = window; readyFunc = function() { editorInfo.onEditorReady(); readyFunc = null; editorInfo = null; }; var doc = iframe.contentWindow.document; doc.open(); doc.write('+T.join("+")+"); doc.close(); }, 0); }"; var Y=[W,"",(''),'',"\x3cscript>",X,"\x3c/script>",'
x
']; diff --git a/infrastructure/ace/www/ace2_inner.js b/infrastructure/ace/www/ace2_inner.js index 6723cef..a6233d3 100644 --- a/infrastructure/ace/www/ace2_inner.js +++ b/infrastructure/ace/www/ace2_inner.js @@ -4778,6 +4778,11 @@ function OUTER(gscope) { a = a.nextSibling; b = b.nextSibling; } + + // fix if first line has margin (f.e. h1 in first line) + sideDivInner.firstChild.style.marginTop = + (doc.body.firstChild.offsetTop - sideDivInner.firstChild.offsetTop + + parseInt(sideDivInner.firstChild.style.marginTop + "0")) + "px"; } } -- cgit v1.2.3