REFACTOR: Move Mousetrap library to an import

REFACTOR: Move Mousetrap library to an import

diff --git a/app/assets/javascripts/discourse-shims.js b/app/assets/javascripts/discourse-shims.js
index df7de11..8e66422 100644
--- a/app/assets/javascripts/discourse-shims.js
+++ b/app/assets/javascripts/discourse-shims.js
@@ -25,6 +25,10 @@ define("bootbox", ["exports"], function(__exports__) {
   __exports__.default = window.bootbox;
 });
 
+define("mousetrap", ["exports"], function(__exports__) {
+  __exports__.default = window.Mousetrap;
+});
+
 define("@popperjs/core", ["exports"], function(__exports__) {
   __exports__.default = window.Popper;
   __exports__.createPopper = window.Popper.createPopper;
diff --git a/app/assets/javascripts/discourse/app/app.js b/app/assets/javascripts/discourse/app/app.js
index 458f63a..80d288f 100644
--- a/app/assets/javascripts/discourse/app/app.js
+++ b/app/assets/javascripts/discourse/app/app.js
@@ -1,6 +1,6 @@
-/*global Mousetrap:true*/
 import Application from "@ember/application";
 import { buildResolver } from "discourse-common/resolver";
+import Mousetrap from "mousetrap";
 
 const _pluginCallbacks = [];
 
diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js
index 735d4fe..e2cf874 100644
--- a/app/assets/javascripts/discourse/app/components/d-editor.js
+++ b/app/assets/javascripts/discourse/app/components/d-editor.js
@@ -2,7 +2,8 @@ import I18n from "I18n";
 import { debounce, later, next, schedule, scheduleOnce } from "@ember/runloop";
 import { inject as service } from "@ember/service";
 import Component from "@ember/component";
-/*global Mousetrap:true */
+import Mousetrap from "mousetrap";
+
 import discourseComputed, {
   on,
   observes
diff --git a/app/assets/javascripts/discourse/app/initializers/keyboard-shortcuts.js b/app/assets/javascripts/discourse/app/initializers/keyboard-shortcuts.js
index 9086019..7612ed6 100644
--- a/app/assets/javascripts/discourse/app/initializers/keyboard-shortcuts.js
+++ b/app/assets/javascripts/discourse/app/initializers/keyboard-shortcuts.js
@@ -1,5 +1,5 @@
-/*global Mousetrap:true*/
 import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
+import Mousetrap from "mousetrap";
 
 export default {
   name: "keyboard-shortcuts",

GitHub sha: 96edb7da

1 Like