pdfjs-viewer-highlight-echo 5.4.456 → 5.4.460

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.
@@ -21,8 +21,8 @@
21
21
  */
22
22
 
23
23
  /**
24
- * pdfjsVersion = 5.4.456
25
- * pdfjsBuild = 01b61ef1d
24
+ * pdfjsVersion = 5.4.460
25
+ * pdfjsBuild = 8489d7097
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
- if (toolbarButtons) {
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,54 @@ 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
+ const editorInfo = {
11854
+ editorId: this.id,
11855
+ editorType: this.editorType,
11856
+ pageIndex: this.pageIndex,
11857
+ pageNumber: this.pageIndex + 1,
11858
+ parent: this.parent,
11859
+ x: this.x,
11860
+ y: this.y,
11861
+ width: this.width,
11862
+ height: this.height,
11863
+ screenRect: {
11864
+ left: editorRect.left,
11865
+ top: editorRect.top,
11866
+ right: editorRect.right,
11867
+ bottom: editorRect.bottom,
11868
+ width: editorRect.width,
11869
+ height: editorRect.height
11870
+ },
11871
+ textContent: this.div.textContent || ""
11872
+ };
11873
+ this._uiManager.saveSelectionAsJson("editor_save_button", editorInfo);
11874
+ });
11875
+ return button;
11876
+ }
11877
+ addSaveButtonInToolbar() {
11878
+ if (this.#saveSelectionButton) {
11879
+ return;
11880
+ }
11881
+ const button = this.addSaveSelectionButton();
11882
+ this._editToolbar?.addSaveButton(button);
11883
+ this.#saveSelectionButton = button;
11884
+ }
11885
+ removeSaveButtonFromToolbar() {
11886
+ if (!this.#saveSelectionButton) {
11887
+ return;
11888
+ }
11889
+ this._editToolbar?.removeSaveButton();
11890
+ this.#saveSelectionButton = null;
11891
+ }
11832
11892
  get comment() {
11833
11893
  const {
11834
11894
  data: {
@@ -20756,7 +20816,7 @@ function getDocument(src = {}) {
20756
20816
  }
20757
20817
  const docParams = {
20758
20818
  docId,
20759
- apiVersion: "5.4.456",
20819
+ apiVersion: "5.4.460",
20760
20820
  data,
20761
20821
  password,
20762
20822
  disableAutoFetch,
@@ -22421,8 +22481,8 @@ class InternalRenderTask {
22421
22481
  }
22422
22482
  }
22423
22483
  }
22424
- const version = "5.4.456";
22425
- const build = "01b61ef1d";
22484
+ const version = "5.4.460";
22485
+ const build = "8489d7097";
22426
22486
 
22427
22487
  ;// ./src/display/editor/color_picker.js
22428
22488