@hailin-zheng/editor-core 1.1.0 → 1.1.1

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
@@ -1444,6 +1444,8 @@ class ViewOptions {
1444
1444
  trackHistoryMaxLength = 500;
1445
1445
  //开启动态脚本功能
1446
1446
  enableDyExpression = false;
1447
+ //是否显示标尺
1448
+ showRule = true;
1447
1449
  //整页模式,不分页
1448
1450
  _fullPageView = false;
1449
1451
  get fullPageView() {
@@ -11834,7 +11836,17 @@ class DynamicContextParser {
11834
11836
  return condition() ? truePart() : falsePart();
11835
11837
  }
11836
11838
  Number(val) {
11837
- return Number.parseInt(val);
11839
+ if (typeof val === 'number') {
11840
+ return val;
11841
+ }
11842
+ else if (typeof val === 'string') {
11843
+ const parseVal = Number.parseInt(val.trim());
11844
+ if (Number.isNaN(parseVal)) {
11845
+ return 0;
11846
+ }
11847
+ return parseVal;
11848
+ }
11849
+ return 0;
11838
11850
  }
11839
11851
  TableData(tableId, startRow, startCol, endRow, endCol) {
11840
11852
  const tb = this.doc.treeFind(item => item instanceof TableElement && item.props.id === tableId);
@@ -21704,7 +21716,18 @@ class CanvasTextEditor extends NodeItems {
21704
21716
  this.rule.x = (this.viewOptions.viewSettings.width - this.rule.width) / 2;
21705
21717
  this.rule.y = 0;
21706
21718
  this.rule.width = this.viewOptions.docPageSettings.width;
21707
- this.scrollView.height = this.viewOptions.viewSettings.height - this.rule.ruleSize;
21719
+ if (!this.viewOptions.showRule) {
21720
+ this.rule.visible = false;
21721
+ this.rule.height = 0;
21722
+ this.scrollView.y = 0;
21723
+ this.scrollView.height = this.viewOptions.viewSettings.height - this.scrollView.y;
21724
+ }
21725
+ else {
21726
+ this.rule.height = 30;
21727
+ this.rule.visible = true;
21728
+ this.scrollView.y = this.rule.ruleSize;
21729
+ this.scrollView.height = this.viewOptions.viewSettings.height - this.scrollView.y;
21730
+ }
21708
21731
  }
21709
21732
  createMenu() {
21710
21733
  const menu = new Menu();