瀏覽代碼

Editor: Clean up publish.

Mr.doob 7 年之前
父節點
當前提交
219e89cd97
共有 2 個文件被更改,包括 14 次插入8 次删除
  1. 11 8
      editor/js/Menubar.File.js
  2. 3 0
      editor/js/libs/app/index.html

+ 11 - 8
editor/js/Menubar.File.js

@@ -295,16 +295,19 @@ Menubar.File = function ( editor ) {
 
 			if ( config.getKey( 'project/editable' ) ) {
 
-				editButton =
-			  		"var button = document.createElement( 'a' );" +
-					  "button.href = 'https://threejs.org/editor/#file=' + location.href.split( '/' ).slice( 0, - 1 ).join( '/' ) + '/app.json';" +
-					  "button.style.cssText = 'position: absolute; bottom: 20px; right: 20px; padding: 12px 14px; color: #fff; border: 1px solid #fff; border-radius: 4px; text-decoration: none;';" +
-					  "button.target = '_blank';" +
-					  "button.textContent = 'EDIT';" +
-					  "document.body.appendChild( button );";
+				editButton = [
+					'',
+					'			var button = document.createElement( \'a\' );',
+					'			button.href = \'https://threejs.org/editor/#file=\' + location.href.split( \'/\' ).slice( 0, - 1 ).join( \'/\' ) + \'/app.json\';',
+					'			button.style.cssText = \'position: absolute; bottom: 20px; right: 20px; padding: 12px 14px; color: #fff; border: 1px solid #fff; border-radius: 4px; text-decoration: none;\';',
+					'			button.target = \'_blank\';',
+					'			button.textContent = \'EDIT\';',
+					'			document.body.appendChild( button );',
+					''
+				].join( '\n' );
 			}
 
-			content = content.replace( '/* edit button */', editButton );
+			content = content.replace( '\n\t\t\t/* edit button */\n', editButton );
 
 			zip.file( 'index.html', content );
 

+ 3 - 0
editor/js/libs/app/index.html

@@ -34,8 +34,11 @@
 				window.addEventListener( 'resize', function () {
 					player.setSize( window.innerWidth, window.innerHeight );
 				} );
+
 			} );
+
 			/* edit button */
+
 		</script>
 	</body>
 </html>