@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-cjs.js CHANGED
@@ -26262,7 +26262,14 @@ class EditorCalendarVNode {
26262
26262
  elm.style.left = (position.x - elmRect.width + 10) + 'px';
26263
26263
  }
26264
26264
  if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
26265
- elm.style.top = (position.y - position.height - elmRect.height) + 'px';
26265
+ const newTop = position.y - position.height - elmRect.height;
26266
+ const oldTop = position.y + 5 + position.height;
26267
+ //计算前后的高度的差距,然后判断新的值是否在父元素的范围内,如果不在则使用旧的值
26268
+ if (oldTop - newTop < elmRect.top - parentRect.top) {
26269
+ elm.style.top = (position.y - position.height - elmRect.height) + 'px';
26270
+ }
26271
+ //elm.style.top = (top - (elmRect.top + elmRect.height - (parentRect.top + parentRect.height))) + 'px';
26272
+ //elm.style.top = (position.y - position.height - elmRect.height) + 'px';
26266
26273
  }
26267
26274
  }
26268
26275
  }
@@ -27159,7 +27166,8 @@ class DocEditor {
27159
27166
  sel: 'div.scale-container', data: {
27160
27167
  style: {
27161
27168
  transform: 'scale(' + this.viewOptions.scale + ')',
27162
- transformOrigin: 'left top'
27169
+ transformOrigin: 'right top',
27170
+ width: this.viewOptions.docPageSettings.width + 'px',
27163
27171
  }
27164
27172
  },
27165
27173
  children: [docContentVNode, inputVNode, dropContainer]
@@ -27270,8 +27278,8 @@ class DocEditor {
27270
27278
  this.contentChanged.next();
27271
27279
  }
27272
27280
  this.updateSelection();
27273
- this.onShouldRender.next();
27274
27281
  this.setCursor();
27282
+ this.onShouldRender.next();
27275
27283
  //this.refreshView();
27276
27284
  }
27277
27285
  /**
@@ -27415,12 +27423,12 @@ class DocEditor {
27415
27423
  */
27416
27424
  docClickHandle(evt) {
27417
27425
  this.hiddenInput();
27418
- this.setCursor();
27419
- this.updateSelection();
27426
+ // this.setCursor();
27427
+ // this.updateSelection();
27428
+ this.refreshDocument();
27420
27429
  this.onClickEvent.next(evt);
27421
27430
  if (this.menusData) {
27422
27431
  this.menusData = null;
27423
- this.onChange();
27424
27432
  }
27425
27433
  }
27426
27434
  /**
@@ -27509,7 +27517,9 @@ class DocEditor {
27509
27517
  elementEvent.source = startControl;
27510
27518
  DocumentEvent.invokeEvent('ElementContextMenu', startControl, elementEvent, 'All');
27511
27519
  //const position = {x: evt.offsetX + 10, y: evt.offsetY, translateY: this.viewOptions.pageOffset.y};
27512
- const pos = ElementUtil.getMousePos(evt);
27520
+ const pos = ElementUtil.getMousePos(evt, this.viewOptions.scale);
27521
+ pos.x += 10;
27522
+ pos.y -= 10;
27513
27523
  this.menusData = {
27514
27524
  position: pos,
27515
27525
  menus: elementEvent.menus
@@ -28084,6 +28094,7 @@ class DocEditor {
28084
28094
  style: {
28085
28095
  height: '0px',
28086
28096
  position: 'relative',
28097
+ width: '0px',
28087
28098
  'user-select': 'none',
28088
28099
  },
28089
28100
  on: this.documentEvent.getEventListener()
@@ -28392,7 +28403,7 @@ class DocEditor {
28392
28403
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
28393
28404
  }
28394
28405
  version() {
28395
- return "2.0.54";
28406
+ return "2.1.0";
28396
28407
  }
28397
28408
  }
28398
28409