Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bind metaKey + enter on macOS #1365

Closed
montlebalm opened this issue Mar 14, 2017 · 1 comment
Closed

Unable to bind metaKey + enter on macOS #1365

montlebalm opened this issue Mar 14, 2017 · 1 comment

Comments

@montlebalm
Copy link

It looks like you're unable to bind metaKey + enter in the Quill keyboard module. It appears that you can bind shortKey + enter. It would be helpful to have the former when targeting macOS specifically.

Steps for Reproduction

  1. On macOS, visit https://quilljs.com/playground/
  2. Use the following configuration:
var quill = new Quill('#editor-container', {
  modules: {
    keyboard: {
      bindings: [{
        key: 13, // enter
        metaKey: true,
        handler: function() {
          console.log('meta enter');
        },
      }, {
        key: 13, // enter
        shortKey: true,
        handler: function() {
          console.log('short enter');
        },
      }]
    }
  },
});
  1. Hit cmd + enter

Expected behavior:

You should see "meta enter" in the console.

Actual behavior:

You see "short enter" in the console.

Platforms:

macOS: Safari, Chrome 56

Version:

Version 1.2.2.

@SahilPatel2349
Copy link

keyboard: {
bindings: {
tab: false,
// list: {
// key: "backspace",
// context: { format: ["list"] },
// handler(range, context) {
// backspaceHandler(range, context);
// },
// },
enter:
portal?.parentSection === "credit"
? {
key: 13,
handler: () => {},
}
: null,
shiftEnter:
portal?.parentSection === "credit"
? {
key: 13,
shiftKey: true,
handler: () => {},
}
: null,
controlB: {
key: 66,
handler: () => {
console.log("Hello from Control B");
},
},
commandB: {
key: 66,
metaKey: true,
handler: (event) => {
console.log("hello");
// Check if it's Mac and Command key is pressed
if (event.code === "KeyB" && event.metaKey) {
console.log("Command + B key pressed");
}
},
},
},
},

  control + B is working for me, But command + B is not working on mac. 
  
  What am I doing wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants