Skip to content

Commit

Permalink
Merge pull request #3775 from 3scale/remove_mousetrap_dependency
Browse files Browse the repository at this point in the history
⚰️ Remove `Mousetrap`
  • Loading branch information
josemigallas authored May 8, 2024
2 parents 810e96e + 8f49dcf commit 86bb6fe
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 35 deletions.
18 changes: 0 additions & 18 deletions app/assets/javascripts/provider/admin/cms/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,6 @@
toggledInputsInit();
});

// keyboard actions
//
(function(){
var save = function(){
$("#cms_template_submit").click();
};
// this makes mousetrap work inside codemirror
// just have to load it in right time (after textarea is created)
//
// $(".CodeMirror textarea").addClass("mousetrap");

Mousetrap.bind(['meta+s', 'ctrl+s', 'command+s'], function(e){
save();
return false;
});

}());

// init change detection
$(window).on('beforeunload', function(e){
var textareas = $(".codemirror textarea[name]"),
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/provider/cms.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//= require vendor/mousetrap.min.js
//= require vendor/jquery.tipsy.js
//= require vendor/jquery/extensions/jquery.cookie.js
//= require jquery.pjax.js
Expand Down
8 changes: 0 additions & 8 deletions app/assets/javascripts/vendor/mousetrap.min.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/inputs/codemirror_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def to_html
end

def input_html_options
super.merge(options.slice(:value)).merge({ class: 'mousetrap' })
super.merge(options.slice(:value))
end
end
7 changes: 0 additions & 7 deletions app/javascript/src/Types/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ declare global {

type WithRequiredProp<T, Key extends keyof T> = Required<Pick<T, Key>> & T

// Defined in app/assets/javascripts/vendor/mousetrap.min.js
// imported in app/assets/javascripts/provider/cms.js
// used in app/javascript/packs/cms.ts
namespace Mousetrap {
function bind (arr: unknown[], fun: (event: unknown) => false): void
}

namespace ThreeScale {
// Made globally available in assets/javascripts/provider/cms/sidebar.js.coffee and available
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
Expand Down

0 comments on commit 86bb6fe

Please sign in to comment.