mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-16 19:02:40 +00:00
Proposed fix per calc.
This also works but has different currsor behavior. Original fix left in place, commented pending decisions.
This commit is contained in:
@@ -97,20 +97,20 @@ const Editor = createClass({
|
|||||||
if(prevProps.moveSource !== this.props.moveSource)
|
if(prevProps.moveSource !== this.props.moveSource)
|
||||||
this.sourceJump();
|
this.sourceJump();
|
||||||
|
|
||||||
if((prevProps.isDragging !== this.props.isDragging) && (this.props.isDragging) && (this.lastCursor == undefined)) {
|
// if((prevProps.isDragging !== this.props.isDragging) && (this.props.isDragging) && (this.lastCursor == undefined)) {
|
||||||
this.lastCursor = this.codeEditor.current.codeMirror.getCursor();
|
// this.lastCursor = this.codeEditor.current.codeMirror.getCursor();
|
||||||
const lastXY = this.codeEditor.current.codeMirror.getScrollInfo();
|
// const lastXY = this.codeEditor.current.codeMirror.getScrollInfo();
|
||||||
const lastRowPos = this.codeEditor.current.codeMirror.heightAtLine(this.lastCursor.line, 'local', true);
|
// const lastRowPos = this.codeEditor.current.codeMirror.heightAtLine(this.lastCursor.line, 'local', true);
|
||||||
this.lastCursor.offset = Math.round(lastRowPos-lastXY.top);
|
// this.lastCursor.offset = Math.round(lastRowPos-lastXY.top);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if((prevProps.isDragging !== this.props.isDragging) && (!this.props.isDragging)) {
|
// if((prevProps.isDragging !== this.props.isDragging) && (!this.props.isDragging)) {
|
||||||
const scroll = this.codeEditor.current.codeMirror.getScrollInfo();
|
// const scroll = this.codeEditor.current.codeMirror.getScrollInfo();
|
||||||
this.codeEditor.current.codeMirror.scrollTo(null,
|
// this.codeEditor.current.codeMirror.scrollTo(null,
|
||||||
this.codeEditor.current.codeMirror.heightAtLine(this.lastCursor.line, 'local', true) - this.lastCursor.offset);
|
// this.codeEditor.current.codeMirror.heightAtLine(this.lastCursor.line, 'local', true) - this.lastCursor.offset);
|
||||||
this.codeEditor.current.setCursorPosition(this.lastCursor.line, this.lastCursor.ch);
|
// this.codeEditor.current.setCursorPosition(this.lastCursor.line, this.lastCursor.ch);
|
||||||
this.lastCursor = undefined;
|
// this.lastCursor = undefined;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(this.props.liveScroll) {
|
if(this.props.liveScroll) {
|
||||||
if(prevProps.currentBrewRendererPageNum !== this.props.currentBrewRendererPageNum) {
|
if(prevProps.currentBrewRendererPageNum !== this.props.currentBrewRendererPageNum) {
|
||||||
@@ -424,7 +424,6 @@ const Editor = createClass({
|
|||||||
|
|
||||||
//Called when there are changes to the editor's dimensions
|
//Called when there are changes to the editor's dimensions
|
||||||
update : function(){
|
update : function(){
|
||||||
this.codeEditor.current?.updateSize();
|
|
||||||
const snipHeight = document.querySelector('.editor > .snippetBar').offsetHeight;
|
const snipHeight = document.querySelector('.editor > .snippetBar').offsetHeight;
|
||||||
if(snipHeight !== this.state.snippetbarHeight)
|
if(snipHeight !== this.state.snippetbarHeight)
|
||||||
this.setState({ snippetbarHeight: snipHeight });
|
this.setState({ snippetbarHeight: snipHeight });
|
||||||
|
|||||||
Reference in New Issue
Block a user