Skip to content

Commit

Permalink
Merge 39d175f into 3450f2d
Browse files Browse the repository at this point in the history
  • Loading branch information
alihamuh committed Aug 10, 2023
2 parents 3450f2d + 39d175f commit 46aeccd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/editor/src/extensions/link/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,27 @@ export const Link = TiptapLink.extend({
})
})
];
},
addKeyboardShortcuts() {
return {
Space: ({ editor }) => {
const { from, to } = editor.state.selection;
let found;

editor.state.doc.nodesBetween(from, to + 1, (node) => {
found = node.marks.find(
(mark) => mark.type === editor.state.schema.marks.link
);
});

if (!found) {
const { tr } = editor.state;
tr.removeStoredMark(editor.schema.marks.link);
editor.view.dispatch(tr);
}

return false;
}
};
}
});

0 comments on commit 46aeccd

Please sign in to comment.