feat:set content block default width 100%
This commit is contained in:
@@ -711,7 +711,9 @@ export class Draw {
|
|||||||
metrics.boundingBoxDescent = 0
|
metrics.boundingBoxDescent = 0
|
||||||
metrics.boundingBoxAscent = metrics.height
|
metrics.boundingBoxAscent = metrics.height
|
||||||
} else if (element.type === ElementType.BLOCK) {
|
} else if (element.type === ElementType.BLOCK) {
|
||||||
metrics.width = element.width! * scale
|
metrics.width = element.width
|
||||||
|
? element.width * scale
|
||||||
|
: this.getInnerWidth()
|
||||||
metrics.height = element.height! * scale
|
metrics.height = element.height! * scale
|
||||||
metrics.boundingBoxDescent = metrics.height
|
metrics.boundingBoxDescent = metrics.height
|
||||||
metrics.boundingBoxAscent = 0
|
metrics.boundingBoxAscent = 0
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ export class BaseBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setClientRects(pageNo: number, x: number, y: number) {
|
public setClientRects(pageNo: number, x: number, y: number) {
|
||||||
const scale = this.draw.getOptions().scale
|
|
||||||
const height = this.draw.getHeight()
|
const height = this.draw.getHeight()
|
||||||
const pageGap = this.draw.getPageGap()
|
const pageGap = this.draw.getPageGap()
|
||||||
const preY = pageNo * (height + pageGap)
|
const preY = pageNo * (height + pageGap)
|
||||||
// 尺寸
|
// 尺寸
|
||||||
this.blockItem.style.width = `${this.element.width! * scale}px`
|
const { metrics } = this.element
|
||||||
this.blockItem.style.height = `${this.element.height! * scale}px`
|
this.blockItem.style.width = `${metrics.width}px`
|
||||||
|
this.blockItem.style.height = `${metrics.height}px`
|
||||||
// 位置
|
// 位置
|
||||||
this.blockItem.style.left = `${x}px`
|
this.blockItem.style.left = `${x}px`
|
||||||
this.blockItem.style.top = `${preY + y}px`
|
this.blockItem.style.top = `${preY + y}px`
|
||||||
|
|||||||
@@ -237,16 +237,9 @@ export function formatElementList(elementList: IElement[], options: IFormatEleme
|
|||||||
if (el.value === '\n') {
|
if (el.value === '\n') {
|
||||||
el.value = ZERO
|
el.value = ZERO
|
||||||
}
|
}
|
||||||
if (el.type === ElementType.IMAGE) {
|
if (el.type === ElementType.IMAGE || el.type === ElementType.BLOCK) {
|
||||||
el.id = getUUID()
|
el.id = getUUID()
|
||||||
}
|
}
|
||||||
if (el.type === ElementType.BLOCK) {
|
|
||||||
el.id = getUUID()
|
|
||||||
if (!el.width) {
|
|
||||||
const { editorOptions: { width, margins } } = options
|
|
||||||
el.width = width - margins[1] - margins[3]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (el.type === ElementType.LATEX) {
|
if (el.type === ElementType.LATEX) {
|
||||||
const { svg, width, height } = LaTexParticle.convertLaTextToSVG(el.value)
|
const { svg, width, height } = LaTexParticle.convertLaTextToSVG(el.value)
|
||||||
el.width = el.width || width
|
el.width = el.width || width
|
||||||
|
|||||||
Reference in New Issue
Block a user