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.
20 lines (15 loc) • 396 B
JavaScript
import { InsertNodeCommand } from '../../ui'
import insertImage from './insertImage'
export default class InsertImageCommand extends InsertNodeCommand {
/*
Inserts file and image nodes
*/
execute(params) {
let editorSession = params.editorSession
editorSession.transaction((tx) => {
params.files.forEach((file) => {
insertImage(tx, file)
})
})
}
}