From 7a9b6a51682d692ef71184b7f75bc53103176aca Mon Sep 17 00:00:00 2001 From: Krenair Date: Sun, 25 Aug 2013 15:43:55 +0100 Subject: [PATCH] Save real tabs and allow configuration by users via JS hook Bug: 39616 Change-Id: I64c3b9b53f1265f5b9c19edb480040113fa85590 --- hooks.txt | 4 ++++ modules/jquery.codeEditor.js | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 hooks.txt diff --git a/hooks.txt b/hooks.txt new file mode 100644 index 00000000..531d9ebc --- /dev/null +++ b/hooks.txt @@ -0,0 +1,4 @@ +== JS hooks == +'codeEditor.configure' is fired during the set up of the ACE editor +Params: +* {object} session ACE editor session diff --git a/modules/jquery.codeEditor.js b/modules/jquery.codeEditor.js index fccc8504..2c320d92 100644 --- a/modules/jquery.codeEditor.js +++ b/modules/jquery.codeEditor.js @@ -165,10 +165,15 @@ context.fn = $.extend( context.fn, { box.closest('form').submit( context.evt.codeEditorSubmit ); var session = context.codeEditor.getSession(); + // Use proper tabs + session.setUseSoftTabs( false ); + // Bug 47235: Update text field for LivePreview if ( mw.hook ) { // New style hook mw.hook( 'LivePreviewPrepare' ).add( context.evt.codeEditorSubmit ); + + mw.hook( 'codeEditor.configure' ).fire( session ); } // Old, deprecated style for backwards compat // Do this even if mw.hook exists, because the caller wasn't