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

[Bug] External inline tools shortcut not working #1132

Closed
sis-dk opened this issue Apr 28, 2020 · 0 comments · Fixed by #1141
Closed

[Bug] External inline tools shortcut not working #1132

sis-dk opened this issue Apr 28, 2020 · 0 comments · Fixed by #1141
Labels

Comments

@sis-dk
Copy link
Contributor

sis-dk commented Apr 28, 2020

Describe a bug.
So I created an inline tool and gave it a getter function 'shortcut' that returns a key combination string.

export default class TextConverter {
    static get isInline() {
        return true;
    }

    get shortcut() {
        return 'CMD+D';
    }

   /** render, surround and checkState function... */
}

But the shortcut is not registered.

src/components/modules/toolbar/inline.ts:578 has this piece of code

if (internalTools.includes(toolName)) {
     shortcut = this.inlineTools[toolName][Tools.INTERNAL_SETTINGS.SHORTCUT];
} else if (toolSettings && toolSettings[Tools.USER_SETTINGS.SHORTCUT]) {
     shortcut = toolSettings[Tools.USER_SETTINGS.SHORTCUT];
}

if (shortcut) {
     this.enableShortcuts(tool, shortcut);
}

toolSettings has my external inline tool in it but not directly under toolSettings
toolSettings looks like this
{ class: { sanitize, ... } }
So the check 'toolSettings && toolSettings[Tools.USER_SETTINGS.SHORTCUT]' would fail.

What am I doing wrong here?

Steps to reproduce:
Just create an external inline-tool and give it a shortcut key

Expected behavior:
Shortcut should be registered

Screenshots:
none

Device, Browser, OS:
Macbook, Chrome(Electron), MacOS

Editor.js version: 2.17.0

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

Successfully merging a pull request may close this issue.

1 participant