feat:paste html with textAlign info

This commit is contained in:
Hufe921
2023-02-05 15:52:21 +08:00
parent 34799d7cb9
commit eb0086a4b8
2 changed files with 32 additions and 7 deletions
+19 -1
View File
@@ -1,5 +1,5 @@
import { deepClone, getUUID, splitText } from '.'
import { ElementType, IEditorOption, IElement } from '..'
import { ElementType, IEditorOption, IElement, RowFlex } from '..'
import { LaTexParticle } from '../core/draw/particle/latex/LaTexParticle'
import { defaultCheckboxOption } from '../dataset/constant/Checkbox'
import { ZERO } from '../dataset/constant/Common'
@@ -397,3 +397,21 @@ export function zipElementList(payload: IElement[]): IElement[] {
}
return zipElementListData
}
export function getElementRowFlex(node: HTMLElement) {
const textAlign = window.getComputedStyle(node).textAlign
switch (textAlign) {
case 'left':
case 'start':
return RowFlex.LEFT
case 'center':
return RowFlex.CENTER
case 'right':
case 'end':
return RowFlex.RIGHT
case 'justify':
return RowFlex.ALIGNMENT
default:
return RowFlex.LEFT
}
}