You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When changing the session (Ace.EditSession) of the current editor (to allow for different editing sessions but reusing the same editor component) via the editor.setSession() method, the various session/selection related events stop firing
The events includes onCursorChange, onSelectionChange, onScroll, etc.
This could be due to the way how ReactAce implements event registration for the session-based events, as they are only registered during the componentDidMount lifecycle stage for the default session.
A simple but tedious workaround for the problem is to re-register the aforementioned events manually, right after changing sessions via editor.setSession(). However, care and caution is also needed to ensure the event is only registered once for each session, which leads to some very hacky fixes.
Possible resolution can be to track/intercept the session changes, and rebind the event listeners.
References
The text was updated successfully, but these errors were encountered:
Problem
When changing the session (
Ace.EditSession
) of the current editor (to allow for different editing sessions but reusing the same editor component) via theeditor.setSession()
method, the various session/selection related events stop firingThe events includes
onCursorChange
,onSelectionChange
,onScroll
, etc.This could be due to the way how ReactAce implements event registration for the session-based events, as they are only registered during the
componentDidMount
lifecycle stage for the default session.Sample code to reproduce your issue
The following code has been tested on [email protected], [email protected], and on both react@16 and react@18.
A simple but tedious workaround for the problem is to re-register the aforementioned events manually, right after changing sessions via
editor.setSession()
. However, care and caution is also needed to ensure the event is only registered once for each session, which leads to some very hacky fixes.Possible resolution can be to track/intercept the session changes, and rebind the event listeners.
References
The text was updated successfully, but these errors were encountered: