mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 07:45:51 +01:00
feat(client/rtl): handle left
This commit is contained in:
@@ -15,12 +15,12 @@ const TPL = /*html*/`
|
||||
padding: 10px 10px 10px 0px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
|
||||
.quick-search button, .quick-search input {
|
||||
border: 0;
|
||||
font-size: 100% !important;
|
||||
}
|
||||
|
||||
|
||||
.quick-search .dropdown-menu {
|
||||
--quick-search-item-delimiter-color: var(--dropdown-border-color);
|
||||
|
||||
@@ -32,40 +32,40 @@ const TPL = /*html*/`
|
||||
text-overflow: ellipsis;
|
||||
box-shadow: -30px 50px 93px -50px black;
|
||||
}
|
||||
|
||||
|
||||
.quick-search .dropdown-item {
|
||||
white-space: normal;
|
||||
padding: 12px 16px;
|
||||
line-height: 1.4;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.quick-search .dropdown-item + .dropdown-item::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
inset-inline-start: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
border-bottom: 1px solid var(--quick-search-item-delimiter-color);
|
||||
}
|
||||
|
||||
|
||||
.quick-search .dropdown-item:last-child::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.quick-search .dropdown-item.disabled::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.quick-search .dropdown-item.show-in-full-search::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.quick-search-item.dropdown-item:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
|
||||
.quick-search .quick-search-item {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
private dropdown!: bootstrap.Dropdown;
|
||||
private $searchString!: JQuery<HTMLElement>;
|
||||
private $dropdownMenu!: JQuery<HTMLElement>;
|
||||
|
||||
|
||||
// State for infinite scrolling
|
||||
private allSearchResults: Array<any> = [];
|
||||
private allSearchResultNoteIds: string[] = [];
|
||||
@@ -172,7 +172,7 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
});
|
||||
|
||||
this.$widget.find(".input-group-prepend").on("shown.bs.dropdown", () => this.search());
|
||||
|
||||
|
||||
// Add scroll event listener for infinite scrolling
|
||||
this.$dropdownMenu.on("scroll", () => {
|
||||
this.handleScroll();
|
||||
@@ -187,7 +187,7 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
if (originalEvent && isIMEComposing(originalEvent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (e.which === 13) {
|
||||
if (this.$dropdownMenu.is(":visible")) {
|
||||
this.search(); // just update already visible dropdown
|
||||
@@ -293,40 +293,40 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
if (!noteId) continue;
|
||||
|
||||
const $item = $('<a class="dropdown-item" tabindex="0" href="javascript:">');
|
||||
|
||||
|
||||
// Build the display HTML with content snippet below the title
|
||||
let itemHtml = `<div class="quick-search-item">
|
||||
<div class="quick-search-item-header">
|
||||
<span class="quick-search-item-icon ${result.icon}"></span>
|
||||
<span class="search-result-title">${result.highlightedNotePathTitle}</span>
|
||||
</div>`;
|
||||
|
||||
|
||||
// Add attribute snippet (tags/attributes) below the title if available
|
||||
if (result.highlightedAttributeSnippet) {
|
||||
// Replace <br> with a blank space to join the atributes on the same single line
|
||||
const snippet = (result.highlightedAttributeSnippet as string).replace(/<br\s?\/?>/g, " ");
|
||||
itemHtml += `<div class="search-result-attributes">${snippet}</div>`;
|
||||
}
|
||||
|
||||
|
||||
// Add content snippet below the attributes if available
|
||||
if (result.highlightedContentSnippet) {
|
||||
itemHtml += `<div class="search-result-content">${result.highlightedContentSnippet}</div>`;
|
||||
}
|
||||
|
||||
|
||||
itemHtml += `</div>`;
|
||||
|
||||
|
||||
$item.html(itemHtml);
|
||||
|
||||
|
||||
$item.on("click", (e) => {
|
||||
this.dropdown.hide();
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
const activeContext = appContext.tabManager.getActiveContext();
|
||||
if (activeContext) {
|
||||
activeContext.setNote(noteId);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
shortcutService.bindElShortcut($item, "return", () => {
|
||||
this.dropdown.hide();
|
||||
|
||||
@@ -390,7 +390,7 @@ export default class QuickSearchWidget extends BasicWidget {
|
||||
// Trigger loading more when user scrolls near the bottom (within 50px)
|
||||
if (scrollTop + clientHeight >= scrollHeight - 50) {
|
||||
const totalResults = this.allSearchResults.length > 0 ? this.allSearchResults.length : this.allSearchResultNoteIds.length;
|
||||
|
||||
|
||||
if (this.currentDisplayedCount < totalResults) {
|
||||
this.displayMoreResults(LOAD_MORE_BATCH_SIZE).then(() => {
|
||||
this.addShowInFullSearchButton();
|
||||
|
||||
Reference in New Issue
Block a user