-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 104 Export menu plugin #342
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this is somewhat Alliander specific. Should we separate it from the other plugins?
What do you think @Sander3003?
const a = document.createElement('a'); | ||
a.download = this.docName + '-104-signals.csv'; | ||
a.href = URL.createObjectURL(csvBlob); | ||
a.dataset.downloadurl = ['text/csv', a.download, a.href].join(':'); | ||
a.style.display = 'none'; | ||
|
||
document.body.appendChild(a); | ||
a.click(); | ||
document.body.removeChild(a); | ||
URL.revokeObjectURL(a.href); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice hack. I assume there is no other way to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pretty much copied the code from here https://github.com/com-pas/compas-open-scd/blob/main/packages/compas-open-scd/src/menu/ExportIEDParams.ts#L296
After googling for a while the hidden <a>
element seems to be the only way, we might want to look for a way to make this function reuseable, because at the moment it has been copied at least three times between different plugins.
We will leave the plugin in this repo for the time being. |
closes #334