mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 14:14:55 +00:00
enhance: show close button when search box opened
This commit is contained in:
1
deps/publish/src/logseq/publish/publish.css
vendored
1
deps/publish/src/logseq/publish/publish.css
vendored
@@ -175,6 +175,7 @@ a:hover {
|
||||
|
||||
.publish-search-toggle .ti {
|
||||
font-size: 16px;
|
||||
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.publish-search-input {
|
||||
|
||||
5
deps/publish/src/logseq/publish/publish.js
vendored
5
deps/publish/src/logseq/publish/publish.js
vendored
@@ -413,6 +413,7 @@ const initSearch = () => {
|
||||
const graphUuid = container.dataset.graphUuid;
|
||||
const input = container.querySelector(".publish-search-input");
|
||||
const toggleBtn = container.querySelector(".publish-search-toggle");
|
||||
const toggleIcon = container.querySelector(".publish-search-toggle .ti");
|
||||
const resultsEl = container.querySelector(".publish-search-results");
|
||||
if (!input || !resultsEl || !toggleBtn) return;
|
||||
|
||||
@@ -560,6 +561,10 @@ const initSearch = () => {
|
||||
const setExpanded = (expanded) => {
|
||||
container.classList.toggle("is-expanded", expanded);
|
||||
toggleBtn.setAttribute("aria-expanded", String(expanded));
|
||||
if (toggleIcon) {
|
||||
toggleIcon.classList.toggle("ti-search", !expanded);
|
||||
toggleIcon.classList.toggle("ti-x", expanded);
|
||||
}
|
||||
if (expanded) {
|
||||
input.focus();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user