feat: add forceUpdate api #263
This commit is contained in:
@@ -79,6 +79,16 @@ Usage:
|
|||||||
instance.command.executeSetRange(startIndex: number , endIndex: number)
|
instance.command.executeSetRange(startIndex: number , endIndex: number)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## executeForceUpdate
|
||||||
|
|
||||||
|
Feature: force update editor
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
instance.command.executeForceUpdate(options?: IForceUpdateOption)
|
||||||
|
```
|
||||||
|
|
||||||
## executeUndo
|
## executeUndo
|
||||||
|
|
||||||
Feature: Undo
|
Feature: Undo
|
||||||
@@ -755,9 +765,11 @@ instance.command.executeWordTool()
|
|||||||
```
|
```
|
||||||
|
|
||||||
## executeSetHTML
|
## executeSetHTML
|
||||||
|
|
||||||
Feature: Set the editor HTML data
|
Feature: Set the editor HTML data
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
instance.command.executeSetHTML(payload: Partial<IEditorHTML)
|
instance.command.executeSetHTML(payload: Partial<IEditorHTML)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -79,6 +79,16 @@ instance.command.executeBackspace()
|
|||||||
instance.command.executeSetRange(startIndex: number , endIndex: number)
|
instance.command.executeSetRange(startIndex: number , endIndex: number)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## executeForceUpdate
|
||||||
|
|
||||||
|
功能:强制重新渲染文档
|
||||||
|
|
||||||
|
用法:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
instance.command.executeForceUpdate(options?: IForceUpdateOption)
|
||||||
|
```
|
||||||
|
|
||||||
## executeUndo
|
## executeUndo
|
||||||
|
|
||||||
功能:撤销
|
功能:撤销
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export class Command {
|
|||||||
public executeSelectAll: CommandAdapt['selectAll']
|
public executeSelectAll: CommandAdapt['selectAll']
|
||||||
public executeBackspace: CommandAdapt['backspace']
|
public executeBackspace: CommandAdapt['backspace']
|
||||||
public executeSetRange: CommandAdapt['setRange']
|
public executeSetRange: CommandAdapt['setRange']
|
||||||
|
public executeForceUpdate: CommandAdapt['forceUpdate']
|
||||||
public executeUndo: CommandAdapt['undo']
|
public executeUndo: CommandAdapt['undo']
|
||||||
public executeRedo: CommandAdapt['redo']
|
public executeRedo: CommandAdapt['redo']
|
||||||
public executePainter: CommandAdapt['painter']
|
public executePainter: CommandAdapt['painter']
|
||||||
@@ -103,6 +104,7 @@ export class Command {
|
|||||||
this.executeSelectAll = adapt.selectAll.bind(adapt)
|
this.executeSelectAll = adapt.selectAll.bind(adapt)
|
||||||
this.executeBackspace = adapt.backspace.bind(adapt)
|
this.executeBackspace = adapt.backspace.bind(adapt)
|
||||||
this.executeSetRange = adapt.setRange.bind(adapt)
|
this.executeSetRange = adapt.setRange.bind(adapt)
|
||||||
|
this.executeForceUpdate = adapt.forceUpdate.bind(adapt)
|
||||||
// 撤销、重做、格式刷、清除格式
|
// 撤销、重做、格式刷、清除格式
|
||||||
this.executeUndo = adapt.undo.bind(adapt)
|
this.executeUndo = adapt.undo.bind(adapt)
|
||||||
this.executeRedo = adapt.redo.bind(adapt)
|
this.executeRedo = adapt.redo.bind(adapt)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { DeepRequired } from '../../interface/Common'
|
|||||||
import {
|
import {
|
||||||
IAppendElementListOption,
|
IAppendElementListOption,
|
||||||
IDrawImagePayload,
|
IDrawImagePayload,
|
||||||
|
IForceUpdateOption,
|
||||||
IGetImageOption,
|
IGetImageOption,
|
||||||
IGetValueOption,
|
IGetValueOption,
|
||||||
IPainterOption
|
IPainterOption
|
||||||
@@ -156,6 +157,15 @@ export class CommandAdapt {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public forceUpdate(options?: IForceUpdateOption) {
|
||||||
|
const { isSubmitHistory = false } = options || {}
|
||||||
|
this.range.clearRange()
|
||||||
|
this.draw.render({
|
||||||
|
isSubmitHistory,
|
||||||
|
isSetCursor: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public undo() {
|
public undo() {
|
||||||
const isReadonly = this.draw.isReadonly()
|
const isReadonly = this.draw.isReadonly()
|
||||||
if (isReadonly) return
|
if (isReadonly) return
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ export interface IDrawOption {
|
|||||||
isSourceHistory?: boolean
|
isSourceHistory?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IForceUpdateOption {
|
||||||
|
isSubmitHistory?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface IDrawImagePayload {
|
export interface IDrawImagePayload {
|
||||||
width: number
|
width: number
|
||||||
height: number
|
height: number
|
||||||
|
|||||||
Reference in New Issue
Block a user