@hailin-zheng/editor-core 2.2.33 → 2.2.35
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 +93 -17
- package/index-cjs.js.map +1 -1
- package/index.js +93 -17
- package/index.js.map +1 -1
- package/med_editor/framework/impl/document/doc-impl.d.ts +1 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -4008,6 +4008,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
4008
4008
|
const pageCorner = this.exportPageCornerHTML(event);
|
4009
4009
|
const pageNum = this.exportPageNumHTML(event);
|
4010
4010
|
const copyright = this.exportCopyRight(event);
|
4011
|
+
const defs = this.exportDefs();
|
4011
4012
|
return {
|
4012
4013
|
sel: "svg",
|
4013
4014
|
isCompleted: true,
|
@@ -4022,7 +4023,7 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
4022
4023
|
},
|
4023
4024
|
},
|
4024
4025
|
children: [
|
4025
|
-
pageCorner, highlight, selection, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, copyright
|
4026
|
+
defs, pageCorner, highlight, selection, ...CommonUtil.toArray(event.getChildNodes(this)), pageNum, copyright
|
4026
4027
|
]
|
4027
4028
|
};
|
4028
4029
|
}
|
@@ -4089,6 +4090,34 @@ class DocumentRenderObject extends BlockContainerRenderObject {
|
|
4089
4090
|
},
|
4090
4091
|
};
|
4091
4092
|
}
|
4093
|
+
exportDefs() {
|
4094
|
+
/**
|
4095
|
+
* <defs>
|
4096
|
+
<filter id="f1" x="0" y="0">
|
4097
|
+
<feGaussianBlur stdDeviation="0.5" result="blur" />
|
4098
|
+
<feMerge>
|
4099
|
+
<feMergeNode in="thicken" />
|
4100
|
+
<feMergeNode in="SourceGraphic" />
|
4101
|
+
</feMerge>
|
4102
|
+
</filter>
|
4103
|
+
</defs>
|
4104
|
+
*/
|
4105
|
+
return {
|
4106
|
+
sel: 'defs',
|
4107
|
+
data: {
|
4108
|
+
ns: "http://www.w3.org/2000/svg",
|
4109
|
+
props: {
|
4110
|
+
innerHTML: `<filter id="t_bold" x="0" y="0">
|
4111
|
+
<feGaussianBlur stdDeviation="0.5" result="blur" />
|
4112
|
+
<feMerge>
|
4113
|
+
<feMergeNode in="thicken" />
|
4114
|
+
<feMergeNode in="SourceGraphic" />
|
4115
|
+
</feMerge>
|
4116
|
+
</filter>`
|
4117
|
+
}
|
4118
|
+
},
|
4119
|
+
};
|
4120
|
+
}
|
4092
4121
|
}
|
4093
4122
|
class DocumentFactory extends ElementFactory {
|
4094
4123
|
match(type) {
|
@@ -5213,7 +5242,7 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
5213
5242
|
//行高处理
|
5214
5243
|
y += (height - props.fontSize) / 2;
|
5215
5244
|
const t = ElementUtil.createSvgText(text, {
|
5216
|
-
'font-family':
|
5245
|
+
'font-family': props.fontName,
|
5217
5246
|
'font-size': fontSize,
|
5218
5247
|
x,
|
5219
5248
|
y,
|
@@ -5221,38 +5250,85 @@ class TextGroupRenderObject extends LeafRenderObject {
|
|
5221
5250
|
if (actualFontBoundingBoxAscent === undefined) {
|
5222
5251
|
t.data.attrs['dominant-baseline'] = 'hanging';
|
5223
5252
|
}
|
5224
|
-
if (
|
5225
|
-
|
5253
|
+
if (props.fontWeight !== 'normal') ;
|
5254
|
+
if (props.fontStyle !== 'normal') {
|
5255
|
+
t.data.attrs['font-style'] = props.fontStyle;
|
5226
5256
|
}
|
5227
|
-
if (
|
5228
|
-
t.data.attrs['
|
5257
|
+
if (props.color) {
|
5258
|
+
t.data.attrs['fill'] = props.color;
|
5229
5259
|
}
|
5230
|
-
if (
|
5231
|
-
t.data.attrs['fill'] = this.element.props.color;
|
5232
|
-
}
|
5233
|
-
if (this.element.props.background) {
|
5260
|
+
if (props.background) {
|
5234
5261
|
const bgX = event.relativePagePos.x;
|
5235
5262
|
const bgY = event.relativePagePos.y;
|
5236
|
-
event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, this.rect.width, this.rect.height,
|
5263
|
+
event.highlights.push(ElementUtil.getFillSvgRect(bgX, bgY, this.rect.width, this.rect.height, props.background));
|
5237
5264
|
}
|
5238
|
-
if (
|
5239
|
-
const underHeight =
|
5265
|
+
if (props.underline) {
|
5266
|
+
const underHeight = props.fontSize * 1.2;
|
5240
5267
|
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y + underHeight} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + underHeight}`;
|
5241
5268
|
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
5242
5269
|
}
|
5243
|
-
if (
|
5270
|
+
if (props.linethrough) {
|
5244
5271
|
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y + this.rect.height / 2} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y + this.rect.height / 2}`;
|
5245
5272
|
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
5246
5273
|
}
|
5247
|
-
if (
|
5274
|
+
if (props.border) {
|
5248
5275
|
event.highlights.push(ElementUtil.getStrokeSvgPath(ElementUtil.getRectPath(event.relativePagePos.x, event.relativePagePos.y, this.rect.width, this.rect.height), '#000', 1));
|
5249
5276
|
}
|
5250
|
-
if (
|
5277
|
+
if (props.overline) {
|
5251
5278
|
const path = `M${event.relativePagePos.x} ${event.relativePagePos.y} L${event.relativePagePos.x + this.rect.width} ${event.relativePagePos.y}`;
|
5252
5279
|
event.highlights.push(ElementUtil.getStrokeSvgPath(path, '#000', 1));
|
5253
5280
|
}
|
5254
5281
|
//处理null-text
|
5255
5282
|
if (this.element.isDecorate && this.element.disableClick && !this.element.parent) ;
|
5283
|
+
if (props.fontWeight === "bold") {
|
5284
|
+
const blurRate = props.fontSize * 0.5 / 15;
|
5285
|
+
const g = {
|
5286
|
+
sel: "g",
|
5287
|
+
data: {
|
5288
|
+
ns: "http://www.w3.org/2000/svg",
|
5289
|
+
attrs: {}
|
5290
|
+
},
|
5291
|
+
children: [
|
5292
|
+
{
|
5293
|
+
sel: "g",
|
5294
|
+
data: {
|
5295
|
+
ns: "http://www.w3.org/2000/svg",
|
5296
|
+
attrs: {
|
5297
|
+
translate: { x: 0, y: 0 }
|
5298
|
+
}
|
5299
|
+
},
|
5300
|
+
children: [
|
5301
|
+
{ ...t }
|
5302
|
+
]
|
5303
|
+
},
|
5304
|
+
{
|
5305
|
+
sel: "g",
|
5306
|
+
data: {
|
5307
|
+
ns: "http://www.w3.org/2000/svg",
|
5308
|
+
attrs: {
|
5309
|
+
translate: { x: blurRate, y: 0 }
|
5310
|
+
}
|
5311
|
+
},
|
5312
|
+
children: [
|
5313
|
+
{ ...t }
|
5314
|
+
]
|
5315
|
+
},
|
5316
|
+
{
|
5317
|
+
sel: "g",
|
5318
|
+
data: {
|
5319
|
+
ns: "http://www.w3.org/2000/svg",
|
5320
|
+
attrs: {
|
5321
|
+
translate: { x: 0, y: blurRate }
|
5322
|
+
}
|
5323
|
+
},
|
5324
|
+
children: [
|
5325
|
+
{ ...t }
|
5326
|
+
]
|
5327
|
+
}
|
5328
|
+
]
|
5329
|
+
};
|
5330
|
+
return g;
|
5331
|
+
}
|
5256
5332
|
return t;
|
5257
5333
|
}
|
5258
5334
|
}
|
@@ -23414,7 +23490,7 @@ class DocEditor {
|
|
23414
23490
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
23415
23491
|
}
|
23416
23492
|
version() {
|
23417
|
-
return "2.2.
|
23493
|
+
return "2.2.35";
|
23418
23494
|
}
|
23419
23495
|
switchPageHeaderEditor() {
|
23420
23496
|
this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
|