MediaWiki:Gadget-acevim.js

From Fyra Wiki
Revision as of 10:07, 6 June 2023 by Alyxia (talk | contribs) (Fix a CRITICAL BUG!!! (missing `var` keyword))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
(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);
        }
      );
  });
})();