0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Change for line consistency when moving to page 1

This commit is contained in:
G.Ambatte
2022-05-29 13:48:36 +12:00
parent 3f852ccff3
commit 160cfcce4d

View File

@@ -202,15 +202,14 @@ const Editor = createClass({
}
}
if(currentPage > 1){
const textString = this.props.brew.text.split('\\page').slice(0, currentPage-1).join('\\page');
const textPosition = textString.length;
const lineCount = textString.slice(0, textPosition).split('\n').length;
const textSplit = this.props.renderer == 'V3' ? '\n\\page\n' : '\\page';
const textString = this.props.brew.text.split(textSplit).slice(0, currentPage-1).join(textSplit);
const textPosition = textString.length;
const lineCount = textString.match('\n') ? textString.slice(0, textPosition).split('\n').length : 0;
targetLine = lineCount;
}
targetLine = lineCount;
}
// Math.floor(target.scrollTop / target.scrollHeight * prevState.pages.length);
this.refs.codeEditor.setCursorPosition(targetLine, 0);
}
},