-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
Search first
- I searched and no similar issues were found
What Happened?
When using logseq.App.registerCommandShortcut
to register command shortcuts in plugins, if the mode is set to editing
, then the shortcut is not actually registered.
Reproduce the Bug
- Create a simple plugin
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Logseq selection bug</title>
</head>
<body>
<div id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/@logseq/libs"></script>
<script src="./index.js"></script>
</body>
</html>
function main () {
logseq.App.registerCommandShortcut(
{ binding: 'mod+shift+7' },
() => logseq.UI.showMsg('123'),
)
logseq.App.registerCommandShortcut(
{ binding: 'mod+shift+8', mode: 'editing' },
() => logseq.UI.showMsg('456'),
)
logseq.App.registerCommandShortcut(
{ binding: 'mod+shift+9', mode: 'non-editing' },
() => logseq.UI.showMsg('789'),
)
}
// bootstrap
logseq.ready(main).catch(console.error)
{
"name": "logseq-cmd-bug",
"version": "1.0.0",
"description": "",
"main": "index.html",
"logseq": {
"id": "logseq-cmd-bug"
},
"license": "MIT"
}
- Open Logseq, when editing a block, press
ctrl+shift+8
- Go to settings, find plugin section in keymap
Expected Behavior
456
message is displayedmod+shift+8
keymap is present
Screenshots
- no message shown
mod+shift+8
keymap is absent
Desktop or Mobile Platform Information
Linux, Desktop App v0.9.19
Additional Context
global
and non-editing
mode works fine. Only editing
mode fails.
Are you willing to submit a PR? If you know how to fix the bug.
- I'm willing to submit a PR (Thank you!)