-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
When enabling this extension in TipTap editor, the document can't be fully selected with the default Mod-a
keyboard shortcut, at least on macOS where cmd+a selects the whole document.
cmd+a only works within a footnote, wher only the text of the footnote is selected.
It looks like these lines set this behavior:
tiptap-footnotes/package/src/footnotes/footnotes.ts
Lines 30 to 56 in 4feeced
addKeyboardShortcuts() { | |
return { | |
// override the default behavior of Mod-a: | |
// rather than selecting the whole text content of the editor, only select the text inside the current footnote | |
"Mod-a": ({ editor }) => { | |
try { | |
const { selection } = editor.state; | |
const { $from } = selection; | |
// footnote listItems are at depth 2, we are getting the start & end position of the parent list item from the current cursor position | |
const start = $from.start(2); | |
const startNode = editor.$pos(start); | |
if (startNode.node.type.name != "footnote") return false; | |
const end = $from.end(2); | |
editor.commands.setTextSelection({ | |
from: start + 1, | |
to: end - 1, | |
}); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}, | |
}; | |
}, |
P.S.: Thanks for this library!