@hailin-zheng/editor-core 1.1.0 → 1.1.2
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/controls/Config.d.ts +1 -0
- package/controls/SurfaceView.d.ts +1 -0
- package/index-cjs.js +55 -27
- package/index-cjs.js.map +1 -1
- package/index.js +55 -27
- package/index.js.map +1 -1
- package/med_editor/framework/document-event.d.ts +1 -1
- package/med_editor/framework/element-define.d.ts +1 -0
- package/med_editor/texteditor.d.ts +5 -0
- package/package.json +1 -1
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() {
|
@@ -4453,7 +4455,7 @@ class PSymbolElement extends LeafElement {
|
|
4453
4455
|
super('psym');
|
4454
4456
|
this.textProps = new TextProps();
|
4455
4457
|
this.textProps.fontSize = this.defaultHeight;
|
4456
|
-
this.textProps.fontName = '
|
4458
|
+
this.textProps.fontName = 'sans-serif';
|
4457
4459
|
this.textProps.color = '#8c8c8c';
|
4458
4460
|
}
|
4459
4461
|
createRenderObject() {
|
@@ -4480,7 +4482,7 @@ class PSymbolRenderObject extends LeafRenderObject {
|
|
4480
4482
|
if (render.drawMode === 'print') {
|
4481
4483
|
return;
|
4482
4484
|
}
|
4483
|
-
render.contentContext.drawText('
|
4485
|
+
render.contentContext.drawText('↩', this.element.textProps, position.x, position.y, 20, this.rect.height);
|
4484
4486
|
}
|
4485
4487
|
//绘制段落符号
|
4486
4488
|
clone() {
|
@@ -11834,7 +11836,17 @@ class DynamicContextParser {
|
|
11834
11836
|
return condition() ? truePart() : falsePart();
|
11835
11837
|
}
|
11836
11838
|
Number(val) {
|
11837
|
-
|
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);
|
@@ -12065,7 +12077,6 @@ class ParagraphMeasure {
|
|
12065
12077
|
*/
|
12066
12078
|
setParaTextAlign(counter, paraLineIndex, paraElement, limitWidth, paraLineRender) {
|
12067
12079
|
let indent = paraLineRender.startX;
|
12068
|
-
paraLineRender.line.rect.width = limitWidth;
|
12069
12080
|
if (paraElement.props.textAlign === 'center') {
|
12070
12081
|
const remainSpace = limitWidth - paraLineRender.line.rect.width;
|
12071
12082
|
const startX = Math.ceil(remainSpace / 2) + indent;
|
@@ -12089,6 +12100,7 @@ class ParagraphMeasure {
|
|
12089
12100
|
//return indent;
|
12090
12101
|
}
|
12091
12102
|
else ;
|
12103
|
+
paraLineRender.line.rect.width = limitWidth;
|
12092
12104
|
}
|
12093
12105
|
/**
|
12094
12106
|
* 设置两端对齐
|
@@ -14207,7 +14219,7 @@ class PageBreakRenderObject extends LeafRenderObject {
|
|
14207
14219
|
if (render.drawMode === 'print') {
|
14208
14220
|
return;
|
14209
14221
|
}
|
14210
|
-
render.contentContext.drawText('
|
14222
|
+
render.contentContext.drawText('↩', this.element.textProps, position.x, position.y, 20, this.rect.height);
|
14211
14223
|
}
|
14212
14224
|
clone() {
|
14213
14225
|
const render = new PageBreakRenderObject(this.element);
|
@@ -14730,7 +14742,8 @@ class DocumentEvent {
|
|
14730
14742
|
};
|
14731
14743
|
}
|
14732
14744
|
}
|
14733
|
-
|
14745
|
+
//只有设计模式时,才需要进行边界判断,方可调整表格列宽等
|
14746
|
+
if (!this.ismousedown && this.viewOptions.docMode === DocMode.Design) {
|
14734
14747
|
this.edgeRenderInfo = edgeRenderInfo;
|
14735
14748
|
}
|
14736
14749
|
//存在边界元素,并且当前边界处于鼠标按下状态
|
@@ -18590,6 +18603,7 @@ class ButtonBase extends TextBase {
|
|
18590
18603
|
|
18591
18604
|
const ViewConfig = {
|
18592
18605
|
surfaceBgColor: '#f0f0f0',
|
18606
|
+
showMousePositionLine: false,
|
18593
18607
|
primaryColor: '#6750A4',
|
18594
18608
|
onPrimaryColor: '#FFFFFF',
|
18595
18609
|
themeSecondaryColor: '#2b88d8',
|
@@ -19411,8 +19425,8 @@ class ViewPaint {
|
|
19411
19425
|
let { x, y } = lines[i];
|
19412
19426
|
x = Math.ceil(x);
|
19413
19427
|
y = Math.ceil(y);
|
19414
|
-
x += 0.5;
|
19415
|
-
y += 0.5;
|
19428
|
+
// x += 0.5;
|
19429
|
+
// y += 0.5;
|
19416
19430
|
if (i === 0) {
|
19417
19431
|
this.ctx.moveTo(x, y);
|
19418
19432
|
}
|
@@ -19435,8 +19449,8 @@ class ViewPaint {
|
|
19435
19449
|
}
|
19436
19450
|
}
|
19437
19451
|
drawRadioBox(x, y, width, height, isChecked) {
|
19438
|
-
x = x + Math.floor(width / 2);
|
19439
|
-
y = y + Math.floor(height / 2);
|
19452
|
+
// x = x + Math.floor(width / 2);
|
19453
|
+
// y = y + Math.floor(height / 2);
|
19440
19454
|
width = Math.floor(width / 2);
|
19441
19455
|
this.ctx.save();
|
19442
19456
|
this.ctx.strokeStyle = 'black';
|
@@ -19580,6 +19594,13 @@ class SurfaceView extends NodeItems {
|
|
19580
19594
|
this.reLayout = false;
|
19581
19595
|
}
|
19582
19596
|
e.render.fillRect(0, 0, this.finalRect.width, this.finalRect.height, ViewConfig.surfaceBgColor);
|
19597
|
+
e.next(e.render);
|
19598
|
+
this.drawMouseLinePosition(e);
|
19599
|
+
}
|
19600
|
+
drawMouseLinePosition(e) {
|
19601
|
+
{
|
19602
|
+
return;
|
19603
|
+
}
|
19583
19604
|
}
|
19584
19605
|
start() {
|
19585
19606
|
this.renderSchedule = renderApp(this, this.renderCtx, this.nodeEvent);
|
@@ -20864,8 +20885,6 @@ class CanvasTextEditor extends NodeItems {
|
|
20864
20885
|
pagePL = left;
|
20865
20886
|
pagePR = right;
|
20866
20887
|
}
|
20867
|
-
// this.docRule.setRuleOptions({width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft});
|
20868
|
-
// this.docRule.refreshRule();
|
20869
20888
|
this.rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
20870
20889
|
}
|
20871
20890
|
createDocViewer() {
|
@@ -20964,12 +20983,17 @@ class CanvasTextEditor extends NodeItems {
|
|
20964
20983
|
this.documentPaint.rePages();
|
20965
20984
|
});
|
20966
20985
|
this.updateDocSize();
|
20967
|
-
//页面高度
|
20968
|
-
// this.documentSelection.updateSelectionState();
|
20969
|
-
// this.selectionOverlays.getSelectionTreeData();
|
20970
|
-
// this.beforeRenderSubject.next();
|
20971
20986
|
}
|
20972
|
-
|
20987
|
+
this.updateSelection();
|
20988
|
+
this.refreshDocRule();
|
20989
|
+
this.onChanged();
|
20990
|
+
//this.refreshView();
|
20991
|
+
}
|
20992
|
+
/**
|
20993
|
+
* 计算选区内容对象
|
20994
|
+
* @private
|
20995
|
+
*/
|
20996
|
+
updateSelection() {
|
20973
20997
|
let ssChanged = false;
|
20974
20998
|
try {
|
20975
20999
|
//防止由于选区不正确导致的错误,导致后续的当前任务无法释放
|
@@ -20980,18 +21004,12 @@ class CanvasTextEditor extends NodeItems {
|
|
20980
21004
|
}
|
20981
21005
|
this.selectionOverlays.getSelectionTreeData();
|
20982
21006
|
ssChanged && this.selectionChanged.next(this.documentSelection.selectionState);
|
20983
|
-
this.refreshDocRule();
|
20984
|
-
this.onChanged();
|
20985
|
-
//this.refreshView();
|
20986
21007
|
}
|
20987
21008
|
/**
|
20988
21009
|
* 刷新绘制文档
|
20989
21010
|
* @param rePaint
|
20990
21011
|
*/
|
20991
21012
|
refreshView() {
|
20992
|
-
// const ssChanged = this.documentSelection.updateSelectionState();
|
20993
|
-
// this.selectionOverlays.getSelectionTreeData();
|
20994
|
-
// ssChanged && this.selectionChanged.next(this.documentSelection.selectionState);
|
20995
21013
|
this.documentPaint.refreshView();
|
20996
21014
|
this.setCursor();
|
20997
21015
|
}
|
@@ -21183,8 +21201,6 @@ class CanvasTextEditor extends NodeItems {
|
|
21183
21201
|
let minDocViewWidth = pageWidth + this.viewOptions.docSpace * 2;
|
21184
21202
|
let maxDocViewWidth = this.surfaceView.width;
|
21185
21203
|
this.width = Math.max(minDocViewWidth, maxDocViewWidth) - ScrollBarSize;
|
21186
|
-
// this.viewOptions.viewSettings.width = this.width;
|
21187
|
-
// this.viewOptions.viewSettings.height = this.scrollView.height as number;
|
21188
21204
|
const docSize = this.documentPaint.getDocumentContainerHeight();
|
21189
21205
|
this.height = docSize.height;
|
21190
21206
|
this.updateRenderCtx();
|
@@ -21197,6 +21213,7 @@ class CanvasTextEditor extends NodeItems {
|
|
21197
21213
|
this.updateRenderCtx();
|
21198
21214
|
this.documentPaint.layoutPages();
|
21199
21215
|
this.refreshDocument();
|
21216
|
+
this.updateLayout();
|
21200
21217
|
}
|
21201
21218
|
/**
|
21202
21219
|
* 缩放视图
|
@@ -21685,7 +21702,6 @@ class CanvasTextEditor extends NodeItems {
|
|
21685
21702
|
this.viewOptions.viewSettings.height = data.height;
|
21686
21703
|
this.updateDocSize();
|
21687
21704
|
this.resetViewer();
|
21688
|
-
this.updateLayout();
|
21689
21705
|
});
|
21690
21706
|
surface.addChild(scrollView);
|
21691
21707
|
const rule2 = new RuleControl(this.docCtx);
|
@@ -21695,6 +21711,7 @@ class CanvasTextEditor extends NodeItems {
|
|
21695
21711
|
rule2.x = 20;
|
21696
21712
|
rule2.y = 500;
|
21697
21713
|
surface.addChild(rule2);
|
21714
|
+
//surface.addChild(win);
|
21698
21715
|
surface.start();
|
21699
21716
|
}
|
21700
21717
|
/**
|
@@ -21704,7 +21721,18 @@ class CanvasTextEditor extends NodeItems {
|
|
21704
21721
|
this.rule.x = (this.viewOptions.viewSettings.width - this.rule.width) / 2;
|
21705
21722
|
this.rule.y = 0;
|
21706
21723
|
this.rule.width = this.viewOptions.docPageSettings.width;
|
21707
|
-
|
21724
|
+
if (!this.viewOptions.showRule) {
|
21725
|
+
this.rule.visible = false;
|
21726
|
+
this.rule.height = 0;
|
21727
|
+
this.scrollView.y = 0;
|
21728
|
+
this.scrollView.height = this.viewOptions.viewSettings.height - this.scrollView.y;
|
21729
|
+
}
|
21730
|
+
else {
|
21731
|
+
this.rule.height = 30;
|
21732
|
+
this.rule.visible = true;
|
21733
|
+
this.scrollView.y = this.rule.ruleSize;
|
21734
|
+
this.scrollView.height = this.viewOptions.viewSettings.height - this.scrollView.y;
|
21735
|
+
}
|
21708
21736
|
}
|
21709
21737
|
createMenu() {
|
21710
21738
|
const menu = new Menu();
|