fix the search function/display
This commit is contained in:
@@ -3462,6 +3462,19 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.planet-layout.alpha-text-global-search-only {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.planet-layout.alpha-text-global-search-only > .planet-list-panel,
|
||||
.planet-layout.alpha-text-global-search-only > .planet-detail-panel > .alpha-text-detail-heading,
|
||||
.planet-layout.alpha-text-global-search-only .alpha-text-heading-tools,
|
||||
.planet-layout.alpha-text-global-search-only .alpha-text-controls--heading,
|
||||
.planet-layout.alpha-text-global-search-only .alpha-text-search-controls--detail,
|
||||
.planet-layout.alpha-text-global-search-only .alpha-text-search-inline {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media (max-width: 1040px) {
|
||||
.alpha-text-heading-tools {
|
||||
grid-template-columns: 1fr;
|
||||
@@ -5377,6 +5390,9 @@
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: minmax(220px, 42svh) minmax(0, 1fr);
|
||||
}
|
||||
.planet-layout.alpha-text-global-search-only {
|
||||
grid-template-rows: minmax(0, 1fr);
|
||||
}
|
||||
.planet-layout.layout-sidebar-collapsed,
|
||||
.planet-layout.layout-detail-collapsed,
|
||||
.tarot-layout.layout-sidebar-collapsed,
|
||||
|
||||
@@ -37,8 +37,10 @@
|
||||
let localSearchInputEl;
|
||||
let workSelectEl;
|
||||
let sectionSelectEl;
|
||||
let detailHeadingEl;
|
||||
let detailNameEl;
|
||||
let detailSubEl;
|
||||
let detailHeadingToolsEl;
|
||||
let detailBodyEl;
|
||||
let textLayoutEl;
|
||||
let lexiconPopupEl;
|
||||
@@ -63,13 +65,34 @@
|
||||
localSearchInputEl = document.getElementById("alpha-text-local-search-input");
|
||||
workSelectEl = document.getElementById("alpha-text-work-select");
|
||||
sectionSelectEl = document.getElementById("alpha-text-section-select");
|
||||
detailHeadingEl = document.querySelector("#alphabet-text-section .alpha-text-detail-heading");
|
||||
detailNameEl = document.getElementById("alpha-text-detail-name");
|
||||
detailSubEl = document.getElementById("alpha-text-detail-sub");
|
||||
detailHeadingToolsEl = document.querySelector("#alphabet-text-section .alpha-text-heading-tools");
|
||||
detailBodyEl = document.getElementById("alpha-text-detail-body");
|
||||
textLayoutEl = sourceListEl?.closest?.(".planet-layout") || detailBodyEl?.closest?.(".planet-layout") || null;
|
||||
ensureLexiconPopup();
|
||||
}
|
||||
|
||||
function setGlobalSearchHeadingMode(isGlobalSearchOnly) {
|
||||
if (textLayoutEl instanceof HTMLElement) {
|
||||
textLayoutEl.classList.toggle("alpha-text-global-search-only", Boolean(isGlobalSearchOnly));
|
||||
textLayoutEl.setAttribute("data-global-search-only", isGlobalSearchOnly ? "true" : "false");
|
||||
}
|
||||
|
||||
if (detailHeadingEl instanceof HTMLElement) {
|
||||
detailHeadingEl.hidden = Boolean(isGlobalSearchOnly);
|
||||
detailHeadingEl.setAttribute("aria-hidden", isGlobalSearchOnly ? "true" : "false");
|
||||
}
|
||||
|
||||
if (!(detailHeadingToolsEl instanceof HTMLElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
detailHeadingToolsEl.hidden = Boolean(isGlobalSearchOnly);
|
||||
detailHeadingToolsEl.setAttribute("aria-hidden", isGlobalSearchOnly ? "true" : "false");
|
||||
}
|
||||
|
||||
function showDetailOnlyMode() {
|
||||
if (!(textLayoutEl instanceof HTMLElement)) {
|
||||
return;
|
||||
@@ -1411,7 +1434,7 @@
|
||||
}
|
||||
|
||||
function isGlobalSearchOnlyMode() {
|
||||
return state.activeSearchScope === "global"
|
||||
return (state.activeSearchScope === "global" || state.activeSearchScope === "source")
|
||||
&& Boolean(state.searchQuery)
|
||||
&& !state.highlightedVerseId;
|
||||
}
|
||||
@@ -1421,6 +1444,7 @@
|
||||
const work = getSelectedWork(source);
|
||||
const section = getSelectedSection(source, work);
|
||||
const globalSearchOnlyMode = isGlobalSearchOnlyMode();
|
||||
setGlobalSearchHeadingMode(globalSearchOnlyMode);
|
||||
|
||||
if (!source || !work || !section) {
|
||||
renderPlaceholder("Text Reader", "Select a source to begin", "Choose a text source and section from the left panel.");
|
||||
@@ -1524,6 +1548,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (normalizedScope === "global" || normalizedScope === "source") {
|
||||
showDetailOnlyMode();
|
||||
}
|
||||
|
||||
const requestId = state.searchRequestId + 1;
|
||||
state.searchRequestId = requestId;
|
||||
state.searchLoading = true;
|
||||
|
||||
Reference in New Issue
Block a user