fixed bindings.find() bug

pull/510/head
WittBulter 7 years ago
parent 82ec7e6249
commit 23beca55d1

File diff suppressed because one or more lines are too long

@ -16761,7 +16761,10 @@ var createSep = function createSep() {
var createTootlip = function createTootlip(title, action, shortcuts) {
if (!action) return title;
if (!shortcuts[_metadata.bindings.find(action)]) return title;
var actionName = _metadata.bindings.find(function (bindingName) {
return bindingName === action;
});
if (!shortcuts[actionName]) return title;
return title + ' ( ' + _utils2.default.fixShortcut(shortcuts[actionName]) + ' )';
};
@ -16907,10 +16910,12 @@ var SimpleMDE = function (_Action) {
var _loop = function _loop(key) {
// null stands for "do not bind this command"
var isExistent = _metadata.bindings.find(key);
var isExistent = _metadata.bindings.find(function (bindingName) {
return bindingName === key;
});
if (options.shortcuts[key] !== null && isExistent) {
keyMaps[_utils2.default.fixShortcut(options.shortcuts[key])] = function () {
return _get(SimpleMDE.prototype.__proto__ || Object.getPrototypeOf(SimpleMDE.prototype), key, _this2).call(_this2, self);
return _get(SimpleMDE.prototype.__proto__ || Object.getPrototypeOf(SimpleMDE.prototype), key, _this2).call(_this2, _this2);
};
}
};

File diff suppressed because one or more lines are too long

@ -53,7 +53,8 @@ const createSep = () => {
const createTootlip = (title, action, shortcuts) => {
if(!action) return title
if(!shortcuts[bindings.find(action)]) return title
const actionName = bindings.find(bindingName => bindingName === action)
if(!shortcuts[actionName]) return title
return `${title} ( ${utils.fixShortcut(shortcuts[actionName])} )`
}
@ -175,9 +176,9 @@ class SimpleMDE extends Action {
for(const key in options.shortcuts) {
// null stands for "do not bind this command"
const isExistent = bindings.find(key)
const isExistent = bindings.find(bindingName => bindingName === key)
if(options.shortcuts[key] !== null && isExistent) {
keyMaps[utils.fixShortcut(options.shortcuts[key])] = () => super[key](self);
keyMaps[utils.fixShortcut(options.shortcuts[key])] = () => super[key](this);
}
}

Loading…
Cancel
Save