mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
🐛 Several bugfixes (#7062)
* 🐛 Fix incorrect status validation on subscription internal api * 🐛 Make the shortcuts overwritting optional
This commit is contained in:
parent
ded8e39e73
commit
85f6cf32ae
4 changed files with 21 additions and 18 deletions
|
@ -186,7 +186,7 @@
|
||||||
"canceled"
|
"canceled"
|
||||||
"incomplete"
|
"incomplete"
|
||||||
"incomplete_expired"
|
"incomplete_expired"
|
||||||
"pass_due"
|
"past_due"
|
||||||
"paused"
|
"paused"
|
||||||
"trialing"
|
"trialing"
|
||||||
"unpaid"]]
|
"unpaid"]]
|
||||||
|
|
|
@ -148,17 +148,17 @@
|
||||||
|
|
||||||
(defn- bind!
|
(defn- bind!
|
||||||
[shortcuts]
|
[shortcuts]
|
||||||
(let [msbind (fn [command callback type]
|
|
||||||
(if type
|
|
||||||
(mousetrap/bind command callback type)
|
|
||||||
(mousetrap/bind command callback)))]
|
|
||||||
(->> shortcuts
|
(->> shortcuts
|
||||||
(remove #(:disabled (second %)))
|
(remove #(:disabled (second %)))
|
||||||
(run! (fn [[key {:keys [command fn type]}]]
|
(run! (fn [[key {:keys [command fn type overwrite]}]]
|
||||||
(let [callback (wrap-cb key fn)]
|
(let [callback (wrap-cb key fn)
|
||||||
(if (vector? command)
|
undefined (js* "(void 0)")
|
||||||
(run! #(msbind % callback type) command)
|
commands (if (vector? command)
|
||||||
(msbind command callback type))))))))
|
(into-array command)
|
||||||
|
#js [command])]
|
||||||
|
(if type
|
||||||
|
(mousetrap/bind commands callback type overwrite)
|
||||||
|
(mousetrap/bind commands callback undefined overwrite)))))))
|
||||||
|
|
||||||
(defn- reset!
|
(defn- reset!
|
||||||
([]
|
([]
|
||||||
|
|
|
@ -24,5 +24,6 @@
|
||||||
{:delete-stop {:tooltip (ds/supr)
|
{:delete-stop {:tooltip (ds/supr)
|
||||||
:command ["del" "backspace"]
|
:command ["del" "backspace"]
|
||||||
:subsections [:edit]
|
:subsections [:edit]
|
||||||
|
:overwrite true
|
||||||
:fn #(st/emit! (dwc/remove-gradient-stop))}}))
|
:fn #(st/emit! (dwc/remove-gradient-stop))}}))
|
||||||
|
|
||||||
|
|
16
frontend/vendor/mousetrap/index.js
vendored
16
frontend/vendor/mousetrap/index.js
vendored
|
@ -821,7 +821,7 @@ function Mousetrap(targetElement) {
|
||||||
* @param {number=} level - what part of the sequence the command is
|
* @param {number=} level - what part of the sequence the command is
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
function _bindSingle(combination, callback, action, sequenceName, level) {
|
function _bindSingle(combination, callback, action, sequenceName, level, overwrite) {
|
||||||
|
|
||||||
// store a direct mapped reference for use with Mousetrap.trigger
|
// store a direct mapped reference for use with Mousetrap.trigger
|
||||||
self._directMap[combination + ':' + action] = callback;
|
self._directMap[combination + ':' + action] = callback;
|
||||||
|
@ -845,8 +845,10 @@ function Mousetrap(targetElement) {
|
||||||
// a callback is added for this key
|
// a callback is added for this key
|
||||||
self._callbacks[info.key] = self._callbacks[info.key] || [];
|
self._callbacks[info.key] = self._callbacks[info.key] || [];
|
||||||
|
|
||||||
// // remove an existing match if there is one
|
// remove an existing match if there is one
|
||||||
// _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
|
if (overwrite) {
|
||||||
|
_getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
|
||||||
|
}
|
||||||
|
|
||||||
// add this call back to the array
|
// add this call back to the array
|
||||||
// if it is a sequence put it at the beginning
|
// if it is a sequence put it at the beginning
|
||||||
|
@ -872,9 +874,9 @@ function Mousetrap(targetElement) {
|
||||||
* @param {string|undefined} action
|
* @param {string|undefined} action
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
self._bindMultiple = function(combinations, callback, action) {
|
self._bindMultiple = function(combinations, callback, action, overwrite) {
|
||||||
for (var i = 0; i < combinations.length; ++i) {
|
for (var i = 0; i < combinations.length; ++i) {
|
||||||
_bindSingle(combinations[i], callback, action);
|
_bindSingle(combinations[i], callback, action, undefined, undefined, overwrite);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -899,10 +901,10 @@ function Mousetrap(targetElement) {
|
||||||
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
|
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
|
||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
Mousetrap.prototype.bind = function(keys, callback, action) {
|
Mousetrap.prototype.bind = function(keys, callback, action, overwrite) {
|
||||||
var self = this;
|
var self = this;
|
||||||
keys = keys instanceof Array ? keys : [keys];
|
keys = keys instanceof Array ? keys : [keys];
|
||||||
self._bindMultiple.call(self, keys, callback, action);
|
self._bindMultiple.call(self, keys, callback, action, overwrite);
|
||||||
return self;
|
return self;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue