Skip to content

Commit

Permalink
🐛 focus av
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 5, 2023
1 parent 1bb95fd commit 0580a0c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/src/protyle/util/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export const focusByOffset = (container: Element, start: number, end: number) =>
const editElement = getContenteditableElement(container);
if (editElement) {
container = editElement;
} else if (isNotEditBlock(container)) {
} else if (isNotEditBlock(container) || container.classList.contains("av")) {
return focusBlock(container);
}
let startNode;
Expand Down Expand Up @@ -533,6 +533,17 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
focusSideBlock(element);
return false;
}
} else if (element.classList.contains("av")) {
const avTitleElement = element.querySelector(".av__title")
if (avTitleElement) {
const range = document.createRange();
range.selectNodeContents(avTitleElement);
range.collapse();
focusByRange(range);
return range;
} else {
return false;
}
}
let cursorElement;
if (toStart) {
Expand Down

0 comments on commit 0580a0c

Please sign in to comment.