pdfjs-viewer-highlight-echo 5.4.457 → 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.
package/build/pdf.mjs CHANGED
@@ -21,8 +21,8 @@
21
21
  */
22
22
 
23
23
  /**
24
- * pdfjsVersion = 5.4.457
25
- * pdfjsBuild = d53d4404b
24
+ * pdfjsVersion = 5.4.460
25
+ * pdfjsBuild = 8489d7097
26
26
  */
27
27
  /******/ // The require scope
28
28
  /******/ var __webpack_require__ = {};
@@ -1988,6 +1988,18 @@ class EditorToolbar {
1988
1988
  }
1989
1989
  this.#buttons.append(button);
1990
1990
  }
1991
+ addSaveButton(saveButton) {
1992
+ if (!saveButton) {
1993
+ return;
1994
+ }
1995
+ saveButton.classList.add("basic", "saveButton");
1996
+ this.#addListenersToElement(saveButton);
1997
+ this.#buttons.append(saveButton);
1998
+ }
1999
+ removeSaveButton() {
2000
+ const saveButton = this.#buttons.querySelector(".saveButton");
2001
+ saveButton?.remove();
2002
+ }
1991
2003
  get #divider() {
1992
2004
  const divider = document.createElement("div");
1993
2005
  divider.className = "divider";
@@ -2067,6 +2079,11 @@ class EditorToolbar {
2067
2079
  this.addComment(tool);
2068
2080
  }
2069
2081
  break;
2082
+ case "save":
2083
+ if (tool) {
2084
+ this.addSaveButton(tool);
2085
+ }
2086
+ break;
2070
2087
  }
2071
2088
  }
2072
2089
  async addButtonBefore(name, tool, beforeSelector) {
@@ -3116,9 +3133,11 @@ class AnnotationEditorUIManager {
3116
3133
  navigator.clipboard.writeText(selectedText).catch(() => {});
3117
3134
  this.#floatingToolbar?.hide();
3118
3135
  }
3119
- saveSelectionAsJson(methodOfCreation = "") {
3136
+ saveSelectionAsJson(methodOfCreation = "", editorInfo = null) {
3120
3137
  this._eventBus.dispatch("saveselectionasjson", {
3121
- source: this
3138
+ source: this,
3139
+ methodOfCreation,
3140
+ editorInfo
3122
3141
  });
3123
3142
  }
3124
3143
  #displayFloatingToolbar() {
@@ -4972,6 +4991,7 @@ class AnnotationEditor {
4972
4991
  #altText = null;
4973
4992
  #comment = null;
4974
4993
  #commentStandaloneButton = null;
4994
+ #saveSelectionButton = null;
4975
4995
  #disabled = false;
4976
4996
  #dragPointerId = null;
4977
4997
  #dragPointerType = "";
@@ -5652,15 +5672,7 @@ class AnnotationEditor {
5652
5672
  const {
5653
5673
  toolbarButtons
5654
5674
  } = this;
5655
- if (toolbarButtons) {
5656
- for (const [name, tool] of toolbarButtons) {
5657
- await this._editToolbar.addButton(name, tool);
5658
- }
5659
- }
5660
- if (!this.hasComment) {
5661
- this._editToolbar.addButton("comment", this.addCommentButton());
5662
- }
5663
- this._editToolbar.addButton("delete");
5675
+ this._editToolbar.addButton("save", this.addSaveSelectionButton());
5664
5676
  return this._editToolbar;
5665
5677
  }
5666
5678
  addCommentButtonInToolbar() {
@@ -5749,6 +5761,54 @@ class AnnotationEditor {
5749
5761
  hideStandaloneCommentButton() {
5750
5762
  this.#commentStandaloneButton?.classList.add("hidden");
5751
5763
  }
5764
+ addSaveSelectionButton() {
5765
+ const button = document.createElement("button");
5766
+ button.className = "saveSelectionButton";
5767
+ button.textContent = "Save";
5768
+ button.title = "Save selection as JSON";
5769
+ button.tabIndex = 0;
5770
+ button.addEventListener("click", event => {
5771
+ event.stopPropagation();
5772
+ const editorRect = this.div.getBoundingClientRect();
5773
+ const editorInfo = {
5774
+ editorId: this.id,
5775
+ editorType: this.editorType,
5776
+ pageIndex: this.pageIndex,
5777
+ pageNumber: this.pageIndex + 1,
5778
+ parent: this.parent,
5779
+ x: this.x,
5780
+ y: this.y,
5781
+ width: this.width,
5782
+ height: this.height,
5783
+ screenRect: {
5784
+ left: editorRect.left,
5785
+ top: editorRect.top,
5786
+ right: editorRect.right,
5787
+ bottom: editorRect.bottom,
5788
+ width: editorRect.width,
5789
+ height: editorRect.height
5790
+ },
5791
+ textContent: this.div.textContent || ""
5792
+ };
5793
+ this._uiManager.saveSelectionAsJson("editor_save_button", editorInfo);
5794
+ });
5795
+ return button;
5796
+ }
5797
+ addSaveButtonInToolbar() {
5798
+ if (this.#saveSelectionButton) {
5799
+ return;
5800
+ }
5801
+ const button = this.addSaveSelectionButton();
5802
+ this._editToolbar?.addSaveButton(button);
5803
+ this.#saveSelectionButton = button;
5804
+ }
5805
+ removeSaveButtonFromToolbar() {
5806
+ if (!this.#saveSelectionButton) {
5807
+ return;
5808
+ }
5809
+ this._editToolbar?.removeSaveButton();
5810
+ this.#saveSelectionButton = null;
5811
+ }
5752
5812
  get comment() {
5753
5813
  const {
5754
5814
  data: {
@@ -14437,7 +14497,7 @@ function getDocument(src = {}) {
14437
14497
  }
14438
14498
  const docParams = {
14439
14499
  docId,
14440
- apiVersion: "5.4.457",
14500
+ apiVersion: "5.4.460",
14441
14501
  data,
14442
14502
  password,
14443
14503
  disableAutoFetch,
@@ -16102,8 +16162,8 @@ class InternalRenderTask {
16102
16162
  }
16103
16163
  }
16104
16164
  }
16105
- const version = "5.4.457";
16106
- const build = "d53d4404b";
16165
+ const version = "5.4.460";
16166
+ const build = "8489d7097";
16107
16167
 
16108
16168
  ;// ./src/display/editor/color_picker.js
16109
16169