@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-cjs.js CHANGED
@@ -1472,6 +1472,8 @@ class ViewOptions {
1472
1472
  trackHistoryMaxLength = 500;
1473
1473
  //开启动态脚本功能
1474
1474
  enableDyExpression = false;
1475
+ //是否显示标尺
1476
+ showRule = true;
1475
1477
  //整页模式,不分页
1476
1478
  _fullPageView = false;
1477
1479
  get fullPageView() {
@@ -11862,7 +11864,17 @@ class DynamicContextParser {
11862
11864
  return condition() ? truePart() : falsePart();
11863
11865
  }
11864
11866
  Number(val) {
11865
- return Number.parseInt(val);
11867
+ if (typeof val === 'number') {
11868
+ return val;
11869
+ }
11870
+ else if (typeof val === 'string') {
11871
+ const parseVal = Number.parseInt(val.trim());
11872
+ if (Number.isNaN(parseVal)) {
11873
+ return 0;
11874
+ }
11875
+ return parseVal;
11876
+ }
11877
+ return 0;
11866
11878
  }
11867
11879
  TableData(tableId, startRow, startCol, endRow, endCol) {
11868
11880
  const tb = this.doc.treeFind(item => item instanceof TableElement && item.props.id === tableId);
@@ -21732,7 +21744,18 @@ class CanvasTextEditor extends NodeItems {
21732
21744
  this.rule.x = (this.viewOptions.viewSettings.width - this.rule.width) / 2;
21733
21745
  this.rule.y = 0;
21734
21746
  this.rule.width = this.viewOptions.docPageSettings.width;
21735
- this.scrollView.height = this.viewOptions.viewSettings.height - this.rule.ruleSize;
21747
+ if (!this.viewOptions.showRule) {
21748
+ this.rule.visible = false;
21749
+ this.rule.height = 0;
21750
+ this.scrollView.y = 0;
21751
+ this.scrollView.height = this.viewOptions.viewSettings.height - this.scrollView.y;
21752
+ }
21753
+ else {
21754
+ this.rule.height = 30;
21755
+ this.rule.visible = true;
21756
+ this.scrollView.y = this.rule.ruleSize;
21757
+ this.scrollView.height = this.viewOptions.viewSettings.height - this.scrollView.y;
21758
+ }
21736
21759
  }
21737
21760
  createMenu() {
21738
21761
  const menu = new Menu();