mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Notes: added stroked zero button
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary btn-light category-btn active" data-category="__all__">
|
||||
<?= __("All Categories"); ?> <span class="badge bg-secondary"><?= $all_notes_count ?></span>
|
||||
</button>
|
||||
<?php
|
||||
<?php
|
||||
// Decode HTML entities for proper display
|
||||
$decoded_categories = array();
|
||||
foreach ($categories as $key => $value) {
|
||||
@@ -51,6 +51,9 @@
|
||||
<!-- Search box and reset button -->
|
||||
<div class="input-group">
|
||||
<input type="text" id="notesSearchBox" class="form-control form-control-sm" maxlength="50" placeholder="<?= __("Search notes (min. 3 chars)") ?>">
|
||||
<button class="btn btn-outline-secondary btn-sm btn-light" id="notesAddStrokedZero" type="button" title="<?= __("Add stroked zero (Ø)") ?>" data-bs-toggle="tooltip">
|
||||
Ø
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary btn-sm btn-light" id="notesSearchReset" type="button" title="<?= __("Reset search") ?>">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
|
||||
@@ -575,4 +575,29 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
if (domCache.notesTableBody) {
|
||||
performNotesSearch();
|
||||
}
|
||||
|
||||
// Add stroked zero (Ø) to search box
|
||||
var addStrokedZeroBtn = document.getElementById('notesAddStrokedZero');
|
||||
if (addStrokedZeroBtn) {
|
||||
addStrokedZeroBtn.addEventListener('click', function() {
|
||||
var searchBox = domCache.searchBox;
|
||||
if (searchBox) {
|
||||
var currentValue = searchBox.value;
|
||||
var cursorPos = searchBox.selectionStart;
|
||||
|
||||
// Insert Ø at cursor position
|
||||
var newValue = currentValue.slice(0, cursorPos) + 'Ø' + currentValue.slice(cursorPos);
|
||||
searchBox.value = newValue;
|
||||
|
||||
// Set cursor position after the inserted character
|
||||
searchBox.focus();
|
||||
searchBox.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
||||
|
||||
// Trigger search if minimum length is met
|
||||
if (newValue.length >= SEARCH_MIN_LENGTH) {
|
||||
performNotesSearch();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user