| 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(``) |