feat: wrap within list item
This commit is contained in:
@@ -1043,7 +1043,7 @@ export class Draw {
|
||||
if (element.listId) {
|
||||
if (element.listId !== listId) {
|
||||
listIndex = 0
|
||||
} else if (element.value === ZERO) {
|
||||
} else if (element.value === ZERO && !element.listWrap) {
|
||||
listIndex++
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export class ListParticle {
|
||||
public drawListStyle(ctx: CanvasRenderingContext2D, row: IRow, position: IElementPosition) {
|
||||
const { elementList, offsetX, listIndex, ascent } = row
|
||||
const startElement = elementList[0]
|
||||
if (startElement.value !== ZERO) return
|
||||
if (startElement.value !== ZERO || startElement.listWrap) return
|
||||
let text = ''
|
||||
if (startElement.listType === ListType.UL) {
|
||||
if (startElement.listStyle) {
|
||||
|
||||
@@ -77,8 +77,13 @@ export function keydown(evt: KeyboardEvent, host: CanvasEvent) {
|
||||
const enterText: IElement = {
|
||||
value: ZERO
|
||||
}
|
||||
// 标题结尾处回车无需格式化
|
||||
const startElement = elementList[startIndex]
|
||||
const endElement = elementList[endIndex]
|
||||
// 列表块内换行
|
||||
if (evt.shiftKey && startElement.listId) {
|
||||
enterText.listWrap = true
|
||||
}
|
||||
// 标题结尾处回车无需格式化
|
||||
if (!(endElement.titleId && endElement.titleId !== elementList[endIndex + 1]?.titleId)) {
|
||||
formatElementContext(elementList, [enterText], startIndex)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user