@hailin-zheng/editor-core 2.0.54 → 2.1.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/index.js CHANGED
@@ -26232,7 +26232,14 @@ class EditorCalendarVNode {
26232
26232
  elm.style.left = (position.x - elmRect.width + 10) + 'px';
26233
26233
  }
26234
26234
  if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
26235
- elm.style.top = (position.y - position.height - elmRect.height) + 'px';
26235
+ const newTop = position.y - position.height - elmRect.height;
26236
+ const oldTop = position.y + 5 + position.height;
26237
+ //计算前后的高度的差距,然后判断新的值是否在父元素的范围内,如果不在则使用旧的值
26238
+ if (oldTop - newTop < elmRect.top - parentRect.top) {
26239
+ elm.style.top = (position.y - position.height - elmRect.height) + 'px';
26240
+ }
26241
+ //elm.style.top = (top - (elmRect.top + elmRect.height - (parentRect.top + parentRect.height))) + 'px';
26242
+ //elm.style.top = (position.y - position.height - elmRect.height) + 'px';
26236
26243
  }
26237
26244
  }
26238
26245
  }
@@ -27129,7 +27136,8 @@ class DocEditor {
27129
27136
  sel: 'div.scale-container', data: {
27130
27137
  style: {
27131
27138
  transform: 'scale(' + this.viewOptions.scale + ')',
27132
- transformOrigin: 'left top'
27139
+ transformOrigin: 'right top',
27140
+ width: this.viewOptions.docPageSettings.width + 'px',
27133
27141
  }
27134
27142
  },
27135
27143
  children: [docContentVNode, inputVNode, dropContainer]
@@ -27240,8 +27248,8 @@ class DocEditor {
27240
27248
  this.contentChanged.next();
27241
27249
  }
27242
27250
  this.updateSelection();
27243
- this.onShouldRender.next();
27244
27251
  this.setCursor();
27252
+ this.onShouldRender.next();
27245
27253
  //this.refreshView();
27246
27254
  }
27247
27255
  /**
@@ -27385,12 +27393,12 @@ class DocEditor {
27385
27393
  */
27386
27394
  docClickHandle(evt) {
27387
27395
  this.hiddenInput();
27388
- this.setCursor();
27389
- this.updateSelection();
27396
+ // this.setCursor();
27397
+ // this.updateSelection();
27398
+ this.refreshDocument();
27390
27399
  this.onClickEvent.next(evt);
27391
27400
  if (this.menusData) {
27392
27401
  this.menusData = null;
27393
- this.onChange();
27394
27402
  }
27395
27403
  }
27396
27404
  /**
@@ -27479,7 +27487,9 @@ class DocEditor {
27479
27487
  elementEvent.source = startControl;
27480
27488
  DocumentEvent.invokeEvent('ElementContextMenu', startControl, elementEvent, 'All');
27481
27489
  //const position = {x: evt.offsetX + 10, y: evt.offsetY, translateY: this.viewOptions.pageOffset.y};
27482
- const pos = ElementUtil.getMousePos(evt);
27490
+ const pos = ElementUtil.getMousePos(evt, this.viewOptions.scale);
27491
+ pos.x += 10;
27492
+ pos.y -= 10;
27483
27493
  this.menusData = {
27484
27494
  position: pos,
27485
27495
  menus: elementEvent.menus
@@ -28054,6 +28064,7 @@ class DocEditor {
28054
28064
  style: {
28055
28065
  height: '0px',
28056
28066
  position: 'relative',
28067
+ width: '0px',
28057
28068
  'user-select': 'none',
28058
28069
  },
28059
28070
  on: this.documentEvent.getEventListener()
@@ -28362,7 +28373,7 @@ class DocEditor {
28362
28373
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28363
28374
  }
28364
28375
  version() {
28365
- return "2.0.54";
28376
+ return "2.1.0";
28366
28377
  }
28367
28378
  }
28368
28379