mirror of
https://github.com/zen-browser/desktop.git
synced 2026-07-29 03:17:48 +00:00
fix: Fixed urlbar results not being able to be heuristic, b=no-bug, c=folders, tabs
This commit is contained in:
@@ -1157,6 +1157,9 @@
|
||||
Services.prefs.getIntPref('zen.view.drag-and-drop.drop-inside-lower-threshold') / 100;
|
||||
|
||||
const dropElementGroup = dropElement.group;
|
||||
if (!dropElementGroup) {
|
||||
return { dropElement, colorCode, dropBefore };
|
||||
}
|
||||
const isSplitGroup = dropElement?.group?.hasAttribute('split-view-group');
|
||||
let firstGroupElem =
|
||||
dropElementGroup.querySelector('.zen-tab-group-start').nextElementSibling;
|
||||
|
||||
@@ -447,7 +447,7 @@
|
||||
case 'TabGroupCollapse':
|
||||
case 'TabGroupExpand':
|
||||
case 'ZenFolderChangedWorkspace':
|
||||
this.#updateGroupInfo(event.originalTarget);
|
||||
this.#updateGroupInfo(event.originalTarget, action);
|
||||
break;
|
||||
case 'TabGrouped':
|
||||
this.#onTabGrouped(event);
|
||||
@@ -523,7 +523,7 @@
|
||||
ZenPinnedTabsStorage.removeTabFromGroup(tabPinId, /* position */ tab._pPos);
|
||||
}
|
||||
|
||||
async #updateGroupInfo(group) {
|
||||
async #updateGroupInfo(group, action) {
|
||||
if (!group?.isZenFolder) {
|
||||
return;
|
||||
}
|
||||
@@ -537,12 +537,20 @@
|
||||
groupPin.parentUuid = group.group?.getAttribute('zen-pin-id') || null;
|
||||
groupPin.workspaceUuid = group.getAttribute('zen-workspace-id') || null;
|
||||
await this.savePin(groupPin);
|
||||
for (const item of group.allItems) {
|
||||
if (gBrowser.isTabGroup(item)) {
|
||||
await this.#updateGroupInfo(item);
|
||||
} else {
|
||||
await this.#onTabMove(item);
|
||||
}
|
||||
switch (action) {
|
||||
case 'ZenFolderRenamed':
|
||||
case 'ZenFolderIconChanged':
|
||||
case 'TabGroupCollapse':
|
||||
case 'TabGroupExpand':
|
||||
break;
|
||||
default:
|
||||
for (const item of group.allItems) {
|
||||
if (gBrowser.isTabGroup(item)) {
|
||||
await this.#updateGroupInfo(item, action);
|
||||
} else {
|
||||
await this.#onTabMove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,17 +262,18 @@ export class ZenUrlbarProviderGlobalActions extends UrlbarProvider {
|
||||
...action.extraPayload,
|
||||
});
|
||||
|
||||
const shouldBePrioritized =
|
||||
zenUrlbarResultsLearner.shouldPrioritize(action.commandId) && !isPrefixed;
|
||||
let result = new lazy.UrlbarResult({
|
||||
type: UrlbarUtils.RESULT_TYPE.DYNAMIC,
|
||||
source: UrlbarUtils.RESULT_SOURCE.ZEN_ACTIONS,
|
||||
payload,
|
||||
payloadHighlights,
|
||||
heuristic: shouldBePrioritized,
|
||||
suggestedIndex: !shouldBePrioritized
|
||||
? zenUrlbarResultsLearner.getDeprioritizeIndex(action.commandId)
|
||||
: undefined,
|
||||
});
|
||||
if (zenUrlbarResultsLearner.shouldPrioritize(action.commandId) && !isPrefixed) {
|
||||
result.heuristic = true;
|
||||
} else {
|
||||
result.suggestedIndex = zenUrlbarResultsLearner.getDeprioritizeIndex(action.commandId);
|
||||
}
|
||||
result.commandId = action.commandId;
|
||||
if (!(isPrefixed && query.length < 2)) {
|
||||
// We dont want to record prefixed results, as the user explicitly asked for them.
|
||||
|
||||
Reference in New Issue
Block a user