2828 border-radius : 4px ;
2929 cursor : pointer;
3030 }
31+ .btn .disabled {
32+ opacity : 0.5 ;
33+ cursor : default;
34+ pointer-events : none;
35+ }
3136 </ style >
3237</ head >
3338< body >
3439 < h1 > Dwg/dxf Database JSON Viewer</ h1 >
3540 < table class ="table ">
3641 < tr >
3742 < td >
38- < label for ="fileInput " class ="btn "> Choose Dwg File</ label >
39- < input type ="file " id ="fileInput " accept =".dwg " style ="display: none; " />
43+ < label for ="fileInput " class ="btn disabled "> Choose Dwg File</ label >
44+ < input type ="file " id ="fileInput " accept =".dwg " style ="display: none; " disabled />
4045 < span id ="dwgFileName "> No File Chosen</ span >
4146 < div id ="dwgInfo "> </ div >
4247 </ td >
4348 < td > </ td >
4449 < td >
45- < label for ="fileInputDxf " class ="btn "> Choose Dxf File</ label >
46- < input type ="file " id ="fileInputDxf " accept =".dxf " style ="display: none; " />
50+ < label for ="fileInputDxf " class ="btn disabled "> Choose Dxf File</ label >
51+ < input type ="file " id ="fileInputDxf " accept =".dxf " style ="display: none; " disabled />
4752 < span id ="dxfFileName "> No File Chosen</ span >
4853 < div id ="dxfInfo "> </ div >
4954 </ td >
@@ -67,7 +72,7 @@ <h1>Dwg/dxf Database JSON Viewer</h1>
6772 ( function ( ) {
6873 // Check if running locally (localhost, 127.0.0.1, or file:// protocol)
6974 const wl = window . location ;
70- const isDevEnv = wl . hostname === 'localhost' || wl . hostname === '127.0.0.1' ;
75+ const isDevEnv = false ;
7176
7277 // Load jsoneditor based on environment
7378 const jsoneditorJsPath = isDevEnv
@@ -90,9 +95,12 @@ <h1>Dwg/dxf Database JSON Viewer</h1>
9095 document . head . appendChild ( script ) ;
9196
9297 // Set import map for x-viewer/core
93- const corePath = isDevEnv
94- ? "../packages/core/dist/index.esm.js"
95- : "https://cdn.jsdelivr.net/npm/@x-viewer/core@latest/dist/index.esm.js" ;
98+ const resolvePath = ( pkgName ) =>
99+ isDevEnv
100+ ? `../packages/${ pkgName } /dist/index.esm.js`
101+ : `https://cdn.jsdelivr.net/npm/@x-viewer/${ pkgName } @latest/dist/index.esm.js` ;
102+
103+ const corePath = resolvePath ( "core" ) ;
96104
97105 const importMap = document . createElement ( 'script' ) ;
98106 importMap . type = 'importmap' ;
@@ -107,6 +115,14 @@ <h1>Dwg/dxf Database JSON Viewer</h1>
107115 < script type ="module ">
108116 import { DxfParser , VERSION , LIBREDWG_WEB_VERSION } from "@x-viewer/core" ;
109117
118+ // Enable file selection buttons after page and resources are fully loaded
119+ window . addEventListener ( "load" , ( ) => {
120+ document . querySelector ( 'label[for="fileInput"]' ) . classList . remove ( "disabled" ) ;
121+ document . querySelector ( 'label[for="fileInputDxf"]' ) . classList . remove ( "disabled" ) ;
122+ document . getElementById ( "fileInput" ) . disabled = false ;
123+ document . getElementById ( "fileInputDxf" ) . disabled = false ;
124+ } ) ;
125+
110126 // Display libredwg-web version
111127 const libredwgVersionElement = document . getElementById ( 'libredwgVersion' ) ;
112128 if ( libredwgVersionElement && LIBREDWG_WEB_VERSION ) {
0 commit comments