|
|
|
@ -129,15 +129,19 @@ export class RangeManager {
|
|
|
|
|
|
|
|
|
|
|
|
public setRangeStyle() {
|
|
|
|
public setRangeStyle() {
|
|
|
|
if (!this.listener.rangeStyleChange) return
|
|
|
|
if (!this.listener.rangeStyleChange) return
|
|
|
|
let curElementList = this.getSelection()
|
|
|
|
// 结束光标位置
|
|
|
|
if (!curElementList) {
|
|
|
|
const { endIndex } = this.range
|
|
|
|
const elementList = this.draw.getElementList()
|
|
|
|
const index = ~endIndex ? endIndex : 0
|
|
|
|
const { endIndex } = this.range
|
|
|
|
// 行首以第一个非换行符元素定位
|
|
|
|
const index = ~endIndex ? endIndex : 0
|
|
|
|
const elementList = this.draw.getElementList()
|
|
|
|
curElementList = [elementList[index]]
|
|
|
|
const endElement = elementList[index]
|
|
|
|
}
|
|
|
|
const endNextElement = elementList[index + 1]
|
|
|
|
const curElement = curElementList[curElementList.length - 1]
|
|
|
|
const curElement = endElement.value === ZERO && endNextElement
|
|
|
|
|
|
|
|
? endNextElement
|
|
|
|
|
|
|
|
: endElement
|
|
|
|
if (!curElement) return
|
|
|
|
if (!curElement) return
|
|
|
|
|
|
|
|
// 选取元素列表
|
|
|
|
|
|
|
|
const curElementList = this.getSelection() || [curElement]
|
|
|
|
// 类型
|
|
|
|
// 类型
|
|
|
|
const type = curElement.type || ElementType.TEXT
|
|
|
|
const type = curElement.type || ElementType.TEXT
|
|
|
|
// 富文本
|
|
|
|
// 富文本
|
|
|
|
|