Skip to content

Commit

Permalink
Merge pull request #120 from ator-dev/highlighting-feedbackloop-fix
Browse files Browse the repository at this point in the history
Remove page-freeze error, enhance UI input
  • Loading branch information
ator-dev authored Apr 25, 2023
2 parents b36fd1a + c222bfb commit 2eb41eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
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

0 comments on commit 2eb41eb

Please sign in to comment.