فهرست منبع

hide the "print" button if window.print is undefined

Gildas 5 سال پیش
والد
کامیت
a293835c9d
1فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 7 3
      extension/ui/bg/ui-editor.js

+ 7 - 3
extension/ui/bg/ui-editor.js

@@ -192,9 +192,13 @@ singlefile.extension.ui.bg.editor = (() => {
 	savePageButton.onclick = () => {
 		savePage();
 	};
-	printPageButton.onclick = () => {
-		editorElement.contentWindow.postMessage(JSON.stringify({ method: "printPage" }), "*");
-	};
+	if (window.print) {
+		printPageButton.onclick = () => {
+			editorElement.contentWindow.postMessage(JSON.stringify({ method: "printPage" }), "*");
+		};
+	} else {
+		printPageButton.remove();
+	}
 	let updatedResources = {};
 
 	window.onmessage = event => {