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