jvs-ppt-ui 0.0.33 → 0.0.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.
Files changed (29) hide show
  1. package/dist/lib/jvs-ppt-ui.es.js +20752 -20255
  2. package/dist/lib/jvs-ppt-ui.umd.js +115 -116
  3. package/dist/lib/style.css +1 -1
  4. package/package.json +1 -1
  5. package/src/components/CanvasArea.vue +85 -37
  6. package/src/components/PresentationGroupChild.vue +11 -1
  7. package/src/components/PresentationMode.vue +10 -1
  8. package/src/components/QuickColorPopover.vue +2 -1
  9. package/src/components/SidebarLeft.vue +3354 -3212
  10. package/src/components/SidebarRight.vue +183 -134
  11. package/src/components/canvas/CanvasTransformHandles.vue +27 -36
  12. package/src/components/canvas/elements/CanvasShapeElement.vue +3 -2
  13. package/src/components/canvas/elements/CanvasTextElement.vue +4 -0
  14. package/src/components/sidebar/panels/LayoutThumbSvg.vue +130 -57
  15. package/src/components/sidebar/panels/SidebarDesignPanel.vue +7 -14
  16. package/src/components/sidebar/panels/SidebarShapeFormatPanel.vue +1 -1
  17. package/src/components/sidebar/panels/SidebarTextFormatPanel.vue +1 -1
  18. package/src/composables/canvas/useCanvasContextMenu.ts +1 -1
  19. package/src/composables/canvas/useCanvasFormatting.ts +20 -13
  20. package/src/composables/canvas/useCanvasText.ts +4 -3
  21. package/src/composables/canvas/useCanvasTransform.ts +37 -10
  22. package/src/composables/sidebar/useSidebarDesign.ts +2 -1
  23. package/src/composables/sidebar/useSidebarElementTransform.ts +87 -58
  24. package/src/composables/sidebar/useSidebarTextFormat.ts +242 -19
  25. package/src/composables/useSlides.ts +228 -62
  26. package/src/configs/slideTemplates.ts +7 -3
  27. package/src/style.css +3 -3
  28. package/src/utils/canvas/elementStyles.ts +11 -1
  29. package/src/utils/canvas/formatPainter.ts +177 -30
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jvs-ppt-ui",
3
3
  "private": false,
4
- "version": "0.0.33",
4
+ "version": "0.0.35",
5
5
  "type": "module",
6
6
  "main": "./dist/lib/jvs-ppt-ui.umd.js",
7
7
  "module": "./dist/lib/jvs-ppt-ui.es.js",
@@ -1010,13 +1010,19 @@ const getOverlayWidth = (el: any) => {
1010
1010
  }
1011
1011
  const isVerticalText = el.type === 'text' && !el.content?.includes('<table') && !el.latex && (el.style?.writingMode === 'vertical-rl' || el.style?.writingMode === 'vertical-lr')
1012
1012
  if (isVerticalText && !isDragging.value) {
1013
- const dom = document.getElementById(`editable-${el.id}`) || document.getElementById(`canvas-el-${el.id}`)
1014
- if (dom) {
1015
- const w = Math.max(dom.scrollWidth || 0, dom.offsetWidth || 0)
1016
- if (w > 0) return `${w}px`
1013
+ if (el.autoFit?.type === 'shape' || el.style?.width === 'auto' || el.style?.width === undefined) {
1014
+ const dom = document.getElementById(`editable-${el.id}`) || document.getElementById(`canvas-el-${el.id}`)
1015
+ if (dom) {
1016
+ const w = Math.max(dom.scrollWidth || 0, dom.offsetWidth || 0)
1017
+ if (w > 0) return `${w}px`
1018
+ }
1019
+ } else if (el.style?.width && el.style.width !== 'auto') {
1020
+ return `${getElementWidthHeight(el).width}px`
1021
+ } else if (el.width && el.width > 0) {
1022
+ return `${el.width}px`
1017
1023
  }
1018
1024
  }
1019
- if (el.style?.width && el.style.width !== 'auto' && !isVerticalText) {
1025
+ if (el.style?.width && el.style.width !== 'auto') {
1020
1026
  return `${getElementWidthHeight(el).width}px`
1021
1027
  }
1022
1028
  if (el.id === selectedElementId.value && !isResizing.value && selectedElementWidth.value && selectedElementWidth.value !== '0px') {
@@ -1208,7 +1214,8 @@ function syncSelectedElementDimensionsFromDom(id: string | null) {
1208
1214
  const editableDom = document.getElementById(`editable-${id}`)
1209
1215
  const selEl = activeSlide.value?.elements.find((x: any) => x.id === id)
1210
1216
  const isVertical = selEl && (selEl.style?.writingMode === 'vertical-rl' || selEl.style?.writingMode === 'vertical-lr')
1211
- const initialW = isVertical && editableDom ? Math.max(editableDom.scrollWidth, dom.offsetWidth) : dom.offsetWidth
1217
+ const isVerticalAutoW = isVertical && (selEl?.autoFit?.type === 'shape' || !selEl?.style?.width || selEl.style.width === 'auto')
1218
+ const initialW = isVerticalAutoW && editableDom ? Math.max(editableDom.scrollWidth, dom.offsetWidth) : dom.offsetWidth
1212
1219
  const initialH = dom.offsetHeight > 0 ? dom.offsetHeight : (tableEl && tableEl.offsetHeight > 0 ? tableEl.offsetHeight : 0)
1213
1220
  selectedElementWidth.value = `${initialW}px`
1214
1221
  selectedElementHeight.value = `${initialH}px`
@@ -1237,7 +1244,8 @@ function observeSelectedElement() {
1237
1244
  const editableDom = document.getElementById(`editable-${selectedElementId.value}`)
1238
1245
  const selEl = activeSlide.value?.elements.find((x: any) => x.id === selectedElementId.value)
1239
1246
  const isVertical = selEl && (selEl.style?.writingMode === 'vertical-rl' || selEl.style?.writingMode === 'vertical-lr')
1240
- const initialW = isVertical && editableDom ? Math.max(editableDom.scrollWidth, dom.offsetWidth) : dom.offsetWidth
1247
+ const isVerticalAutoW = isVertical && (selEl?.autoFit?.type === 'shape' || !selEl?.style?.width || selEl.style.width === 'auto')
1248
+ const initialW = isVerticalAutoW && editableDom ? Math.max(editableDom.scrollWidth, dom.offsetWidth) : dom.offsetWidth
1241
1249
  const initialH = dom.offsetHeight > 0 ? dom.offsetHeight : (tableEl && tableEl.offsetHeight > 0 ? tableEl.offsetHeight : 0)
1242
1250
  selectedElementWidth.value = `${initialW}px`
1243
1251
  selectedElementHeight.value = `${initialH}px`
@@ -1249,7 +1257,8 @@ function observeSelectedElement() {
1249
1257
  const curEditableDom = document.getElementById(`editable-${selectedElementId.value}`)
1250
1258
  const currentSelEl = activeSlide.value?.elements.find((x: any) => x.id === selectedElementId.value)
1251
1259
  const curIsVertical = currentSelEl && (currentSelEl.style?.writingMode === 'vertical-rl' || currentSelEl.style?.writingMode === 'vertical-lr')
1252
- const curW = curIsVertical && curEditableDom
1260
+ const curIsVerticalAutoW = curIsVertical && (currentSelEl?.autoFit?.type === 'shape' || !currentSelEl?.style?.width || currentSelEl.style.width === 'auto')
1261
+ const curW = curIsVerticalAutoW && curEditableDom
1253
1262
  ? Math.max(curEditableDom.scrollWidth, dom.offsetWidth)
1254
1263
  : dom.offsetWidth
1255
1264
  // 值相等守卫:避免 RO → 渲染 → RO 的无谓链路
@@ -1274,6 +1283,7 @@ watch(selectedElementId, observeSelectedElement)
1274
1283
  watch(
1275
1284
  () => [
1276
1285
  selectedElement.value?.content,
1286
+ (selectedElement.value as any)?.text,
1277
1287
  selectedElement.value?.style?.fontSize,
1278
1288
  selectedElement.value?.style?.fontFamily,
1279
1289
  selectedElement.value?.style?.lineHeight,
@@ -1284,9 +1294,15 @@ watch(
1284
1294
  selectedElement.value?.autoFit?.type
1285
1295
  ],
1286
1296
  () => {
1287
- if (selectedElement.value?.type === 'text' && selectedElement.value?.autoFit?.type === 'text') {
1297
+ const el = selectedElement.value
1298
+ if (!el) return
1299
+ if ((el.type === 'text' || el.type === 'shape') && el.autoFit?.type === 'text') {
1300
+ nextTick(() => {
1301
+ updateTextFontScale(el)
1302
+ })
1303
+ } else if (el.type === 'shape' && el.autoFit?.type === 'shape') {
1288
1304
  nextTick(() => {
1289
- updateTextFontScale(selectedElement.value)
1305
+ syncShapeAutoFitHeight(el)
1290
1306
  })
1291
1307
  }
1292
1308
  },
@@ -2773,14 +2789,16 @@ function handleCanvasMouseDown(e: MouseEvent) {
2773
2789
  const fontWeight = textCfg.fontWeight || typeConf.defaultFontWeight
2774
2790
  const lineHeight = textCfg.lineHeight || typeConf.defaultLineHeight
2775
2791
  const letterSpacing = textCfg.letterSpacing !== undefined ? `${textCfg.letterSpacing}px` : '0px'
2776
- const defaultW = `${typeConf.defaultWidth}px`
2792
+ const defaultWNum = typeConf.defaultWidth
2793
+ const defaultW = `${defaultWNum}px`
2794
+ const defaultHNum = Math.max(typeConf.defaultHeight || 36, Math.ceil((parseFloat(fontSize) || typeConf.defaultFontSize || 18) * (parseFloat(String(lineHeight)) || 1.2) + 12))
2777
2795
 
2778
2796
  content = `<div style="color:${textColor}; font-family:${textFont};"><br></div>`
2779
2797
  style = {
2780
2798
  top: `${creationStartPctY.toFixed(2)}%`,
2781
2799
  left: `${creationStartPctX.toFixed(2)}%`,
2782
2800
  width: defaultW,
2783
- height: 'auto',
2801
+ height: `${defaultHNum}px`,
2784
2802
  color: textColor,
2785
2803
  textColor: textColor,
2786
2804
  fontFamily: textFont,
@@ -2801,10 +2819,17 @@ function handleCanvasMouseDown(e: MouseEvent) {
2801
2819
  name: typeConf.label,
2802
2820
  content,
2803
2821
  style,
2822
+ width: defaultWNum,
2823
+ height: defaultHNum,
2804
2824
  color: textColor,
2805
2825
  textColor: textColor,
2806
2826
  fontFamily: textFont,
2807
- verticalAlign: 'middle'
2827
+ verticalAlign: 'middle',
2828
+ autoFit: {
2829
+ type: 'none',
2830
+ fontScale: 100,
2831
+ lnSpcReduction: 0
2832
+ }
2808
2833
  }
2809
2834
  } else if (activeTool.value === 'text-vertical') {
2810
2835
  type = 'text'
@@ -2822,12 +2847,13 @@ function handleCanvasMouseDown(e: MouseEvent) {
2822
2847
  const fontWeight = textCfg.fontWeight || typeConf.defaultFontWeight
2823
2848
  const lineHeight = textCfg.lineHeight || typeConf.defaultLineHeight
2824
2849
  const letterSpacing = textCfg.letterSpacing !== undefined ? `${textCfg.letterSpacing}px` : '0px'
2850
+ const defaultVertW = Math.max(48, Math.ceil((parseFloat(fontSize) || typeConf.defaultFontSize || 18) * (parseFloat(String(lineHeight)) || 1.2) + 16))
2825
2851
 
2826
2852
  content = `<div style="color:${textColor}; font-family:${textFont};"><br></div>`
2827
2853
  style = {
2828
2854
  top: `${creationStartPctY.toFixed(2)}%`,
2829
2855
  left: `${creationStartPctX.toFixed(2)}%`,
2830
- width: 'auto',
2856
+ width: `${defaultVertW}px`,
2831
2857
  height: '180px',
2832
2858
  color: textColor,
2833
2859
  textColor: textColor,
@@ -2849,10 +2875,17 @@ function handleCanvasMouseDown(e: MouseEvent) {
2849
2875
  name: `竖排${typeConf.label}`,
2850
2876
  content,
2851
2877
  style,
2878
+ width: defaultVertW,
2879
+ height: 180,
2852
2880
  color: textColor,
2853
2881
  textColor: textColor,
2854
2882
  fontFamily: textFont,
2855
- verticalAlign: 'middle'
2883
+ verticalAlign: 'middle',
2884
+ autoFit: {
2885
+ type: 'none',
2886
+ fontScale: 100,
2887
+ lnSpcReduction: 0
2888
+ }
2856
2889
  }
2857
2890
  } else if (activeTool.value === 'shape-draw') {
2858
2891
  type = 'shape'
@@ -3108,14 +3141,6 @@ function updateCreationPosition(e: MouseEvent) {
3108
3141
  const midPoint = [(startRel[0] + endRel[0]) / 2, (startRel[1] + endRel[1]) / 2] as [number, number]
3109
3142
  createdElement.cubic = [midPoint, midPoint]
3110
3143
  }
3111
- } else if (createdElement.type === 'text') {
3112
- if (createdElement.style.writingMode === 'vertical-rl' || createdElement.style.writingMode === 'vertical-lr') {
3113
- createdElement.style.height = `${heightPx.toFixed(0)}px`
3114
- createdElement.style.width = 'auto'
3115
- } else {
3116
- createdElement.style.width = `${widthPx.toFixed(0)}px`
3117
- createdElement.style.height = 'auto'
3118
- }
3119
3144
  }
3120
3145
  }
3121
3146
 
@@ -3192,17 +3217,32 @@ function stopCreationDrag() {
3192
3217
  }
3193
3218
  }
3194
3219
  } else if (createdElement.type === 'text') {
3220
+ const typeConf = TEXT_TYPE_CONFIGS[createdElement.textType as SlideTextType] || TEXT_TYPE_CONFIGS.normalText
3221
+ const fs = parseFloat(createdElement.style.fontSize) || typeConf.defaultFontSize || 18
3222
+ const lh = parseFloat(String(createdElement.style.lineHeight)) || typeConf.defaultLineHeight || 1.3
3223
+ const minVertW = Math.max(48, Math.ceil(fs * lh + 16))
3224
+ const minHorizH = Math.max(typeConf.defaultHeight || 36, Math.ceil(fs * lh + 12))
3195
3225
  if (createdElement.style.writingMode === 'vertical-rl' || createdElement.style.writingMode === 'vertical-lr') {
3196
3226
  if (heightVal < 15) {
3197
3227
  createdElement.style.height = '180px'
3198
3228
  }
3199
- createdElement.style.width = 'auto'
3229
+ if (widthVal < minVertW) {
3230
+ createdElement.style.width = `${minVertW}px`
3231
+ }
3200
3232
  } else {
3201
3233
  if (widthVal < 15) {
3202
- const typeConf = TEXT_TYPE_CONFIGS[createdElement.textType as SlideTextType] || TEXT_TYPE_CONFIGS.normalText
3203
3234
  createdElement.style.width = `${typeConf.defaultWidth}px`
3204
3235
  }
3205
- createdElement.style.height = 'auto'
3236
+ if (heightVal < minHorizH) {
3237
+ createdElement.style.height = `${minHorizH}px`
3238
+ }
3239
+ }
3240
+ createdElement.width = parseFloat(createdElement.style.width) || typeConf.defaultWidth
3241
+ createdElement.height = parseFloat(createdElement.style.height) || typeConf.defaultHeight
3242
+ createdElement.autoFit = {
3243
+ type: 'none',
3244
+ fontScale: 100,
3245
+ lnSpcReduction: 0
3206
3246
  }
3207
3247
  }
3208
3248
 
@@ -3210,6 +3250,12 @@ function stopCreationDrag() {
3210
3250
  createdElement.__isTemporaryNew = true
3211
3251
  }
3212
3252
 
3253
+ const maxOrder = (activeSlide.value.elements || []).reduce((max: number, el: any) => {
3254
+ const o = el?.order !== undefined ? el.order : 0
3255
+ return Math.max(max, o)
3256
+ }, 0)
3257
+ createdElement.order = maxOrder + 1
3258
+
3213
3259
  activeSlide.value.elements.push(createdElement)
3214
3260
  if (createdElement.type === 'line' && (createdElement.startConnection || createdElement.endConnection)) {
3215
3261
  syncSlideConnections(activeSlide.value, logicalWidth.value, logicalHeight.value, [createdElement.id])
@@ -4381,10 +4427,12 @@ function getElementWidthHeight(el: any): { width: number; height: number } {
4381
4427
  if (!isNaN(w) && !isNaN(h) && w > 0 && h > 0) {
4382
4428
  if (el.type === 'text' && !el.content?.includes('<table') && !el.latex && !isDragging.value) {
4383
4429
  if (el.style?.writingMode === 'vertical-rl' || el.style?.writingMode === 'vertical-lr') {
4384
- const editableDom = document.getElementById(`editable-${el.id}`)
4385
- const dom = document.getElementById(`canvas-el-${el.id}`)
4386
- const actualW = Math.max(editableDom?.scrollWidth || 0, dom?.offsetWidth || 0, w)
4387
- return { width: actualW, height: h }
4430
+ if (el.autoFit?.type === 'shape') {
4431
+ const editableDom = document.getElementById(`editable-${el.id}`)
4432
+ const dom = document.getElementById(`canvas-el-${el.id}`)
4433
+ const actualW = Math.max(editableDom?.scrollWidth || 0, dom?.offsetWidth || 0, w)
4434
+ return { width: actualW, height: h }
4435
+ }
4388
4436
  } else if (el.autoFit?.type === 'shape') {
4389
4437
  const dom = document.getElementById(`canvas-el-${el.id}`) || document.getElementById(`canvas-content-${el.id}`)
4390
4438
  if (dom && dom.offsetHeight > 0) {
@@ -4400,7 +4448,7 @@ function getElementWidthHeight(el: any): { width: number; height: number } {
4400
4448
  return { width: el.width, height: el.height }
4401
4449
  }
4402
4450
 
4403
- const fitType = el.autoFit?.type || ((el.style?.height && el.style.height !== 'auto') ? 'none' : (el.type === 'text' ? 'shape' : undefined))
4451
+ const fitType = el.autoFit?.type || 'none'
4404
4452
  const isWidthAuto = el.style?.width === 'auto' || (el.type === 'text' && fitType === 'shape' && (el.style?.writingMode === 'vertical-rl' || el.style?.writingMode === 'vertical-lr' || el.style?.whiteSpace === 'nowrap'))
4405
4453
  const isHeightAuto = el.style?.height === 'auto' || el.style?.height === undefined || (el.type === 'text' && !el.content?.includes('<table') && !el.latex && fitType === 'shape' && (!(el.style?.writingMode === 'vertical-rl' || el.style?.writingMode === 'vertical-lr') || el.style?.whiteSpace === 'nowrap'))
4406
4454
 
@@ -4467,7 +4515,7 @@ function getElementWidthHeight(el: any): { width: number; height: number } {
4467
4515
  }
4468
4516
  }
4469
4517
 
4470
- if (el.type === 'text' && !el.content?.includes('<table') && !el.latex && el.style?.writingMode !== 'vertical-rl' && el.style?.writingMode !== 'vertical-lr') {
4518
+ if (isHeightAuto && el.type === 'text' && !el.content?.includes('<table') && !el.latex && el.style?.writingMode !== 'vertical-rl' && el.style?.writingMode !== 'vertical-lr') {
4471
4519
  if (dom && dom.offsetHeight > 0) {
4472
4520
  height = Math.max(height, dom.offsetHeight)
4473
4521
  }
@@ -7156,7 +7204,7 @@ function handleTextBlur(e: FocusEvent, el: any) {
7156
7204
  el.style.height = `${el.height || 40}px`
7157
7205
  }
7158
7206
  } else {
7159
- const fitType = el.autoFit?.type || 'shape'
7207
+ const fitType = el.autoFit?.type || 'none'
7160
7208
  if (fitType === 'shape') {
7161
7209
  el.style.height = 'auto'
7162
7210
  if (container.offsetHeight > 0) {
@@ -8168,7 +8216,7 @@ async function handleGlobalPaste(e: ClipboardEvent) {
8168
8216
  <!-- Master Background Elements Layer (Z-Index 1: Read-only background elements) -->
8169
8217
  <div v-for="el in effectiveMasterElements" :key="`master-el-${el.id}`"
8170
8218
  class="canvas-element master-element-item"
8171
- v-memo="[el.id, isDragging ? 'drag' : `${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}`]"
8219
+ v-memo="[el.id, isDragging ? 'drag' : `${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}_${el.fill}_${el.color}_${el.style?.fill}_${el.style?.color}_${el.style?.fontFamily}_${activeSlide?.themeId}_${activeSlideVersion}`]"
8172
8220
  :style="{
8173
8221
  position: 'absolute',
8174
8222
  top: el.style?.top || (el.top !== undefined ? `${el.top}px` : '0px'),
@@ -8226,7 +8274,7 @@ async function handleGlobalPaste(e: ClipboardEvent) {
8226
8274
 
8227
8275
  <!-- Layout Placeholders Layer (Z-Index 2: Master layout placeholder boxes) -->
8228
8276
  <div v-for="ph in effectiveLayoutPlaceholders" :key="`ph-${ph.id}`" class="canvas-placeholder-item"
8229
- v-memo="[ph.id, isDragging ? 'drag' : `${ph.style?.left}_${ph.style?.top}_${ph.style?.width}_${ph.style?.height}_${isMasterEditingView}`]"
8277
+ v-memo="[ph.id, isDragging ? 'drag' : `${ph.style?.left}_${ph.style?.top}_${ph.style?.width}_${ph.style?.height}_${isMasterEditingView}_${activeSlideVersion}`]"
8230
8278
  :style="{
8231
8279
  position: 'absolute',
8232
8280
  top: ph.style.top,
@@ -8254,11 +8302,11 @@ async function handleGlobalPaste(e: ClipboardEvent) {
8254
8302
  v-memo="[
8255
8303
  (isDragging || isCanvasDragging)
8256
8304
  ? (selectedElementIds.includes(el.id)
8257
- ? `${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}_${el.style?.rotate}`
8305
+ ? `${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}_${el.style?.rotate}_${(el as any).autoFit?.fontScale || ''}`
8258
8306
  : (el.type === 'line'
8259
8307
  ? `${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}_${el.start?.join(',')}_${el.end?.join(',')}_${el.broken?.join(',')}_${el.broken2?.join(',')}_${el.curve?.join(',')}`
8260
8308
  : 'frozen'))
8261
- : `${el.id}_${el.type}_${el.content}_${(el as any).src}_${el.isPlaceholderReplaced}_${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}_${el.style?.rotate}_${el.type === 'line' ? `${el.start?.join(',')}_${el.end?.join(',')}_${el.broken?.join(',')}_${el.broken2?.join(',')}_${el.curve?.join(',')}_` : ''}${selectedElementIds.includes(el.id)}_${selectedElementId === el.id}_${isEditingText}_${activeTab}_${activeSlideVersion}_${(el.style as any)?.reflection?.enabled}_${(el.style as any)?.reflection?.distance}_${(el.style as any)?.reflection?.size}_${(el.style as any)?.reflection?.blur}_${(el.style as any)?.reflection?.opacity}`
8309
+ : `${el.id}_${el.type}_${el.content}_${typeof (el as any).text === 'string' ? (el as any).text : ((el as any).text?.content || '')}_${(el.style as any)?.textBackground || ''}_${(el as any).autoFit?.type || ''}_${(el as any).autoFit?.fontScale || ''}_${(el as any).src}_${el.isPlaceholderReplaced}_${el.style?.left}_${el.style?.top}_${el.style?.width}_${el.style?.height}_${el.style?.rotate}_${el.type === 'line' ? `${el.start?.join(',')}_${el.end?.join(',')}_${el.broken?.join(',')}_${el.broken2?.join(',')}_${el.curve?.join(',')}_` : ''}${selectedElementIds.includes(el.id)}_${selectedElementId === el.id}_${isEditingText}_${activeTab}_${activeSlideVersion}_${(el.style as any)?.reflection?.enabled}_${(el.style as any)?.reflection?.distance}_${(el.style as any)?.reflection?.size}_${(el.style as any)?.reflection?.blur}_${(el.style as any)?.reflection?.opacity}`
8262
8310
  ]"
8263
8311
  :class="{
8264
8312
  selected: selectedElementIds.includes(el.id),
@@ -190,7 +190,17 @@ function getElementPattern(el: any): string | undefined {
190
190
  if (!pattern || typeof pattern !== 'string') return undefined
191
191
  const str = pattern.trim()
192
192
  if (!str) return undefined
193
- if (str.startsWith('data:') || str.startsWith('http:') || str.startsWith('https:') || str.startsWith('blob:') || str.startsWith('url(')) {
193
+ if (
194
+ str.startsWith('data:') ||
195
+ str.startsWith('http:') ||
196
+ str.startsWith('https:') ||
197
+ str.startsWith('blob:') ||
198
+ str.startsWith('url(') ||
199
+ str.startsWith('/') ||
200
+ str.startsWith('./') ||
201
+ str.startsWith('../') ||
202
+ /\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)([?#].*)?$/i.test(str)
203
+ ) {
194
204
  return str
195
205
  }
196
206
  return `data:image/png;base64,${str}`
@@ -586,7 +586,16 @@ function getElementPattern(el: any): string | undefined {
586
586
  str = str.replace(/^url\(['"]?/, '').replace(/['"]?\)$/, '').trim()
587
587
  }
588
588
  if (!str) return undefined
589
- if (str.startsWith('data:') || str.startsWith('http:') || str.startsWith('https:') || str.startsWith('blob:')) {
589
+ if (
590
+ str.startsWith('data:') ||
591
+ str.startsWith('http:') ||
592
+ str.startsWith('https:') ||
593
+ str.startsWith('blob:') ||
594
+ str.startsWith('/') ||
595
+ str.startsWith('./') ||
596
+ str.startsWith('../') ||
597
+ /\.(png|jpe?g|gif|webp|svg|bmp|avif|ico)([?#].*)?$/i.test(str)
598
+ ) {
590
599
  return str
591
600
  }
592
601
  return `data:image/png;base64,${str}`
@@ -36,6 +36,7 @@ const isCustomColorPickerShow = ref(false)
36
36
  const referenceWrapperRef = ref<HTMLElement>()
37
37
 
38
38
  const handleBodyBubble = (e: MouseEvent) => {
39
+ if (!popoverVisible.value && !isCustomColorPickerShow.value) return
39
40
  const target = e.target as HTMLElement
40
41
  if (!target) return
41
42
  const isInsidePopover = target.closest('.quick-color-popover') ||
@@ -147,7 +148,7 @@ function getCurrentColor(): string {
147
148
  col = props.color || '#000000'
148
149
  }
149
150
  if (!col || col === 'transparent' || col === 'none') {
150
- return 'rgba(0, 0, 0, 0)'
151
+ return '#FFFFFF'
151
152
  }
152
153
  if (props.alpha !== undefined && props.alpha >= 0 && props.alpha <= 100) {
153
154
  const cleanHex = col.trim().replace('#', '')