0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-24 01:57:32 +01:00

Remove canvas-to-blob polyfill

Historic recommendation for jQuery image upload before all browsers supported `canvas.toBlob`.

All modern browsers supported by Wagtail have had support for this for many years now.

- See https://caniuse.com/?search=toblob
- See https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
This commit is contained in:
LB 2024-10-30 17:14:13 +10:00 committed by LB (Ben Johnston)
parent 5be9bd12d3
commit acd2c535f6
5 changed files with 2 additions and 3 deletions

View File

@ -49,6 +49,7 @@ Changelog
* Maintenance: Remove unused Rangy JS library (LB (Ben) Johnston)
* Maintenance: Update `PreviewController` usage to leverage Stimulus actions instead of calling `preventDefault` manually (Ayaan Qadri)
* Maintenance: Various performance optimizations to page publishing (Jake Howard)
* Maintenance: Remove unnecessary DOM canvas.toBlob polyfill (LB (Ben) Johnston)
6.3.1 (19.11.2024)

View File

@ -68,6 +68,7 @@ depth: 1
* Remove unused Rangy JS library (LB (Ben) Johnston)
* Update `PreviewController` usage to leverage Stimulus actions instead of calling `preventDefault` manually (Ayaan Qadri)
* Various performance optimizations to page publishing (Jake Howard)
* Remove unnecessary DOM canvas.toBlob polyfill (LB (Ben) Johnston)
## Upgrade considerations - changes affecting all projects

View File

@ -1 +0,0 @@
!function(a){"use strict";var b=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,c=a.Blob&&function(){try{return Boolean(new Blob)}catch(a){return!1}}(),d=c&&a.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(a){return!1}}(),e=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,f=(c||e)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(a){var b,f,g,h,i,j;for(b=a.split(",")[0].indexOf("base64")>=0?atob(a.split(",")[1]):decodeURIComponent(a.split(",")[1]),f=new ArrayBuffer(b.length),g=new Uint8Array(f),h=0;h<b.length;h+=1)g[h]=b.charCodeAt(h);return i=a.split(",")[0].split(":")[1].split(";")[0],c?new Blob([d?g:f],{type:i}):(j=new e,j.append(f),j.getBlob(i))};a.HTMLCanvasElement&&!b.toBlob&&(b.mozGetAsFile?b.toBlob=function(a,c,d){d&&b.toDataURL&&f?a(f(this.toDataURL(c,d))):a(this.mozGetAsFile("blob",c))}:b.toDataURL&&f&&(b.toBlob=function(a,b,c){a(f(this.toDataURL(b,c)))})),"function"==typeof define&&define.amd?define(function(){return f}):a.dataURLtoBlob=f}(this);

View File

@ -22,7 +22,6 @@
'load-image-meta',
'load-image-exif',
'load-image-ios',
'canvas-to-blob',
'./jquery.fileupload-process'
], factory);
} else {

View File

@ -89,7 +89,6 @@
<!-- this exact order of plugins is vital -->
<script src="{% versioned_static 'wagtailimages/js/vendor/load-image.min.js' %}"></script>
<script src="{% versioned_static 'wagtailimages/js/vendor/canvas-to-blob.min.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.iframe-transport.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.fileupload.js' %}"></script>
<script src="{% versioned_static 'wagtailadmin/js/vendor/jquery.fileupload-process.js' %}"></script>