@d-i-t-a/reader 2.1.8 → 2.1.10

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/dist/esm/index.js CHANGED
@@ -39506,17 +39506,7 @@ var TextHighlighter = class {
39506
39506
  toolbox.style.top = ev.clientY + (self2.delegate.attributes?.navHeight ?? 0) + "px";
39507
39507
  toolbox.style.left = ev.clientX + "px";
39508
39508
  if (getComputedStyle(toolbox).display === "none") {
39509
- let noteH = function() {
39510
- self2.delegate.annotationModule?.api?.addCommentToAnnotation(anno).then((result) => {
39511
- self2.delegate.annotationModule?.updateAnnotation(result).then(async () => {
39512
- import_loglevel5.default.log("update highlight " + result.id);
39513
- toolbox.style.display = "none";
39514
- self2.selectionMenuClosed();
39515
- });
39516
- toolbox.style.display = "none";
39517
- self2.selectionMenuClosed();
39518
- });
39519
- }, deleteH = function() {
39509
+ let deleteH = function() {
39520
39510
  if (self2.delegate.rights.enableAnnotations) {
39521
39511
  self2.delegate.annotationModule?.deleteSelectedHighlight(anno).then(async () => {
39522
39512
  import_loglevel5.default.log("delete highlight " + anno.id);
@@ -39551,14 +39541,6 @@ var TextHighlighter = class {
39551
39541
  }
39552
39542
  if (commentIcon) {
39553
39543
  commentIcon.style.display = "none";
39554
- let clone = commentIcon.cloneNode(true);
39555
- let parent = commentIcon.parentElement;
39556
- clone.style.display = "unset";
39557
- clone.id = "cloneCommentIcon";
39558
- clone.addEventListener("click", noteH, false);
39559
- if (parent) {
39560
- parent.append(clone);
39561
- }
39562
39544
  }
39563
39545
  let deleteIcon = document.getElementById("deleteIcon");
39564
39546
  let cloneDeleteIcon = document.getElementById("cloneDeleteIcon");
@@ -48284,24 +48266,30 @@ var HistoryModule = class {
48284
48266
  addEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
48285
48267
  }
48286
48268
  async handleHistoryForwardClick(event) {
48269
+ await this.historyForward();
48270
+ event.preventDefault();
48271
+ event.stopPropagation();
48272
+ }
48273
+ async historyForward() {
48287
48274
  if (this.history.length > 0) {
48288
48275
  if (this.historyCurrentIndex + 1 < this.history.length) {
48289
48276
  this.historyCurrentIndex = this.historyCurrentIndex + 1;
48290
48277
  await this.delegate.navigate(this.history[this.historyCurrentIndex], false);
48291
48278
  }
48292
48279
  }
48280
+ }
48281
+ async handleHistoryBackClick(event) {
48282
+ await this.historyBack();
48293
48283
  event.preventDefault();
48294
48284
  event.stopPropagation();
48295
48285
  }
48296
- async handleHistoryBackClick(event) {
48286
+ async historyBack() {
48297
48287
  if (this.history.length > 0) {
48298
48288
  if (this.historyCurrentIndex > 0) {
48299
48289
  this.historyCurrentIndex = this.historyCurrentIndex - 1;
48300
48290
  await this.delegate.navigate(this.history[this.historyCurrentIndex], false);
48301
48291
  }
48302
48292
  }
48303
- event.preventDefault();
48304
- event.stopPropagation();
48305
48293
  }
48306
48294
  };
48307
48295
 
@@ -48627,6 +48615,12 @@ var D2Reader = class {
48627
48615
  this.addDefinition = async (definition) => {
48628
48616
  await this.definitionsModule?.addDefinition(definition);
48629
48617
  };
48618
+ this.historyBack = async () => {
48619
+ return this.historyModule?.historyBack();
48620
+ };
48621
+ this.historyForward = async () => {
48622
+ return this.historyModule?.historyForward();
48623
+ };
48630
48624
  this.search = async (term, current) => {
48631
48625
  return await this.searchModule?.search(term, current) ?? [];
48632
48626
  };
@@ -48944,6 +48938,12 @@ var D2Reader = class {
48944
48938
  get annotations() {
48945
48939
  return this.annotationModule?.getAnnotations();
48946
48940
  }
48941
+ get history() {
48942
+ return this.historyModule?.history;
48943
+ }
48944
+ get historyCurrentIndex() {
48945
+ return this.historyModule?.historyCurrentIndex;
48946
+ }
48947
48947
  get currentResource() {
48948
48948
  return this.navigator.currentResource();
48949
48949
  }