@d-i-t-a/reader 2.3.17 → 2.4.0

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
@@ -345,39 +345,65 @@ var require_implementation = __commonJS({
345
345
  "use strict";
346
346
  init_polyfills();
347
347
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
348
- var slice = Array.prototype.slice;
349
348
  var toStr = Object.prototype.toString;
349
+ var max = Math.max;
350
350
  var funcType = "[object Function]";
351
+ var concatty = function concatty2(a, b) {
352
+ var arr = [];
353
+ for (var i = 0; i < a.length; i += 1) {
354
+ arr[i] = a[i];
355
+ }
356
+ for (var j = 0; j < b.length; j += 1) {
357
+ arr[j + a.length] = b[j];
358
+ }
359
+ return arr;
360
+ };
361
+ var slicy = function slicy2(arrLike, offset) {
362
+ var arr = [];
363
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
364
+ arr[j] = arrLike[i];
365
+ }
366
+ return arr;
367
+ };
368
+ var joiny = function(arr, joiner) {
369
+ var str = "";
370
+ for (var i = 0; i < arr.length; i += 1) {
371
+ str += arr[i];
372
+ if (i + 1 < arr.length) {
373
+ str += joiner;
374
+ }
375
+ }
376
+ return str;
377
+ };
351
378
  module2.exports = function bind(that) {
352
379
  var target = this;
353
- if (typeof target !== "function" || toStr.call(target) !== funcType) {
380
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
354
381
  throw new TypeError(ERROR_MESSAGE + target);
355
382
  }
356
- var args = slice.call(arguments, 1);
383
+ var args = slicy(arguments, 1);
357
384
  var bound;
358
385
  var binder = function() {
359
386
  if (this instanceof bound) {
360
387
  var result = target.apply(
361
388
  this,
362
- args.concat(slice.call(arguments))
389
+ concatty(args, arguments)
363
390
  );
364
391
  if (Object(result) === result) {
365
392
  return result;
366
393
  }
367
394
  return this;
368
- } else {
369
- return target.apply(
370
- that,
371
- args.concat(slice.call(arguments))
372
- );
373
395
  }
396
+ return target.apply(
397
+ that,
398
+ concatty(args, arguments)
399
+ );
374
400
  };
375
- var boundLength = Math.max(0, target.length - args.length);
401
+ var boundLength = max(0, target.length - args.length);
376
402
  var boundArgs = [];
377
403
  for (var i = 0; i < boundLength; i++) {
378
- boundArgs.push("$" + i);
404
+ boundArgs[i] = "$" + i;
379
405
  }
380
- bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
406
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
381
407
  if (target.prototype) {
382
408
  var Empty = function Empty2() {
383
409
  };
@@ -55198,8 +55224,16 @@ var TextHighlighter = class _TextHighlighter {
55198
55224
  this.hasEventListener = true;
55199
55225
  }
55200
55226
  async mousedown(ev) {
55227
+ var _a;
55201
55228
  lastMouseDownX = ev.clientX;
55202
55229
  lastMouseDownY = ev.clientY;
55230
+ if ((_a = this.properties) == null ? void 0 : _a.preventScrollOnSelection) {
55231
+ const wrapper = findRequiredElement(
55232
+ document,
55233
+ "#iframe-wrapper"
55234
+ );
55235
+ wrapper.style.overflow = "hidden";
55236
+ }
55203
55237
  }
55204
55238
  async mouseup(ev) {
55205
55239
  if (Math.abs(lastMouseDownX - ev.clientX) < 3 && Math.abs(lastMouseDownY - ev.clientY) < 3) {
@@ -55415,10 +55449,18 @@ var TextHighlighter = class _TextHighlighter {
55415
55449
  }
55416
55450
  }
55417
55451
  toolboxHide() {
55452
+ var _a;
55418
55453
  let toolbox = document.getElementById("highlight-toolbox");
55419
55454
  if (toolbox)
55420
55455
  toolbox.style.display = "none";
55421
55456
  this.selectionMenuClosed();
55457
+ if ((_a = this.properties) == null ? void 0 : _a.preventScrollOnSelection) {
55458
+ const wrapper = findRequiredElement(
55459
+ document,
55460
+ "#iframe-wrapper"
55461
+ );
55462
+ wrapper.style.overflow = "auto";
55463
+ }
55422
55464
  }
55423
55465
  // Use short timeout to let the selection updated to 'finish', otherwise some
55424
55466
  // browsers can get wrong or incomplete selection data.