fix for #75, fix for adding image to entry text

This commit is contained in:
Ro 2021-12-18 12:05:13 -08:00
parent f119bdc773
commit 03c629462b
3 changed files with 15 additions and 9 deletions

File diff suppressed because one or more lines are too long

View file

@ -266,7 +266,8 @@ class MaintenanceManager {
} }
}; };
if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) { if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) {
//if (eventType === TASK_UPLOAD_FILES) request.setRequestHeader("fipamo-access-token", self.token); if (eventType === TASK_UPLOAD_FILES)
request.setRequestHeader("fipamo-access-token", self.token);
switch (contentType) { switch (contentType) {
case CONTENT_TYPE_JSON: case CONTENT_TYPE_JSON:
request.setRequestHeader( request.setRequestHeader(

View file

@ -20,6 +20,7 @@ export default class PostEditor {
this.processing = false; this.processing = false;
let self = this; let self = this;
this.admin = new FipamoAdminAPI(null); this.admin = new FipamoAdminAPI(null);
this.mm = new Maintenance();
this.urlPieces = document.URL.split("/"); this.urlPieces = document.URL.split("/");
this.post = []; this.post = [];
this.postID = null; this.postID = null;
@ -250,12 +251,16 @@ export default class PostEditor {
handleImageUpload(type, files) { handleImageUpload(type, files) {
let self = this; let self = this;
notify.alert("Uploading Image", null); notify.alert("Uploading Image", null);
let mm = new Maintenance();
mm.imageUpload(type, files) self.mm
.imageUpload(type, files)
.then((r) => { .then((r) => {
if (r.type == DataEvent.POST_IMAGE_ADDED) if (r.type == DataEvent.POST_IMAGE_ADDED) {
self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url); self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url);
notify.alert("Image Added to Entry", true); notify.alert("Image Added to Entry", true);
} else {
notify.alert("Uh oh. Image not added", false);
}
}) })
.catch(() => { .catch(() => {
notify.alert("Uh oh. Image not added", false); notify.alert("Uh oh. Image not added", false);