|
@@ -14,7 +14,7 @@ import {
|
|
|
getFontShadow
|
|
|
} from './fontStyle'
|
|
|
|
|
|
-export function genTextBody (
|
|
|
+export function genTextBody(
|
|
|
textBodyNode,
|
|
|
spNode,
|
|
|
slideLayoutSpNode,
|
|
@@ -25,7 +25,7 @@ export function genTextBody (
|
|
|
|
|
|
let text = ''
|
|
|
const listCounters = {} // 添加列表计数器对象
|
|
|
-
|
|
|
+ const slideMasterTextStyles = warpObj['slideMasterTextStyles']
|
|
|
const pFontStyle = getTextByPathList(spNode, ['p:style', 'a:fontRef'])
|
|
|
const pNode = textBodyNode['a:p']
|
|
|
const pNodes = pNode.constructor === Array ? pNode : [pNode]
|
|
@@ -67,7 +67,8 @@ export function genTextBody (
|
|
|
text += `<${tagName} style="list-style: none; " class="${className}">`
|
|
|
isList = listType
|
|
|
listCounters[className] = 0
|
|
|
- } else if (isList && isList !== listType) {
|
|
|
+ }
|
|
|
+ else if (isList && isList !== listType) {
|
|
|
text += `</${isList.split(' ')[0]}>`
|
|
|
text += `<${tagName} style="list-style: none; " class="${className}">`
|
|
|
isList = listType
|
|
@@ -91,8 +92,12 @@ export function genTextBody (
|
|
|
'': '•' // 默认圆点
|
|
|
}
|
|
|
const displayChar = symbolMap[bulletChar] || bulletChar
|
|
|
- text += `<span style="display: inline-block; width: 20px; margin-left: -20px;">${displayChar}</span>`
|
|
|
- } else {
|
|
|
+ // 获取字体大小,与内容保持一致
|
|
|
+ const fontSize = getFontSize(textBodyNode, slideLayoutSpNode, type, slideMasterTextStyles)
|
|
|
+ const fontSizeStyle = fontSize ? `font-size: ${fontSize};` : ''
|
|
|
+ text += `<span style="display: inline-block; width: 20px; ${fontSizeStyle}; margin-left: -20px;">${displayChar}</span>`
|
|
|
+ }
|
|
|
+ else {
|
|
|
let displayNumber = ''
|
|
|
|
|
|
switch (className) {
|
|
@@ -120,10 +125,13 @@ export function genTextBody (
|
|
|
default:
|
|
|
displayNumber = `${currentNumber}.`
|
|
|
}
|
|
|
-
|
|
|
- text += `<span style="display: inline-block; margin-left: -20px;">${displayNumber}</span>`
|
|
|
+ // 获取字体大小,与内容保持一致
|
|
|
+ const fontSize = getFontSize(textBodyNode, slideLayoutSpNode, type, slideMasterTextStyles)
|
|
|
+ const fontSizeStyle = fontSize ? `font-size: ${fontSize};` : ''
|
|
|
+ text += `<span style="display: inline-block; ${fontSizeStyle}; margin-left: -20px;">${displayNumber}</span>`
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
if (isList) {
|
|
|
text += `</${isList.split(' ')[0]}>`
|
|
|
isList = ''
|
|
@@ -141,7 +149,8 @@ export function genTextBody (
|
|
|
type,
|
|
|
warpObj
|
|
|
)
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
for (const rNodeItem of rNode) {
|
|
|
text += genSpanElement(
|
|
|
rNodeItem,
|
|
@@ -161,7 +170,7 @@ export function genTextBody (
|
|
|
return text
|
|
|
}
|
|
|
|
|
|
-export function getListType (node) {
|
|
|
+export function getListType(node) {
|
|
|
const pPrNode = node['a:pPr']
|
|
|
if (!pPrNode) return ''
|
|
|
|
|
@@ -191,7 +200,7 @@ export function getListType (node) {
|
|
|
return ''
|
|
|
}
|
|
|
|
|
|
-export function genSpanElement (
|
|
|
+export function genSpanElement(
|
|
|
node,
|
|
|
pNode,
|
|
|
textBodyNode,
|
|
@@ -216,7 +225,8 @@ export function genSpanElement (
|
|
|
if (directSize) {
|
|
|
// 如果节点本身有字体大小设置,直接使用
|
|
|
fontSize = getFontSize(node, slideLayoutSpNode, type, slideMasterTextStyles)
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
// 如果节点没有字体大小设置,使用 textBodyNode
|
|
|
fontSize = getFontSize(textBodyNode, slideLayoutSpNode, type, slideMasterTextStyles)
|
|
|
}
|