feat:optimize add content block
This commit is contained in:
@@ -9,10 +9,10 @@ import { ControlComponent, ControlType } from '../dataset/enum/Control'
|
||||
|
||||
interface IFormatElementListOption {
|
||||
isHandleFirstElement?: boolean;
|
||||
editorOptions?: Required<IEditorOption>;
|
||||
editorOptions: Required<IEditorOption>;
|
||||
}
|
||||
|
||||
export function formatElementList(elementList: IElement[], options: IFormatElementListOption = {}) {
|
||||
export function formatElementList(elementList: IElement[], options: IFormatElementListOption) {
|
||||
const { isHandleFirstElement, editorOptions } = <IFormatElementListOption>{
|
||||
isHandleFirstElement: true,
|
||||
...options
|
||||
@@ -237,9 +237,16 @@ export function formatElementList(elementList: IElement[], options: IFormatEleme
|
||||
if (el.value === '\n') {
|
||||
el.value = ZERO
|
||||
}
|
||||
if (el.type === ElementType.IMAGE || el.type === ElementType.BLOCK) {
|
||||
if (el.type === ElementType.IMAGE) {
|
||||
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) {
|
||||
const { svg, width, height } = LaTexParticle.convertLaTextToSVG(el.value)
|
||||
el.width = el.width || width
|
||||
|
||||
Reference in New Issue
Block a user