feat: add executeBlur api #262
This commit is contained in:
@@ -89,6 +89,16 @@ Usage:
|
||||
instance.command.executeForceUpdate(options?: IForceUpdateOption)
|
||||
```
|
||||
|
||||
## executeBlur
|
||||
|
||||
Feature: Set editor blur
|
||||
|
||||
Usage:
|
||||
|
||||
```javascript
|
||||
instance.command.executeBlur()
|
||||
```
|
||||
|
||||
## executeUndo
|
||||
|
||||
Feature: Undo
|
||||
|
||||
@@ -89,6 +89,16 @@ instance.command.executeSetRange(startIndex: number , endIndex: number)
|
||||
instance.command.executeForceUpdate(options?: IForceUpdateOption)
|
||||
```
|
||||
|
||||
## executeBlur
|
||||
|
||||
功能:设置编辑器失焦
|
||||
|
||||
用法:
|
||||
|
||||
```javascript
|
||||
instance.command.executeBlur()
|
||||
```
|
||||
|
||||
## executeUndo
|
||||
|
||||
功能:撤销
|
||||
|
||||
@@ -10,6 +10,7 @@ export class Command {
|
||||
public executeBackspace: CommandAdapt['backspace']
|
||||
public executeSetRange: CommandAdapt['setRange']
|
||||
public executeForceUpdate: CommandAdapt['forceUpdate']
|
||||
public executeBlur: CommandAdapt['blur']
|
||||
public executeUndo: CommandAdapt['undo']
|
||||
public executeRedo: CommandAdapt['redo']
|
||||
public executePainter: CommandAdapt['painter']
|
||||
@@ -112,6 +113,7 @@ export class Command {
|
||||
this.executeBackspace = adapt.backspace.bind(adapt)
|
||||
this.executeSetRange = adapt.setRange.bind(adapt)
|
||||
this.executeForceUpdate = adapt.forceUpdate.bind(adapt)
|
||||
this.executeBlur = adapt.blur.bind(adapt)
|
||||
// 撤销、重做、格式刷、清除格式
|
||||
this.executeUndo = adapt.undo.bind(adapt)
|
||||
this.executeRedo = adapt.redo.bind(adapt)
|
||||
|
||||
@@ -172,6 +172,11 @@ export class CommandAdapt {
|
||||
})
|
||||
}
|
||||
|
||||
public blur() {
|
||||
this.range.clearRange()
|
||||
this.draw.getCursor().recoveryCursor()
|
||||
}
|
||||
|
||||
public undo() {
|
||||
const isReadonly = this.draw.isReadonly()
|
||||
if (isReadonly) return
|
||||
|
||||
Reference in New Issue
Block a user