feat: bulk issue deletion, colours to labels

This commit is contained in:
Aaryan Khandelwal 2022-11-30 21:28:45 +05:30
parent 71cd84e65c
commit 2b7282c6e8
31 changed files with 726 additions and 581 deletions

View file

@ -0,0 +1,17 @@
import { $isAtNodeEnd } from "@lexical/selection";
export const getSelectedNode = (selection: any) => {
const anchor = selection.anchor;
const focus = selection.focus;
const anchorNode = selection.anchor.getNode();
const focusNode = selection.focus.getNode();
if (anchorNode === focusNode) {
return anchorNode;
}
const isBackward = selection.isBackward();
if (isBackward) {
return $isAtNodeEnd(focus) ? anchorNode : focusNode;
} else {
return $isAtNodeEnd(anchor) ? focusNode : anchorNode;
}
};