|
|
@@ -355,12 +355,20 @@ const sendAction = async (action: string) => {
|
|
|
|
|
|
// 提取当前页面中 type 为 'text' 的元素的纯文本内容
|
|
|
const textContents = slidesStore.currentSlide?.elements
|
|
|
- .filter((element: any) => element.type === 'text')
|
|
|
+ .filter((element: any) => element.type === 'text' || (element.type === 'shape' && element.text && element.text.content))
|
|
|
.map((textElement: any) => {
|
|
|
+ if (textElement.type === 'shape') {
|
|
|
+ // 创建一个临时元素来解析 HTML 并提取纯文本
|
|
|
+ const tempElement = document.createElement('div')
|
|
|
+ tempElement.innerHTML = textElement.text.content
|
|
|
+ return tempElement.textContent || tempElement.innerText || ''
|
|
|
+ }
|
|
|
// 创建一个临时元素来解析 HTML 并提取纯文本
|
|
|
const tempElement = document.createElement('div')
|
|
|
tempElement.innerHTML = textElement.content
|
|
|
return tempElement.textContent || tempElement.innerText || ''
|
|
|
+
|
|
|
+
|
|
|
})
|
|
|
.filter(content => content.trim() !== '') || []
|
|
|
console.log('textContents', textContents)
|