jvs-ppt-ui 0.0.35 → 0.0.36

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jvs-ppt-ui",
3
3
  "private": false,
4
- "version": "0.0.35",
4
+ "version": "0.0.36",
5
5
  "type": "module",
6
6
  "main": "./dist/lib/jvs-ppt-ui.umd.js",
7
7
  "module": "./dist/lib/jvs-ppt-ui.es.js",
@@ -69,7 +69,7 @@ const {
69
69
  showSearchPanel, showSelectionPanel, activeSearchTab, searchText, replaceText, isCaseSensitive, searchResults, currentResultIndex,
70
70
  nextSearchMatch, prevSearchMatch, replaceCurrent, replaceAll, formulaDialogVisible, currentEditingFormulaEl, renderLatexToSvg,
71
71
  editingElementId, symbolPanelVisible, addElement, isPresenting, startPresentation, clipboard, slideClipboard, pasteSlideData, pasteElementsData, copySelectedElements, handleUnifiedPaste, shapeFormatPainter,
72
- activeTab: activeTabRaw, isOpenedFromFloatToolbar, formatedAnimations, logicalWidth, logicalHeight, pauseHistory, isCanvasDragging, activeSlideVersion, addHistorySnapshot, normalizeHtmlFontFamily,
72
+ activeTab: activeTabRaw, isOpenedFromFloatToolbar, formatedAnimations, logicalWidth, logicalHeight, isUndoingRedoing, pauseHistory, isCanvasDragging, activeSlideVersion, addHistorySnapshot, normalizeHtmlFontFamily,
73
73
  globalThemeColor, globalFontColor, globalFontFamily, globalBgColor, getActiveSlideThemeRecipe, croppingElementId,
74
74
  isMasterEditingView, slideMasters, activeMasterId, activeLayoutId, activeLayout, sortSlideElements,
75
75
  selectedSlideIndexes, isMouseOverSlideList, selectAllSlides, deleteSelectedSlides, copySelectedSlides, cutSelectedSlides, duplicateSelectedSlides, duplicateSelectedElements,
@@ -1294,14 +1294,17 @@ watch(
1294
1294
  selectedElement.value?.autoFit?.type
1295
1295
  ],
1296
1296
  () => {
1297
+ if (isUndoingRedoing.value) return
1297
1298
  const el = selectedElement.value
1298
1299
  if (!el) return
1299
1300
  if ((el.type === 'text' || el.type === 'shape') && el.autoFit?.type === 'text') {
1300
1301
  nextTick(() => {
1302
+ if (isUndoingRedoing.value) return
1301
1303
  updateTextFontScale(el)
1302
1304
  })
1303
1305
  } else if (el.type === 'shape' && el.autoFit?.type === 'shape') {
1304
1306
  nextTick(() => {
1307
+ if (isUndoingRedoing.value) return
1305
1308
  syncShapeAutoFitHeight(el)
1306
1309
  })
1307
1310
  }
@@ -1602,11 +1605,17 @@ watch([selectedElementId, isEditingText], () => {
1602
1605
  })
1603
1606
 
1604
1607
  watch(selectedElementId, (newId, oldId) => {
1608
+ if (isUndoingRedoing.value) {
1609
+ isEditingText.value = false
1610
+ quickToolbarOffset.value = { x: 0, y: 0 }
1611
+ return
1612
+ }
1605
1613
  if (oldId && newId !== oldId) {
1606
1614
  const oldContainer = document.getElementById(`editable-${oldId}`)
1607
1615
  if (oldContainer && activeSlide.value) {
1616
+ const wasEditing = isEditingText.value || Boolean(oldContainer.querySelector('td[contenteditable="true"]'))
1608
1617
  const oldEl = activeSlide.value.elements.find((x: any) => x.id === oldId)
1609
- if (oldEl) {
1618
+ if (oldEl && wasEditing) {
1610
1619
  let htmlVal = oldContainer.innerHTML
1611
1620
  if (oldEl.style) {
1612
1621
  if (oldEl.style.fontWeight === 'bold') htmlVal = htmlVal.replace(/font-weight:\s*normal/gi, '')
@@ -1997,6 +2006,9 @@ function handleWindowMouseDown(e: MouseEvent) {
1997
2006
  }
1998
2007
 
1999
2008
  // Deselect active elements
2009
+ if (isEditingText.value) {
2010
+ checkAndExitEditText(undefined, true)
2011
+ }
2000
2012
  isEditingText.value = false
2001
2013
  activePlaceholderMenuElId.value = null
2002
2014
  selectedElementId.value = null
@@ -2081,6 +2093,9 @@ function handleDeselect(e?: MouseEvent) {
2081
2093
  activeTool.value = null
2082
2094
  return
2083
2095
  }
2096
+ if (isEditingText.value) {
2097
+ checkAndExitEditText(undefined, true)
2098
+ }
2084
2099
  isEditingText.value = false
2085
2100
  selectedElementId.value = null
2086
2101
  selectedElementIds.value = []
@@ -4526,9 +4541,6 @@ function getElementWidthHeight(el: any): { width: number; height: number } {
4526
4541
  const tableEl = dom?.querySelector('table')
4527
4542
  if (tableEl && tableEl.offsetHeight > 0) {
4528
4543
  height = Math.max(height, tableEl.offsetHeight)
4529
- if (el.height && height > el.height) {
4530
- el.height = height
4531
- }
4532
4544
  }
4533
4545
  }
4534
4546
 
@@ -6968,22 +6980,23 @@ function cleanupEmptyTextboxes() {
6968
6980
  if (!activeSlide.value || !activeSlide.value.elements) return
6969
6981
  const toRemove: string[] = []
6970
6982
  activeSlide.value.elements.forEach((el: any) => {
6971
- // 检查 DOM 容器是否有真实内容并同步
6983
+ // 核心保护:只有新建且从未输入过的临时文本框,才检查并清理,绝不覆写或删除历史已有元素!
6984
+ if (!el.__isTemporaryNew) return
6985
+ // Skip element if currently being edited by user
6986
+ if (isEditingText.value && (el.id === selectedElementId.value || el.id === editingElementId.value)) {
6987
+ return
6988
+ }
6972
6989
  const container = document.getElementById(`editable-${el.id}`)
6973
6990
  if (container) {
6974
6991
  const domText = (container.innerText || container.textContent || '').replace(/\u200B/g, '').trim()
6975
- if (domText.length > 0) {
6992
+ if (domText.length > 0 && !isTextEmptyOrPlaceholderPrompt(domText)) {
6976
6993
  if (el.type === 'shape') el.text = container.innerHTML
6977
6994
  else el.content = container.innerHTML
6995
+ delete el.__isTemporaryNew
6978
6996
  return
6979
6997
  }
6980
6998
  }
6981
- // Skip element if currently being edited by user
6982
- if (isEditingText.value && (el.id === selectedElementId.value || el.id === editingElementId.value)) {
6983
- return
6984
- }
6985
- // 核心保护:只有新建且从未输入过的临时文本框,才在内容为空时自动清理,绝不删除历史已有文本框!
6986
- if (el.__isTemporaryNew && el.type === 'text' && !isMasterOrPlaceholder(el) && !el.content?.includes('<table') && !el.latex) {
6999
+ if (el.type === 'text' && !isMasterOrPlaceholder(el) && !el.content?.includes('<table') && !el.latex) {
6987
7000
  if (isTextEmptyOrPlaceholderPrompt(el.content || '')) {
6988
7001
  toRemove.push(el.id)
6989
7002
  }
@@ -46,7 +46,7 @@ const {
46
46
  enterMasterView, addMaster, deleteMaster, addLayout, deleteLayout, duplicateLayout,
47
47
  clipboard, slideClipboard, handleUnifiedPaste, sortSlideElements, getEffectiveMasterElementsForSlide,
48
48
  getEffectiveSlideBackground, isCanvasDragging, activeSlideVersion, pauseHistory,
49
- activeSidebarTab, isReadonly, isTemplateEnabled
49
+ activeSidebarTab, isReadonly, isTemplateEnabled, addHistorySnapshot
50
50
  } = useSlides()
51
51
 
52
52
  const displaySlides = shallowRef<any[]>([...slides.value])
@@ -1447,7 +1447,7 @@ const thumbMasterCache = new WeakMap<object, { masterKey: string; result: any[]
1447
1447
 
1448
1448
  function getEffectiveMasterElements(slide: any) {
1449
1449
  if (!slide) return []
1450
- const curKey = `${slide.masterId || ''}_${slide.layoutId || ''}_${slide.showMasterElements !== false}_${slideMasters.value?.length || 0}`
1450
+ const curKey = `${slide.masterId || ''}_${slide.layoutId || ''}_${slide.themeId || ''}_${slide.showMasterElements !== false}_${slideMasters.value?.length || 0}_${activeSlideVersion.value}`
1451
1451
  const cached = thumbMasterCache.get(slide)
1452
1452
  if (cached && cached.masterKey === curKey) {
1453
1453
  return cached.result
@@ -292,6 +292,7 @@ watch(selectedElementId, (newId) => {
292
292
 
293
293
 
294
294
  const {
295
+ chartActiveTab,
295
296
  chartDataDialogVisible,
296
297
  tempChartDataText,
297
298
  tempChartLabels,
@@ -1400,6 +1401,30 @@ function handleUndockToPopover() {
1400
1401
  </div>
1401
1402
  </div>
1402
1403
 
1404
+ <!-- Sub tabs for Chart: 图表 vs 数据 -->
1405
+ <div
1406
+ v-if="activeTab === 'format' && selectedElement && selectedElementIds.length <= 1 && selectedElement.type === 'chart'"
1407
+ style="display: flex; height: 38px; border-bottom: 1px solid #edf0f3; padding: 0 16px; align-items: center; gap: 24px; background: #ffffff;">
1408
+ <div
1409
+ style="font-size: 13px; font-weight: 600; cursor: pointer; height: 100%; display: flex; align-items: center; position: relative; transition: color 0.15s ease;"
1410
+ :style="chartActiveTab === 'chart' ? { color: '#2563eb' } : { color: '#64748b' }"
1411
+ @click="chartActiveTab = 'chart'">
1412
+ 图表
1413
+ <div v-if="chartActiveTab === 'chart'"
1414
+ style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #2563eb; border-radius: 2px 2px 0 0;">
1415
+ </div>
1416
+ </div>
1417
+ <div
1418
+ style="font-size: 13px; font-weight: 600; cursor: pointer; height: 100%; display: flex; align-items: center; position: relative; transition: color 0.15s ease;"
1419
+ :style="chartActiveTab === 'data' ? { color: '#2563eb' } : { color: '#64748b' }"
1420
+ @click="chartActiveTab = 'data'">
1421
+ 数据
1422
+ <div v-if="chartActiveTab === 'data'"
1423
+ style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: #2563eb; border-radius: 2px 2px 0 0;">
1424
+ </div>
1425
+ </div>
1426
+ </div>
1427
+
1403
1428
  <!-- Sub tabs for Slide Design/Format: Global vs Theme vs Layout -->
1404
1429
  <div v-if="activeTab === 'design' && !isMasterEditingView"
1405
1430
  style="display: flex; height: 38px; border-bottom: 1px solid var(--border-color); padding: 0 16px; align-items: center; gap: 20px; background: var(--bg-surface);">
@@ -1774,6 +1799,18 @@ function handleUndockToPopover() {
1774
1799
  @update:shape-pattern-bg="shapePatternBg = $event"
1775
1800
  @handle-shape-pattern-upload="handleShapePatternUpload"
1776
1801
  @clear-shape-pattern-fill="clearShapePatternFill"
1802
+ :chart-active-tab="chartActiveTab"
1803
+ v-model:labels="tempChartLabels"
1804
+ v-model:datasets="tempChartDatasets"
1805
+ v-model:csv-text="tempChartDataText"
1806
+ v-model:edit-mode="chartEditMode"
1807
+ @add-row="addChartRow"
1808
+ @remove-row="removeChartRow"
1809
+ @add-series="addChartSeries"
1810
+ @remove-series="removeChartSeries"
1811
+ @transpose="transposeChartData"
1812
+ @sync-from-table="syncStructuredToText"
1813
+ @sync-from-csv="syncTextToStructured"
1777
1814
  @update:border-alpha="borderAlpha = $event"
1778
1815
  @update:shadow-alpha="shadowAlpha = $event"
1779
1816
  @update:is-border-enabled="enableBorder = $event"
@@ -2219,8 +2256,9 @@ function handleUndockToPopover() {
2219
2256
 
2220
2257
 
2221
2258
 
2222
- <!-- Chart Data Editor Dialog (方案二:左表右图双栏实时预览版) -->
2259
+ <!-- Chart Data Editor Dialog (已抽离为右侧栏「编辑数据」独立 Tab,此处弹窗隐藏保留不调用) -->
2223
2260
  <ChartDataEditorDialog
2261
+ v-if="false"
2224
2262
  v-model:visible="chartDataDialogVisible"
2225
2263
  v-model:labels="tempChartLabels"
2226
2264
  v-model:datasets="tempChartDatasets"