TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/316572

Change subject: Enable conditional loading of ACE language modes
......................................................................

Enable conditional loading of ACE language modes

require bypasses Ace's internal loadModule() logic which is capable of
on demand loading of Ace modules. Because unloaded modules are not
defined, they cannot be required, and because we don't use RL to preload
all modes (because it's a lot of bytes), currently only very few of the
available language modes were currently available.

Bug: T148518
Change-Id: I82d278920695be12aa80a79548abf8b8ce5445fd
---
M modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/72/316572/1

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
index 187c9d2..e349efa 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWAceEditorWidget.js
@@ -70,8 +70,8 @@
  */
 ve.ui.MWAceEditorWidget.prototype.setup = function () {
        if ( !this.loadingPromise ) {
-               this.loadingPromise = mw.loader.getState( 
'ext.codeEditor.ace.modes' ) ?
-                       mw.loader.using( 'ext.codeEditor.ace.modes' ) :
+               this.loadingPromise = mw.loader.getState( 'ext.codeEditor.ace' 
) ?
+                       mw.loader.using( 'ext.codeEditor.ace' ) :
                        $.Deferred().reject().promise();
                // Resolved promises will run synchronously, so ensure 
#setupEditor
                // runs after this.loadingPromise is stored.
@@ -327,9 +327,7 @@
 ve.ui.MWAceEditorWidget.prototype.setLanguage = function ( lang ) {
        var widget = this;
        this.loadingPromise.done( function () {
-               // TODO: Just use ace.require once T127643 is resolved
-               var require = ace.require || require;
-               widget.editor.getSession().setMode( 'ace/mode/' + ( require( 
'ace/mode/' + lang ) ? lang : 'text' ) );
+               widget.editor.getSession().setMode( 'ace/mode/' + lang );
        } );
        return this;
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/316572
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82d278920695be12aa80a79548abf8b8ce5445fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: TheDJ <hartman.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to