File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
browser-extension/src/lib Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ export class EnhancerRegistry {
6969 this . preparedEnhancers . add ( enhancer )
7070 }
7171 const overtype = enhancer . enhance ( textarea , spot )
72+ this . handleDelayedValueInjection ( overtype )
7273 return { enhancer, overtype, spot, textarea }
7374 }
7475 } catch ( error ) {
@@ -78,6 +79,24 @@ export class EnhancerRegistry {
7879 return null
7980 }
8081
82+ private handleDelayedValueInjection ( overtype : OverTypeInstance ) : void {
83+ // GitHub sometimes injects textarea content after a delay
84+ // We need to trigger OverType to update its preview after such injections
85+ // https://github.com/diffplug/gitcasso/issues/46
86+ setTimeout ( ( ) => {
87+ overtype . updatePreview ( )
88+ } , 100 )
89+ setTimeout ( ( ) => {
90+ overtype . updatePreview ( )
91+ } , 200 )
92+ setTimeout ( ( ) => {
93+ overtype . updatePreview ( )
94+ } , 400 )
95+ setTimeout ( ( ) => {
96+ overtype . updatePreview ( )
97+ } , 8000 )
98+ }
99+
81100 getEnhancerCount ( ) : number {
82101 return this . enhancers . size
83102 }
You can’t perform that action at this time.
0 commit comments