|
|
@@ -47,9 +47,9 @@ const getStyle = (htmlString: string) => {
|
|
|
// 2. 解析 HTML 字符串为文档对象
|
|
|
const doc = parser.parseFromString(htmlString, 'text/html')
|
|
|
// 3. 获取 p 元素
|
|
|
- const p = doc.querySelector('p')
|
|
|
- // 4. 读取 style 属性(内联样式字符串)
|
|
|
- const styleAttr = p?.getAttribute('allstyle')
|
|
|
+ const firstElem = doc.querySelector('p, ul, ol, table');
|
|
|
+ // 读取该元素的 allstyle 属性
|
|
|
+ const styleAttr = firstElem?.getAttribute('allstyle');
|
|
|
console.log(styleAttr) // 输出完整的 style 字符串
|
|
|
return styleAttr || ''
|
|
|
|
|
|
@@ -1963,7 +1963,7 @@ export default () => {
|
|
|
gradient,
|
|
|
pattern,
|
|
|
fixedRatio: false,
|
|
|
- rotate: el.rotate,
|
|
|
+ rotate: 0,
|
|
|
pathBBox: el.pathBBox,
|
|
|
outline: {
|
|
|
color: el.borderColor,
|
|
|
@@ -1994,6 +1994,7 @@ export default () => {
|
|
|
const { maxX, maxY } = getSvgPathRange(el.path)
|
|
|
element.path = el.path
|
|
|
element.viewBox = poriginWidth ? [maxX, maxY] : [originWidth, originHeight]
|
|
|
+ /*
|
|
|
if (shape.pathFormula) {
|
|
|
element.pathFormula = shape.pathFormula
|
|
|
element.viewBox = [el.width, el.height]
|
|
|
@@ -2007,6 +2008,7 @@ export default () => {
|
|
|
element.path = pathFormula.formula(el.width, el.height)
|
|
|
}
|
|
|
}
|
|
|
+ */
|
|
|
}
|
|
|
else if (el.path && el.path.indexOf('NaN') === -1) {
|
|
|
const { maxX, maxY } = getSvgPathRange(el.path)
|