feat:增加打印功能
This commit is contained in:
@@ -1,22 +1,33 @@
|
||||
import { printImageBase64 } from "../../utils/print"
|
||||
import { Draw } from "../draw/Draw"
|
||||
|
||||
export class Command {
|
||||
|
||||
private undo: Function
|
||||
private redo: Function
|
||||
private static undo: Function
|
||||
private static redo: Function
|
||||
private static getDataURL: Function
|
||||
|
||||
constructor(draw: Draw) {
|
||||
const historyManager = draw.getHistoryManager()
|
||||
this.undo = historyManager.undo.bind(historyManager)
|
||||
this.redo = historyManager.redo.bind(historyManager)
|
||||
Command.undo = historyManager.undo.bind(historyManager)
|
||||
Command.redo = historyManager.redo.bind(historyManager)
|
||||
Command.getDataURL = draw.getDataURL.bind(draw)
|
||||
}
|
||||
|
||||
// 撤销、重做、格式刷、清除格式
|
||||
public executeUndo() {
|
||||
return this.undo()
|
||||
return Command.undo()
|
||||
}
|
||||
|
||||
public executeRedo() {
|
||||
return this.redo()
|
||||
return Command.redo()
|
||||
}
|
||||
|
||||
// 字体变大、字体变小、加粗、斜体、下划线、删除线、字体颜色、背景色
|
||||
|
||||
// 搜索、打印
|
||||
public executePrint() {
|
||||
return printImageBase64(Command.getDataURL())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ZERO } from "../../dataset/constant/Common"
|
||||
import { KeyMap } from "../../dataset/enum/Keymap"
|
||||
import { IElement } from "../../interface/Element"
|
||||
import { writeText } from "../../utils"
|
||||
import { writeText } from "../../utils/clipboard"
|
||||
import { Cursor } from "../cursor/Cursor"
|
||||
import { Draw } from "../draw/Draw"
|
||||
import { HistoryManager } from "../history/HistoryManager"
|
||||
|
||||
Reference in New Issue
Block a user