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.

26 lines (21 loc) 458 B
import { Command } from '../../ui' class SaveCommand extends Command { constructor() { super({ name: 'save' }) } getCommandState(params) { let dirty = params.editorSession.hasUnsavedChanges() return { disabled: !dirty, active: false } } execute(params) { let editorSession = params.editorSession editorSession.save() return { status: 'saving-process-started' } } } export default SaveCommand