UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.

25 lines (19 loc) 421 B
import { Command } from '../../ui' class Undo extends Command { getCommandState(params) { let editorSession = params.editorSession return { disabled: !editorSession.canUndo(), active: false } } execute(params) { let editorSession = params.editorSession if (editorSession.canUndo()) { editorSession.undo() return true } return false } } export default Undo