Максим Кудрявцев 6 年之前
父节点
当前提交
bad61d082c
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      editor/js/Menubar.File.js

+ 3 - 3
editor/js/Menubar.File.js

@@ -393,14 +393,14 @@ Menubar.File = function ( editor ) {
 	//
 	//
 
 
 	var link = document.createElement( 'a' );
 	var link = document.createElement( 'a' );
-	link.style.display = 'none';
-	document.body.appendChild( link ); // Firefox workaround, see #6594
+	link.style.display = 'none'; 
+	var clickEvent = new MouseEvent('click');
 
 
 	function save( blob, filename ) {
 	function save( blob, filename ) {
 
 
 		link.href = URL.createObjectURL( blob );
 		link.href = URL.createObjectURL( blob );
 		link.download = filename || 'data.json';
 		link.download = filename || 'data.json';
-		link.click();
+		link.dispatchEvent( clickEvent );
 
 
 		// URL.revokeObjectURL( url ); breaks Firefox...
 		// URL.revokeObjectURL( url ); breaks Firefox...