pdfjs-viewer-highlight-echo 5.4.457 → 5.4.462
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/pdf.min.mjs +4 -4
- package/build/pdf.mjs +87 -16
- package/build/pdf.mjs.map +1 -1
- package/build/pdf.sandbox.min.mjs +2 -2
- package/build/pdf.sandbox.mjs +2 -2
- package/build/pdf.worker.min.mjs +3 -3
- package/build/pdf.worker.mjs +3 -3
- package/config/highlights.json +41 -11
- package/image_decoders/pdf.image_decoders.min.mjs +2 -2
- package/image_decoders/pdf.image_decoders.mjs +2 -2
- package/legacy/build/pdf.min.mjs +4 -4
- package/legacy/build/pdf.mjs +87 -16
- package/legacy/build/pdf.mjs.map +1 -1
- package/legacy/build/pdf.sandbox.min.mjs +2 -2
- package/legacy/build/pdf.sandbox.mjs +2 -2
- package/legacy/build/pdf.worker.min.mjs +3 -3
- package/legacy/build/pdf.worker.mjs +3 -3
- package/legacy/image_decoders/pdf.image_decoders.min.mjs +2 -2
- package/legacy/image_decoders/pdf.image_decoders.mjs +2 -2
- package/legacy/web/config/highlights.json +41 -11
- package/legacy/web/pdf_viewer.mjs +3 -3
- package/legacy/web/viewer.mjs +357 -42
- package/legacy/web/viewer.mjs.map +1 -1
- package/package.json +1 -1
- package/types/src/display/editor/editor.d.ts +3 -0
- package/types/src/display/editor/highlight.d.ts +2 -0
- package/types/src/display/editor/toolbar.d.ts +2 -0
- package/types/src/display/editor/tools.d.ts +1 -1
- package/web/config/highlights.json +41 -11
- package/web/pdf_viewer.mjs +3 -3
- package/web/viewer.mjs +310 -42
- package/web/viewer.mjs.map +1 -1
package/legacy/build/pdf.mjs
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* pdfjsVersion = 5.4.
|
|
25
|
-
* pdfjsBuild =
|
|
24
|
+
* pdfjsVersion = 5.4.462
|
|
25
|
+
* pdfjsBuild = 34e1cb08c
|
|
26
26
|
*/
|
|
27
27
|
/******/ var __webpack_modules__ = ({
|
|
28
28
|
|
|
@@ -8049,6 +8049,18 @@ class EditorToolbar {
|
|
|
8049
8049
|
}
|
|
8050
8050
|
this.#buttons.append(button);
|
|
8051
8051
|
}
|
|
8052
|
+
addSaveButton(saveButton) {
|
|
8053
|
+
if (!saveButton) {
|
|
8054
|
+
return;
|
|
8055
|
+
}
|
|
8056
|
+
saveButton.classList.add("basic", "saveButton");
|
|
8057
|
+
this.#addListenersToElement(saveButton);
|
|
8058
|
+
this.#buttons.append(saveButton);
|
|
8059
|
+
}
|
|
8060
|
+
removeSaveButton() {
|
|
8061
|
+
const saveButton = this.#buttons.querySelector(".saveButton");
|
|
8062
|
+
saveButton?.remove();
|
|
8063
|
+
}
|
|
8052
8064
|
get #divider() {
|
|
8053
8065
|
const divider = document.createElement("div");
|
|
8054
8066
|
divider.className = "divider";
|
|
@@ -8128,6 +8140,11 @@ class EditorToolbar {
|
|
|
8128
8140
|
this.addComment(tool);
|
|
8129
8141
|
}
|
|
8130
8142
|
break;
|
|
8143
|
+
case "save":
|
|
8144
|
+
if (tool) {
|
|
8145
|
+
this.addSaveButton(tool);
|
|
8146
|
+
}
|
|
8147
|
+
break;
|
|
8131
8148
|
}
|
|
8132
8149
|
}
|
|
8133
8150
|
async addButtonBefore(name, tool, beforeSelector) {
|
|
@@ -9196,9 +9213,11 @@ class AnnotationEditorUIManager {
|
|
|
9196
9213
|
navigator.clipboard.writeText(selectedText).catch(() => {});
|
|
9197
9214
|
this.#floatingToolbar?.hide();
|
|
9198
9215
|
}
|
|
9199
|
-
saveSelectionAsJson(methodOfCreation = "") {
|
|
9216
|
+
saveSelectionAsJson(methodOfCreation = "", editorInfo = null) {
|
|
9200
9217
|
this._eventBus.dispatch("saveselectionasjson", {
|
|
9201
|
-
source: this
|
|
9218
|
+
source: this,
|
|
9219
|
+
methodOfCreation,
|
|
9220
|
+
editorInfo
|
|
9202
9221
|
});
|
|
9203
9222
|
}
|
|
9204
9223
|
#displayFloatingToolbar() {
|
|
@@ -11052,6 +11071,7 @@ class AnnotationEditor {
|
|
|
11052
11071
|
#altText = null;
|
|
11053
11072
|
#comment = null;
|
|
11054
11073
|
#commentStandaloneButton = null;
|
|
11074
|
+
#saveSelectionButton = null;
|
|
11055
11075
|
#disabled = false;
|
|
11056
11076
|
#dragPointerId = null;
|
|
11057
11077
|
#dragPointerType = "";
|
|
@@ -11732,15 +11752,7 @@ class AnnotationEditor {
|
|
|
11732
11752
|
const {
|
|
11733
11753
|
toolbarButtons
|
|
11734
11754
|
} = this;
|
|
11735
|
-
|
|
11736
|
-
for (const [name, tool] of toolbarButtons) {
|
|
11737
|
-
await this._editToolbar.addButton(name, tool);
|
|
11738
|
-
}
|
|
11739
|
-
}
|
|
11740
|
-
if (!this.hasComment) {
|
|
11741
|
-
this._editToolbar.addButton("comment", this.addCommentButton());
|
|
11742
|
-
}
|
|
11743
|
-
this._editToolbar.addButton("delete");
|
|
11755
|
+
this._editToolbar.addButton("save", this.addSaveSelectionButton());
|
|
11744
11756
|
return this._editToolbar;
|
|
11745
11757
|
}
|
|
11746
11758
|
addCommentButtonInToolbar() {
|
|
@@ -11829,6 +11841,62 @@ class AnnotationEditor {
|
|
|
11829
11841
|
hideStandaloneCommentButton() {
|
|
11830
11842
|
this.#commentStandaloneButton?.classList.add("hidden");
|
|
11831
11843
|
}
|
|
11844
|
+
addSaveSelectionButton() {
|
|
11845
|
+
const button = document.createElement("button");
|
|
11846
|
+
button.className = "saveSelectionButton";
|
|
11847
|
+
button.textContent = "Save";
|
|
11848
|
+
button.title = "Save selection as JSON";
|
|
11849
|
+
button.tabIndex = 0;
|
|
11850
|
+
button.addEventListener("click", event => {
|
|
11851
|
+
event.stopPropagation();
|
|
11852
|
+
const editorRect = this.div.getBoundingClientRect();
|
|
11853
|
+
let selectedText = "";
|
|
11854
|
+
if (this.contentText) {
|
|
11855
|
+
selectedText = this.contentText;
|
|
11856
|
+
} else if (this.contentDiv) {
|
|
11857
|
+
selectedText = this.contentDiv.textContent || "";
|
|
11858
|
+
} else {
|
|
11859
|
+
selectedText = this.div.textContent || "";
|
|
11860
|
+
}
|
|
11861
|
+
const editorInfo = {
|
|
11862
|
+
editorId: this.id,
|
|
11863
|
+
editorType: this.editorType,
|
|
11864
|
+
pageIndex: this.pageIndex,
|
|
11865
|
+
pageNumber: this.pageIndex + 1,
|
|
11866
|
+
parent: this.parent,
|
|
11867
|
+
x: this.x,
|
|
11868
|
+
y: this.y,
|
|
11869
|
+
width: this.width,
|
|
11870
|
+
height: this.height,
|
|
11871
|
+
screenRect: {
|
|
11872
|
+
left: editorRect.left,
|
|
11873
|
+
top: editorRect.top,
|
|
11874
|
+
right: editorRect.right,
|
|
11875
|
+
bottom: editorRect.bottom,
|
|
11876
|
+
width: editorRect.width,
|
|
11877
|
+
height: editorRect.height
|
|
11878
|
+
},
|
|
11879
|
+
textContent: selectedText
|
|
11880
|
+
};
|
|
11881
|
+
this._uiManager.saveSelectionAsJson("editor_save_button", editorInfo);
|
|
11882
|
+
});
|
|
11883
|
+
return button;
|
|
11884
|
+
}
|
|
11885
|
+
addSaveButtonInToolbar() {
|
|
11886
|
+
if (this.#saveSelectionButton) {
|
|
11887
|
+
return;
|
|
11888
|
+
}
|
|
11889
|
+
const button = this.addSaveSelectionButton();
|
|
11890
|
+
this._editToolbar?.addSaveButton(button);
|
|
11891
|
+
this.#saveSelectionButton = button;
|
|
11892
|
+
}
|
|
11893
|
+
removeSaveButtonFromToolbar() {
|
|
11894
|
+
if (!this.#saveSelectionButton) {
|
|
11895
|
+
return;
|
|
11896
|
+
}
|
|
11897
|
+
this._editToolbar?.removeSaveButton();
|
|
11898
|
+
this.#saveSelectionButton = null;
|
|
11899
|
+
}
|
|
11832
11900
|
get comment() {
|
|
11833
11901
|
const {
|
|
11834
11902
|
data: {
|
|
@@ -20756,7 +20824,7 @@ function getDocument(src = {}) {
|
|
|
20756
20824
|
}
|
|
20757
20825
|
const docParams = {
|
|
20758
20826
|
docId,
|
|
20759
|
-
apiVersion: "5.4.
|
|
20827
|
+
apiVersion: "5.4.462",
|
|
20760
20828
|
data,
|
|
20761
20829
|
password,
|
|
20762
20830
|
disableAutoFetch,
|
|
@@ -22421,8 +22489,8 @@ class InternalRenderTask {
|
|
|
22421
22489
|
}
|
|
22422
22490
|
}
|
|
22423
22491
|
}
|
|
22424
|
-
const version = "5.4.
|
|
22425
|
-
const build = "
|
|
22492
|
+
const version = "5.4.462";
|
|
22493
|
+
const build = "34e1cb08c";
|
|
22426
22494
|
|
|
22427
22495
|
;// ./src/display/editor/color_picker.js
|
|
22428
22496
|
|
|
@@ -27682,6 +27750,9 @@ class HighlightEditor extends AnnotationEditor {
|
|
|
27682
27750
|
numberOfColors: data.get("color").size
|
|
27683
27751
|
};
|
|
27684
27752
|
}
|
|
27753
|
+
get contentText() {
|
|
27754
|
+
return this.#text;
|
|
27755
|
+
}
|
|
27685
27756
|
#createOutlines() {
|
|
27686
27757
|
const outliner = new HighlightOutliner(this.#boxes, 0.001);
|
|
27687
27758
|
this.#highlightOutlines = outliner.getOutlines();
|