mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-12 00:38:51 +00:00
CodeMirrorWikiEditor: add missing hook and fix reference to textarea
This fixes integration with some consumers of the 'ext.CodeMirror.switch' hook, such as Extension:Disambiguator. The jQuery element passed to the hook is around the CodeMirror DOM element which has the jQuery.textSelection() API registered to it. Bug: T317243 Follow-Up: I2239d2449b2db3b638551f847eb4eff1aafa6276 Change-Id: Iec368613da3c69df52ce5e7ca441c31172cdc5de
This commit is contained in:
parent
39ed5a05fc
commit
06829a5a0a
2
resources/dist/main.js
vendored
2
resources/dist/main.js
vendored
File diff suppressed because one or more lines are too long
2
resources/dist/main.js.map.json
vendored
2
resources/dist/main.js.map.json
vendored
File diff suppressed because one or more lines are too long
|
@ -84,6 +84,8 @@ export default class CodeMirrorWikiEditor extends CodeMirror {
|
|||
if ( hasFocus ) {
|
||||
this.view.focus();
|
||||
}
|
||||
|
||||
mw.hook( 'ext.CodeMirror.switch' ).fire( true, $( this.view.dom ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +174,7 @@ export default class CodeMirrorWikiEditor extends CodeMirror {
|
|||
this.$textarea.prop( 'selectionStart', Math.min( from, to ) )
|
||||
.prop( 'selectionEnd', Math.max( to, from ) );
|
||||
this.$textarea.scrollTop( scrollTop );
|
||||
mw.hook( 'ext.CodeMirror.switch' ).fire( false, this.$textbox1 );
|
||||
mw.hook( 'ext.CodeMirror.switch' ).fire( false, this.$textarea );
|
||||
} else {
|
||||
this.enableCodeMirror();
|
||||
this.setCodeMirrorPreference( true );
|
||||
|
|
Loading…
Reference in a new issue