jvs-ppt-ui 0.0.37 → 0.0.39
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/lib/jvs-ppt-ui.es.js +22348 -21892
- package/dist/lib/jvs-ppt-ui.umd.js +111 -111
- package/dist/lib/style.css +1 -1
- package/package.json +1 -1
- package/src/App.vue +7 -5
- package/src/components/CanvasArea.vue +316 -59
- package/src/components/Header.vue +2 -4
- package/src/components/PptEditor.vue +97 -5
- package/src/components/SidebarLeft.vue +30 -6
- package/src/components/canvas/elements/CanvasGroupElement.vue +3 -0
- package/src/components/canvas/elements/CanvasTextElement.vue +1 -1
- package/src/components/sidebar/common/SidebarPositionGroup.vue +199 -33
- package/src/components/sidebar/panels/SidebarImageFormatPanel.vue +37 -33
- package/src/composables/canvas/useCanvasCrop.ts +25 -2
- package/src/composables/canvas/useCanvasText.ts +27 -8
- package/src/composables/sidebar/useSidebarElementTransform.ts +13 -7
- package/src/composables/useSlides.ts +6 -4
- package/src/index.ts +8 -1
- package/src/style.css +1 -1
- package/src/types/index.ts +14 -0
- package/src/utils/canvas/formatPainter.ts +91 -32
- package/src/utils/localDraftStorage.ts +340 -0
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref } from 'vue'
|
|
3
3
|
import PptEditor from './components/PptEditor.vue'
|
|
4
|
+
import { saveMediaBlobToIndexedDB } from './utils/localDraftStorage'
|
|
4
5
|
import type { DeckData, PptEditorApi, UploadResourceContext } from './types'
|
|
5
6
|
|
|
6
7
|
const editorRef = ref<PptEditorApi | null>(null)
|
|
7
8
|
|
|
8
9
|
function handleSave(deck: DeckData) {
|
|
9
10
|
console.log('[JVS-PPT 独立运行模式] 保存幻灯片:', deck)
|
|
11
|
+
editorRef.value?.saveLocalDraft?.()
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
function handleReady(api: PptEditorApi) {
|
|
@@ -27,7 +29,7 @@ async function handleCustomUpload(fileOrBlob: File | Blob, context: UploadResour
|
|
|
27
29
|
})
|
|
28
30
|
|
|
29
31
|
// 1. 模拟网络上传请求耗时
|
|
30
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
32
|
+
await new Promise(resolve => setTimeout(resolve, 100))
|
|
31
33
|
|
|
32
34
|
// 2. 实际业务生产代码范例:
|
|
33
35
|
// const formData = new FormData()
|
|
@@ -36,16 +38,16 @@ async function handleCustomUpload(fileOrBlob: File | Blob, context: UploadResour
|
|
|
36
38
|
// const res = await fetch('/api/oss/upload', { method: 'POST', body: formData }).then(r => r.json())
|
|
37
39
|
// return res.data.url
|
|
38
40
|
|
|
39
|
-
// 3.
|
|
40
|
-
const mockServerUrl =
|
|
41
|
-
console.log(`[模拟上传成功]
|
|
41
|
+
// 3. 独立运行环境:将二进制存入浏览器 IndexedDB 并生成可持久化还原的 URL
|
|
42
|
+
const mockServerUrl = await saveMediaBlobToIndexedDB(fileOrBlob)
|
|
43
|
+
console.log(`[模拟上传成功] 已缓存到 IndexedDB 并返回文件地址:`, mockServerUrl)
|
|
42
44
|
return mockServerUrl
|
|
43
45
|
}
|
|
44
46
|
</script>
|
|
45
47
|
|
|
46
48
|
<template>
|
|
47
49
|
<!-- :custom-upload="handleCustomUpload" -->
|
|
48
|
-
<PptEditor ref="editorRef" :custom-upload="handleCustomUpload" :enable-mcp="true" :enable-ai="
|
|
50
|
+
<PptEditor ref="editorRef" :local-storage-cache="true" :custom-upload="handleCustomUpload" :enable-mcp="true" :enable-ai="false"
|
|
49
51
|
ai-api-url="/jvs-dam/api/ppt/ai-replace" :enable-material="true"
|
|
50
52
|
material-api-url="/jvs-dam/stock/search" material-page-api-url="/jvs-dam/stock/search"
|
|
51
53
|
material-save-api-url="/jvs-dam/api/dam/material/save"
|