mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-06 13:48:58 +02:00
feat: add copy to clipboard functionality to bookmarks editor
This commit is contained in:
parent
a5d219ed05
commit
d2b39118c8
@ -1859,6 +1859,8 @@ editTableOfContents.replaceExisting=Replace existing bookmarks (uncheck to appen
|
|||||||
editTableOfContents.editorTitle=Bookmark Editor
|
editTableOfContents.editorTitle=Bookmark Editor
|
||||||
editTableOfContents.editorDesc=Add and arrange bookmarks below. Click + to add child bookmarks.
|
editTableOfContents.editorDesc=Add and arrange bookmarks below. Click + to add child bookmarks.
|
||||||
editTableOfContents.addBookmark=Add New Bookmark
|
editTableOfContents.addBookmark=Add New Bookmark
|
||||||
|
editTableOfContents.copyBookmarks=Copy
|
||||||
|
editTableOfContents.copyBookmarksHint=Copy bookmark data as string
|
||||||
editTableOfContents.desc.1=This tool allows you to add or edit the table of contents (bookmarks) in a PDF document.
|
editTableOfContents.desc.1=This tool allows you to add or edit the table of contents (bookmarks) in a PDF document.
|
||||||
editTableOfContents.desc.2=You can create a hierarchical structure by adding child bookmarks to parent bookmarks.
|
editTableOfContents.desc.2=You can create a hierarchical structure by adding child bookmarks to parent bookmarks.
|
||||||
editTableOfContents.desc.3=Each bookmark requires a title and target page number.
|
editTableOfContents.desc.3=Each bookmark requires a title and target page number.
|
||||||
|
@ -597,6 +597,20 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
updateEmptyStateButton();
|
updateEmptyStateButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add copy bookmarks to clipboard functionality
|
||||||
|
async function copyBookmarksStringToClipboard() {
|
||||||
|
const bookmarkData = bookmarkDataInput.value;
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(bookmarkData);
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`Failed to copy bookmarks: ${error.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add event listener to the copy bookmarks button
|
||||||
|
const copyBookmarksBtn = document.getElementById('copyBookmarksBtn');
|
||||||
|
copyBookmarksBtn.addEventListener('click', copyBookmarksStringToClipboard);
|
||||||
|
|
||||||
// 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) {
|
||||||
mutations.forEach(function(mutation) {
|
mutations.forEach(function(mutation) {
|
||||||
|
@ -51,6 +51,12 @@
|
|||||||
<p>
|
<p>
|
||||||
<a class="btn btn-outline-primary" data-bs-toggle="collapse" href="#info" role="button"
|
<a class="btn btn-outline-primary" data-bs-toggle="collapse" href="#info" role="button"
|
||||||
aria-expanded="false" aria-controls="info" th:text="#{info}"></a>
|
aria-expanded="false" aria-controls="info" th:text="#{info}"></a>
|
||||||
|
<button type="button"
|
||||||
|
id="copyBookmarksBtn"
|
||||||
|
class="btn btn-outline-primary"
|
||||||
|
th:text="#{editTableOfContents.copyBookmarks}"
|
||||||
|
th:title="#{editTableOfContents.copyBookmarksHint}">
|
||||||
|
</button>
|
||||||
</p>
|
</p>
|
||||||
<div class="collapse" id="info">
|
<div class="collapse" id="info">
|
||||||
<p th:text="#{editTableOfContents.desc.1}"></p>
|
<p th:text="#{editTableOfContents.desc.1}"></p>
|
||||||
|
Loading…
Reference in New Issue
Block a user