feat: web text support iconfont
This commit is contained in:
@@ -42,6 +42,13 @@ export class DoricTextNode extends DoricViewNode {
|
||||
v.style.alignItems = "center"
|
||||
}
|
||||
break
|
||||
case "font":
|
||||
const fontLink = document.createElement('link')
|
||||
fontLink.rel = 'stylesheet'
|
||||
fontLink.href = `${prop}.css`
|
||||
document.head.appendChild(fontLink)
|
||||
this.view.classList.add(prop)
|
||||
break
|
||||
case "fontStyle":
|
||||
switch (prop) {
|
||||
case "bold":
|
||||
@@ -87,7 +94,7 @@ export class DoricTextNode extends DoricViewNode {
|
||||
this.view.style.height = toPixelString(maxHeight)
|
||||
this.view.style.alignItems = "flex-start"
|
||||
this.view.style.overflow = 'hidden'
|
||||
this.view.textContent = this.getTruncationText(computedStyle, maxHeight)
|
||||
this.textElement.innerText = this.getTruncationText(computedStyle, maxHeight)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +110,7 @@ export class DoricTextNode extends DoricViewNode {
|
||||
}
|
||||
|
||||
getTruncationText(style:CSSStyleDeclaration, maxHeight:number) {
|
||||
const originalText = this.view.textContent!
|
||||
const originalText = this.textElement.innerText
|
||||
let start = 0, end = originalText.length
|
||||
|
||||
const tempEle = document.createElement('div')
|
||||
|
Reference in New Issue
Block a user