fix: first row height boundary error #563
This commit is contained in:
@@ -63,7 +63,11 @@ import {
|
|||||||
WordBreak
|
WordBreak
|
||||||
} from '../../dataset/enum/Editor'
|
} from '../../dataset/enum/Editor'
|
||||||
import { Control } from './control/Control'
|
import { Control } from './control/Control'
|
||||||
import { getSlimCloneElementList, zipElementList } from '../../utils/element'
|
import {
|
||||||
|
getIsInlineElement,
|
||||||
|
getSlimCloneElementList,
|
||||||
|
zipElementList
|
||||||
|
} from '../../utils/element'
|
||||||
import { CheckboxParticle } from './particle/CheckboxParticle'
|
import { CheckboxParticle } from './particle/CheckboxParticle'
|
||||||
import { RadioParticle } from './particle/RadioParticle'
|
import { RadioParticle } from './particle/RadioParticle'
|
||||||
import { DeepRequired, IPadding } from '../../interface/Common'
|
import { DeepRequired, IPadding } from '../../interface/Common'
|
||||||
@@ -84,7 +88,6 @@ import { Zone } from '../zone/Zone'
|
|||||||
import { Footer } from './frame/Footer'
|
import { Footer } from './frame/Footer'
|
||||||
import {
|
import {
|
||||||
IMAGE_ELEMENT_TYPE,
|
IMAGE_ELEMENT_TYPE,
|
||||||
INLINE_ELEMENT_TYPE,
|
|
||||||
TEXTLIKE_ELEMENT_TYPE
|
TEXTLIKE_ELEMENT_TYPE
|
||||||
} from '../../dataset/constant/Element'
|
} from '../../dataset/constant/Element'
|
||||||
import { ListParticle } from './particle/ListParticle'
|
import { ListParticle } from './particle/ListParticle'
|
||||||
@@ -1599,14 +1602,6 @@ export class Draw {
|
|||||||
if (isForceBreak || isWidthNotEnough) {
|
if (isForceBreak || isWidthNotEnough) {
|
||||||
// 换行原因:宽度不足
|
// 换行原因:宽度不足
|
||||||
curRow.isWidthNotEnough = isWidthNotEnough && !isForceBreak
|
curRow.isWidthNotEnough = isWidthNotEnough && !isForceBreak
|
||||||
// 减小行元素前第一行空行行高
|
|
||||||
if (
|
|
||||||
curRow.startIndex === 0 &&
|
|
||||||
curRow.elementList.length === 1 &&
|
|
||||||
INLINE_ELEMENT_TYPE.includes(element.type!)
|
|
||||||
) {
|
|
||||||
curRow.height = defaultBasicRowMarginHeight
|
|
||||||
}
|
|
||||||
// 两端对齐、分散对齐
|
// 两端对齐、分散对齐
|
||||||
if (
|
if (
|
||||||
preElement?.rowFlex === RowFlex.JUSTIFY ||
|
preElement?.rowFlex === RowFlex.JUSTIFY ||
|
||||||
@@ -1665,7 +1660,11 @@ export class Draw {
|
|||||||
rowList.push(row)
|
rowList.push(row)
|
||||||
} else {
|
} else {
|
||||||
curRow.width += metrics.width
|
curRow.width += metrics.width
|
||||||
if (curRow.height < height) {
|
// 减小行元素前第一行空行行高
|
||||||
|
if (i === 0 && getIsInlineElement(elementList[1])) {
|
||||||
|
curRow.height = defaultBasicRowMarginHeight
|
||||||
|
curRow.ascent = defaultBasicRowMarginHeight
|
||||||
|
} else if (curRow.height < height) {
|
||||||
curRow.height = height
|
curRow.height = height
|
||||||
curRow.ascent = ascent
|
curRow.ascent = ascent
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
ElementType,
|
ElementType,
|
||||||
IEditorOption,
|
IEditorOption,
|
||||||
IElement,
|
IElement,
|
||||||
|
ImageDisplay,
|
||||||
ListStyle,
|
ListStyle,
|
||||||
ListType,
|
ListType,
|
||||||
RowFlex,
|
RowFlex,
|
||||||
@@ -23,6 +24,7 @@ import {
|
|||||||
CONTROL_STYLE_ATTR,
|
CONTROL_STYLE_ATTR,
|
||||||
EDITOR_ELEMENT_CONTEXT_ATTR,
|
EDITOR_ELEMENT_CONTEXT_ATTR,
|
||||||
EDITOR_ELEMENT_ZIP_ATTR,
|
EDITOR_ELEMENT_ZIP_ATTR,
|
||||||
|
INLINE_ELEMENT_TYPE,
|
||||||
INLINE_NODE_NAME,
|
INLINE_NODE_NAME,
|
||||||
TABLE_CONTEXT_ATTR,
|
TABLE_CONTEXT_ATTR,
|
||||||
TABLE_TD_ZIP_ATTR,
|
TABLE_TD_ZIP_ATTR,
|
||||||
@@ -1377,3 +1379,11 @@ export function getSlimCloneElementList(elementList: IElement[]) {
|
|||||||
'style'
|
'style'
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getIsInlineElement(element?: IElement) {
|
||||||
|
return (
|
||||||
|
!!element?.type &&
|
||||||
|
(INLINE_ELEMENT_TYPE.includes(element.type) ||
|
||||||
|
element.imgDisplay === ImageDisplay.INLINE)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user