mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-13 17:27:42 +00:00
Merge "Use dispatchEvent instead of jQuery triggerHandler for focus/blur events"
This commit is contained in:
commit
61d71a5f53
|
@ -125,8 +125,12 @@ class CodeMirror {
|
||||||
this.dirExtension,
|
this.dirExtension,
|
||||||
EditorState.readOnly.of( this.readOnly ),
|
EditorState.readOnly.of( this.readOnly ),
|
||||||
EditorView.domEventHandlers( {
|
EditorView.domEventHandlers( {
|
||||||
blur: () => this.$textarea.triggerHandler( 'blur' ),
|
blur: () => {
|
||||||
focus: () => this.$textarea.triggerHandler( 'focus' )
|
this.$textarea[ 0 ].dispatchEvent( new Event( 'blur' ) );
|
||||||
|
},
|
||||||
|
focus: () => {
|
||||||
|
this.$textarea[ 0 ].dispatchEvent( new Event( 'focus' ) );
|
||||||
|
}
|
||||||
} ),
|
} ),
|
||||||
EditorView.lineWrapping,
|
EditorView.lineWrapping,
|
||||||
keymap.of( [
|
keymap.of( [
|
||||||
|
|
|
@ -191,10 +191,10 @@ function init() {
|
||||||
const $codeMirror = $( codeMirror.getWrapperElement() );
|
const $codeMirror = $( codeMirror.getWrapperElement() );
|
||||||
|
|
||||||
codeMirror.on( 'focus', () => {
|
codeMirror.on( 'focus', () => {
|
||||||
$textbox1.triggerHandler( 'focus' );
|
$textbox1[ 0 ].dispatchEvent( new Event( 'focus' ) );
|
||||||
} );
|
} );
|
||||||
codeMirror.on( 'blur', () => {
|
codeMirror.on( 'blur', () => {
|
||||||
$textbox1.triggerHandler( 'blur' );
|
$textbox1[ 0 ].dispatchEvent( new Event( 'blur' ) );
|
||||||
} );
|
} );
|
||||||
mw.hook( 'editRecovery.loadEnd' ).add( ( data ) => {
|
mw.hook( 'editRecovery.loadEnd' ).add( ( data ) => {
|
||||||
codeMirror.on( 'change', data.fieldChangeHandler );
|
codeMirror.on( 'change', data.fieldChangeHandler );
|
||||||
|
|
Loading…
Reference in a new issue