@hailin-zheng/editor-core 2.1.25 → 2.1.26

Sign up to get free protection for your applications and to get access to all the features.
package/editor.css CHANGED
@@ -170,6 +170,7 @@
170
170
  }
171
171
 
172
172
  .tg-container {
173
+ font-size: 14px;
173
174
  border: 1px solid #ccc;
174
175
  margin: 10px 0;
175
176
  padding: 10px;
@@ -540,4 +541,4 @@
540
541
  100% {
541
542
  opacity: 1;
542
543
  }
543
- }
544
+ }
package/index-cjs.js CHANGED
@@ -1819,6 +1819,8 @@ class ViewOptions {
1819
1819
  docMode = exports.DocMode.Design;
1820
1820
  //是否显示审阅痕迹
1821
1821
  _showTrackChanges = true;
1822
+ //是否显示审阅痕迹提示
1823
+ _showTrackChangesTip = true;
1822
1824
  get showTrackChanges() {
1823
1825
  return this._showTrackChanges;
1824
1826
  }
@@ -1829,6 +1831,16 @@ class ViewOptions {
1829
1831
  this._showTrackChanges = value;
1830
1832
  this.onChange.next('force');
1831
1833
  }
1834
+ get showTrackChangesTip() {
1835
+ return this._showTrackChangesTip;
1836
+ }
1837
+ set showTrackChangesTip(value) {
1838
+ if (this._showTrackChangesTip === value) {
1839
+ return;
1840
+ }
1841
+ this._showTrackChangesTip = value;
1842
+ this.onChange.next('force');
1843
+ }
1832
1844
  //医嘱打印模式,文字行模式,将表格多行对象转换为多个表格行对象
1833
1845
  textRowLineMode = false;
1834
1846
  editUser = { id: '', name: '' };
@@ -4492,6 +4504,7 @@ class TableCellFactory extends ElementFactory {
4492
4504
  }
4493
4505
  }
4494
4506
 
4507
+ const RowMinHeight = 20;
4495
4508
  class TableRowElement extends BlockContainerElement {
4496
4509
  //props: TableRowProps;
4497
4510
  constructor() {
@@ -10636,6 +10649,9 @@ class TrackRunRenderObject extends InlineGroupRenderObject {
10636
10649
  if (this.element.paintRenders.indexOf(this) !== 0) {
10637
10650
  return;
10638
10651
  }
10652
+ if (!event.options.showTrackChangesTip) {
10653
+ return;
10654
+ }
10639
10655
  const opType = this.element.type === 'ins-run' ? '插入:' : '删除:';
10640
10656
  const content = ElementSerialize.serializeString(this.element, { all: true });
10641
10657
  const left = this.element.gotFocus ? -10 : 5;
@@ -10672,27 +10688,6 @@ class TrackRunRenderObject extends InlineGroupRenderObject {
10672
10688
  };
10673
10689
  event.addChangeTips(node);
10674
10690
  }
10675
- //根据时间显示中文日时间提示范围
10676
- getTipsDate(date) {
10677
- const now = new Date();
10678
- const diff = now.getTime() - date.getTime();
10679
- if (diff < 60 * 1000) {
10680
- return '刚刚';
10681
- }
10682
- if (diff < 60 * 60 * 1000) {
10683
- return `${Math.floor(diff / 60 / 1000)}分钟前`;
10684
- }
10685
- if (diff < 24 * 60 * 60 * 1000) {
10686
- return `${Math.floor(diff / 60 / 60 / 1000)}小时前`;
10687
- }
10688
- if (diff < 30 * 24 * 60 * 60 * 1000) {
10689
- return `${Math.floor(diff / 24 / 60 / 60 / 1000)}天前`;
10690
- }
10691
- if (diff < 12 * 30 * 24 * 60 * 60 * 1000) {
10692
- return `${Math.floor(diff / 30 / 24 / 60 / 60 / 1000)}月前`;
10693
- }
10694
- return `${Math.floor(diff / 12 / 30 / 24 / 60 / 60 / 1000)}年前`;
10695
- }
10696
10691
  clone() {
10697
10692
  const cloneRender = new TrackRunRenderObject(this.element);
10698
10693
  cloneRender.rect = ElementUtil.cloneRect(this.rect);
@@ -13913,18 +13908,21 @@ class ParagraphMeasure {
13913
13908
  * @param lineEmpty
13914
13909
  */
13915
13910
  patchHandlePostPunctuation(render, i, inCloseBody, lineEmpty) {
13916
- if (inCloseBody && this.containPostPunctuation(render.textMeasures[i]?.char)) {
13917
- if (this.containPostPunctuation(render.textMeasures[i + 1]?.char)) {
13918
- i--;
13919
- }
13920
- else {
13921
- i++;
13922
- }
13911
+ if (i === 1 && lineEmpty) {
13912
+ return i;
13923
13913
  }
13924
- else {
13925
- if (i > 1 && this.containPostPunctuation(render.textMeasures[i]?.char)) {
13926
- i--;
13927
- }
13914
+ //判断当前行最后一个字符是否是后置标点
13915
+ //const currCharIsPostPunctuation = this.containPostPunctuation(render.textMeasures[i]?.char);
13916
+ //判断下一个字符是否是后置标点,如果不是,直接返回
13917
+ const nextCharIsPostPunctuation = this.containPostPunctuation(render.textMeasures[i]?.char);
13918
+ if (!nextCharIsPostPunctuation) {
13919
+ return i;
13920
+ }
13921
+ if (inCloseBody) {
13922
+ return ++i;
13923
+ }
13924
+ if (i > 0) {
13925
+ return --i;
13928
13926
  }
13929
13927
  return i;
13930
13928
  }
@@ -14579,6 +14577,9 @@ class DocumentArrange {
14579
14577
  // if (render.element.props.minHeight > 0 && render.rect.height < limitHeight) {
14580
14578
  // return null;
14581
14579
  // }
14580
+ if (limitHeight < RowMinHeight) {
14581
+ return null;
14582
+ }
14582
14583
  render.remeasureState = true;
14583
14584
  const cloneRowRender = render.element.createRenderObject();
14584
14585
  if (cloneRowRender.minHeight > 0 && render.minHeight <= 0) {
@@ -27253,7 +27254,7 @@ class DocEditor {
27253
27254
  rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
27254
27255
  }
27255
27256
  version() {
27256
- return "2.1.25";
27257
+ return "2.1.26";
27257
27258
  }
27258
27259
  switchPageHeaderEditor() {
27259
27260
  this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
@@ -27697,6 +27698,7 @@ exports.Rect = Rect;
27697
27698
  exports.RenderContext = RenderContext;
27698
27699
  exports.RenderObject = RenderObject;
27699
27700
  exports.ResizeLeafRenderObject = ResizeLeafRenderObject;
27701
+ exports.RowMinHeight = RowMinHeight;
27700
27702
  exports.RunElementFactory = RunElementFactory;
27701
27703
  exports.SVGElement = SVGElement;
27702
27704
  exports.SVGFactory = SVGFactory;