mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-14 14:09:26 +02:00
Add notes to bookmarks (#472)
* Add basic bookmark notes * Add bookmark list JS to shared bookmarks page * Allow testing through ngrok * Improve CSS * Set notes through API * Improve notes editing * Improve notes icon * Remove transitions for now * Update keyboard shortcut * Add bookmark list tests * Add setting for showing notes permanently * Add test for toggling notes * Update API docs * Allow searching for notes content * Skip test
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
(function () {
|
||||
function allowBulkEdit() {
|
||||
return !!document.getElementById('bulk-edit-mode');
|
||||
}
|
||||
|
||||
function setupBulkEdit() {
|
||||
if (!allowBulkEdit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bulkEditToggle = document.getElementById('bulk-edit-mode')
|
||||
const bulkEditBar = document.querySelector('.bulk-edit-bar')
|
||||
const singleToggles = document.querySelectorAll('.bulk-edit-toggle input')
|
||||
@@ -64,6 +72,10 @@
|
||||
}
|
||||
|
||||
function setupBulkEditTagAutoComplete() {
|
||||
if (!allowBulkEdit()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
const tagInput = document.getElementById('bulk-edit-tags-input');
|
||||
const apiBaseUrl = document.documentElement.dataset.apiBaseUrl || '';
|
||||
@@ -121,7 +133,39 @@
|
||||
});
|
||||
}
|
||||
|
||||
function setupNotes() {
|
||||
// Shortcut for toggling all notes
|
||||
document.addEventListener('keydown', function(event) {
|
||||
// Filter for shortcut key
|
||||
if (event.key !== 'e') return;
|
||||
// Skip if event occurred within an input element
|
||||
const targetNodeName = event.target.nodeName;
|
||||
const isInputTarget = targetNodeName === 'INPUT'
|
||||
|| targetNodeName === 'SELECT'
|
||||
|| targetNodeName === 'TEXTAREA';
|
||||
|
||||
if (isInputTarget) return;
|
||||
|
||||
const list = document.querySelector('.bookmark-list');
|
||||
list.classList.toggle('show-notes');
|
||||
});
|
||||
|
||||
// Toggle notes for single bookmark
|
||||
const bookmarks = document.querySelectorAll('.bookmark-list li');
|
||||
bookmarks.forEach(bookmark => {
|
||||
const toggleButton = bookmark.querySelector('.toggle-notes');
|
||||
if (toggleButton) {
|
||||
toggleButton.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
bookmark.classList.toggle('show-notes');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupBulkEdit();
|
||||
setupBulkEditTagAutoComplete();
|
||||
setupListNavigation();
|
||||
setupNotes();
|
||||
})()
|
||||
|
Reference in New Issue
Block a user