From 40936efe8d114d01fedafede7ee256ca0c79fb4a Mon Sep 17 00:00:00 2001
From: Lukas <38840142+lukasstorck@users.noreply.github.com>
Date: Fri, 8 Aug 2025 13:48:36 +0200
Subject: [PATCH] feature: import and export bookmarks to clipboard (#4093)
# Description of Changes
- add **import** and **export buttons** to bookmark editor (bottom
right) to **copy and past bookmark data**
- the export reads the hidden `` field and uses
`navigator.clipboard.writeText()` to copy it to the clipboard
- the import reads from `navigator.clipboard.readText()` and sets the
internal `bookmarks` variable, which is used to update the UI elements
- after successful import or export, the buttons flash in green to give
visual feedback to the user
- this provides non-technical users with an intuitive method to copy
bookmarks between files
- I have seen, that this is also possible with the pipeline tool, but
this requires multiple steps and familiarity with the pipeline:
1. use `extract-bookmarks` to generate `bookmarks.json`
2. open the file and copy the data
3. use `edit-table-of-contents` with the copied data
4. process the target file
- challenges:
- I used `navigator.clipboard` as opposed to `document.execCommand`. The
latter is used in `account.html`, `errorBanner.html` and
`errorBanner.js`, but is
[deprecated](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand).
- I used the bootstrap-style rendering for the title attribute tooltip
for visual consistency in the bookmark editor, where the tooltip hovers
centered above the originating element. However, in most other places
the title tooltip follows the cursor and is slightly visually different.
- in case you are testing this on a mobile device (EDIT: or non-locally
hosted), the copy-to-clipboard might fail when hosted without SSL
(mobile only works in secure environment)
- similarly, when not using normal user interaction (i.e.
`element.click()` via console) the copy-to-clipboard will throw an error
`Clipboard write was blocked due to lack of user activation.`
---
## Checklist
### General
- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings
### Documentation
- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [x] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)
### UI Changes (if applicable)
- [x] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)
### Testing (if applicable)
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.
---
.../main/resources/messages_ar_AR.properties | 6 +
.../main/resources/messages_az_AZ.properties | 6 +
.../main/resources/messages_bg_BG.properties | 6 +
.../main/resources/messages_bo_CN.properties | 6 +
.../main/resources/messages_ca_CA.properties | 6 +
.../main/resources/messages_cs_CZ.properties | 6 +
.../main/resources/messages_da_DK.properties | 6 +
.../main/resources/messages_de_DE.properties | 6 +
.../main/resources/messages_el_GR.properties | 6 +
.../main/resources/messages_en_GB.properties | 6 +
.../main/resources/messages_en_US.properties | 6 +
.../main/resources/messages_es_ES.properties | 6 +
.../main/resources/messages_eu_ES.properties | 6 +
.../main/resources/messages_fa_IR.properties | 6 +
.../main/resources/messages_fr_FR.properties | 6 +
.../main/resources/messages_ga_IE.properties | 6 +
.../main/resources/messages_hi_IN.properties | 6 +
.../main/resources/messages_hr_HR.properties | 6 +
.../main/resources/messages_hu_HU.properties | 6 +
.../main/resources/messages_id_ID.properties | 6 +
.../main/resources/messages_it_IT.properties | 6 +
.../main/resources/messages_ja_JP.properties | 6 +
.../main/resources/messages_ko_KR.properties | 6 +
.../main/resources/messages_ml_IN.properties | 6 +
.../main/resources/messages_nl_NL.properties | 6 +
.../main/resources/messages_no_NB.properties | 6 +
.../main/resources/messages_pl_PL.properties | 6 +
.../main/resources/messages_pt_BR.properties | 6 +
.../main/resources/messages_pt_PT.properties | 6 +
.../main/resources/messages_ro_RO.properties | 6 +
.../main/resources/messages_ru_RU.properties | 6 +
.../main/resources/messages_sk_SK.properties | 6 +
.../main/resources/messages_sl_SI.properties | 6 +
.../resources/messages_sr_LATN_RS.properties | 6 +
.../main/resources/messages_sv_SE.properties | 6 +
.../main/resources/messages_th_TH.properties | 6 +
.../main/resources/messages_tr_TR.properties | 6 +
.../main/resources/messages_uk_UA.properties | 6 +
.../main/resources/messages_vi_VN.properties | 6 +
.../main/resources/messages_zh_CN.properties | 6 +
.../main/resources/messages_zh_TW.properties | 6 +
.../static/css/edit-table-of-contents.css | 24 +-
.../static/js/pages/edit-table-of-contents.js | 527 ++++++++++++------
.../templates/edit-table-of-contents.html | 220 +++++---
44 files changed, 772 insertions(+), 245 deletions(-)
diff --git a/app/core/src/main/resources/messages_ar_AR.properties b/app/core/src/main/resources/messages_ar_AR.properties
index 841bdd285..71bedd8e2 100644
--- a/app/core/src/main/resources/messages_ar_AR.properties
+++ b/app/core/src/main/resources/messages_ar_AR.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_az_AZ.properties b/app/core/src/main/resources/messages_az_AZ.properties
index 5da8d541b..151dc0e64 100644
--- a/app/core/src/main/resources/messages_az_AZ.properties
+++ b/app/core/src/main/resources/messages_az_AZ.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_bg_BG.properties b/app/core/src/main/resources/messages_bg_BG.properties
index 3d3c89de0..63b0c0b85 100644
--- a/app/core/src/main/resources/messages_bg_BG.properties
+++ b/app/core/src/main/resources/messages_bg_BG.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_bo_CN.properties b/app/core/src/main/resources/messages_bo_CN.properties
index b5aba5f6a..5b39cdcf5 100644
--- a/app/core/src/main/resources/messages_bo_CN.properties
+++ b/app/core/src/main/resources/messages_bo_CN.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_ca_CA.properties b/app/core/src/main/resources/messages_ca_CA.properties
index 144c9bac1..a8f9a560f 100644
--- a/app/core/src/main/resources/messages_ca_CA.properties
+++ b/app/core/src/main/resources/messages_ca_CA.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_cs_CZ.properties b/app/core/src/main/resources/messages_cs_CZ.properties
index e7b60818e..a83268aa2 100644
--- a/app/core/src/main/resources/messages_cs_CZ.properties
+++ b/app/core/src/main/resources/messages_cs_CZ.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_da_DK.properties b/app/core/src/main/resources/messages_da_DK.properties
index 6b07c4a7d..bc06c0915 100644
--- a/app/core/src/main/resources/messages_da_DK.properties
+++ b/app/core/src/main/resources/messages_da_DK.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_de_DE.properties b/app/core/src/main/resources/messages_de_DE.properties
index c78fbc31c..1bb923450 100644
--- a/app/core/src/main/resources/messages_de_DE.properties
+++ b/app/core/src/main/resources/messages_de_DE.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Vorhandene Lesezeichen ersetzen (deaktiviere
editTableOfContents.editorTitle=Lesezeichen-Editor
editTableOfContents.editorDesc=Fügen unten Lesezeichen hinzu und ordne sie an. Klicke auf +, um das untergeordnete Lesezeichen hinzuzufügen.
editTableOfContents.addBookmark=Neues Lesezeichen hinzufügen
+editTableOfContents.importBookmarksDefault=Importieren
+editTableOfContents.importBookmarksFromJsonFile=JSON-Datei hochladen
+editTableOfContents.importBookmarksFromClipboard=Aus Zwischenablage einfügen
+editTableOfContents.exportBookmarksDefault=Exportieren
+editTableOfContents.exportBookmarksAsJson=Als JSON herunterladen
+editTableOfContents.exportBookmarksAsText=Als Text kopieren
editTableOfContents.desc.1=Mit diesem Werkzeug können Sie das Inhaltsverzeichnis (Lesezeichen) eines PDF-Dokuments hinzufügen oder bearbeiten.
editTableOfContents.desc.2=Sie können eine hierarchische Struktur erstellen, indem Sie untergeordnete Lesezeichen zu übergeordneten hinzufügen.
editTableOfContents.desc.3=Jedes Lesezeichen benötigt einen Titel und eine Seitenzahl.
diff --git a/app/core/src/main/resources/messages_el_GR.properties b/app/core/src/main/resources/messages_el_GR.properties
index 773d873d2..e4209faf8 100644
--- a/app/core/src/main/resources/messages_el_GR.properties
+++ b/app/core/src/main/resources/messages_el_GR.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_en_GB.properties b/app/core/src/main/resources/messages_en_GB.properties
index a905a1f4d..37be2c06a 100644
--- a/app/core/src/main/resources/messages_en_GB.properties
+++ b/app/core/src/main/resources/messages_en_GB.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_en_US.properties b/app/core/src/main/resources/messages_en_US.properties
index 34d5d81c4..e6bad97d0 100644
--- a/app/core/src/main/resources/messages_en_US.properties
+++ b/app/core/src/main/resources/messages_en_US.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_es_ES.properties b/app/core/src/main/resources/messages_es_ES.properties
index d6ba297c3..40fe58987 100644
--- a/app/core/src/main/resources/messages_es_ES.properties
+++ b/app/core/src/main/resources/messages_es_ES.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_eu_ES.properties b/app/core/src/main/resources/messages_eu_ES.properties
index 58f20132a..92bb97c63 100644
--- a/app/core/src/main/resources/messages_eu_ES.properties
+++ b/app/core/src/main/resources/messages_eu_ES.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_fa_IR.properties b/app/core/src/main/resources/messages_fa_IR.properties
index 33a3baa7e..02e44b563 100644
--- a/app/core/src/main/resources/messages_fa_IR.properties
+++ b/app/core/src/main/resources/messages_fa_IR.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_fr_FR.properties b/app/core/src/main/resources/messages_fr_FR.properties
index 4087137f8..f45f94078 100644
--- a/app/core/src/main/resources/messages_fr_FR.properties
+++ b/app/core/src/main/resources/messages_fr_FR.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Remplacer les signets existants (décocher p
editTableOfContents.editorTitle=Éditeur de signets
editTableOfContents.editorDesc=Ajoutez et organisez les signets ci-dessous. Cliquez sur + pour ajouter des signets enfants.
editTableOfContents.addBookmark=Ajouter un nouveau signet
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=Cet outil vous permet d'ajouter ou de modifier la table des matières (signets) dans un document PDF.
editTableOfContents.desc.2=Vous pouvez créer une structure hiérarchique en ajoutant des signets enfants à des signets parents.
editTableOfContents.desc.3=Chaque signet nécessite un titre et un numéro de page cible.
diff --git a/app/core/src/main/resources/messages_ga_IE.properties b/app/core/src/main/resources/messages_ga_IE.properties
index d90d14cc7..874c8ebca 100644
--- a/app/core/src/main/resources/messages_ga_IE.properties
+++ b/app/core/src/main/resources/messages_ga_IE.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_hi_IN.properties b/app/core/src/main/resources/messages_hi_IN.properties
index 188de81f8..369d9444c 100644
--- a/app/core/src/main/resources/messages_hi_IN.properties
+++ b/app/core/src/main/resources/messages_hi_IN.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_hr_HR.properties b/app/core/src/main/resources/messages_hr_HR.properties
index 061f08497..87a4add1d 100644
--- a/app/core/src/main/resources/messages_hr_HR.properties
+++ b/app/core/src/main/resources/messages_hr_HR.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_hu_HU.properties b/app/core/src/main/resources/messages_hu_HU.properties
index a4cd82005..490dbecce 100644
--- a/app/core/src/main/resources/messages_hu_HU.properties
+++ b/app/core/src/main/resources/messages_hu_HU.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Meglévő könyvjelzők cseréje (törölje
editTableOfContents.editorTitle=Könyvjelző szerkesztő
editTableOfContents.editorDesc=Könyvjelzők hozzáadása és rendezése lent. Kattintson a + gombra gyermek könyvjelzők hozzáadásához.
editTableOfContents.addBookmark=Új könyvjelző hozzáadása
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=Ez az eszköz lehetővé teszi a tartalomjegyzék (könyvjelzők) hozzáadását vagy szerkesztését egy PDF dokumentumban.
editTableOfContents.desc.2=Hierarchikus struktúrákat hozhat létre, ha gyermek könyvjelzőket ad a szülő könyvjelzőkhöz.
editTableOfContents.desc.3=Minden könyvjelzőhöz szükséges egy cím és egy céloldalszám.
diff --git a/app/core/src/main/resources/messages_id_ID.properties b/app/core/src/main/resources/messages_id_ID.properties
index c75656b6e..470945372 100644
--- a/app/core/src/main/resources/messages_id_ID.properties
+++ b/app/core/src/main/resources/messages_id_ID.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_it_IT.properties b/app/core/src/main/resources/messages_it_IT.properties
index be48d9e6f..71c0f9ffc 100644
--- a/app/core/src/main/resources/messages_it_IT.properties
+++ b/app/core/src/main/resources/messages_it_IT.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Sostituisci i segnalibri esistenti (deselezi
editTableOfContents.editorTitle=Editor segnalibri
editTableOfContents.editorDesc=Aggiungi e disponi i segnalibri qui sotto. Fai clic su + per aggiungere segnalibri secondari.
editTableOfContents.addBookmark=Aggiungi nuovo segnalibro
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=Questo strumento consente di aggiungere o modificare il sommario (segnalibri) in un documento PDF.
editTableOfContents.desc.2=È possibile creare una struttura gerarchica aggiungendo segnalibri secondari a quelli principali.
editTableOfContents.desc.3=Ogni segnalibro richiede un titolo e un numero di pagina di destinazione.
diff --git a/app/core/src/main/resources/messages_ja_JP.properties b/app/core/src/main/resources/messages_ja_JP.properties
index 12f490166..fdffa3523 100644
--- a/app/core/src/main/resources/messages_ja_JP.properties
+++ b/app/core/src/main/resources/messages_ja_JP.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=既存のしおりを置き換える(既
editTableOfContents.editorTitle=しおりエディター
editTableOfContents.editorDesc=以下にしおりを追加して配置します。+をクリックして、子のしおりを追加します。
editTableOfContents.addBookmark=新しいしおりを追加
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=このツールを使用すると、PDFドキュメントに目次(しおり)を追加または編集できます。
editTableOfContents.desc.2=親しおりに子しおりを追加することで階層構造を作成できます。
editTableOfContents.desc.3=各しおりにはタイトルと対象のページ番号が必要です。
diff --git a/app/core/src/main/resources/messages_ko_KR.properties b/app/core/src/main/resources/messages_ko_KR.properties
index 70c4178d4..b129e9c69 100644
--- a/app/core/src/main/resources/messages_ko_KR.properties
+++ b/app/core/src/main/resources/messages_ko_KR.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_ml_IN.properties b/app/core/src/main/resources/messages_ml_IN.properties
index 26d18fd4d..775b68792 100644
--- a/app/core/src/main/resources/messages_ml_IN.properties
+++ b/app/core/src/main/resources/messages_ml_IN.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_nl_NL.properties b/app/core/src/main/resources/messages_nl_NL.properties
index ac001d2a8..94b1bb020 100644
--- a/app/core/src/main/resources/messages_nl_NL.properties
+++ b/app/core/src/main/resources/messages_nl_NL.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_no_NB.properties b/app/core/src/main/resources/messages_no_NB.properties
index f16c1f898..dadc0bc32 100644
--- a/app/core/src/main/resources/messages_no_NB.properties
+++ b/app/core/src/main/resources/messages_no_NB.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_pl_PL.properties b/app/core/src/main/resources/messages_pl_PL.properties
index 442540fbb..7d553c574 100644
--- a/app/core/src/main/resources/messages_pl_PL.properties
+++ b/app/core/src/main/resources/messages_pl_PL.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_pt_BR.properties b/app/core/src/main/resources/messages_pt_BR.properties
index 5db475798..cde839e5e 100644
--- a/app/core/src/main/resources/messages_pt_BR.properties
+++ b/app/core/src/main/resources/messages_pt_BR.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_pt_PT.properties b/app/core/src/main/resources/messages_pt_PT.properties
index aad725305..49998f273 100644
--- a/app/core/src/main/resources/messages_pt_PT.properties
+++ b/app/core/src/main/resources/messages_pt_PT.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_ro_RO.properties b/app/core/src/main/resources/messages_ro_RO.properties
index d785d49c6..e33d01f4a 100644
--- a/app/core/src/main/resources/messages_ro_RO.properties
+++ b/app/core/src/main/resources/messages_ro_RO.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_ru_RU.properties b/app/core/src/main/resources/messages_ru_RU.properties
index 64bb21a2c..072e03123 100644
--- a/app/core/src/main/resources/messages_ru_RU.properties
+++ b/app/core/src/main/resources/messages_ru_RU.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Заменить существующие з
editTableOfContents.editorTitle=Редактор закладок
editTableOfContents.editorDesc=Добавьте и упорядочьте закладки ниже. Нажмите «+», чтобы добавить дочерние закладки.
editTableOfContents.addBookmark=Добавить новую закладку
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=Этот инструмент позволяет вам добавлять или редактировать оглавление (закладки) в PDF-документе.
editTableOfContents.desc.2=Вы можете создать иерархическую структуру, добавив дочерние закладки к родительским.
editTableOfContents.desc.3=Для каждой закладки требуется название и номер целевой страницы.
diff --git a/app/core/src/main/resources/messages_sk_SK.properties b/app/core/src/main/resources/messages_sk_SK.properties
index 6325a85e9..10ed3d985 100644
--- a/app/core/src/main/resources/messages_sk_SK.properties
+++ b/app/core/src/main/resources/messages_sk_SK.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_sl_SI.properties b/app/core/src/main/resources/messages_sl_SI.properties
index 698e5aee0..8b15dcc42 100644
--- a/app/core/src/main/resources/messages_sl_SI.properties
+++ b/app/core/src/main/resources/messages_sl_SI.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_sr_LATN_RS.properties b/app/core/src/main/resources/messages_sr_LATN_RS.properties
index 968c277e9..305b68aa1 100644
--- a/app/core/src/main/resources/messages_sr_LATN_RS.properties
+++ b/app/core/src/main/resources/messages_sr_LATN_RS.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Zameni postojeće obeleživače (isključi d
editTableOfContents.editorTitle=Editor obeleživača
editTableOfContents.editorDesc=Dodaj i rasporedi obeleživače ispod. Klikni + za dodavanje podređenih obeleživača.
editTableOfContents.addBookmark=Dodaj novi obeleživač
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=Ovaj alat omogućava dodavanje ili izmenu sadržaja (obeleživača) u PDF dokumentu.
editTableOfContents.desc.2=Moguće je kreirati hijerarhijsku strukturu dodavanjem podređenih obeleživača nadređenim obeleživačima.
editTableOfContents.desc.3=Svaki obeleživač zahteva naslov i broj ciljne strane.
diff --git a/app/core/src/main/resources/messages_sv_SE.properties b/app/core/src/main/resources/messages_sv_SE.properties
index 31c250caa..e731f6337 100644
--- a/app/core/src/main/resources/messages_sv_SE.properties
+++ b/app/core/src/main/resources/messages_sv_SE.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_th_TH.properties b/app/core/src/main/resources/messages_th_TH.properties
index df50423ca..7a2b20aea 100644
--- a/app/core/src/main/resources/messages_th_TH.properties
+++ b/app/core/src/main/resources/messages_th_TH.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_tr_TR.properties b/app/core/src/main/resources/messages_tr_TR.properties
index 01e946c56..c03d7872e 100644
--- a/app/core/src/main/resources/messages_tr_TR.properties
+++ b/app/core/src/main/resources/messages_tr_TR.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=Mevcut yer işaretlerini değiştir (var ola
editTableOfContents.editorTitle=Yer İşareti Düzenleyici
editTableOfContents.editorDesc=Aşağıdan yer işaretleri ekleyin ve düzenleyin. Alt yer işareti eklemek için + simgesine tıklayın.
editTableOfContents.addBookmark=Yeni Yer İşareti Ekle
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=Bu araç, bir PDF belgesine içindekiler tablosu (yer işaretleri) eklemenizi veya mevcut olanları düzenlemenizi sağlar.
editTableOfContents.desc.2=Alt yer işaretleri ekleyerek hiyerarşik bir yapı oluşturabilirsiniz.
editTableOfContents.desc.3=Her yer işareti bir başlık ve hedef sayfa numarası gerektirir.
diff --git a/app/core/src/main/resources/messages_uk_UA.properties b/app/core/src/main/resources/messages_uk_UA.properties
index 16add9977..f24d997ac 100644
--- a/app/core/src/main/resources/messages_uk_UA.properties
+++ b/app/core/src/main/resources/messages_uk_UA.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_vi_VN.properties b/app/core/src/main/resources/messages_vi_VN.properties
index c9e070e77..cd2e412f7 100644
--- a/app/core/src/main/resources/messages_vi_VN.properties
+++ b/app/core/src/main/resources/messages_vi_VN.properties
@@ -1860,6 +1860,12 @@ 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.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
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/messages_zh_CN.properties b/app/core/src/main/resources/messages_zh_CN.properties
index 75957b1b0..252eb2768 100644
--- a/app/core/src/main/resources/messages_zh_CN.properties
+++ b/app/core/src/main/resources/messages_zh_CN.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=替换现有书签(取消勾选则追加
editTableOfContents.editorTitle=书签编辑器
editTableOfContents.editorDesc=在下方添加并排列书签,点击 + 可添加子书签
editTableOfContents.addBookmark=添加书签
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=此工具可用于在 PDF 文档中添加或编辑目录(书签)
editTableOfContents.desc.2=您可以通过为父书签添加子书签来构建层级结构
editTableOfContents.desc.3=每个书签需填写标题和目标页码
diff --git a/app/core/src/main/resources/messages_zh_TW.properties b/app/core/src/main/resources/messages_zh_TW.properties
index 3968b07d2..9f38178ac 100644
--- a/app/core/src/main/resources/messages_zh_TW.properties
+++ b/app/core/src/main/resources/messages_zh_TW.properties
@@ -1860,6 +1860,12 @@ editTableOfContents.replaceExisting=取代現有書籤 (取消勾選以附加到
editTableOfContents.editorTitle=書籤編輯器
editTableOfContents.editorDesc=在下方新增和排列書籤。點選 + 新增子書籤。
editTableOfContents.addBookmark=新增書籤
+editTableOfContents.importBookmarksDefault=Import
+editTableOfContents.importBookmarksFromJsonFile=Upload JSON file
+editTableOfContents.importBookmarksFromClipboard=Paste from clipboard
+editTableOfContents.exportBookmarksDefault=Export
+editTableOfContents.exportBookmarksAsJson=Download as JSON
+editTableOfContents.exportBookmarksAsText=Copy as text
editTableOfContents.desc.1=此工具可讓您在 PDF 文件中新增或編輯目錄 (書籤)。
editTableOfContents.desc.2=您可以透過將子書籤新增至父書籤來建立階層式結構。
editTableOfContents.desc.3=每個書籤都需要標題和目標頁碼。
diff --git a/app/core/src/main/resources/static/css/edit-table-of-contents.css b/app/core/src/main/resources/static/css/edit-table-of-contents.css
index d85813a73..74ee98b3c 100644
--- a/app/core/src/main/resources/static/css/edit-table-of-contents.css
+++ b/app/core/src/main/resources/static/css/edit-table-of-contents.css
@@ -156,7 +156,7 @@
.bookmark-actions {
margin-top: 20px;
display: flex;
- justify-content: flex-start;
+ justify-content: space-between;
}
/* Collapse/expand icons */
@@ -274,3 +274,25 @@
--bg-empty: var(--md-sys-color-surface-container-low, #24282e);
--border-empty: var(--md-sys-color-outline, #495057);
}
+
+.success-flash {
+ position: relative;
+}
+
+.success-flash::after {
+ content: "✓";
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ font-weight: bold;
+ font-size: 1.2em;
+ color: white;
+ opacity: 0;
+ animation: fadeOut 1s ease-in-out;
+}
+
+@keyframes fadeOut {
+ 0% { opacity: 1; }
+ 100% { opacity: 0; }
+}
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..82c92a50e 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
@@ -1,88 +1,117 @@
-document.addEventListener('DOMContentLoaded', function() {
- const bookmarksContainer = document.getElementById('bookmarks-container');
- const addBookmarkBtn = document.getElementById('addBookmarkBtn');
- const bookmarkDataInput = document.getElementById('bookmarkData');
+document.addEventListener("DOMContentLoaded", function () {
+ const bookmarksContainer = document.getElementById("bookmarks-container");
+ const errorMessageContainer = document.getElementById("error-message-container");
+ const addBookmarkBtn = document.getElementById("addBookmarkBtn");
+ const bookmarkDataInput = document.getElementById("bookmarkData");
let bookmarks = [];
let counter = 0; // Used for generating unique IDs
- // Add event listener to the file input to extract existing bookmarks
- document.getElementById('fileInput-input').addEventListener('change', async function(e) {
- if (!e.target.files || e.target.files.length === 0) {
+ // callback function on file input change to extract bookmarks from PDF
+ async function getBookmarkDataFromPdf(event) {
+ if (!event.target.files || event.target.files.length === 0) {
return;
}
- // Reset bookmarks initially
- bookmarks = [];
- updateBookmarksUI();
-
const formData = new FormData();
- formData.append('file', e.target.files[0]);
-
- // Show loading indicator
- showLoadingIndicator();
+ formData.append("file", event.target.files[0]);
try {
// Call the API to extract bookmarks using fetchWithCsrf for CSRF protection
- const response = await fetchWithCsrf('/api/v1/general/extract-bookmarks', {
- method: 'POST',
- body: formData
+ const response = await fetchWithCsrf("/api/v1/general/extract-bookmarks", {
+ method: "POST",
+ body: formData,
});
if (!response.ok) {
- throw new Error(`Failed to extract bookmarks: ${response.status} ${response.statusText}`);
+ throw new Error(`Failed to fetch API: ${response.status} ${response.statusText}`);
}
const extractedBookmarks = await response.json();
+ return extractedBookmarks;
+ } catch (error) {
+ throw new Error("Error extracting bookmark data:", error);
+ }
+ }
+
+ // callback function on file input change to extract bookmarks from JSON
+ async function getBookmarkDataFromJson(event) {
+ if (!event.target.files || event.target.files.length === 0) {
+ return;
+ }
+
+ const file = event.target.files[0];
+
+ try {
+ const fileText = await file.text();
+ const jsonData = JSON.parse(fileText);
+ return jsonData;
+ } catch (error) {
+ throw new Error(`Error extracting bookmark data: error while reading or parsing JSON file: ${error.message}`);
+ }
+ }
+
+ // display new bookmark data given by a callback function that loads or fetches the data
+ async function loadBookmarks(getBookmarkDataCallback) {
+ // reset bookmarks
+ bookmarks = [];
+ updateBookmarksUI();
+ showLoadingIndicator();
+
+ try {
+ // Get new bookmarks from the callback
+ const newBookmarks = await getBookmarkDataCallback();
// Convert extracted bookmarks to our format with IDs
- if (extractedBookmarks && extractedBookmarks.length > 0) {
- bookmarks = extractedBookmarks.map(convertExtractedBookmark);
- } else {
- showEmptyState();
+ if (newBookmarks && newBookmarks.length > 0) {
+ bookmarks = newBookmarks.map(convertExtractedBookmark);
}
} catch (error) {
- // Show error message
- showErrorMessage('Failed to extract bookmarks. You can still create new ones.');
-
- // Add a default bookmark if no bookmarks and error
- if (bookmarks.length === 0) {
- showEmptyState();
- }
+ bookmarks = [];
+ throw new Error(`Error loading bookmarks: ${error}`);
} finally {
- // Remove loading indicator
removeLoadingIndicator();
-
- // Update the UI
updateBookmarksUI();
}
+ }
+
+ // Add event listener to the file input to extract existing bookmarks
+ document.getElementById("fileInput-input").addEventListener("change", async function (event) {
+ try {
+ await loadBookmarks(async function () {
+ return getBookmarkDataFromPdf(event);
+ });
+ } catch {
+ showErrorMessage("Failed to extract bookmarks. You can still create new ones.");
+ }
});
function showLoadingIndicator() {
- const loadingEl = document.createElement('div');
- loadingEl.className = 'alert alert-info';
- loadingEl.textContent = 'Loading bookmarks from PDF...';
- loadingEl.id = 'loading-bookmarks';
- bookmarksContainer.innerHTML = '';
+ const loadingEl = document.createElement("div");
+ loadingEl.className = "alert alert-info";
+ loadingEl.textContent = "Loading bookmarks from PDF...";
+ loadingEl.id = "loading-bookmarks";
+ errorMessageContainer.innerHTML = "";
+ bookmarksContainer.innerHTML = "";
bookmarksContainer.appendChild(loadingEl);
}
function removeLoadingIndicator() {
- const loadingEl = document.getElementById('loading-bookmarks');
+ const loadingEl = document.getElementById("loading-bookmarks");
if (loadingEl) {
loadingEl.remove();
}
}
function showErrorMessage(message) {
- const errorEl = document.createElement('div');
- errorEl.className = 'alert alert-danger';
+ const errorEl = document.createElement("div");
+ errorEl.className = "alert alert-danger";
errorEl.textContent = message;
- bookmarksContainer.appendChild(errorEl);
+ errorMessageContainer.appendChild(errorEl);
}
function showEmptyState() {
- const emptyStateEl = document.createElement('div');
- emptyStateEl.className = 'empty-bookmarks mb-3';
+ const emptyStateEl = document.createElement("div");
+ emptyStateEl.className = "empty-bookmarks mb-3";
emptyStateEl.innerHTML = `
bookmark_add