mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-27 08:30:26 +00:00
Save real tabs and allow configuration by users via JS hook
Bug: 39616 Change-Id: I64c3b9b53f1265f5b9c19edb480040113fa85590
This commit is contained in:
parent
7adc7b1a8b
commit
7a9b6a5168
4
hooks.txt
Normal file
4
hooks.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
== JS hooks ==
|
||||||
|
'codeEditor.configure' is fired during the set up of the ACE editor
|
||||||
|
Params:
|
||||||
|
* {object} session ACE editor session
|
|
@ -165,10 +165,15 @@ context.fn = $.extend( context.fn, {
|
||||||
box.closest('form').submit( context.evt.codeEditorSubmit );
|
box.closest('form').submit( context.evt.codeEditorSubmit );
|
||||||
var session = context.codeEditor.getSession();
|
var session = context.codeEditor.getSession();
|
||||||
|
|
||||||
|
// Use proper tabs
|
||||||
|
session.setUseSoftTabs( false );
|
||||||
|
|
||||||
// Bug 47235: Update text field for LivePreview
|
// Bug 47235: Update text field for LivePreview
|
||||||
if ( mw.hook ) {
|
if ( mw.hook ) {
|
||||||
// New style hook
|
// New style hook
|
||||||
mw.hook( 'LivePreviewPrepare' ).add( context.evt.codeEditorSubmit );
|
mw.hook( 'LivePreviewPrepare' ).add( context.evt.codeEditorSubmit );
|
||||||
|
|
||||||
|
mw.hook( 'codeEditor.configure' ).fire( session );
|
||||||
}
|
}
|
||||||
// Old, deprecated style for backwards compat
|
// Old, deprecated style for backwards compat
|
||||||
// Do this even if mw.hook exists, because the caller wasn't
|
// Do this even if mw.hook exists, because the caller wasn't
|
||||||
|
|
Loading…
Reference in a new issue