@mce/bigesj 0.15.16 → 0.15.18
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/dist/index.js +13 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEditor, definePlugin } from "mce";
|
|
2
|
+
import { assets } from "modern-canvas";
|
|
2
3
|
import { ref, onBeforeUnmount } from "vue";
|
|
3
4
|
import { createSharedComposable } from "@vueuse/core";
|
|
4
5
|
import { idGenerator, isGradient, normalizeCRLF, isGradientFill, normalizeGradientFill } from "modern-idoc";
|
|
5
6
|
import { OoxmlNode, parsePresetShapeDefinition } from "modern-openxml";
|
|
6
|
-
import { assets } from "modern-canvas";
|
|
7
7
|
import { gunzipSync } from "fflate";
|
|
8
8
|
const bigeFonts = ref([]);
|
|
9
9
|
function levenshteinDistance(a, b) {
|
|
@@ -591,6 +591,7 @@ function getStyle(el, clone = false) {
|
|
|
591
591
|
style = { ...style };
|
|
592
592
|
delete style.right;
|
|
593
593
|
delete style.bottom;
|
|
594
|
+
delete style.transform;
|
|
594
595
|
delete style.backgroundColor;
|
|
595
596
|
delete style.backgroundImage;
|
|
596
597
|
delete style.backgroundImageOpacity;
|
|
@@ -1342,7 +1343,7 @@ function convertTextStyle(el, isByWord = false) {
|
|
|
1342
1343
|
return style;
|
|
1343
1344
|
}
|
|
1344
1345
|
async function convertTextEffects(el) {
|
|
1345
|
-
const effects = el.textEffects ?? [];
|
|
1346
|
+
const effects = el.textFlower ?? el.textEffects ?? [];
|
|
1346
1347
|
if (!effects.length) {
|
|
1347
1348
|
return void 0;
|
|
1348
1349
|
}
|
|
@@ -1466,6 +1467,7 @@ function convertTextContent(el, isByWord = false) {
|
|
|
1466
1467
|
}
|
|
1467
1468
|
return paragraphs;
|
|
1468
1469
|
}
|
|
1470
|
+
const matrixRex = /matrix\(([^)]+)\)/;
|
|
1469
1471
|
const percentageToPx = (per) => (Number.parseFloat(per) || 0) / 100;
|
|
1470
1472
|
async function convertElement(el, parent, context) {
|
|
1471
1473
|
const { children: _children, ...raw } = el;
|
|
@@ -1484,6 +1486,11 @@ async function convertElement(el, parent, context) {
|
|
|
1484
1486
|
children: [],
|
|
1485
1487
|
background: convertBackground(el)
|
|
1486
1488
|
};
|
|
1489
|
+
if (typeof el.transform === "string" && matrixRex.test(el.transform)) {
|
|
1490
|
+
const flips = el.transform.match(matrixRex)[1].split(",");
|
|
1491
|
+
style.scaleX = Number.parseInt(flips[0]);
|
|
1492
|
+
style.scaleY = Number.parseInt(flips[3]);
|
|
1493
|
+
}
|
|
1487
1494
|
if (oldStyle.borderRadius) {
|
|
1488
1495
|
style.borderRadius = oldStyle.borderRadius * 0.01 * Math.max(oldStyle.height, oldStyle.width);
|
|
1489
1496
|
}
|
|
@@ -1572,6 +1579,7 @@ async function convertElement(el, parent, context) {
|
|
|
1572
1579
|
effects: await convertTextEffects(el)
|
|
1573
1580
|
// plugins: [deformation(el.deformation?.type?.endsWith("byWord") ? -1 : 999, () => el.deformation)],
|
|
1574
1581
|
};
|
|
1582
|
+
meta.textEffectsId = el.effectId;
|
|
1575
1583
|
if (style.color && isGradientFill(style.color)) {
|
|
1576
1584
|
element.text.fill = normalizeGradientFill(style.color);
|
|
1577
1585
|
style.color = "#000000";
|
|
@@ -1865,7 +1873,9 @@ async function setupFonts(editor, api) {
|
|
|
1865
1873
|
});
|
|
1866
1874
|
on("setDoc", preload);
|
|
1867
1875
|
renderEngine.value.on("nodeEnter", preloadNode);
|
|
1868
|
-
|
|
1876
|
+
assets.awaitBy(async () => {
|
|
1877
|
+
await loadBigeFonts(api.fonts, true);
|
|
1878
|
+
});
|
|
1869
1879
|
}
|
|
1870
1880
|
export {
|
|
1871
1881
|
bidTidLoader,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mce/bigesj",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.18",
|
|
5
5
|
"description": "Plugin for mce",
|
|
6
6
|
"author": "wxm",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"modern-openxml": "^1.10.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"mce": "0.15.
|
|
52
|
+
"mce": "0.15.18"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"mce": "^0"
|