Skip to content

Commit

Permalink
Fix block error when transforming blocks with Link Popover opened (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored Jan 12, 2021
1 parent 36b596b commit 195a73e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/rich-text/src/component/use-anchor-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export function useAnchorRef( { ref, value, settings = {} } ) {
const activeFormat = name ? getActiveFormat( value, name ) : undefined;

return useMemo( () => {
const { ownerDocument } = ref.current;
const { defaultView } = ownerDocument;
if ( ! ref.current ) return;
const {
ownerDocument: { defaultView },
} = ref.current;
const selection = defaultView.getSelection();

if ( ! selection.rangeCount ) {
Expand Down

0 comments on commit 195a73e

Please sign in to comment.