MediaWiki:Gadget-acevim.js: Difference between revisions

From Fyra Wiki
Jump to navigation Jump to search
(Add the gadget code)
 
m (Fix a CRITICAL BUG!!! (missing `var` keyword))
 
Line 8: Line 8:
         'https://rawgithub.com/ajaxorg/ace-builds/d37df561f010a90a740300e593f8536d3435393c/src-min-noconflict/keybinding-vim.js',
         'https://rawgithub.com/ajaxorg/ace-builds/d37df561f010a90a740300e593f8536d3435393c/src-min-noconflict/keybinding-vim.js',
         function () {
         function () {
           e = document.querySelector('.ace_editor').env.editor;
           var e = document.querySelector('.ace_editor').env.editor;
           e.setKeyboardHandler(ace.require('ace/keyboard/vim').handler);
           e.setKeyboardHandler(ace.require('ace/keyboard/vim').handler);
         }
         }

Latest revision as of 10:07, 6 June 2023

(function () {
  'use strict';
  mw.hook('codeEditor.configure').add(function (config) {
    // Load vim keybindings for ace
    ace
      .require('ace/lib/net')
      .loadScript(
        'https://rawgithub.com/ajaxorg/ace-builds/d37df561f010a90a740300e593f8536d3435393c/src-min-noconflict/keybinding-vim.js',
        function () {
          var e = document.querySelector('.ace_editor').env.editor;
          e.setKeyboardHandler(ace.require('ace/keyboard/vim').handler);
        }
      );
  });
})();