MCPcopy Create free account
hub / github.com/codecombat/codecombat / onFileChosen

Method onFileChosen

app/core/treema-ext.js:137–153  ·  view source on GitHub ↗
(InkBlob)

Source from the content-addressed store, hash-verified

135 }
136
137 onFileChosen (InkBlob) {
138 if (!this.settings.filePath) {
139 console.error('Need to specify a filePath for this treema', this.getRoot())
140 throw Error('cannot upload file')
141 }
142
143 const body = {
144 url: InkBlob.url,
145 filename: InkBlob.filename,
146 mimetype: InkBlob.mimetype,
147 path: this.settings.filePath,
148 force: true,
149 }
150
151 this.uploadingPath = [this.settings.filePath, InkBlob.filename].join('/')
152 return $.ajax('/file', { type: 'POST', data: body, success: this.onFileUploaded, error: uploadFailHandler })
153 }
154
155 onFileUploaded (e) {
156 return this.editor.insert(`![${e.metadata.name}](/file/${this.uploadingPath})`)

Callers

nothing calls this directly

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected