@plait/core 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1510,10 +1510,11 @@ function withSelection(board) {
1510
1510
  }
1511
1511
  if (PlaitBoard.isFocus(board)) {
1512
1512
  const isInBoard = event.target instanceof Node && PlaitBoard.getBoardNativeElement(board).contains(event.target);
1513
- const isAttachedElement = event.target instanceof HTMLElement && event.target.closest(`.${ATTACHED_ELEMENT_CLASS_NAME}`);
1513
+ const isInDocument = event.target instanceof Node && document.contains(event.target);
1514
+ const isAttachedElement = event.target instanceof Element && event.target.closest(`.${ATTACHED_ELEMENT_CLASS_NAME}`);
1514
1515
  // Clear selection when mouse board outside area
1515
1516
  // The framework needs to determine whether the board is focused through selection
1516
- if (!isInBoard && !start && !isAttachedElement) {
1517
+ if (!isInBoard && !start && !isAttachedElement && isInDocument) {
1517
1518
  Transforms.setSelection(board, null);
1518
1519
  }
1519
1520
  }