mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-06 13:48:58 +02:00
fix: hide import/export buttons when clipboard is not available
This commit is contained in:
parent
2fdeca7074
commit
538e1534d5
@ -640,8 +640,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add event listeners for import/export buttons
|
// Add event listeners for import/export buttons
|
||||||
document.getElementById('importBookmarksBtn').addEventListener('click', importBookmarkStringFromClipboard);
|
const importBookmarksBtn = document.getElementById('importBookmarksBtn');
|
||||||
document.getElementById('exportBookmarksBtn').addEventListener('click', exportBookmarkStringToClipboard);
|
const exportBookmarksBtn = document.getElementById('exportBookmarksBtn');
|
||||||
|
importBookmarksBtn.addEventListener('click', importBookmarkStringFromClipboard);
|
||||||
|
exportBookmarksBtn.addEventListener('click', exportBookmarkStringToClipboard);
|
||||||
|
|
||||||
|
// display import/export buttons if supported
|
||||||
|
if (navigator.clipboard && navigator.clipboard.writeText && navigator.clipboard.readText) {
|
||||||
|
importBookmarksBtn.classList.remove('d-none');
|
||||||
|
exportBookmarksBtn.classList.remove('d-none');
|
||||||
|
}
|
||||||
|
|
||||||
// Listen for theme changes to update badge colors
|
// Listen for theme changes to update badge colors
|
||||||
const observer = new MutationObserver(function(mutations) {
|
const observer = new MutationObserver(function(mutations) {
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<div class="d-flex flex-wrap justify-content-end gap-2">
|
<div class="d-flex flex-wrap justify-content-end gap-2">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
id="importBookmarksBtn"
|
id="importBookmarksBtn"
|
||||||
class="btn btn-outline-primary"
|
class="d-none btn btn-outline-primary"
|
||||||
th:text="#{editTableOfContents.importBookmarks}"
|
th:text="#{editTableOfContents.importBookmarks}"
|
||||||
th:data-bs-original-title="#{editTableOfContents.importBookmarksHint}"
|
th:data-bs-original-title="#{editTableOfContents.importBookmarksHint}"
|
||||||
data-bs-toggle="tooltip"
|
data-bs-toggle="tooltip"
|
||||||
@ -53,7 +53,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
id="exportBookmarksBtn"
|
id="exportBookmarksBtn"
|
||||||
class="btn btn-outline-primary"
|
class="d-none btn btn-outline-primary"
|
||||||
th:text="#{editTableOfContents.exportBookmarks}"
|
th:text="#{editTableOfContents.exportBookmarks}"
|
||||||
th:data-bs-original-title="#{editTableOfContents.exportBookmarksHint}"
|
th:data-bs-original-title="#{editTableOfContents.exportBookmarksHint}"
|
||||||
data-bs-toggle="tooltip"
|
data-bs-toggle="tooltip"
|
||||||
|
Loading…
Reference in New Issue
Block a user