0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 18:48:39 +00:00

handle scroll remake

This commit is contained in:
Víctor Losada Hernández
2026-04-12 23:42:20 +02:00
parent 5a778ad4e6
commit ed5e5004e0
2 changed files with 28 additions and 31 deletions
-23
View File
@@ -266,29 +266,6 @@ const Editor = createReactClass({
this.forceUpdate();
},
//temporary fix until cm6 comes next update
attachCodeMirrorListeners : function(cm) {
if(!cm) return;
// detach previous (important on remount / view switch)
if(this._cm) {
this._cm.off('cursorActivity', this._onCursor);
this._cm.off('scroll', this._onScroll);
}
this._cm = cm;
this._onCursor = ()=>{
this.updateCurrentCursorPage(cm.getCursor());
};
this._onScroll = _.throttle(()=>{
const topLine = cm.lineAtHeight(cm.getScrollInfo().top, 'local');
this.updateCurrentViewPage(topLine);
}, 200);
cm.on('cursorActivity', this._onCursor);
cm.on('scroll', this._onScroll);
},
renderEditor : function(){
if(this.isText()){
return <>