mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 03:55:31 +00:00
replace dots with underscores in save as filenames (#3565)
This commit is contained in:
parent
12727adb16
commit
6f810add43
@ -117,8 +117,10 @@ define(
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.exportJPG = function (element, filename, className) {
|
||||
const processedFilename = replaceDotsWithUnderscores(filename);
|
||||
|
||||
return this.renderElement(element, "jpg", className).then(function (img) {
|
||||
saveAs(img, filename);
|
||||
saveAs(img, processedFilename);
|
||||
});
|
||||
};
|
||||
|
||||
@ -130,8 +132,10 @@ define(
|
||||
* @returns {promise}
|
||||
*/
|
||||
ExportImageService.prototype.exportPNG = function (element, filename, className) {
|
||||
const processedFilename = replaceDotsWithUnderscores(filename);
|
||||
|
||||
return this.renderElement(element, "png", className).then(function (img) {
|
||||
saveAs(img, filename);
|
||||
saveAs(img, processedFilename);
|
||||
});
|
||||
};
|
||||
|
||||
@ -146,6 +150,12 @@ define(
|
||||
return this.renderElement(element, "png", className);
|
||||
};
|
||||
|
||||
function replaceDotsWithUnderscores(filename) {
|
||||
const regex = /\./gi;
|
||||
|
||||
return filename.replace(regex, '_');
|
||||
}
|
||||
|
||||
/**
|
||||
* canvas.toBlob() not supported in IE < 10, Opera, and Safari. This polyfill
|
||||
* implements the method in browsers that would not otherwise support it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user