fix: unable to copy elements in control #347
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
|||||||
import { EDITOR_ELEMENT_STYLE_ATTR } from '../../../../dataset/constant/Element'
|
import { EDITOR_ELEMENT_STYLE_ATTR } from '../../../../dataset/constant/Element'
|
||||||
import { ControlComponent } from '../../../../dataset/enum/Control'
|
import { ControlComponent } from '../../../../dataset/enum/Control'
|
||||||
import { EditorComponent } from '../../../../dataset/enum/Editor'
|
import { EditorComponent } from '../../../../dataset/enum/Editor'
|
||||||
|
import { ElementType } from '../../../../dataset/enum/Element'
|
||||||
import { KeyMap } from '../../../../dataset/enum/KeyMap'
|
import { KeyMap } from '../../../../dataset/enum/KeyMap'
|
||||||
import {
|
import {
|
||||||
IControlContext,
|
IControlContext,
|
||||||
@@ -231,6 +232,7 @@ export class SelectControl implements IControlInstance {
|
|||||||
const newElement: IElement = {
|
const newElement: IElement = {
|
||||||
...styleElement,
|
...styleElement,
|
||||||
...propertyElement,
|
...propertyElement,
|
||||||
|
type: ElementType.TEXT,
|
||||||
value: data[i],
|
value: data[i],
|
||||||
controlComponent: ControlComponent.VALUE
|
controlComponent: ControlComponent.VALUE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,7 +265,6 @@ export function formatElementList(
|
|||||||
...valueStyleList[valueStyleIndex],
|
...valueStyleList[valueStyleIndex],
|
||||||
controlId,
|
controlId,
|
||||||
value,
|
value,
|
||||||
type: el.type,
|
|
||||||
letterSpacing: isLastLetter ? checkboxOption.gap : 0,
|
letterSpacing: isLastLetter ? checkboxOption.gap : 0,
|
||||||
control: el.control,
|
control: el.control,
|
||||||
controlComponent: ControlComponent.VALUE
|
controlComponent: ControlComponent.VALUE
|
||||||
@@ -297,7 +296,7 @@ export function formatElementList(
|
|||||||
...element,
|
...element,
|
||||||
controlId,
|
controlId,
|
||||||
value,
|
value,
|
||||||
type: el.type,
|
type: element.type || ElementType.TEXT,
|
||||||
control: el.control,
|
control: el.control,
|
||||||
controlComponent: ControlComponent.VALUE
|
controlComponent: ControlComponent.VALUE
|
||||||
})
|
})
|
||||||
@@ -831,21 +830,18 @@ export function createDomFromElementList(
|
|||||||
const tab = document.createElement('span')
|
const tab = document.createElement('span')
|
||||||
tab.innerHTML = `${NON_BREAKING_SPACE}${NON_BREAKING_SPACE}`
|
tab.innerHTML = `${NON_BREAKING_SPACE}${NON_BREAKING_SPACE}`
|
||||||
clipboardDom.append(tab)
|
clipboardDom.append(tab)
|
||||||
|
} else if (element.type === ElementType.CONTROL) {
|
||||||
|
const controlElement = document.createElement('span')
|
||||||
|
const childDom = buildDom(zipElementList(element.control?.value || []))
|
||||||
|
controlElement.innerHTML = childDom.innerHTML
|
||||||
|
clipboardDom.append(controlElement)
|
||||||
} else if (
|
} else if (
|
||||||
!element.type ||
|
!element.type ||
|
||||||
element.type === ElementType.LATEX ||
|
element.type === ElementType.LATEX ||
|
||||||
TEXTLIKE_ELEMENT_TYPE.includes(element.type)
|
TEXTLIKE_ELEMENT_TYPE.includes(element.type)
|
||||||
) {
|
) {
|
||||||
let text = ''
|
let text = ''
|
||||||
if (element.controlId) {
|
if (element.type === ElementType.DATE) {
|
||||||
text =
|
|
||||||
element
|
|
||||||
.control!.value?.filter(
|
|
||||||
v => !v.type || TEXTLIKE_ELEMENT_TYPE.includes(v.type)
|
|
||||||
)
|
|
||||||
.map(v => v.value)
|
|
||||||
.join('') || ''
|
|
||||||
} else if (element.type === ElementType.DATE) {
|
|
||||||
text = element.valueList?.map(v => v.value).join('') || ''
|
text = element.valueList?.map(v => v.value).join('') || ''
|
||||||
} else {
|
} else {
|
||||||
text = element.value
|
text = element.value
|
||||||
|
|||||||
Reference in New Issue
Block a user