Merge branch 'master' of github.com:makeplane/plane into build/merge_frontend_backend

This commit is contained in:
pablohashescobar 2022-12-01 23:05:37 +05:30
commit 45fe4b89db
55 changed files with 5928 additions and 937 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;
}
};