diff --git a/Views/Slides/Create.cshtml b/Views/Slides/Create.cshtml index 463ce81..f68683d 100644 --- a/Views/Slides/Create.cshtml +++ b/Views/Slides/Create.cshtml @@ -62,6 +62,17 @@ +
+ + +
How the background image fills the slide area.
+
@@ -97,14 +108,10 @@ menubar: 'file edit view insert format table', plugins: 'advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table help wordcount', toolbar: 'undo redo | blocks | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | image media table | removeformat code fullscreen', - images_upload_url: '/api/upload', - images_upload_handler: function (blobInfo, progress) { + images_upload_handler: function (blobInfo) { return new Promise(function (resolve, reject) { - var formData = new FormData(); - formData.append('file', blobInfo.blob(), blobInfo.filename()); - fetch('/api/upload', { method: 'POST', body: formData }) - .then(r => r.json()).then(data => resolve(data.location)) - .catch(err => reject('Upload failed: ' + err)); + var fd = new FormData(); fd.append('file', blobInfo.blob(), blobInfo.filename()); + fetch('/api/upload', { method: 'POST', body: fd }).then(r => r.json()).then(d => resolve(d.location)).catch(e => reject(e)); }); }, content_style: 'body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; color: #fff; background: #1a1a2e; }', @@ -115,13 +122,11 @@ document.getElementById('bgColorPicker').addEventListener('input', function () { document.getElementById('BackgroundColor').value = this.value; }); function uploadBackgroundImage() { document.getElementById('bgImageUpload').click(); } document.getElementById('bgImageUpload').addEventListener('change', function () { - if (!this.files[0]) return; - var fd = new FormData(); fd.append('file', this.files[0]); + if (!this.files[0]) return; var fd = new FormData(); fd.append('file', this.files[0]); fetch('/api/upload', { method: 'POST', body: fd }).then(r => r.json()).then(d => { document.getElementById('BackgroundImage').value = d.location; }); }); document.getElementById('icsFileUpload')?.addEventListener('change', function () { - if (!this.files[0]) return; - var fd = new FormData(); fd.append('file', this.files[0]); + if (!this.files[0]) return; var fd = new FormData(); fd.append('file', this.files[0]); fetch('/api/uploadfile', { method: 'POST', body: fd }).then(r => r.json()).then(d => { document.getElementById('IcsSource').value = d.url; }); });