Ver Fonte

update lib files

Gildas Lormeau há 3 anos atrás
pai
commit
5a8f48063c

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
lib/chrome-browser-polyfill.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
lib/single-file-extension-background.js


+ 12 - 2
lib/single-file-extension-editor.js

@@ -24,7 +24,7 @@
 	 *   Source.
 	 */
 
-	/* global globalThis, window, document, fetch, DOMParser, getComputedStyle, setTimeout, clearTimeout, NodeFilter, Readability, isProbablyReaderable, matchMedia, TextDecoder, Node */
+	/* global globalThis, window, document, fetch, DOMParser, getComputedStyle, setTimeout, clearTimeout, NodeFilter, Readability, isProbablyReaderable, matchMedia, TextDecoder, Node, URL, MouseEvent, Blob */
 
 	(globalThis => {
 
@@ -1080,7 +1080,17 @@ pre code {
 				if (initScriptContent) {
 					content = content.replace(/<script data-template-shadow-root src.*?<\/script>/g, initScriptContent);
 				}
-				window.parent.postMessage(JSON.stringify({ method: "setContent", content }), "*");
+				if (message.foregroundSave) {
+					if (message.filename && message.filename.length) {
+						const link = document.createElement("a");
+						link.download = message.filename;
+						link.href = URL.createObjectURL(new Blob([content], { type: "text/html" }));
+						link.dispatchEvent(new MouseEvent("click"));
+					}
+					return new Promise(resolve => setTimeout(resolve, 1));
+				} else {
+					window.parent.postMessage(JSON.stringify({ method: "setContent", content }), "*");
+				}
 			}
 			if (message.method == "printPage") {
 				printPage();

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff