feat: add executeUpdateOptions api #571
This commit is contained in:
@@ -90,6 +90,7 @@ export class Command {
|
||||
public executeSetControlExtension: CommandAdapt['setControlExtension']
|
||||
public executeSetControlProperties: CommandAdapt['setControlProperties']
|
||||
public executeSetControlHighlight: CommandAdapt['setControlHighlight']
|
||||
public executeUpdateOptions: CommandAdapt['updateOptions']
|
||||
public getCatalog: CommandAdapt['getCatalog']
|
||||
public getImage: CommandAdapt['getImage']
|
||||
public getOptions: CommandAdapt['getOptions']
|
||||
@@ -205,6 +206,7 @@ export class Command {
|
||||
this.executeDeleteGroup = adapt.deleteGroup.bind(adapt)
|
||||
this.executeLocationGroup = adapt.locationGroup.bind(adapt)
|
||||
this.executeSetZone = adapt.setZone.bind(adapt)
|
||||
this.executeUpdateOptions = adapt.updateOptions.bind(adapt)
|
||||
// 获取
|
||||
this.getImage = adapt.getImage.bind(adapt)
|
||||
this.getOptions = adapt.getOptions.bind(adapt)
|
||||
|
||||
@@ -45,7 +45,8 @@ import {
|
||||
IEditorHTML,
|
||||
IEditorOption,
|
||||
IEditorResult,
|
||||
IEditorText
|
||||
IEditorText,
|
||||
IUpdateOption
|
||||
} from '../../interface/Editor'
|
||||
import { IElement, IElementStyle } from '../../interface/Element'
|
||||
import { IPasteOption } from '../../interface/Event'
|
||||
@@ -71,6 +72,7 @@ import {
|
||||
getTextFromElementList,
|
||||
zipElementList
|
||||
} from '../../utils/element'
|
||||
import { mergeOption } from '../../utils/option'
|
||||
import { printImageBase64 } from '../../utils/print'
|
||||
import { Control } from '../draw/control/Control'
|
||||
import { Draw } from '../draw/Draw'
|
||||
@@ -2399,6 +2401,14 @@ export class CommandAdapt {
|
||||
this.draw.getControl().setHighlightList(payload)
|
||||
}
|
||||
|
||||
public updateOptions(payload: IUpdateOption) {
|
||||
const newOption = mergeOption(payload)
|
||||
Object.entries(newOption).forEach(([key, value]) => {
|
||||
Reflect.set(this.options, key, value)
|
||||
})
|
||||
this.forceUpdate()
|
||||
}
|
||||
|
||||
public getControlList(): IElement[] {
|
||||
return this.draw.getControl().getList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user