@hufe921/canvas-editor 0.9.126 → 0.9.127

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [0.9.127](https://github.com/Hufe921/canvas-editor/compare/v0.9.126...v0.9.127) (2026-02-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * format elements error in executeComputeElementListHeight api #1356 ([6fe3e70](https://github.com/Hufe921/canvas-editor/commit/6fe3e70d801a34337814e936ebe83349fe8d2684)), closes [#1356](https://github.com/Hufe921/canvas-editor/issues/1356)
7
+ * move cursor to the visible range boundary error ([2c01b92](https://github.com/Hufe921/canvas-editor/commit/2c01b929be8bd58560bb3c1c99292f0b4fff4eae))
8
+
9
+
10
+
1
11
  ## [0.9.126](https://github.com/Hufe921/canvas-editor/compare/v0.9.125...v0.9.126) (2026-02-12)
2
12
 
3
13
 
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
23
23
  return value;
24
24
  };
25
25
  var index = "";
26
- const version = "0.9.126";
26
+ const version = "0.9.127";
27
27
  var MaxHeightRatio;
28
28
  (function(MaxHeightRatio2) {
29
29
  MaxHeightRatio2["HALF"] = "half";
@@ -463,163 +463,6 @@ function scrollIntoView(container, selected) {
463
463
  container.scrollTop = bottom - container.clientHeight;
464
464
  }
465
465
  }
466
- var browser = { exports: {} };
467
- var process = browser.exports = {};
468
- var cachedSetTimeout;
469
- var cachedClearTimeout;
470
- function defaultSetTimout() {
471
- throw new Error("setTimeout has not been defined");
472
- }
473
- function defaultClearTimeout() {
474
- throw new Error("clearTimeout has not been defined");
475
- }
476
- (function() {
477
- try {
478
- if (typeof setTimeout === "function") {
479
- cachedSetTimeout = setTimeout;
480
- } else {
481
- cachedSetTimeout = defaultSetTimout;
482
- }
483
- } catch (e) {
484
- cachedSetTimeout = defaultSetTimout;
485
- }
486
- try {
487
- if (typeof clearTimeout === "function") {
488
- cachedClearTimeout = clearTimeout;
489
- } else {
490
- cachedClearTimeout = defaultClearTimeout;
491
- }
492
- } catch (e) {
493
- cachedClearTimeout = defaultClearTimeout;
494
- }
495
- })();
496
- function runTimeout(fun) {
497
- if (cachedSetTimeout === setTimeout) {
498
- return setTimeout(fun, 0);
499
- }
500
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
501
- cachedSetTimeout = setTimeout;
502
- return setTimeout(fun, 0);
503
- }
504
- try {
505
- return cachedSetTimeout(fun, 0);
506
- } catch (e) {
507
- try {
508
- return cachedSetTimeout.call(null, fun, 0);
509
- } catch (e2) {
510
- return cachedSetTimeout.call(this, fun, 0);
511
- }
512
- }
513
- }
514
- function runClearTimeout(marker) {
515
- if (cachedClearTimeout === clearTimeout) {
516
- return clearTimeout(marker);
517
- }
518
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
519
- cachedClearTimeout = clearTimeout;
520
- return clearTimeout(marker);
521
- }
522
- try {
523
- return cachedClearTimeout(marker);
524
- } catch (e) {
525
- try {
526
- return cachedClearTimeout.call(null, marker);
527
- } catch (e2) {
528
- return cachedClearTimeout.call(this, marker);
529
- }
530
- }
531
- }
532
- var queue = [];
533
- var draining = false;
534
- var currentQueue;
535
- var queueIndex = -1;
536
- function cleanUpNextTick() {
537
- if (!draining || !currentQueue) {
538
- return;
539
- }
540
- draining = false;
541
- if (currentQueue.length) {
542
- queue = currentQueue.concat(queue);
543
- } else {
544
- queueIndex = -1;
545
- }
546
- if (queue.length) {
547
- drainQueue();
548
- }
549
- }
550
- function drainQueue() {
551
- if (draining) {
552
- return;
553
- }
554
- var timeout = runTimeout(cleanUpNextTick);
555
- draining = true;
556
- var len = queue.length;
557
- while (len) {
558
- currentQueue = queue;
559
- queue = [];
560
- while (++queueIndex < len) {
561
- if (currentQueue) {
562
- currentQueue[queueIndex].run();
563
- }
564
- }
565
- queueIndex = -1;
566
- len = queue.length;
567
- }
568
- currentQueue = null;
569
- draining = false;
570
- runClearTimeout(timeout);
571
- }
572
- process.nextTick = function(fun) {
573
- var args = new Array(arguments.length - 1);
574
- if (arguments.length > 1) {
575
- for (var i = 1; i < arguments.length; i++) {
576
- args[i - 1] = arguments[i];
577
- }
578
- }
579
- queue.push(new Item(fun, args));
580
- if (queue.length === 1 && !draining) {
581
- runTimeout(drainQueue);
582
- }
583
- };
584
- function Item(fun, array) {
585
- this.fun = fun;
586
- this.array = array;
587
- }
588
- Item.prototype.run = function() {
589
- this.fun.apply(null, this.array);
590
- };
591
- process.title = "browser";
592
- process.browser = true;
593
- process.env = {};
594
- process.argv = [];
595
- process.version = "";
596
- process.versions = {};
597
- function noop() {
598
- }
599
- process.on = noop;
600
- process.addListener = noop;
601
- process.once = noop;
602
- process.off = noop;
603
- process.removeListener = noop;
604
- process.removeAllListeners = noop;
605
- process.emit = noop;
606
- process.prependListener = noop;
607
- process.prependOnceListener = noop;
608
- process.listeners = function(name) {
609
- return [];
610
- };
611
- process.binding = function(name) {
612
- throw new Error("process.binding is not supported");
613
- };
614
- process.cwd = function() {
615
- return "/";
616
- };
617
- process.chdir = function(dir) {
618
- throw new Error("process.chdir is not supported");
619
- };
620
- process.umask = function() {
621
- return 0;
622
- };
623
466
  const CURSOR_AGENT_OFFSET_HEIGHT = 12;
624
467
  const defaultCursorOption = {
625
468
  width: 1,
@@ -6416,7 +6259,7 @@ class Cursor {
6416
6259
  } else {
6417
6260
  this._clearBlinkTimeout();
6418
6261
  }
6419
- browser.exports.nextTick(() => {
6262
+ nextTick(() => {
6420
6263
  this.moveCursorToVisible({
6421
6264
  cursorPosition,
6422
6265
  direction: parseInt(oldTop) > cursorTop ? MoveDirection.UP : MoveDirection.DOWN
@@ -6432,10 +6275,6 @@ class Cursor {
6432
6275
  if (!cursorPosition || !direction)
6433
6276
  return;
6434
6277
  const { pageNo, coordinate: { leftTop, leftBottom } } = cursorPosition;
6435
- const prePageY = pageNo * (this.draw.getHeight() + this.draw.getPageGap()) + this.container.getBoundingClientRect().top;
6436
- const isUp = direction === MoveDirection.UP;
6437
- const x = leftBottom[0];
6438
- const y = isUp ? leftTop[1] + prePageY : leftBottom[1] + prePageY;
6439
6278
  const scrollContainer = findScrollContainer(this.container);
6440
6279
  const rect = {
6441
6280
  left: 0,
@@ -6443,7 +6282,8 @@ class Cursor {
6443
6282
  top: 0,
6444
6283
  bottom: 0
6445
6284
  };
6446
- if (scrollContainer === document.documentElement) {
6285
+ const isDocumentScroll = scrollContainer === document.documentElement;
6286
+ if (isDocumentScroll) {
6447
6287
  rect.right = window.innerWidth;
6448
6288
  rect.bottom = window.innerHeight;
6449
6289
  } else {
@@ -6453,6 +6293,10 @@ class Cursor {
6453
6293
  rect.top = top;
6454
6294
  rect.bottom = bottom;
6455
6295
  }
6296
+ const prePageY = pageNo * (this.draw.getHeight() + this.draw.getPageGap()) + this.container.getBoundingClientRect().top;
6297
+ const isUp = direction === MoveDirection.UP;
6298
+ const x = leftBottom[0] + (isDocumentScroll ? 0 : rect.left);
6299
+ const y = isUp ? leftTop[1] + prePageY : leftBottom[1] + prePageY;
6456
6300
  const { maskMargin } = this.options;
6457
6301
  rect.top += maskMargin[0];
6458
6302
  rect.bottom -= maskMargin[2];
@@ -22785,6 +22629,10 @@ class CommandAdapt {
22785
22629
  if (innerWidth <= 0)
22786
22630
  return 0;
22787
22631
  const targetElementList = deepClone(elementList);
22632
+ formatElementList(targetElementList, {
22633
+ isHandleFirstElement: false,
22634
+ editorOptions: this.options
22635
+ });
22788
22636
  const surroundElementList = pickSurroundElementList(targetElementList);
22789
22637
  const rowList = this.draw.computeRowList({
22790
22638
  innerWidth,