@d-i-t-a/reader 2.3.11 → 2.3.12

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
@@ -50771,6 +50771,12 @@ var NODE_TYPE = {
50771
50771
  ELEMENT_NODE: 1,
50772
50772
  TEXT_NODE: 3
50773
50773
  };
50774
+ var MenuPosition;
50775
+ (function(MenuPosition2) {
50776
+ MenuPosition2["INLINE"] = "inline";
50777
+ MenuPosition2["TOP"] = "top";
50778
+ MenuPosition2["BOTTOM"] = "bottom";
50779
+ })(MenuPosition || (MenuPosition = {}));
50774
50780
  var _blacklistIdClassForCssSelectors = [
50775
50781
  HighlightContainer.R2_ID_HIGHLIGHTS_CONTAINER,
50776
50782
  HighlightContainer.R2_ID_PAGEBREAK_CONTAINER,
@@ -50828,6 +50834,9 @@ var TextHighlighter = class {
50828
50834
  };
50829
50835
  this.layerSettings = layerSettings;
50830
50836
  this.properties = properties;
50837
+ if (this.properties.menuPosition == void 0) {
50838
+ this.properties.menuPosition = MenuPosition.INLINE;
50839
+ }
50831
50840
  this.api = api;
50832
50841
  this.hasEventListener = hasEventListener;
50833
50842
  this.options = this.defaults(options, {
@@ -51407,13 +51416,27 @@ var TextHighlighter = class {
51407
51416
  let rect = range.getBoundingClientRect();
51408
51417
  let toolbox = document.getElementById("highlight-toolbox");
51409
51418
  if (toolbox) {
51410
- const paginated = this.navigator.view?.isPaginated();
51411
- if (paginated) {
51412
- toolbox.style.top = rect.top + (this.navigator.attributes?.navHeight ?? 0) + "px";
51419
+ if (this.properties?.menuPosition === MenuPosition.TOP) {
51420
+ toolbox.style.left = "0px";
51421
+ toolbox.style.transform = "revert";
51422
+ toolbox.style.width = "100%";
51423
+ toolbox.style.textAlign = "center";
51424
+ } else if (this.properties?.menuPosition === MenuPosition.BOTTOM) {
51425
+ toolbox.style.bottom = "0px";
51426
+ toolbox.style.left = "0px";
51427
+ toolbox.style.transform = "revert";
51428
+ toolbox.style.width = "100%";
51429
+ toolbox.style.textAlign = "center";
51430
+ toolbox.style.position = "absolute";
51413
51431
  } else {
51414
- toolbox.style.top = rect.top + "px";
51432
+ const paginated = this.navigator.view?.isPaginated();
51433
+ if (paginated) {
51434
+ toolbox.style.top = rect.top + (this.navigator.attributes?.navHeight ?? 0) + "px";
51435
+ } else {
51436
+ toolbox.style.top = rect.top + "px";
51437
+ }
51438
+ toolbox.style.left = (rect.right - rect.left) / 2 + rect.left + "px";
51415
51439
  }
51416
- toolbox.style.left = (rect.right - rect.left) / 2 + rect.left + "px";
51417
51440
  }
51418
51441
  }
51419
51442
  toolboxHandler() {