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

Remove page-freeze error, enhance UI input #120

Merged
merged 1 commit into from
Apr 25, 2023
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
2 changes: 1 addition & 1 deletion manifest/chromium.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Mark My Search",
"description": "Highlight searched keywords. Find matches instantly.",
"version": "1.13.6",
"version": "1.13.7",

"icons": {
"16": "/icons/dist/mms-16.png",
Expand Down
2 changes: 1 addition & 1 deletion manifest/firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Mark My Search",
"description": "Highlight searched keywords. Find matches instantly.",
"version": "1.13.6",
"version": "1.13.7",

"browser_specific_settings": { "gecko": { "id": "[email protected]" } },

Expand Down
13 changes: 7 additions & 6 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ const insertTermInput = (() => {
entries.forEach(entry => entry.contentRect.width === 0 ? hide() : undefined)
)).observe(input);
input.addEventListener("keydown", event => {
event.stopPropagation();
switch (event.key) {
case "Enter": {
if (event.shiftKey) {
Expand Down Expand Up @@ -970,8 +971,8 @@ const refreshTermControl = (term: MatchTerm, idx: number, highlightTags: Highlig
control.classList.add(getSel(ElementClass.TERM, term.selector));
updateTermControlMatchModeClassList(term.matchMode, control.classList);
const controlContent = control.getElementsByClassName(getSel(ElementClass.CONTROL_CONTENT))[0] as HTMLElement;
controlContent.onclick = () => // Overrides previous event handler in case of new term.
focusOnTermJump(controlsInfo, highlightTags, false, term);
controlContent.onclick = event => // Overrides previous event handler in case of new term.
focusOnTermJump(controlsInfo, highlightTags, event.shiftKey, term);
controlContent.textContent = term.phrase;
// TODO make function
Array.from(control.getElementsByClassName(getSel(ElementClass.OPTION))).forEach(option =>
Expand Down Expand Up @@ -2124,6 +2125,7 @@ const generateTermHighlightsUnderNode = (() => {
highlight.textContent = text.substring(start, end);
textEndNode.textContent = text.substring(end);
(textEndNode.parentNode as Node).insertBefore(highlight, textEndNode);
(highlight.parentNode as Node)["markmysearchKnown"] = true;
nodeItems.insertAfter(nodeItemPrevious, highlight.firstChild as Text);
if (textStart !== "") {
const textStartNode = document.createTextNode(textStart);
Expand All @@ -2132,7 +2134,6 @@ const generateTermHighlightsUnderNode = (() => {
return ((nodeItemPrevious ? nodeItemPrevious.next : nodeItems.first) as UnbrokenNodeListItem)
.next as UnbrokenNodeListItem;
}
(highlight.parentNode as Node)["markmysearchKnown"] = true;
return (nodeItemPrevious ? nodeItemPrevious.next : nodeItems.first) as UnbrokenNodeListItem;
};

Expand Down Expand Up @@ -2641,10 +2642,10 @@ const mutationUpdatesGet = (() => {
}
}
}
for (const element of elementsKnown) {
delete element["markmysearchKnown"];
}
if (elementsKnown.size) {
for (const element of elementsKnown) {
delete element["markmysearchKnown"];
}
mutationUpdates.observe();
return;
}
Expand Down