Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
fix(FormattingToolbar): correct breaking from block actions
Browse files Browse the repository at this point in the history
Signed-off-by: irmerk <[email protected]>
  • Loading branch information
jolanglinais committed Mar 12, 2020
1 parent 471f509 commit 85b5657
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/FormattingToolbar/LinkComponent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ const calculateLinkPopupPosition = (editor, openSetLink, setLinkFormPopup) => {
// No need to calculate position of the popup is it is not even opened!
// Same for if the current selection is not a link

// Get selection node from slate
const selection = editor.findDOMRange(editor.value.selection);
const earlyExit = {
popupPosition,
// Hide the popup by setting negative zIndex
popupStyle: { zIndex: -1 }
};

const isLinkPopupOpened = openSetLink;
if (!isLinkPopupOpened && !isOnlyLink(editor)) return earlyExit;

if (!selection || (!isLinkPopupOpened && !isOnlyLink(editor))) {
return {
popupPosition,
// Hide the popup by setting negative zIndex
popupStyle: { zIndex: -1 }
};
}
// Get selection node from slate
const selection = editor.findDOMRange(editor.value.selection);
if (!selection) return earlyExit;

popupPosition = 'bottom left';

Expand Down

0 comments on commit 85b5657

Please sign in to comment.