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 system. It is developed to power our online editing platform [Substance](http://substance.io).
22 lines (18 loc) • 403 B
JavaScript
import Command from './Command'
class Undo extends Command {
getCommandState (params) {
const editorSession = params.editorSession
return {
disabled: !editorSession.canUndo(),
active: false
}
}
execute (params) {
const editorSession = params.editorSession
if (editorSession.canUndo()) {
editorSession.undo()
}
return true
}
}
export default Undo