Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support annotation on top of top-layer dialog #93

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/helpers/knowledge/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,20 @@
}
}
]
},
"github.com": {
"rules": [
{
"regexes": [
".*"
],
"knowledge": {
"notes": [
"You can open the account menu by clicking the user's avatar on the top right. You can find and manage current user's profile, repositories, projects, organizations, etc. in the menu.",
"To invite a member to an organization or a team, you need to first click \"Invite member\" or \"Invite someone\". When you see the dialog, type in the input to search by username or email, then click the button appear under the input that says \"[name] invite to [org]\". Please note that this does not actually send the invite: it only adds the user to the selection. You must then click the green \"Invite\" button to send the invitation."
]
}
}
]
}
}
9 changes: 9 additions & 0 deletions src/pages/content/drawLabels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ styleElem.innerHTML = `
z-index: 99999999;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: unset;
border: none;
}
._label_overlay_2 {
position: absolute;
Expand Down Expand Up @@ -294,6 +298,8 @@ function getLabelData(
}
}
elements.forEach((elem) => {
// skip if the element is disabled
if (elem.getAttribute("disabled") != null) return;
// skip specialElements
if (elem.hasAttribute(WEB_WAND_LABEL_ATTRIBUTE_NAME)) return;
// skip if the element is already touched
Expand Down Expand Up @@ -329,10 +335,13 @@ export function addLabelsToDom(data: LabelDataWithElement[]) {
// wrapper element
const wrapper = document.createElement("div");
wrapper.classList.add("_label_overlay_wrapper");
wrapper.popover = "manual";
data.forEach(({ element, label }, index) => {
drawLabel(wrapper, element, label, baseZIndex + data.length - index);
});
document.body.appendChild(wrapper);
// this does not exist on Firefox yet
wrapper.togglePopover && wrapper.togglePopover();
}

export function removeLabels() {
Expand Down
Loading