Skip to content

Commit 2e26ead

Browse files
fix: Link keyboard shortcut and remove warning (#782)
* Added link keyboard shortcut and removed warning * Re-added warning conditionally
1 parent 9f51dfb commit 2e26ead

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

packages/core/src/editor/BlockNoteEditor.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,11 @@ export class BlockNoteEditor<
778778
for (const mark of marks) {
779779
const config = this.schema.styleSchema[mark.type.name];
780780
if (!config) {
781-
// eslint-disable-next-line no-console
782-
console.warn("mark not found in styleschema", mark.type.name);
781+
if (mark.type.name !== "link") {
782+
// eslint-disable-next-line no-console
783+
console.warn("mark not found in styleschema", mark.type.name);
784+
}
785+
783786
continue;
784787
}
785788
if (config.propSchema === "boolean") {

packages/core/src/editor/BlockNoteExtensions.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ export const getBlockNoteExtensions = <
7575
Text,
7676

7777
// marks:
78-
Link,
78+
Link.extend({
79+
addKeyboardShortcuts() {
80+
return {
81+
"Mod-k": () => {
82+
this.editor.commands.toggleLink({ href: "" });
83+
return true;
84+
},
85+
};
86+
},
87+
}),
7988
...Object.values(opts.styleSpecs).map((styleSpec) => {
8089
return styleSpec.implementation.mark;
8190
}),

0 commit comments

Comments
 (0)