|
@@ -1,5 +1,7 @@
|
|
|
import * as THREE from '../../build/three.module.js';
|
|
|
|
|
|
+import { zipSync, strToU8 } from './libs/fflate-deflate.min.module.js';
|
|
|
+
|
|
|
import { UIPanel, UIRow, UIHorizontalRule } from './libs/ui.js';
|
|
|
|
|
|
function MenubarFile( editor ) {
|
|
@@ -388,7 +390,7 @@ function MenubarFile( editor ) {
|
|
|
option.setTextContent( strings.getKey( 'menubar/file/publish' ) );
|
|
|
option.onClick( function () {
|
|
|
|
|
|
- var zip = new JSZip(); // eslint-disable-line no-undef
|
|
|
+ var toZip = {};
|
|
|
|
|
|
//
|
|
|
|
|
@@ -399,7 +401,7 @@ function MenubarFile( editor ) {
|
|
|
output = JSON.stringify( output, parseNumber, '\t' );
|
|
|
output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
|
|
|
|
|
|
- zip.file( 'app.json', output );
|
|
|
+ toZip[ 'app.json' ] = strToU8( output );
|
|
|
|
|
|
//
|
|
|
|
|
@@ -407,7 +409,11 @@ function MenubarFile( editor ) {
|
|
|
|
|
|
var manager = new THREE.LoadingManager( function () {
|
|
|
|
|
|
- save( zip.generate( { type: 'blob' } ), ( title !== '' ? title : 'untitled' ) + '.zip' );
|
|
|
+ var zipped = zipSync( toZip, { level: 9 } );
|
|
|
+
|
|
|
+ var blob = new Blob( [ zipped.buffer ], { type: 'application/zip' } );
|
|
|
+
|
|
|
+ save( blob, ( title !== '' ? title : 'untitled' ) + '.zip' );
|
|
|
|
|
|
} );
|
|
|
|
|
@@ -439,22 +445,22 @@ function MenubarFile( editor ) {
|
|
|
|
|
|
content = content.replace( '\n\t\t\t/* edit button */\n', editButton );
|
|
|
|
|
|
- zip.file( 'index.html', content );
|
|
|
+ toZip[ 'index.html' ] = strToU8( content );
|
|
|
|
|
|
} );
|
|
|
loader.load( 'js/libs/app.js', function ( content ) {
|
|
|
|
|
|
- zip.file( 'js/app.js', content );
|
|
|
+ toZip[ 'js/app.js' ] = strToU8( content );
|
|
|
|
|
|
} );
|
|
|
loader.load( '../build/three.module.js', function ( content ) {
|
|
|
|
|
|
- zip.file( 'js/three.module.js', content );
|
|
|
+ toZip[ 'js/three.module.js' ] = strToU8( content );
|
|
|
|
|
|
} );
|
|
|
loader.load( '../examples/jsm/webxr/VRButton.js', function ( content ) {
|
|
|
|
|
|
- zip.file( 'js/VRButton.js', content );
|
|
|
+ toZip[ 'js/VRButton.js' ] = strToU8( content );
|
|
|
|
|
|
} );
|
|
|
|