mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-08 03:02:03 +01:00
smell resolve
This commit is contained in:
parent
ea2c2949c1
commit
46805d80d6
1 changed files with 14 additions and 13 deletions
|
@ -41,28 +41,29 @@ const padeditor = (function () {
|
||||||
|
|
||||||
function aceReady() {
|
function aceReady() {
|
||||||
$('#editorloadingbox').hide();
|
$('#editorloadingbox').hide();
|
||||||
|
const $outerdoc = $('iframe[name="ace_outer"]').contents().find('#outerdocbody');
|
||||||
if (readyFunc) {
|
if (readyFunc) {
|
||||||
// If a number is in the URI IE #L124 go to that line number
|
// If a number is in the URI IE #L124 go to that line number
|
||||||
const lineNumber = window.location.hash.substr(1);
|
const lineNumber = window.location.hash.substr(1);
|
||||||
if (lineNumber) {
|
if (lineNumber) {
|
||||||
if (lineNumber[0] === 'L') {
|
if (lineNumber[0] === 'L') {
|
||||||
const lineNumberInt = parseInt(lineNumber.replace('L', ''));
|
const lineNumberInt = parseInt(lineNumber.replace('L', ''));
|
||||||
const $inner = $('iframe[name="ace_outer"]').contents().find('iframe')
|
if (lineNumberInt) {
|
||||||
.contents().find('#innerdocbody');
|
const $inner = $('iframe[name="ace_outer"]').contents().find('iframe')
|
||||||
const line = $inner.find(`div:nth-child(${lineNumberInt})`);
|
.contents().find('#innerdocbody');
|
||||||
if (line.length !== 0) {
|
const line = $inner.find(`div:nth-child(${lineNumberInt})`);
|
||||||
let offsetTop = line.offset().top;
|
if (line.length !== 0) {
|
||||||
const $outerdoc = $('iframe[name="ace_outer"]').contents().find('#outerdocbody');
|
let offsetTop = line.offset().top;
|
||||||
offsetTop += parseInt($outerdoc.css('padding-top').replace('px', ''));
|
offsetTop += parseInt($outerdoc.css('padding-top').replace('px', ''));
|
||||||
offsetTop += parseInt($inner.css('padding-top').replace('px', ''));
|
offsetTop += parseInt($inner.css('padding-top').replace('px', ''));
|
||||||
const $outerdocHTML = $('iframe[name="ace_outer"]').contents()
|
const $outerdocHTML = $('iframe[name="ace_outer"]').contents()
|
||||||
.find('#outerdocbody').parent();
|
.find('#outerdocbody').parent();
|
||||||
$outerdoc.css({top: `${offsetTop}px`}); // Chrome
|
$outerdoc.css({top: `${offsetTop}px`}); // Chrome
|
||||||
$outerdocHTML.animate({scrollTop: offsetTop}); // needed for FF
|
$outerdocHTML.animate({scrollTop: offsetTop}); // needed for FF
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const $outerdoc = $('iframe[name="ace_outer"]').contents().find('#outerdocbody');
|
|
||||||
// Listen for clicks on sidediv items
|
// Listen for clicks on sidediv items
|
||||||
$outerdoc.find('#sidedivinner').on('click', 'div', function() {
|
$outerdoc.find('#sidedivinner').on('click', 'div', function() {
|
||||||
const lineNumber = $(this).index() + 1;
|
const lineNumber = $(this).index() + 1;
|
||||||
|
|
Loading…
Reference in a new issue