Skip to content

Commit

Permalink
Fix floating link escape handling (#1981)
Browse files Browse the repository at this point in the history
* Fix floating link escape handling

* Create loud-emus-return.md

Co-authored-by: Ziad Beyens <[email protected]>
  • Loading branch information
O4epegb and zbeyens authored Nov 11, 2022
1 parent 96d5a2c commit 9948858
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-emus-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/plate-link": patch
---

Fix floating link escape handling
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ export const useFloatingLinkEscape = () => {

useHotkeys(
'escape',
() => {
if (floatingLinkSelectors.mode() !== 'edit') return;
(e) => {
if (!floatingLinkSelectors.mode()) return;

if (floatingLinkSelectors.isEditing()) {
e.preventDefault();

if (
floatingLinkSelectors.mode() === 'edit' &&
floatingLinkSelectors.isEditing()
) {
floatingLinkActions.show('edit', editor.id);
focusEditor(editor, editor.selection!);
return;
}

if (floatingLinkSelectors.mode() === 'insert') {
focusEditor(editor, editor.selection!);
}

floatingLinkActions.hide();
},
{
Expand Down

2 comments on commit 9948858

@vercel
Copy link

@vercel vercel bot commented on 9948858 Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plate-examples – ./

plate-examples-udecode.vercel.app
plate-examples-git-main-udecode.vercel.app
plate-examples.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 9948858 Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plate – ./

plate-udecode.vercel.app
plate-git-main-udecode.vercel.app
www.plate.udecode.io
plate.udecode.io

Please sign in to comment.