@mce/bigesj 0.24.2 → 0.24.4

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.
Files changed (2) hide show
  1. package/dist/index.js +16 -17
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -8186,32 +8186,31 @@ function convertImageEffects(el) {
8186
8186
  if (!imageEffects.length) return;
8187
8187
  const ratio = el.imageEffectsRatio ?? 50;
8188
8188
  const effects = [];
8189
- let needsBase = false;
8190
- for (const effect of imageEffects) {
8191
- const { filling, offset, stroke } = effect;
8189
+ for (const entry of imageEffects) {
8190
+ const { filling, offset, stroke } = entry;
8192
8191
  const transform = offset ? `translate(${offset.x / 50 * ratio * 200}, ${offset.y / 50 * ratio * 200})` : void 0;
8193
- if (offset) needsBase = true;
8194
8192
  let fill;
8195
8193
  if (filling?.color) fill = { color: filling.color };
8196
8194
  else if (filling?.imageContent?.image) fill = { image: filling.imageContent.image };
8197
8195
  const strokes = Array.isArray(stroke) ? stroke : stroke ? [stroke] : [];
8198
- if (strokes.length) strokes.forEach((s, i) => {
8199
- effects.push({
8200
- ...transform ? { transform } : {},
8201
- ...i === 0 && fill ? { fill } : {},
8202
- outline: {
8203
- color: s.color,
8204
- width: s.width / 50 * ratio
8205
- }
8206
- });
8207
- });
8208
- else if (fill) effects.push({
8196
+ if (strokes.length) {
8197
+ let cumulative = 0;
8198
+ for (const s of strokes) {
8199
+ cumulative += s.width / 50 * ratio;
8200
+ effects.push({
8201
+ ...transform ? { transform } : {},
8202
+ outline: {
8203
+ color: s.color,
8204
+ width: cumulative
8205
+ }
8206
+ });
8207
+ }
8208
+ } else if (fill) effects.push({
8209
8209
  ...transform ? { transform } : {},
8210
8210
  fill
8211
8211
  });
8212
- else if (transform) effects.push({ transform });
8212
+ else effects.push(transform ? { transform } : {});
8213
8213
  }
8214
- if (needsBase && effects.length) effects.push({});
8215
8214
  return effects.length ? effects : void 0;
8216
8215
  }
8217
8216
  function cachedFetchImageBitmap(url) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mce/bigesj",
3
3
  "type": "module",
4
- "version": "0.24.2",
4
+ "version": "0.24.4",
5
5
  "description": "Plugin for mce",
6
6
  "author": "wxm",
7
7
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "modern-openxml": "^1.12.4"
50
50
  },
51
51
  "devDependencies": {
52
- "mce": "0.24.2"
52
+ "mce": "0.24.4"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "mce": "^0"