@hailin-zheng/editor-core 2.1.16 → 2.1.17
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 +20 -3
- package/index-cjs.js.map +1 -1
- package/index.js +20 -3
- package/index.js.map +1 -1
- package/med_editor/framework/impl/data-element/data-element-barcode.d.ts +4 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -8298,8 +8298,9 @@ class DataElementBarcode extends DataElementLeaf {
|
|
8298
8298
|
}
|
8299
8299
|
createRenderObject() {
|
8300
8300
|
const render = new DataElementBarcodeRenderObject(this);
|
8301
|
-
|
8302
|
-
render.rect.
|
8301
|
+
const { width, height } = render.measureSize();
|
8302
|
+
render.rect.width = width + 2;
|
8303
|
+
render.rect.height = height + 2;
|
8303
8304
|
return render;
|
8304
8305
|
}
|
8305
8306
|
serialize(options) {
|
@@ -8370,11 +8371,27 @@ class DataElementBarcodeRenderObject extends ResizeLeafRenderObject {
|
|
8370
8371
|
else {
|
8371
8372
|
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
8372
8373
|
JsBarcode__default["default"](svg, this.element.props.text);
|
8374
|
+
const width = Number.parseInt(svg.getAttribute('width').replace('px', ''));
|
8375
|
+
const height = Number.parseInt(svg.getAttribute('height').replace('px', ''));
|
8376
|
+
svg.setAttribute('width', this.element.props.width + 'px');
|
8377
|
+
svg.setAttribute('height', height * (this.element.props.width / width) + 'px');
|
8373
8378
|
const vNode = snabbdom.toVNode(svg);
|
8374
8379
|
t.children = [vNode];
|
8375
8380
|
}
|
8376
8381
|
return t;
|
8377
8382
|
}
|
8383
|
+
measureSize() {
|
8384
|
+
if (this.element.props.type === 'qrcode') {
|
8385
|
+
return { width: this.element.props.width, height: this.element.props.height };
|
8386
|
+
}
|
8387
|
+
else {
|
8388
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
8389
|
+
JsBarcode__default["default"](svg, this.element.props.text);
|
8390
|
+
const width = Number.parseInt(svg.getAttribute('width').replace('px', ''));
|
8391
|
+
const height = Number.parseInt(svg.getAttribute('height').replace('px', ''));
|
8392
|
+
return { width: this.element.props.width, height: height * (this.element.props.width / width) };
|
8393
|
+
}
|
8394
|
+
}
|
8378
8395
|
toSvgString(qr, border, lightColor, darkColor) {
|
8379
8396
|
let parts = [];
|
8380
8397
|
for (let y = 0; y < qr.size; y++) {
|
@@ -28817,7 +28834,7 @@ class DocEditor {
|
|
28817
28834
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
28818
28835
|
}
|
28819
28836
|
version() {
|
28820
|
-
return "2.1.
|
28837
|
+
return "2.1.17";
|
28821
28838
|
}
|
28822
28839
|
switchPageHeaderEditor() {
|
28823
28840
|
this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
|