@d-i-t-a/reader 2.4.8 → 2.4.9

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
@@ -46466,46 +46466,62 @@ var EventHandler = class {
46466
46466
  );
46467
46467
  return isEpubInternal;
46468
46468
  };
46469
+ this.clicks = 0;
46470
+ this.clickTimer = 0;
46471
+ this.dblClickTimeSpan = 300;
46469
46472
  this.handleLinks = async (event) => {
46470
- var _a;
46471
46473
  import_loglevel.default.log("R2 Click Handler");
46472
- const link = this.checkForLink(event);
46473
- if (link) {
46474
- const isSameOrigin = window.location.protocol === link.protocol && window.location.port === link.port && window.location.hostname === link.hostname;
46475
- const isEpubInternal = this.isReadingOrderInternal(link);
46476
- const isResourceInternal = this.isResourceInternal(link);
46477
- if (!isResourceInternal) {
46478
- await this.popup.hidePopover();
46479
- }
46480
- const isInternal = link.href.indexOf("#");
46481
- if (!isEpubInternal && !isResourceInternal) {
46482
- window.open(link.href, link.target ?? "_blank");
46483
- event.preventDefault();
46484
- event.stopPropagation();
46485
- } else {
46486
- event.target.href = link.href;
46487
- if ((isSameOrigin || isEpubInternal) && isInternal !== -1) {
46488
- const link2 = event.target;
46489
- if (link2) {
46490
- const attribute = link2.getAttribute("epub:type") === "noteref";
46491
- if (attribute) {
46492
- await this.popup.handleFootnote(link2, event);
46493
- } else if (isResourceInternal && !isEpubInternal) {
46494
- await this.popup.showPopover(link2, event);
46495
- } else {
46474
+ this.clicks++;
46475
+ if (this.clicks === 1) {
46476
+ this.clickTimer = setTimeout(async () => {
46477
+ this.clicks = 0;
46478
+ const link = this.checkForLink(event);
46479
+ if (link) {
46480
+ const isSameOrigin = window.location.protocol === link.protocol && window.location.port === link.port && window.location.hostname === link.hostname;
46481
+ const isEpubInternal = this.isReadingOrderInternal(link);
46482
+ const isResourceInternal = this.isResourceInternal(link);
46483
+ if (!isResourceInternal) {
46484
+ await this.popup.hidePopover();
46485
+ }
46486
+ const isInternal = link.href.indexOf("#");
46487
+ if (!isEpubInternal && !isResourceInternal) {
46488
+ window.open(link.href, link.target ?? "_blank");
46489
+ event.preventDefault();
46490
+ event.stopPropagation();
46491
+ } else {
46492
+ event.target.href = link.href;
46493
+ if ((isSameOrigin || isEpubInternal) && isInternal !== -1) {
46494
+ const link2 = event.target;
46495
+ if (link2) {
46496
+ const attribute = link2.getAttribute("epub:type") === "noteref";
46497
+ if (attribute) {
46498
+ await this.popup.handleFootnote(link2, event);
46499
+ } else if (isResourceInternal && !isEpubInternal) {
46500
+ await this.popup.showPopover(link2, event);
46501
+ } else {
46502
+ this.onInternalLink(event);
46503
+ }
46504
+ } else {
46505
+ this.onInternalLink(event);
46506
+ }
46507
+ } else if ((isSameOrigin || isEpubInternal) && isInternal === -1) {
46496
46508
  this.onInternalLink(event);
46497
46509
  }
46498
- } else {
46499
- this.onInternalLink(event);
46500
46510
  }
46501
- } else if ((isSameOrigin || isEpubInternal) && isInternal === -1) {
46502
- this.onInternalLink(event);
46511
+ } else {
46512
+ setTimeout(() => {
46513
+ var _a;
46514
+ console.log("event.detail", event.detail);
46515
+ if (!((_a = this.navigator.highlighter) == null ? void 0 : _a.isSelectionMenuOpen) && event.detail === 1) {
46516
+ this.onClickThrough(event);
46517
+ }
46518
+ }, 100);
46503
46519
  }
46504
- }
46505
- } else {
46506
- if (!((_a = this.navigator.highlighter) == null ? void 0 : _a.isSelectionMenuOpen)) {
46507
- this.onClickThrough(event);
46508
- }
46520
+ }, this.dblClickTimeSpan);
46521
+ }
46522
+ if (this.clicks === 2) {
46523
+ clearTimeout(this.clickTimer);
46524
+ this.clicks = 0;
46509
46525
  }
46510
46526
  };
46511
46527
  this.navigator = navigator2;
@@ -50318,6 +50334,7 @@ var TextHighlighter = class _TextHighlighter {
50318
50334
  );
50319
50335
  switch (mode) {
50320
50336
  case "colors":
50337
+ this.selectionMenuOpened();
50321
50338
  if (toolboxColorsOptions)
50322
50339
  toolboxColorsOptions.style.display = "unset";
50323
50340
  if (toolboxAddOptions)
@@ -50328,6 +50345,7 @@ var TextHighlighter = class _TextHighlighter {
50328
50345
  toolboxMarkOptions.style.display = "none";
50329
50346
  break;
50330
50347
  case "edit":
50348
+ this.selectionMenuOpened();
50331
50349
  if (toolboxColorsOptions)
50332
50350
  toolboxColorsOptions.style.display = "none";
50333
50351
  if (toolboxAddOptions)
@@ -50338,6 +50356,7 @@ var TextHighlighter = class _TextHighlighter {
50338
50356
  toolboxMarkOptions.style.display = "none";
50339
50357
  break;
50340
50358
  case "action":
50359
+ this.selectionMenuOpened();
50341
50360
  if (toolboxColorsOptions)
50342
50361
  toolboxColorsOptions.style.display = "none";
50343
50362
  if (toolboxAddOptions)
@@ -50348,6 +50367,7 @@ var TextHighlighter = class _TextHighlighter {
50348
50367
  toolboxMarkOptions.style.display = "unset";
50349
50368
  break;
50350
50369
  default:
50370
+ this.selectionMenuOpened();
50351
50371
  if (toolboxColorsOptions)
50352
50372
  toolboxColorsOptions.style.display = "none";
50353
50373
  if (toolboxAddOptions)