diff --git a/app/core/src/main/resources/messages_en_US.properties b/app/core/src/main/resources/messages_en_US.properties index eb8a9236c..1a8961098 100644 --- a/app/core/src/main/resources/messages_en_US.properties +++ b/app/core/src/main/resources/messages_en_US.properties @@ -1859,6 +1859,8 @@ editTableOfContents.replaceExisting=Replace existing bookmarks (uncheck to appen editTableOfContents.editorTitle=Bookmark Editor editTableOfContents.editorDesc=Add and arrange bookmarks below. Click + to add child bookmarks. 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.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. diff --git a/app/core/src/main/resources/static/js/pages/edit-table-of-contents.js b/app/core/src/main/resources/static/js/pages/edit-table-of-contents.js index de7fe30db..52955dc4b 100644 --- a/app/core/src/main/resources/static/js/pages/edit-table-of-contents.js +++ b/app/core/src/main/resources/static/js/pages/edit-table-of-contents.js @@ -597,6 +597,20 @@ document.addEventListener('DOMContentLoaded', function() { 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 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { diff --git a/app/core/src/main/resources/templates/edit-table-of-contents.html b/app/core/src/main/resources/templates/edit-table-of-contents.html index 99ab02c1d..8935ae67e 100644 --- a/app/core/src/main/resources/templates/edit-table-of-contents.html +++ b/app/core/src/main/resources/templates/edit-table-of-contents.html @@ -51,6 +51,12 @@