brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

Downloading a file inside an Extension #13722

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by photopea Friday Nov 11, 2016 at 15:46 GMT Originally opened as https://github.com/adobe/brackets/issues/12902


Hi, I am developing a photo editor https://www.Photopea.com

I decided to make it a Brackets extension. You can find and install it by searching for "photopea" in an extension manager.

I have noticed, that files can not be saved (File - Save as PSD does nothing). My editor saves files through a "download" attribute of an anchor tag.

<a href="...." download>XY</a>

It executes a new MouseEvent on this tag. This works in all browsers, but it seems it does not work in Brackets. Are you going to support this in an Extension environment any time soon?

It also seems like you don't support a filter-invert of CSS styles (icons in Photopea should be gray, not black).

filter: invert(  0.2  );
core-ai-bot commented 3 years ago

Comment by ficristo Saturday Nov 12, 2016 at 08:12 GMT


Keep in mind that ATM Brackets is build on top of Chrome 49 on Windows and macOS and Chrome 29 on Linux. So for the filter attribute you probabily need to add the -webkit prefix. For the MouseEvent we should know more. For example how did you create Save as PSD?

core-ai-bot commented 3 years ago

Comment by photopea Saturday Nov 12, 2016 at 11:36 GMT


Chrome is updated like every month. Why do you use 1.5 years and 3 years old versions? Is it because you haven't released a new Brackets version for Linux since 2013?

I am saving files this way:

var data = new Uint8Array(arrayBuffer);
var a = document.createElement( "a" );
var blob = new Blob([data]);
var url = window.URL.createObjectURL( blob );
a.href = url;
a.download = "file.psd";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
core-ai-bot commented 3 years ago

Comment by ficristo Wednesday Nov 16, 2016 at 19:15 GMT


I tryed that snippet on Brackets console (Debug \ Show Developer Tools) replacing arrayBuffer with []. I see a <a> tag created and Brackets ask me to download the file. It seems to work to me. Maybe some other@adobe/brackets-committers can help more here.

Just FYI updating CEF (which is the Chrome based software used by Brackets) is a big task, usually done by Adobe. I don't know if there is any change to update it (or switch the shell). Brackets is divided in two parts: the shell code and the browser one. It is possible to release newer versions of the browser code without touching the shell. So Linux builds are updated every release.