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).
21 lines (18 loc) • 596 B
JavaScript
import { $$ } from '../dom'
import AffiliationModal from './AffiliationModal'
import ItemCommand from './ItemCommand'
export default class EditAffiliationCommand extends ItemCommand {
getType () {
return 'affiliation'
}
execute (params, context) {
const commandState = params.commandState
const node = commandState.node
context.editorSession.getRootComponent().send('requestModal', () => {
return $$(AffiliationModal, { mode: 'edit', node })
}).then(modal => {
if (!modal) return
context.api.updateAffiliation(node.id, modal.state.data)
})
}
}