@hailin-zheng/editor-core 1.1.22 → 1.1.24
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 +24 -19
- package/index-cjs.js.map +1 -1
- package/index.js +21 -16
- package/index.js.map +1 -1
- package/med_editor/framework/impl/text/text-impl.d.ts +1 -2
- package/med_editor/framework/render-context.d.ts +3 -3
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -32,8 +32,8 @@ function _interopNamespace(e) {
|
|
32
32
|
|
33
33
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
34
34
|
var acor__namespace = /*#__PURE__*/_interopNamespace(acor);
|
35
|
-
var
|
36
|
-
var
|
35
|
+
var estraverse__default = /*#__PURE__*/_interopDefaultLegacy(estraverse);
|
36
|
+
var bwipjs__namespace = /*#__PURE__*/_interopNamespace(bwipjs);
|
37
37
|
var moment__default$1 = /*#__PURE__*/_interopDefaultLegacy(moment$1);
|
38
38
|
|
39
39
|
/**
|
@@ -2746,7 +2746,7 @@ class DataDecorateRenderObject extends LeafRenderObject {
|
|
2746
2746
|
|
2747
2747
|
function parser(code) {
|
2748
2748
|
const node = acor__namespace.parse(code, { ecmaVersion: 'latest' });
|
2749
|
-
|
2749
|
+
estraverse__default["default"].traverse(node, {
|
2750
2750
|
enter: (child, parent) => {
|
2751
2751
|
if (child.type === 'Identifier') {
|
2752
2752
|
const identifierName = child['name'];
|
@@ -2756,7 +2756,7 @@ function parser(code) {
|
|
2756
2756
|
}
|
2757
2757
|
}
|
2758
2758
|
});
|
2759
|
-
|
2759
|
+
estraverse__default["default"].replace(node, {
|
2760
2760
|
leave: (child) => {
|
2761
2761
|
//函数调用
|
2762
2762
|
if (child.type == 'CallExpression') {
|
@@ -4120,7 +4120,6 @@ class DocumentContainerRender extends BlockContainerRenderObject {
|
|
4120
4120
|
|
4121
4121
|
class TextGroupElement extends LeafElement {
|
4122
4122
|
textMeasures = [];
|
4123
|
-
fontBoundingBox;
|
4124
4123
|
isMeasure = false;
|
4125
4124
|
constructor() {
|
4126
4125
|
super('text');
|
@@ -4160,7 +4159,7 @@ class TextGroupElement extends LeafElement {
|
|
4160
4159
|
createRenderObject(data) {
|
4161
4160
|
if (!this.isMeasure || this.modifyFlag !== exports.ModifyFlag.None || !this.cacheRender) {
|
4162
4161
|
data.renderCtx.contentContext.measureTextUnits(this.textMeasures, this.props);
|
4163
|
-
|
4162
|
+
//data.renderCtx.contentContext.measureTextMetrics(this.props.getFont());
|
4164
4163
|
this.isMeasure = true;
|
4165
4164
|
}
|
4166
4165
|
const render = new TextGroupRenderObject(this);
|
@@ -4234,7 +4233,7 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4234
4233
|
if (this.element.props.border) {
|
4235
4234
|
render.contentContext.strokeRect(position.x, position.y, this.rect.width, this.rect.height);
|
4236
4235
|
}
|
4237
|
-
render.contentContext.drawTextUnits(this, position.x, position.y
|
4236
|
+
render.contentContext.drawTextUnits(this, position.x, position.y + (this.rect.height - this.element.props.fontSize) / 2);
|
4238
4237
|
}
|
4239
4238
|
constructor(element) {
|
4240
4239
|
super(element);
|
@@ -4253,7 +4252,8 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
4253
4252
|
}
|
4254
4253
|
measure() {
|
4255
4254
|
this.rect.width = this.textMeasures.reduce((prev, curr) => prev + curr.actualSize, 0);
|
4256
|
-
this.rect.height = this.element.
|
4255
|
+
this.rect.height = Math.ceil(this.element.props.fontSize * 1.4);
|
4256
|
+
// this.element.fontBoundingBox.fontBoundingBoxAscent + this.element.fontBoundingBox.fontBoundingBoxDescent;
|
4257
4257
|
}
|
4258
4258
|
}
|
4259
4259
|
class TextGroupFactory extends ElementFactory {
|
@@ -4593,7 +4593,7 @@ class DocumentCursor {
|
|
4593
4593
|
if (['superscript', 'subscript'].indexOf(ele.props.vertAlign) >= 0) {
|
4594
4594
|
rect.height -= ele.props.fontSize / 2;
|
4595
4595
|
if (ele.props.vertAlign === 'subscript') {
|
4596
|
-
rect.y += rect.height;
|
4596
|
+
rect.y += rect.height * 2 / 5;
|
4597
4597
|
}
|
4598
4598
|
}
|
4599
4599
|
rect.x += horX;
|
@@ -7811,7 +7811,7 @@ class PaintContent {
|
|
7811
7811
|
this.init();
|
7812
7812
|
}
|
7813
7813
|
init() {
|
7814
|
-
this.ctx.textBaseline = '
|
7814
|
+
this.ctx.textBaseline = 'top';
|
7815
7815
|
}
|
7816
7816
|
setGlobalAlpha(alpha) {
|
7817
7817
|
this.ctx.globalAlpha = alpha;
|
@@ -7830,8 +7830,8 @@ class PaintContent {
|
|
7830
7830
|
this.ctx.save();
|
7831
7831
|
this.ctx.fillStyle = textProps.color;
|
7832
7832
|
this.ctx.font = textProps.getFont();
|
7833
|
-
const vertHeight = textProps.vertAlign === 'superscript' ? 0 : height;
|
7834
|
-
this.ctx.fillText(text, x, y + vertHeight
|
7833
|
+
const vertHeight = 0; // textProps.vertAlign === 'superscript' ? 0 : height;
|
7834
|
+
this.ctx.fillText(text, x, y + vertHeight);
|
7835
7835
|
this.ctx.restore();
|
7836
7836
|
if (textProps.linethrough) {
|
7837
7837
|
this.drawHoriLine(x, y + (Math.ceil(height / 2)), width, textProps.color, 1);
|
@@ -7851,7 +7851,7 @@ class PaintContent {
|
|
7851
7851
|
this.ctx.fill();
|
7852
7852
|
this.ctx.restore();
|
7853
7853
|
}
|
7854
|
-
drawTextUnits(textGroupRender, x, y
|
7854
|
+
drawTextUnits(textGroupRender, x, y) {
|
7855
7855
|
const textEle = textGroupRender.element;
|
7856
7856
|
const textProps = textEle.props;
|
7857
7857
|
const { width, height } = textGroupRender.rect;
|
@@ -7874,10 +7874,10 @@ class PaintContent {
|
|
7874
7874
|
this.drawHoriLine(x, y, width, textProps.color, 1);
|
7875
7875
|
}
|
7876
7876
|
let horX = 0;
|
7877
|
-
let vertHeight = baseLine;
|
7878
|
-
if (textProps.vertAlign === '
|
7877
|
+
let vertHeight = 0; //baseLine;
|
7878
|
+
if (textProps.vertAlign === 'subscript') {
|
7879
7879
|
//到top
|
7880
|
-
vertHeight
|
7880
|
+
vertHeight += textProps.fontSize * 2 / 5;
|
7881
7881
|
}
|
7882
7882
|
for (let i = 0; i < textGroupRender.textMeasures.length; i++) {
|
7883
7883
|
const unit = textGroupRender.textMeasures[i];
|
@@ -8618,7 +8618,7 @@ class DataElementBarcode extends DataElementLeaf {
|
|
8618
8618
|
if (!this.barCodeCanvas) {
|
8619
8619
|
this.barCodeCanvas = document.createElement('canvas');
|
8620
8620
|
}
|
8621
|
-
this.barCodeCanvas =
|
8621
|
+
this.barCodeCanvas = bwipjs__namespace.toCanvas(this.barCodeCanvas, {
|
8622
8622
|
bcid: this.props.type,
|
8623
8623
|
text: this.props.text || "0123456789",
|
8624
8624
|
height: 10,
|
@@ -11722,8 +11722,13 @@ class ParagraphMeasure {
|
|
11722
11722
|
return;
|
11723
11723
|
}
|
11724
11724
|
else {
|
11725
|
-
parentLine.
|
11726
|
-
|
11725
|
+
if (parentLine.lineWidth() === 0) {
|
11726
|
+
parentLine.add(render);
|
11727
|
+
}
|
11728
|
+
else {
|
11729
|
+
parentLine.applyNewLine();
|
11730
|
+
this.arrangeLeafRender(parentLine, render);
|
11731
|
+
}
|
11727
11732
|
}
|
11728
11733
|
}
|
11729
11734
|
else {
|